|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 11/12] x86/cpu: Migrate vendor checks to use cpu_vendor()
On 06.02.2026 17:15, Alejandro Vallejo wrote:
> --- a/xen/arch/x86/cpu/intel_cacheinfo.c
> +++ b/xen/arch/x86/cpu/intel_cacheinfo.c
> @@ -168,9 +168,8 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
> * Don't use cpuid2 if cpuid4 is supported. For P4, we use cpuid2 for
> * trace cache
> */
> - if ((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1 &&
> - c->x86_vendor != X86_VENDOR_SHANGHAI)
> - {
> + if (((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1) &&
> + (!(cpu_vendor() & X86_VENDOR_SHANGHAI))) {
Nit: Again, no need for the extra parentheses (here: around the !()). Nor do
I see a need to alter the first line at all.
> --- a/xen/arch/x86/cpu/mtrr/generic.c
> +++ b/xen/arch/x86/cpu/mtrr/generic.c
> @@ -218,9 +218,8 @@ static void __init print_mtrr_state(const char *level)
> printk("%s %u disabled\n", level, i);
> }
>
> - if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
> - boot_cpu_data.x86 >= 0xf) ||
> - boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
> + if (((cpu_vendor() & X86_VENDOR_AMD) && boot_cpu_data.x86 >= 0xf) ||
> + (cpu_vendor() & X86_VENDOR_HYGON)) {
Perhaps easier as
if ((cpu_vendor() & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
boot_cpu_data.x86 >= 0xf) {
, seeing that there's no Hygon hardware lower than Fam18?
> --- a/xen/arch/x86/cpu/vpmu.c
> +++ b/xen/arch/x86/cpu/vpmu.c
> @@ -398,7 +398,6 @@ int vpmu_load(struct vcpu *v, bool from_guest)
> static int vpmu_arch_initialise(struct vcpu *v)
> {
> struct vpmu_struct *vpmu = vcpu_vpmu(v);
> - uint8_t vendor = current_cpu_data.x86_vendor;
> int ret;
>
> BUILD_BUG_ON(sizeof(struct xen_pmu_intel_ctxt) > XENPMU_CTXT_PAD_SZ);
> @@ -418,7 +417,7 @@ static int vpmu_arch_initialise(struct vcpu *v)
> if ( vpmu_mode != XENPMU_MODE_OFF )
> {
> printk(XENLOG_G_WARNING "VPMU: Unknown CPU vendor %d. "
> - "Disabling VPMU\n", vendor);
> + "Disabling VPMU\n", cpu_vendor());
Why would you want to make the log message less useful?
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |