Hi Desapogu,

On 2026-08-26T11:35:15, Desapogu, Jayaramudu
<[email protected]> wrote:
> x86: cpu: x86_64: Detect CPU vendor and device ID using cpuid
>
> When U-Boot is configured as a coreboot payload on x86_64, the current
> code leaves the CPU identity at the default Intel vendor and device ID
> 0x0, even on non-Intel platforms.
>
> Read CPUID leaf 0 and build the 12-byte vendor string from EBX:EDX:ECX
> to identify the CPU vendor at runtime. Set gd->arch.x86_vendor to Intel/AMD
> when matched, with fallback to X86_VENDOR_ANY for unknown vendors. Also
> store cpuid_eax(1) in gd->arch.x86_device so later x86 code can use the
> detected CPU identity.
>
> This avoids relying on a fixed vendor value and keeps vendor-sensitive
> paths (e.g. TSC calibration) aligned with the actual CPU.
>
> Signed-off-by: Desapogu Jayaramudu <[email protected]>
>
> arch/x86/cpu/Makefile             |  1 +
>  arch/x86/cpu/i386/cpu.c           | 51 ++------------------------------------
>  arch/x86/cpu/vendor.c             | 52 
> +++++++++++++++++++++++++++++++++++++++
>  arch/x86/cpu/x86_64/cpu.c         | 25 ++++++++++++++++---
>  arch/x86/include/asm/u-boot-x86.h | 16 ++++++++++++
>  5 files changed, 93 insertions(+), 52 deletions(-)

> diff --git a/arch/x86/include/asm/u-boot-x86.h 
> b/arch/x86/include/asm/u-boot-x86.h
> @@ -68,6 +68,22 @@ void cpu_reinit_fpu(void);
> + * @name: 12-byte CPUID vendor string (optionally NUL-terminated)
> + * Return: One of X86_VENDOR_* values, or X86_VENDOR_ANY if unknown
> + */
> +int x86_vendor_name_to_id(const char *name);

Thanks for fixing the ARRAY_SIZE() problem and switching the fallback
back to X86_VENDOR_UNKNOWN. This comment still says X86_VENDOR_ANY
though, so please can you update it?

> diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
> @@ -61,6 +79,7 @@ int x86_cpu_reinit_f(void)
>
>  int x86_cpu_init_f(void)
>  {
> +     setup_identity();
>       return 0;
>  }

This is new in this version and the commit message doesn't mention it.
On x86_64, x86_cpu_init_f() is called by qemu, the EFI app and the EFI
payload, not just coreboot, so this also sets has_mtrr = true on those
platforms. I suspect that isn't what you want, at least for the EFI
app. Please can you either leave x86_cpu_init_f() as it was, or
explain in the commit message why those platforms need this too.
Moving the has_mtrr line back into x86_cpu_reinit_f() would also avoid
the problem.

Regards,
Simon

Reply via email to