From: Subject: Re: [EXT] Re: kern/SEV: Allow boot on QEMU with SEV To: Date: Tue, 1 Oct 2024 14:15:51 +0200 Hi, On Tue, Oct 01, 2024 at 10:00:32PM +1000, Jonathan Gray wrote: > > ok jsg@ if the comments are changed to remove SME: > > * Determine AMD SME and SEV capabilities. > /* AMD CPU, check for SME and SEV. */ true! updated diff below. ----------------------------------------------------------------------- commit 06c6d1529bc4ff4fbfdf633840bd140594483a3b Author: Hans-Joerg Hoexer Date: Thu Sep 12 13:08:17 2024 +0200 kern: Enable booting with SEV on QEMU QEMU does not forward the SME feature if SEV is enabled. This removes the requirement for SME in the x64 boot code. From Sebastian Sturm . diff --git a/sys/arch/amd64/amd64/locore0.S b/sys/arch/amd64/amd64/locore0.S index bc45eee7a09..2d29ffc7057 100644 --- a/sys/arch/amd64/amd64/locore0.S +++ b/sys/arch/amd64/amd64/locore0.S @@ -269,37 +269,33 @@ cont: orl %edx, RELOC(cpu_feature) /* - * Determine AMD SME and SEV capabilities. + * Determine AMD SEV capability. */ movl $RELOC(cpu_vendor),%ebp cmpl $0x68747541, (%ebp) /* "Auth" */ - jne .Lno_smesev + jne .Lno_sev cmpl $0x69746e65, 4(%ebp) /* "enti" */ - jne .Lno_smesev + jne .Lno_sev cmpl $0x444d4163, 8(%ebp) /* "cAMD" */ - jne .Lno_smesev + jne .Lno_sev - /* AMD CPU, check for SME and SEV. */ + /* AMD CPU, check for SEV. */ movl $0x8000001f, %eax cpuid - pushl %eax - andl $CPUIDEAX_SME, %eax /* SME */ - popl %eax - jz .Lno_smesev andl $CPUIDEAX_SEV, %eax /* SEV */ - jz .Lno_smesev + jz .Lno_sev /* Are we in guest mode with SEV enabled? */ movl $MSR_SEV_STATUS, %ecx rdmsr andl $SEV_STAT_ENABLED, %eax - jz .Lno_smesev + jz .Lno_sev /* Determine C bit position */ movl %ebx, %ecx /* %ebx from previous cpuid */ andl $0x3f, %ecx cmpl $0x20, %ecx /* must be at least bit 32 (counting from 0) */ - jl .Lno_smesev + jl .Lno_sev xorl %eax, %eax movl %eax, RELOC(pg_crypt) subl $0x20, %ecx @@ -338,7 +334,7 @@ cont: movl $0x1, RELOC(cpu_sev_guestmode) /* we are a SEV guest */ -.Lno_smesev: +.Lno_sev: /* * Finished with old stack; load new %esp now instead of later so we