[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/26] s390: Switch to use confidential_guest_kvm_init()
From: |
Paolo Bonzini |
Subject: |
[PATCH 06/26] s390: Switch to use confidential_guest_kvm_init() |
Date: |
Fri, 22 Mar 2024 19:10:56 +0100 |
From: Xiaoyao Li <xiaoyao.li@intel.com>
Use unified confidential_guest_kvm_init() for consistency with
other architectures.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-Id: <20240229060038.606591-1-xiaoyao.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/s390x/kvm/pv.h | 14 --------------
hw/s390x/s390-virtio-ccw.c | 5 ++++-
target/s390x/kvm/pv.c | 8 ++++++++
3 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/target/s390x/kvm/pv.h b/target/s390x/kvm/pv.h
index 5877d28ff10..4b408174391 100644
--- a/target/s390x/kvm/pv.h
+++ b/target/s390x/kvm/pv.h
@@ -80,18 +80,4 @@ static inline int kvm_s390_dump_mem_state(uint64_t addr,
size_t len,
static inline int kvm_s390_dump_completion_data(void *buff) { return 0; }
#endif /* CONFIG_KVM */
-int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp);
-static inline int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp)
-{
- if (!cgs) {
- return 0;
- }
- if (kvm_enabled()) {
- return s390_pv_kvm_init(cgs, errp);
- }
-
- error_setg(errp, "Protected Virtualization requires KVM");
- return -1;
-}
-
#endif /* HW_S390_PV_H */
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index b1dcb3857f0..e35b90ed83c 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "exec/ram_addr.h"
+#include "exec/confidential-guest-support.h"
#include "hw/s390x/s390-virtio-hcall.h"
#include "hw/s390x/sclp.h"
#include "hw/s390x/s390_flic.h"
@@ -260,7 +261,9 @@ static void ccw_init(MachineState *machine)
s390_init_cpus(machine);
/* Need CPU model to be determined before we can set up PV */
- s390_pv_init(machine->cgs, &error_fatal);
+ if (machine->cgs) {
+ confidential_guest_kvm_init(machine->cgs, &error_fatal);
+ }
s390_flic_init();
diff --git a/target/s390x/kvm/pv.c b/target/s390x/kvm/pv.c
index 7ca7faec73e..c04d53753bf 100644
--- a/target/s390x/kvm/pv.c
+++ b/target/s390x/kvm/pv.c
@@ -340,6 +340,11 @@ int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error
**errp)
return 0;
}
+ if (!kvm_enabled()) {
+ error_setg(errp, "Protected Virtualization requires KVM");
+ return -1;
+ }
+
if (!s390_has_feat(S390_FEAT_UNPACK)) {
error_setg(errp,
"CPU model does not support Protected Virtualization");
@@ -364,6 +369,9 @@ OBJECT_DEFINE_TYPE_WITH_INTERFACES(S390PVGuest,
static void s390_pv_guest_class_init(ObjectClass *oc, void *data)
{
+ ConfidentialGuestSupportClass *klass =
CONFIDENTIAL_GUEST_SUPPORT_CLASS(oc);
+
+ klass->kvm_init = s390_pv_kvm_init;
}
static void s390_pv_guest_init(Object *obj)
--
2.44.0
- [PATCH for-9.1 00/26] x86, kvm: common confidential computing subset, Paolo Bonzini, 2024/03/22
- [PATCH 01/26] pci-host/q35: Move PAM initialization above SMRAM initialization, Paolo Bonzini, 2024/03/22
- [PATCH 02/26] q35: Introduce smm_ranges property for q35-pci-host, Paolo Bonzini, 2024/03/22
- [PATCH 03/26] confidential guest support: Add kvm_init() and kvm_reset() in class, Paolo Bonzini, 2024/03/22
- [PATCH 04/26] i386/sev: Switch to use confidential_guest_kvm_init(), Paolo Bonzini, 2024/03/22
- [PATCH 05/26] ppc/pef: switch to use confidential_guest_kvm_init/reset(), Paolo Bonzini, 2024/03/22
- [PATCH 06/26] s390: Switch to use confidential_guest_kvm_init(),
Paolo Bonzini <=
- [PATCH 08/26] scripts/update-linux-headers: Add bits.h to file imports, Paolo Bonzini, 2024/03/22
- [PATCH 07/26] scripts/update-linux-headers: Add setup_data.h to import list, Paolo Bonzini, 2024/03/22
- [PATCH 10/26] [TO SQUASH] hw/i386: Remove redeclaration of struct setup_data, Paolo Bonzini, 2024/03/22
- [PATCH 11/26] runstate: skip initial CPU reset if reset is not actually possible, Paolo Bonzini, 2024/03/22
- [PATCH 09/26] [HACK] linux-headers: Update headers for 6.8 + kvm-coco-queue + SNP, Paolo Bonzini, 2024/03/22
- [PATCH 12/26] KVM: track whether guest state is encrypted, Paolo Bonzini, 2024/03/22