[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 32/63] confidential guest support: Add kvm_init() and kvm_reset()
From: |
Paolo Bonzini |
Subject: |
[PULL 32/63] confidential guest support: Add kvm_init() and kvm_reset() in class |
Date: |
Tue, 23 Apr 2024 17:09:20 +0200 |
From: Xiaoyao Li <xiaoyao.li@intel.com>
Different confidential VMs in different architectures all have the same
needs to do their specific initialization (and maybe resetting) stuffs
with KVM. Currently each of them exposes individual *_kvm_init()
functions and let machine code or kvm code to call it.
To facilitate the introduction of confidential guest technology from
different x86 vendors, add two virtual functions, kvm_init() and kvm_reset()
in ConfidentialGuestSupportClass, and expose two helpers functions for
invodking them.
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>
---
include/exec/confidential-guest-support.h | 34 ++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/include/exec/confidential-guest-support.h
b/include/exec/confidential-guest-support.h
index ba2dd4b5dfc..e5b188cffbf 100644
--- a/include/exec/confidential-guest-support.h
+++ b/include/exec/confidential-guest-support.h
@@ -23,7 +23,10 @@
#include "qom/object.h"
#define TYPE_CONFIDENTIAL_GUEST_SUPPORT "confidential-guest-support"
-OBJECT_DECLARE_SIMPLE_TYPE(ConfidentialGuestSupport,
CONFIDENTIAL_GUEST_SUPPORT)
+OBJECT_DECLARE_TYPE(ConfidentialGuestSupport,
+ ConfidentialGuestSupportClass,
+ CONFIDENTIAL_GUEST_SUPPORT)
+
struct ConfidentialGuestSupport {
Object parent;
@@ -55,8 +58,37 @@ struct ConfidentialGuestSupport {
typedef struct ConfidentialGuestSupportClass {
ObjectClass parent;
+
+ int (*kvm_init)(ConfidentialGuestSupport *cgs, Error **errp);
+ int (*kvm_reset)(ConfidentialGuestSupport *cgs, Error **errp);
} ConfidentialGuestSupportClass;
+static inline int confidential_guest_kvm_init(ConfidentialGuestSupport *cgs,
+ Error **errp)
+{
+ ConfidentialGuestSupportClass *klass;
+
+ klass = CONFIDENTIAL_GUEST_SUPPORT_GET_CLASS(cgs);
+ if (klass->kvm_init) {
+ return klass->kvm_init(cgs, errp);
+ }
+
+ return 0;
+}
+
+static inline int confidential_guest_kvm_reset(ConfidentialGuestSupport *cgs,
+ Error **errp)
+{
+ ConfidentialGuestSupportClass *klass;
+
+ klass = CONFIDENTIAL_GUEST_SUPPORT_GET_CLASS(cgs);
+ if (klass->kvm_reset) {
+ return klass->kvm_reset(cgs, errp);
+ }
+
+ return 0;
+}
+
#endif /* !CONFIG_USER_ONLY */
#endif /* QEMU_CONFIDENTIAL_GUEST_SUPPORT_H */
--
2.44.0
- [PULL 09/63] stubs: remove obsolete stubs, (continued)
- [PULL 09/63] stubs: remove obsolete stubs, Paolo Bonzini, 2024/04/23
- [PULL 05/63] yank: only build if needed, Paolo Bonzini, 2024/04/23
- [PULL 07/63] hw/core: Move system emulation files to system_ss, Paolo Bonzini, 2024/04/23
- [PULL 08/63] hw: Include minimal source set in user emulation build, Paolo Bonzini, 2024/04/23
- [PULL 12/63] semihosting: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 13/63] ramfb: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 14/63] memory-device: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 22/63] hw: Add compat machines for 9.1, Paolo Bonzini, 2024/04/23
- [PULL 27/63] target/i386: Add new CPU model SierraForest, Paolo Bonzini, 2024/04/23
- [PULL 33/63] i386/sev: Switch to use confidential_guest_kvm_init(), Paolo Bonzini, 2024/04/23
- [PULL 32/63] confidential guest support: Add kvm_init() and kvm_reset() in class,
Paolo Bonzini <=
- [PULL 19/63] vga: optimize computation of dirty memory region, Paolo Bonzini, 2024/04/23
- [PULL 17/63] stubs: include stubs only if needed, Paolo Bonzini, 2024/04/23
- [PULL 21/63] kvm: use configs/ definition to conditionalize debug support, Paolo Bonzini, 2024/04/23
- [PULL 34/63] ppc/pef: switch to use confidential_guest_kvm_init/reset(), Paolo Bonzini, 2024/04/23
- [PULL 10/63] hw/usb: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 11/63] hw/virtio: move stubs out of stubs/, Paolo Bonzini, 2024/04/23
- [PULL 29/63] pci-host/q35: Move PAM initialization above SMRAM initialization, Paolo Bonzini, 2024/04/23
- [PULL 36/63] scripts/update-linux-headers: Add setup_data.h to import list, Paolo Bonzini, 2024/04/23
- [PULL 56/63] kvm/tdx: Don't complain when converting vMMIO region to shared, Paolo Bonzini, 2024/04/23
- [PULL 58/63] target/i386/host-cpu: Consolidate the use of warn_report_once(), Paolo Bonzini, 2024/04/23