@@ -301,9 +301,21 @@ static bool s390_pv_check_host(Error **errp)
return true;
}
+static bool s390_pv_check_hpage(Error **errp)
+{
+ if (kvm_s390_get_hpage_1m()) {
+ error_setg(errp, "Protected VMs can currently not be backed with "
+ "huge pages");
+ return false;
+ }
+
+ return true;
+}
+
static bool s390_pv_guest_check(ConfidentialGuestSupport *cgs, Error **errp)
{
- return s390_pv_check_cpus(errp) && s390_pv_check_host(errp);
+ return s390_pv_check_cpus(errp) && s390_pv_check_host(errp) &&
+ s390_pv_check_hpage(errp);
}
int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
@@ -170,13 +170,6 @@ out:
return;
}
- if (kvm_enabled() && kvm_s390_get_hpage_1m()) {
- error_report("Protected VMs can currently not be backed with "
- "huge pages");
- env->regs[r1 + 1] = DIAG_308_RC_INVAL_FOR_PV;
- return;
- }
-
if (!s390_pv_check(&local_err)) {
error_report_err(local_err);
env->regs[r1 + 1] = DIAG_308_RC_INVAL_FOR_PV;