[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 06/21] i386: Add support for sw-protected-vm object
From: |
Xiaoyao Li |
Subject: |
[RFC PATCH v2 06/21] i386: Add support for sw-protected-vm object |
Date: |
Wed, 13 Sep 2023 23:51:02 -0400 |
Introduce sw-protected-vm object which implements the interface of
CONFIDENTIAL_GUEST_SUPPORT, and will be used to create
X86_SW_PROTECTED_VM via
$qemu -machine ...,confidential-guest-support=sp-vm0 \
-object sw-protected-vm,id=sp-vm0
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
qapi/qom.json | 1 +
target/i386/kvm/meson.build | 1 +
target/i386/kvm/sw-protected-vm.c | 35 +++++++++++++++++++++++++++++++
target/i386/kvm/sw-protected-vm.h | 17 +++++++++++++++
4 files changed, 54 insertions(+)
create mode 100644 target/i386/kvm/sw-protected-vm.c
create mode 100644 target/i386/kvm/sw-protected-vm.h
diff --git a/qapi/qom.json b/qapi/qom.json
index d28c5403bc0f..be054ee2f348 100644
--- a/qapi/qom.json
+++ b/qapi/qom.json
@@ -944,6 +944,7 @@
'if': 'CONFIG_SECRET_KEYRING' },
'sev-guest',
'thread-context',
+ 'sw-protected-vm',
's390-pv-guest',
'throttle-group',
'tls-creds-anon',
diff --git a/target/i386/kvm/meson.build b/target/i386/kvm/meson.build
index 40fbde96cac6..a31e760b3f19 100644
--- a/target/i386/kvm/meson.build
+++ b/target/i386/kvm/meson.build
@@ -5,6 +5,7 @@ i386_softmmu_kvm_ss = ss.source_set()
i386_softmmu_kvm_ss.add(files(
'kvm.c',
'kvm-cpu.c',
+ 'sw-protected-vm.c',
))
i386_softmmu_kvm_ss.add(when: 'CONFIG_XEN_EMU', if_true: files('xen-emu.c'))
diff --git a/target/i386/kvm/sw-protected-vm.c
b/target/i386/kvm/sw-protected-vm.c
new file mode 100644
index 000000000000..62a1d3d5d3fe
--- /dev/null
+++ b/target/i386/kvm/sw-protected-vm.c
@@ -0,0 +1,35 @@
+/*
+ * QEMU X86_SW_PROTECTED_VM SUPPORT
+ *
+ * Author:
+ * Xiaoyao Li <xiaoyao.li@intel.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "qom/object_interfaces.h"
+
+#include "sw-protected-vm.h"
+
+/* x86-sw-protected-vm */
+OBJECT_DEFINE_TYPE_WITH_INTERFACES(SwProtectedVm,
+ sw_protected_vm,
+ SW_PROTECTED_VM,
+ CONFIDENTIAL_GUEST_SUPPORT,
+ { TYPE_USER_CREATABLE },
+ { NULL })
+
+static void sw_protected_vm_init(Object *obj)
+{
+}
+
+static void sw_protected_vm_finalize(Object *obj)
+{
+}
+
+static void sw_protected_vm_class_init(ObjectClass *oc, void *data)
+{
+}
diff --git a/target/i386/kvm/sw-protected-vm.h
b/target/i386/kvm/sw-protected-vm.h
new file mode 100644
index 000000000000..db192a81c75e
--- /dev/null
+++ b/target/i386/kvm/sw-protected-vm.h
@@ -0,0 +1,17 @@
+#ifndef QEMU_I386_SW_PROTECTED_VM_H
+#define QEMU_I386_SW_PROTECTED_VM_H
+
+#include "exec/confidential-guest-support.h"
+
+#define TYPE_SW_PROTECTED_VM "sw-protected-vm"
+#define SW_PROTECTED_VM(obj) OBJECT_CHECK(SwProtectedVm, (obj),
TYPE_SW_PROTECTED_VM)
+
+typedef struct SwProtectedVmClass {
+ ConfidentialGuestSupportClass parent_class;
+} SwProtectedVmClass;
+
+typedef struct SwProtectedVm {
+ ConfidentialGuestSupport parent_obj;
+} SwProtectedVm;
+
+#endif /* QEMU_I386_SW_PROTECTED_VM_H */
--
2.34.1
- Re: [RFC PATCH v2 03/21] HostMem: Add private property and associate it with RAM_KVM_GMEM, (continued)
[RFC PATCH v2 04/21] memory: Introduce memory_region_has_gmem_fd(), Xiaoyao Li, 2023/09/13
[RFC PATCH v2 05/21] kvm: Enable KVM_SET_USER_MEMORY_REGION2 for memslot, Xiaoyao Li, 2023/09/13
[RFC PATCH v2 06/21] i386: Add support for sw-protected-vm object,
Xiaoyao Li <=
[RFC PATCH v2 07/21] i386/pc: Drop pc_machine_kvm_type(), Xiaoyao Li, 2023/09/13
Re: [RFC PATCH v2 07/21] i386/pc: Drop pc_machine_kvm_type(), David Woodhouse, 2023/09/23
[RFC PATCH v2 08/21] target/i386: Implement mc->kvm_type() to get VM type, Xiaoyao Li, 2023/09/13
[RFC PATCH v2 09/21] target/i386: Introduce kvm_confidential_guest_init(), Xiaoyao Li, 2023/09/13
[RFC PATCH v2 10/21] i386/kvm: Implement kvm_sw_protected_vm_init() for sw-protcted-vm specific functions, Xiaoyao Li, 2023/09/13
[RFC PATCH v2 11/21] kvm: Introduce support for memory_attributes, Xiaoyao Li, 2023/09/13
[RFC PATCH v2 12/21] kvm/memory: Introduce the infrastructure to set the default shared/private value, Xiaoyao Li, 2023/09/13