Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5541611yba; Mon, 13 May 2019 12:42:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxAHDNf58uj/EPzaFPcFBJ8JuFOzICeiHhKbSKqP8tEODNH3cIkt8mH1TFoYJ2TJqOABWKb X-Received: by 2002:a65:4b88:: with SMTP id t8mr33538876pgq.374.1557776557313; Mon, 13 May 2019 12:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557776557; cv=none; d=google.com; s=arc-20160816; b=wgiVEaeBPIMbpTMV4PYF7Va6gzr5qBGXrsm8e1Xy/xZqXSm2LXf9bStryNDzIThepc YBhFjhBdp7kZtZj1CkQRChIlyz0bv/UtyNZrdi5bvGvra2qB2VD5LIZ8AZrEn0Iq1dYF Jq7f17e/VnVwKFRE/dmDrlf+02djNVeN2G8OG+P61dIho+58OTSAMPyKAAqFPt9m6wtQ KPk/dOH/juq+3POm4mYi+eoYyQHrAFmEmTRK+MLeDZYmVdos8u246xFK1AnlBv99foIG DBLPXK/kCm4EnayOVkgGXQy3YMyM9Y0SWKxND/9nWJ9j2gxCRNWPCq+xbqk6S+KnIwv+ cLhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=BllNv+GUuWAJ1ipV1p7Njrwna0Z9LQ0p08C6J8/Y2H0=; b=HUG+PwUHLMZJ25Fg/5BpSjfrpbZ7RDcQbMczWJHPh6uPj4E6Jjm6edQfgRT+VcCFGX PG97cNzkFtW/CNEFHAyZS0sEAYEw7PAFuUXAL3EZIr+yQPkbEOIdT/mtiFFnLDRfEfgR KlWy46c282I9LGdjQoB02RNl/acF3gPHF8HuuekmiWHxqCfhlArUiu07ZqatOE2TSCOr eIxGpY/JuLV2O5an093Wp+njWFIIC0rsYht36tberR4a4RQ6IaiH2+KRzKLEha2CR/lx TC5FQ8UtGWac0tYVH4U06xv7FCgDMPqRnctIOXIpeoO/6NTGJRLE0/eOd+KvT77g4PFG X6TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="jcbgy/Du"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si11630289plr.378.2019.05.13.12.42.20; Mon, 13 May 2019 12:42:37 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b="jcbgy/Du"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731360AbfEMSAs (ORCPT + 99 others); Mon, 13 May 2019 14:00:48 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45861 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732008AbfEMR7S (ORCPT ); Mon, 13 May 2019 13:59:18 -0400 Received: by mail-pf1-f195.google.com with SMTP id s11so7582122pfm.12 for ; Mon, 13 May 2019 10:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :reply-to:organization; bh=BllNv+GUuWAJ1ipV1p7Njrwna0Z9LQ0p08C6J8/Y2H0=; b=jcbgy/DudN6raLsl0pJOcbUgofvULms0tUfHAJB5NUpQJubyre75w9QU+7YA6vlj6v oegmgRCR20GxwKNvkigSX9jmJf3p0iiw1EQgaAxo2CErgYKHjpS+CEBJLIAbsd1/QvRt qz939gOLs3dfpghiwlOqU4Vd91X62NfdU850jcl1fKfvyoX+rz6MTF6OyRVvqW0w7bHH E4+r5JR8Jdxcxc2oq6yLrNOgTeABhr8oXoj874L3mqcTY6RRFAQb75u3NdpxWLrwmZgr KLEY3ko0+kyNP+sCgNJ22A6FQTjdRRyJdByXQ5z15Q/oF3sHNn/TqsQlWvQhpYGc0/bB giFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:reply-to:organization; bh=BllNv+GUuWAJ1ipV1p7Njrwna0Z9LQ0p08C6J8/Y2H0=; b=oo4x3ty7ifEAt1yg0dHXlwaM6agORxLhpQTF/ly3Sf/17eK3kB0CdpZwcO7xsY/Fp4 A8makp5xY5AeWPQ4lm/4oPFy7ouzwY1lvGMAXBPajq6PYU42xggcswdzFWYxnXYJaUZj 7zn16s8HyrBNJtVZwGFaQ/LdJYlJrGHIWLG/SQfJ/83Hbz6GEEdtmsp4U5oYXSl8JT6H 3flnhZg96iH6irIaNsso9mXT7ZycRRbSCvZ/UT7Vp/UT+yixkSE/jJCDZfgbblMaHKv1 X0Dxbnjm6untsGTPjRoAxskQyx+BEv5bdxwnbeiSvPJJG8vGKdQD7iwwqegtxU1yvh2I y+Wg== X-Gm-Message-State: APjAAAWZXOjekRK2t7kRDoXIWmEIKNNSnPpD+2YAMSxmfxcRHchBfA+D XKLwBcaD4dCJKrzfXGnWRLpoSdaM X-Received: by 2002:a62:1a51:: with SMTP id a78mr34412637pfa.133.1557770358140; Mon, 13 May 2019 10:59:18 -0700 (PDT) Received: from localhost.localdomain ([96.79.124.202]) by smtp.gmail.com with ESMTPSA id s12sm9536266pfd.152.2019.05.13.10.59.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 10:59:17 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Len Brown Subject: [PATCH 02/19] x86 topology: Create topology_max_die_per_package() Date: Mon, 13 May 2019 13:58:46 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <7b23d2d26d717b8e14ba137c94b70943f1ae4b5c.1557769318.git.len.brown@intel.com> References: <7b23d2d26d717b8e14ba137c94b70943f1ae4b5c.1557769318.git.len.brown@intel.com> Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Len Brown topology_max_packages() is available to size resources to cover all packages in the system. But now we have multi-die/package systems, and some resources are per-die. Create topology_max_die_per_package(), for detecting multi-die/package systems, and sizing any per-die resources. Signed-off-by: Len Brown --- arch/x86/include/asm/processor.h | 1 - arch/x86/include/asm/topology.h | 10 ++++++++++ arch/x86/kernel/cpu/topology.c | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 00fc03a8da59..87d42c0c6ccc 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -106,7 +106,6 @@ struct cpuinfo_x86 { unsigned long loops_per_jiffy; /* cpuid returned max cores value: */ u16 x86_max_cores; - u16 x86_max_dies; u16 apicid; u16 initial_apicid; u16 x86_clflush_size; diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 453cf38a1c33..e0232f7042c3 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -115,6 +115,13 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu); extern unsigned int __max_logical_packages; #define topology_max_packages() (__max_logical_packages) +extern unsigned int __max_die_per_package; + +static inline int topology_max_die_per_package(void) +{ + return __max_die_per_package; +} + extern int __max_smt_threads; static inline int topology_max_smt_threads(void) @@ -131,6 +138,9 @@ bool topology_smt_supported(void); static inline int topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; } static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; } +static inline int topology_phys_to_logical_die(unsigned int die, + unsigned int cpu) { return 0; } +static inline int topology_max_die_per_package(void) { return 1; } static inline int topology_max_smt_threads(void) { return 1; } static inline bool topology_is_primary_thread(unsigned int cpu) { return true; } static inline bool topology_smt_supported(void) { return false; } diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c index 4d17e699657d..ee48c3fc8a65 100644 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -26,6 +26,9 @@ #define LEVEL_MAX_SIBLINGS(ebx) ((ebx) & 0xffff) #ifdef CONFIG_SMP +unsigned int __max_die_per_package __read_mostly = 1; +EXPORT_SYMBOL(__max_die_per_package); + /* * Check if given CPUID extended toplogy "leaf" is implemented */ @@ -146,7 +149,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c) c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); c->x86_max_cores = (core_level_siblings / smp_num_siblings); - c->x86_max_dies = (die_level_siblings / core_level_siblings); + __max_die_per_package = (die_level_siblings / core_level_siblings); #endif return 0; } -- 2.18.0-rc0