Re: [PATCH] target/i386: SEV: do not assume machine->cgs is SEV

2024-06-06 Thread Paolo Bonzini
On Thu, Jun 6, 2024 at 6:07 PM Xiaoyao Li wrote: > > On 6/6/2024 6:44 AM, Paolo Bonzini wrote: > > There can be other confidential computing classes that are not derived > > from sev-common. Avoid aborting when encountering them. > > I hit it today when rebasing TDX patches to latest QEMU

Re: [PATCH] target/i386: SEV: do not assume machine->cgs is SEV

2024-06-06 Thread Xiaoyao Li
On 6/6/2024 6:44 AM, Paolo Bonzini wrote: There can be other confidential computing classes that are not derived from sev-common. Avoid aborting when encountering them. I hit it today when rebasing TDX patches to latest QEMU master, which has the SEV-SNP series merged. (I didn't get time to

Re: [PATCH] target/i386: SEV: do not assume machine->cgs is SEV

2024-06-06 Thread Paolo Bonzini
Il gio 6 giu 2024, 05:52 Richard Henderson ha scritto: > > SEV_COMMON(object_dynamic_cast()) looks to be twice cast, we can just > > force to do conversion with pointer type: > > > > (SevCommonState *) object_dynamic_cast(OBJECT(cgs), TYPE_SEV_COMMON) > > You don't need the explicit cast either,

Re: [PATCH] target/i386: SEV: do not assume machine->cgs is SEV

2024-06-05 Thread Richard Henderson
On 6/5/24 20:45, Zhao Liu wrote: @@ -1710,7 +1710,9 @@ void sev_es_set_reset_vector(CPUState *cpu) { X86CPU *x86; CPUX86State *env; -SevCommonState *sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs); +ConfidentialGuestSupport *cgs = MACHINE(qdev_get_machine())->cgs;

Re: [PATCH] target/i386: SEV: do not assume machine->cgs is SEV

2024-06-05 Thread Zhao Liu
On Thu, Jun 06, 2024 at 12:44:09AM +0200, Paolo Bonzini wrote: > Date: Thu, 6 Jun 2024 00:44:09 +0200 > From: Paolo Bonzini > Subject: [PATCH] target/i386: SEV: do not assume machine->cgs is SEV > X-Mailer: git-send-email 2.45.1 > > There can be other confident

[PATCH] target/i386: SEV: do not assume machine->cgs is SEV

2024-06-05 Thread Paolo Bonzini
There can be other confidential computing classes that are not derived from sev-common. Avoid aborting when encountering them. Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index