Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp514027imm; Wed, 29 Aug 2018 05:46:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZOlSz2U2FAdm1u5/i5/GUeKXaXCzGy7PXhJYqDeSvQVfojNfVhNOlj0G+AGEMYpQW8XdKc X-Received: by 2002:a63:2605:: with SMTP id m5-v6mr62652pgm.225.1535546785995; Wed, 29 Aug 2018 05:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535546785; cv=none; d=google.com; s=arc-20160816; b=ZoFKj30e+rjPMew0c1Dp+UFjlpL77XYDxJ3s81Q1ot+k2H2cS/+QDe5VyflN6Fw1dt dCHqspHeikxPl9U4AKUXVwUDDBh7t0r5l61+KNucjveOwQ1w8qnwoKPqmbH/BuZqsmiu B+EcExvcnPSGHwRWX8CJMvKry1sgXFd+mB/Rck5ObyNuPOqvSSP4iKSDeBsigCUcngpg NCGlRAiqP/csCgEwag5tVQX0exyDuArU1YEzKF80UBMluE+/SSUKrKtA6mnvwgVhOFb/ sj41/f68QwVU539VNScimEZGxUq9NL7lVt3tALLi9pracO0lMWHTSwNFAY+oS8iyAryz ftkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=D8W+Yskjd1c8zTLtDLDc7HjoN+FqrWPFey/QFFxtIIc=; b=CS9zjcxFbgTSFz7xy2Bn4RBtIWKo2tRkfKl4vURJKVGX3EPJxeADbk+soY1IvzSi2Z aTaNVgBZDliY9mvDYiiFtQ1Iiv143GwQ3igrAy9Rlwq3iX1TdzDJQ0M0zoHdM2FSG8Oj WeiE2ofjIrMgcPi60d94yD7q2dCHCVI6U1qHR7fR7Zpn+L8nx+nkKO9v3R+bccqA7NZm JOz4jLKvFZM2kf1tKLAwK0lv4yVb5GnqRSfuNeXau18PfC00uhwrq9pJF4lLr5t9ufQ7 o0TwTQxzCnbKrQqXd1UUIs95NrrtcBRPGHZLAl/XRr06ecmzuJo5zXgpQDNVyV90/DbJ PmMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9-v6si3561770pfe.11.2018.08.29.05.46.11; Wed, 29 Aug 2018 05:46:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728630AbeH2Qlc (ORCPT + 99 others); Wed, 29 Aug 2018 12:41:32 -0400 Received: from smtp17.cstnet.cn ([159.226.251.17]:48715 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727590AbeH2Qlc (ORCPT ); Wed, 29 Aug 2018 12:41:32 -0400 Received: from pw-vbox.higon.com (unknown [182.150.46.145]) by APP-09 (Coremail) with SMTP id swCowADn7pIvlYZbAJT_BA--.17S2; Wed, 29 Aug 2018 20:44:35 +0800 (CST) From: Pu Wen To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, thomas.lendacky@amd.com, bp@alien8.de, pbonzini@redhat.com Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Pu Wen Subject: [PATCH v5 08/16] x86/apic: add modern APIC support for Hygon Date: Wed, 29 Aug 2018 20:44:30 +0800 Message-Id: <969a367a0b2d58f3e68bc6f97b6e8238e2390991.1535459013.git.puwen@hygon.cn> X-Mailer: git-send-email 2.7.4 In-Reply-To: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KfnxnUUI43 ZEXa7VUbKLvtUUUUU== X-Originating-IP: [182.150.46.145] X-CM-SenderInfo: psxzv046klw03qof0z/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; + return lapic_get_version() >= 0x14; } @@ -1211,9 +1216,11 @@ void __init sync_Arb_IDs(void) { /* * Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 And not - * needed on AMD. + * needed on AMD or Hygon. */ - if (modern_apic() || boot_cpu_data.x86_vendor == X86_VENDOR_AMD) + if (modern_apic() || + boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) return; /* @@ -1912,6 +1919,8 @@ static int __init detect_init_APIC(void) (boot_cpu_data.x86 >= 15)) break; goto no_apic; + case X86_VENDOR_HYGON: + break; case X86_VENDOR_INTEL: if (boot_cpu_data.x86 == 6 || boot_cpu_data.x86 == 15 || (boot_cpu_data.x86 == 5 && boot_cpu_has(X86_FEATURE_APIC))) diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 02e8acb..47ff297 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c @@ -185,6 +185,7 @@ void __init default_setup_apic_routing(void) break; } /* If P4 and above fall through */ + case X86_VENDOR_HYGON: case X86_VENDOR_AMD: def_to_bigsmp = 1; } -- 2.7.4