[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 4/4] s390x/pv: Move check on hugepage under s390_pv_guest_chec
From: |
Cédric Le Goater |
Subject: |
[PATCH v2 4/4] s390x/pv: Move check on hugepage under s390_pv_guest_check() |
Date: |
Fri, 6 Jan 2023 08:53:30 +0100 |
From: Cédric Le Goater <clg@redhat.com>
Such conditions on Protected Virtualization can now be checked at init
time.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/s390x/pv.c | 14 +++++++++++++-
target/s390x/diag.c | 7 -------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
index 13c6116076..b8f53a0247 100644
--- a/hw/s390x/pv.c
+++ b/hw/s390x/pv.c
@@ -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)
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.38.1
- Re: [PATCH v2 3/4] s390x/pv: Introduce a s390_pv_check() helper for runtime, (continued)
- Re: [PATCH v2 3/4] s390x/pv: Introduce a s390_pv_check() helper for runtime, Janosch Frank, 2023/01/09
- Re: [PATCH v2 3/4] s390x/pv: Introduce a s390_pv_check() helper for runtime, Cédric Le Goater, 2023/01/09
- Re: [PATCH v2 3/4] s390x/pv: Introduce a s390_pv_check() helper for runtime, Janosch Frank, 2023/01/09
- Re: [PATCH v2 3/4] s390x/pv: Introduce a s390_pv_check() helper for runtime, Janosch Frank, 2023/01/09
- Re: [PATCH v2 3/4] s390x/pv: Introduce a s390_pv_check() helper for runtime, Cédric Le Goater, 2023/01/09
[PATCH v2 1/4] s390x/pv: Implement a CGS check helper, Cédric Le Goater, 2023/01/06
[PATCH v2 4/4] s390x/pv: Move check on hugepage under s390_pv_guest_check(),
Cédric Le Goater <=