struct kvm_vcpu *vcpu = &svm->vcpu;
u64 reason;
- /* Only GHCB Usage code 0 is supported */
- if (svm->sev_es.ghcb->ghcb_usage) {
- reason = GHCB_ERR_INVALID_USAGE;
- goto vmgexit_err;
- }
-
reason = GHCB_ERR_MISSING_INPUT;
if (!kvm_ghcb_sw_exit_code_is_valid(svm) ||
* Print the exit code even though it may not be marked valid as it
* could help with debugging.
*/
- if (reason == GHCB_ERR_INVALID_USAGE) {
- vcpu_unimpl(vcpu, "vmgexit: ghcb usage %#x is not valid\n",
- svm->sev_es.ghcb->ghcb_usage);
- } else if (reason == GHCB_ERR_INVALID_EVENT) {
+ if (reason == GHCB_ERR_INVALID_EVENT) {
vcpu_unimpl(vcpu, "vmgexit: exit code %#llx is not valid\n",
control->exit_code);
} else {
return 1;
}
+ /* Only GHCB Usage code 0 is supported */
+ if (svm->sev_es.ghcb->ghcb_usage) {
+ vcpu_unimpl(vcpu, "vmgexit: ghcb usage %#x is not valid\n",
+ svm->sev_es.ghcb->ghcb_usage);
+ svm_vmgexit_bad_input(svm, GHCB_ERR_INVALID_USAGE);
+ return 1;
+ }
+
ret = sev_es_validate_vmgexit(svm);
if (ret)
return ret;