Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2775252imm; Mon, 10 Sep 2018 06:22:36 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbo6R5csJNOkasTV/j54G0fdQIG93EgUM5BjRPbbU6bPcTqtwcOaqFma8z15NprkBrE9F1z X-Received: by 2002:a63:e647:: with SMTP id p7-v6mr21943917pgj.218.1536585756878; Mon, 10 Sep 2018 06:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536585756; cv=none; d=google.com; s=arc-20160816; b=1DGmcugkGgBycrIfoQMzWdGJsAr21AtGB/xe+ktu8oBViuGiXRmg2bDo/eKGCm/PzB nzX+hjq2lHIvOqqkfLEh9lv80NxHkYWD4JVE9xHVJv81adNt0iGQNyqQBDGj1n7raCRp LTAycIyZnvMY/q/GEvX+HyLn82BagudXO3o87KkiNkjOz9M9oGMEtuRIaM0YtPABkT23 AVRWoVOsA7cLZccmEvxWwepZDS40v7RRSptLKudIMrmjxwYc+IuPmrKT4KCnCnCiT4bh VaknanjphCoV1aoa1ynpxKYzhzRgbRkLgSDWDlGkz97AXcNix/bIfAAEfso5k7niFidv UPEg== 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; bh=78PJ3Y0TKavDTmJl12P2Py2pLozRie3yp6YqmESzvQo=; b=S+Uq4Xc0wW/52zBjMAvTsa6VCotMAX0N8XUioV4BfsirLfIm/VwUeBIllgb2p3VvJX Qawqk6stpMl2xkM3sJSeLnbt6JLkDHrdXKjsUSCKZri3L+BtGPidLAvG1dN/oRWY4cXs CFZrNXEqgugXhA6lqcY/AKAhUmChKxvIJTOyDFJtU5vxeh9A++38kfSU6tWFNi/76hR3 Mriaqwc0gEUOBOVvNO+foVPzpNFez3mMSKLELu9E+6OYx2YdH8qZd32/C5rSz1ohzjp1 xhN35mRkaR0WvLLfyXOva3yoWFUzd8I0qXNBgojtjFnCTCSnSrgwjhQGewp3KmrXUPwG V9/g== 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 p82-v6si16985688pfi.345.2018.09.10.06.21.51; Mon, 10 Sep 2018 06:22:36 -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 S1728784AbeIJSLq (ORCPT + 99 others); Mon, 10 Sep 2018 14:11:46 -0400 Received: from smtp20.cstnet.cn ([159.226.251.20]:52135 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728020AbeIJSLq (ORCPT ); Mon, 10 Sep 2018 14:11:46 -0400 Received: from pw-vbox.higon.com (unknown [182.150.46.145]) by APP-10 (Coremail) with SMTP id tACowACXnMTobpZbxQWaCQ--.1741S2; Mon, 10 Sep 2018 21:17:32 +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 v6 08/16] x86/apic: Add Hygon Dhyana support to APIC Date: Mon, 10 Sep 2018 21:17:27 +0800 Message-Id: <4f03e734faa5b2b69b0947a156bea29cddcc95ce.1536550550.git.puwen@hygon.cn> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-CM-TRANSID: tACowACXnMTobpZbxQWa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KLvtUUUUU== 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 Add Hygon Dhyana support to the APIC subsystem as it use modern APIC. When running on 32 bit mode, bigsmp should be enabled if there are more than 8 cores online. Signed-off-by: Pu Wen --- arch/x86/kernel/apic/apic.c | 13 +++++++++++-- arch/x86/kernel/apic/probe_32.c | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 84132ed..709daf2 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -224,6 +224,11 @@ static int modern_apic(void) if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD && boot_cpu_data.x86 >= 0xf) return 1; + + /* Hygon systems use modern APIC */ + if (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