Re: [PATCH v7 05/22] x86/sev: Move GHCB page based HV communication out of startup code

Ard Biesheuvel
2025-09-01T14:02:18Z

On Mon, 1 Sept 2025 at 15:55, Borislav Petkov <bp@alien8.de> wrote:
>
> On Sun, Aug 31, 2025 at 03:11:04PM +0200, Ard Biesheuvel wrote:
> > Alternatively, we might consider the below:
>
> This is the full diff ontop of this current patch - it removes the
> get_cpuflags() hunk too as it is not needed now. It builds fine and I'll test
> with it and if all looks good, merge it with your patch.
>
...
> diff --git a/arch/x86/boot/cpuflags.c b/arch/x86/boot/cpuflags.c
> index 63e037e94e4c..916bac09b464 100644
> --- a/arch/x86/boot/cpuflags.c
> +++ b/arch/x86/boot/cpuflags.c
> @@ -106,18 +106,5 @@ void get_cpuflags(void)
> cpuid(0x80000001, &ignored, &ignored, &cpu.flags[6],
> &cpu.flags[1]);
> }
> -
> - if (max_amd_level >= 0x8000001f) {
> - u32 ebx;
> -
> - /*
> - * The X86_FEATURE_COHERENCY_SFW_NO feature bit is in
> - * the virtualization flags entry (word 8) and set by
> - * scattered.c, so the bit needs to be explicitly set.
> - */
> - cpuid(0x8000001f, &ignored, &ebx, &ignored, &ignored);
> - if (ebx & BIT(31))
> - set_bit(X86_FEATURE_COHERENCY_SFW_NO, cpu.flags);
> - }

Are you sure this can be removed? It is tested in other places too
(arch/x86/coco/sev/core.c), and AIUI, it is a Linux defined CPU
feature so it will never be set automatically.