Re: [PATCH v5 08/16] x86/apic: add modern APIC support for Hygon

From: Borislav Petkov
Date: Tue Sep 04 2018 - 14:33:29 EST


On Wed, Aug 29, 2018 at 08:44:30PM +0800, Pu Wen wrote:
> Hygon processors use modern APIC, so just return in modern_apic() and
> sync_Arb_IDs(). And should break in switch case in detect_init_API().
>
> When running on 32 bit mode, should set bigsmp if there are more than
> 8 cores.
>
> Signed-off-by: Pu Wen <puwen@xxxxxxxx>
> ---
> arch/x86/kernel/apic/apic.c | 19 ++++++++++++++-----
> arch/x86/kernel/apic/probe_32.c | 1 +
> 2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index 84132ed..a62968e 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -220,10 +220,15 @@ static inline int lapic_is_integrated(void)
> */
> static int modern_apic(void)
> {
> - /* AMD systems use old APIC versions, so check the CPU */
> - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
> - boot_cpu_data.x86 >= 0xf)
> + /*
> + * Old AMD systems use old APIC versions, newer AMD systems
> + * and Hygon systems use modern APIC, so check the CPU
> + */
> + if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
> + boot_cpu_data.x86 >= 0xf) ||
> + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
> return 1;

Those compound conditionals are not nice to read. Just add yours
underneath:

if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
boot_cpu_data.x86 >= 0xf)
return 1;

if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
return 1;

Do that where applicable and where it makes sense, syntax-wise to have a
separate vendor == HYGON check in the other patches too.

Thx.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.