[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/3] s390x/pv: Move check on hugepage under s390_pv_guest_chec
From: |
Cédric Le Goater |
Subject: |
[PATCH v3 3/3] s390x/pv: Move check on hugepage under s390_pv_guest_check() |
Date: |
Mon, 16 Jan 2023 18:46:07 +0100 |
From: Cédric Le Goater <clg@redhat.com>
Such conditions on Protected Virtualization can now be checked at init
time. This is possible because Protected Virtualization is initialized
after memory where the page size is set.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/s390x/pv.c | 13 ++++++++++++-
target/s390x/diag.c | 7 -------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
index 8405e73a1b..679d860f54 100644
--- a/hw/s390x/pv.c
+++ b/hw/s390x/pv.c
@@ -280,9 +280,20 @@ static bool s390_pv_check_cpus(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);
+ return s390_pv_check_cpus(errp) && s390_pv_check_hpage(errp);
}
int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
diff --git a/target/s390x/diag.c b/target/s390x/diag.c
index 9b16e25930..28f4350aed 100644
--- a/target/s390x/diag.c
+++ b/target/s390x/diag.c
@@ -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;
--
2.39.0