Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2544787imm; Sat, 12 May 2018 14:14:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpxmd9b0sHOcko4/b5/w39+FMDssovMtNXHD1Zz+nlpGfThPhUPKfCVD79eEHBNUuAcc7zD X-Received: by 2002:a63:894a:: with SMTP id v71-v6mr3746083pgd.423.1526159667010; Sat, 12 May 2018 14:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526159666; cv=none; d=google.com; s=arc-20160816; b=ejRKADr1bxcIoA/wPw/zAiZcEc6iWRh/GS3Ha/Mz6uYWCfY4fvlQ62E9neVRnvHrnf tEsNzTMxPSma29tH5Q5EGn0LmINAmg4QNQkM5e2W6TJJF5tCNqghM5IfY7ZjT5DTYdfz g1GOu0BIW7m18BZj4/+wnhz9zhBCvdAKaiDaXlFaTf7XRwd3CUmoLbTUlYPV2tBGjbOu 4Z2Txys/kvMfzENzFIs2N6bfL78tbdvSzLcJyH0hhXTXpkbZkEHT6cTJmBAOk9kumxcU RARLYhLTsn4bK95AJHozM7pq3ZDxywjlHbkYiqttRzbrrCY2/OD87gYskikdlO3CdOLI sJaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=hjCaiMQ3aQV600lMnoBBjkI1o/AB3rXP7oNQNuLPSNk=; b=MkUOKv/cEvLrv1LOQy6zeb+EEuWIG1BAv5slRBnYhjNi+vMNMV+g66KCOyTQ5du0oG KF5vQ7MJX0yNS7kZg0sypjR7ZAyCJ+ZcDYfoCfH8IzhOAT0V9sOkGa8Txjp21u7ndRT6 DUApgnU2kId/xUDe6FQ604kSl1go2kiCzaIrPkO7kdt3usSayxRD0y5lQ7PBIsonq46Z t8uYwp5IsPeM56fZol2FKfos7C4DJR+VKBh+EFWCygzwwl9L9AHg+DPEZkebBbqPnqfF 3lMFiarNSTKA7KPJyOe3+C+U45ZCnNH2LHzjgpFGbSdzMuyLxZcappbd+0M3iIQQ+ci4 77OA== 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 a13-v6si6156325pfd.338.2018.05.12.14.14.12; Sat, 12 May 2018 14:14:26 -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 S1752052AbeELVMk (ORCPT + 99 others); Sat, 12 May 2018 17:12:40 -0400 Received: from terminus.zytor.com ([198.137.202.136]:38905 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751806AbeELVMj (ORCPT ); Sat, 12 May 2018 17:12:39 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w4CLCU63096400 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 12 May 2018 14:12:30 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w4CLCUsL096397; Sat, 12 May 2018 14:12:30 -0700 Date: Sat, 12 May 2018 14:12:30 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Suravee Suthikulpanit Message-ID: Cc: suravee.suthikulpanit@amd.com, hpa@zytor.com, tglx@linutronix.de, bp@suse.de, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: tglx@linutronix.de, hpa@zytor.com, suravee.suthikulpanit@amd.com, mingo@kernel.org, linux-kernel@vger.kernel.org, bp@suse.de In-Reply-To: <1524865681-112110-3-git-send-email-suravee.suthikulpanit@amd.com> References: <1524865681-112110-3-git-send-email-suravee.suthikulpanit@amd.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cpu] x86/CPU/AMD: Derive CPU topology from CPUID function 0xB when available Git-Commit-ID: 3986a0a805e668a63fac0ca2cdfa8db951f87c4b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 3986a0a805e668a63fac0ca2cdfa8db951f87c4b Gitweb: https://git.kernel.org/tip/3986a0a805e668a63fac0ca2cdfa8db951f87c4b Author: Suravee Suthikulpanit AuthorDate: Fri, 27 Apr 2018 16:48:01 -0500 Committer: Thomas Gleixner CommitDate: Sun, 6 May 2018 12:49:16 +0200 x86/CPU/AMD: Derive CPU topology from CPUID function 0xB when available Derive topology information from Extended Topology Enumeration (CPUID function 0xB) when the information is available. Signed-off-by: Suravee Suthikulpanit Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Link: http://lkml.kernel.org/r/1524865681-112110-3-git-send-email-suravee.suthikulpanit@amd.com --- arch/x86/kernel/cpu/amd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index bf27246bb7bd..55361ee04cc5 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -327,6 +327,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c) /* get information required for multi-node processors */ if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { + int err; u32 eax, ebx, ecx, edx; cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); @@ -344,6 +345,14 @@ static void amd_get_topology(struct cpuinfo_x86 *c) c->x86_max_cores /= smp_num_siblings; } + /* + * In case leaf B is available, use it to derive + * topology information. + */ + err = detect_extended_topology(c); + if (!err) + c->x86_coreid_bits = get_count_order(c->x86_max_cores); + cacheinfo_amd_init_llc_id(c, cpu, node_id); } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { @@ -378,7 +387,6 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c) c->phys_proc_id = c->initial_apicid >> bits; /* use socket ID also for last level cache */ per_cpu(cpu_llc_id, cpu) = c->phys_proc_id; - amd_get_topology(c); } u16 amd_get_nb_id(int cpu) @@ -821,6 +829,7 @@ static void init_amd(struct cpuinfo_x86 *c) /* Multi core CPU? */ if (c->extended_cpuid_level >= 0x80000008) { amd_detect_cmp(c); + amd_get_topology(c); srat_detect_node(c); }