88 lines
3.0 KiB
Diff
88 lines
3.0 KiB
Diff
From 831b04c3f8f66705a01b4fd455dbe53fa3193a4e Mon Sep 17 00:00:00 2001
|
|
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
Date: Fri, 18 Jul 2025 18:03:47 +0200
|
|
Subject: [PATCH 060/115] i386/cpu: introduce
|
|
x86_confidential_guest_cpu_instance_init()
|
|
|
|
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
RH-MergeRequest: 391: TDX support, including attestation and device assignment
|
|
RH-Jira: RHEL-15710 RHEL-20798 RHEL-49728
|
|
RH-Acked-by: Yash Mankad <None>
|
|
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
RH-Commit: [60/115] be57d5108231bb12dc6c9ffd8c9c639b87b1f15c (bonzini/rhel-qemu-kvm)
|
|
|
|
To allow execute confidential guest specific cpu init operations.
|
|
|
|
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
|
|
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
|
|
Link: https://lore.kernel.org/r/20250508150002.689633-32-xiaoyao.li@intel.com
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
(cherry picked from commit 8583c53e2b619b1b9569d3f2d3f3cb2904a573ad)
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
Conflict: include/system/ is still include/sysemu/
|
|
---
|
|
target/i386/confidential-guest.h | 11 +++++++++++
|
|
target/i386/cpu.c | 8 ++++++++
|
|
2 files changed, 19 insertions(+)
|
|
|
|
diff --git a/target/i386/confidential-guest.h b/target/i386/confidential-guest.h
|
|
index 7342d2843a..38169ed68e 100644
|
|
--- a/target/i386/confidential-guest.h
|
|
+++ b/target/i386/confidential-guest.h
|
|
@@ -39,6 +39,7 @@ struct X86ConfidentialGuestClass {
|
|
|
|
/* <public> */
|
|
int (*kvm_type)(X86ConfidentialGuest *cg);
|
|
+ void (*cpu_instance_init)(X86ConfidentialGuest *cg, CPUState *cpu);
|
|
uint32_t (*mask_cpuid_features)(X86ConfidentialGuest *cg, uint32_t feature, uint32_t index,
|
|
int reg, uint32_t value);
|
|
};
|
|
@@ -59,6 +60,16 @@ static inline int x86_confidential_guest_kvm_type(X86ConfidentialGuest *cg)
|
|
}
|
|
}
|
|
|
|
+static inline void x86_confidential_guest_cpu_instance_init(X86ConfidentialGuest *cg,
|
|
+ CPUState *cpu)
|
|
+{
|
|
+ X86ConfidentialGuestClass *klass = X86_CONFIDENTIAL_GUEST_GET_CLASS(cg);
|
|
+
|
|
+ if (klass->cpu_instance_init) {
|
|
+ klass->cpu_instance_init(cg, cpu);
|
|
+ }
|
|
+}
|
|
+
|
|
/**
|
|
* x86_confidential_guest_mask_cpuid_features:
|
|
*
|
|
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
|
index 4eef3d1dbd..ee6f1c0627 100644
|
|
--- a/target/i386/cpu.c
|
|
+++ b/target/i386/cpu.c
|
|
@@ -36,6 +36,7 @@
|
|
#include "hw/qdev-properties.h"
|
|
#include "hw/i386/topology.h"
|
|
#ifndef CONFIG_USER_ONLY
|
|
+#include "confidential-guest.h"
|
|
#include "sysemu/reset.h"
|
|
#include "qapi/qapi-commands-machine-target.h"
|
|
#include "exec/address-spaces.h"
|
|
@@ -8600,6 +8601,13 @@ static void x86_cpu_post_initfn(Object *obj)
|
|
}
|
|
|
|
accel_cpu_instance_init(CPU(obj));
|
|
+
|
|
+#ifndef CONFIG_USER_ONLY
|
|
+ if (current_machine && current_machine->cgs) {
|
|
+ x86_confidential_guest_cpu_instance_init(
|
|
+ X86_CONFIDENTIAL_GUEST(current_machine->cgs), (CPU(obj)));
|
|
+ }
|
|
+#endif
|
|
}
|
|
|
|
static void x86_cpu_init_default_topo(X86CPU *cpu)
|
|
--
|
|
2.50.1
|
|
|