Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5724508yba; Tue, 30 Apr 2019 21:28:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRsoPmigp/fZbmCk5Mqq1cRcIuqjJsbKiVEJ/8zGfiBAljODMYTGhxfhdLhVCna5N4s4bR X-Received: by 2002:a17:902:b081:: with SMTP id p1mr26232547plr.110.1556684905951; Tue, 30 Apr 2019 21:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556684905; cv=none; d=google.com; s=arc-20160816; b=X3YTNe//+yFHQ2XjyirTn0IPt7r9sSvhT9T6lAXvgkvzGj3BukQDsYZPH9MjidU3or 0PK6A1hxIiCL0YC4BR8oyuYp+9809b4p9g4agHr+iBfGnlxkQ0v7DY+E875pw24UIvoW kseCdl0eergjuMhHlahNEugkU/MQ8M9tVPt97b2ctbgPrAjf10+26uvU1BjtC+e2WZ3E 2ipCiY2OjZgXVM8xeFJSUuSfoog4ARWCxH4zBRtDuZJRuCFjkuzrGgAID1g/CrTgank1 lRwcH/KoE0dwO/B5kFwfZNKgtjOpAumX6JOv9OjxTDK04gMajJdXmPoj7nXxNLC5yAIH WLlw== 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=y67rI0+7LMqluGWWS+Hg6ADNiTmiQ2c0vs6hDyCQNYU=; b=jQCIBtpE9dFLGlrudTrZKhhhHDDB/pMSg4xEDQAVwQBpt6zbUEhmYqUNUR3c/OaVzR Xb0qKE33WYItTZVb6atTmhSsAUt6tQO4XTq5MIUjp6zN/IUXWg2hnMKOf7UoZ/HnROxX v01+K+EnZjocy4MVhOXvAddpmvZZUvvdiM8wHl07yJAxT3Hz972vrn/ggqT01YUDHNbc MBPxiP3h0yL8nB/2UDis3S6H1hyXUj5l2Pcn/yDAalPJgIN5zIXqxDeJPHBBX/Hy4oqm HYpozs+Zrsq0LLKJIak7upKWPesoiT0r1PPxuSEOVlLXOmRjs8wLpLxolDU570/cpk5A He4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Jw1H4068; 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 d37si40756472pla.97.2019.04.30.21.28.10; Tue, 30 Apr 2019 21:28: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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Jw1H4068; 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 S1726488AbfEAEZu (ORCPT + 99 others); Wed, 1 May 2019 00:25:50 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:36897 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfEAEYk (ORCPT ); Wed, 1 May 2019 00:24:40 -0400 Received: by mail-io1-f65.google.com with SMTP id a23so14113492iot.4 for ; Tue, 30 Apr 2019 21:24:40 -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=y67rI0+7LMqluGWWS+Hg6ADNiTmiQ2c0vs6hDyCQNYU=; b=Jw1H4068Nf+XggslcFDLtr3MRGaJawSSBjgkUN/hgBojENghcU7b4bvYT1g9+cp9Si Lpe+zNBbpQa7CP8odC6yHmJmJ6+4hiMQbHxZCGAeuwqOIUKOhN+raCqLMpqBCLEKZ0J3 rIIBouMemkDgQjN5cA7QfnWI81tywVv0PrEXMP+Ucf+Qxe8BzXOQUaCdNf+qR+ydEFyn hfoMSUmMscva+g7hOKaGWncksXulrh03oaUMTYuDSpOX+sHkX+9Ye+PBpUVOCTf85ZkU Xajoz4zBuNGdmmIz2ho3B04SWAHy9AVM7m0o1fxtBRBzb0eNYjoeNVx1dbKdGmRkM+GL DQ+Q== 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=y67rI0+7LMqluGWWS+Hg6ADNiTmiQ2c0vs6hDyCQNYU=; b=MeW8lsCsqkI7bhH51H6yOdoU/Kab2LuLvPc6RzNKI764h9xYJeMmSfOnIq8FoXAZ3j mT/QQDoSt7h4S8dE9xayoBT4TeX7vqLMgDpjlQUi3/XlgpBwS8KM/1AShsKvv8HkUq0w W7BwWS9q4pInyCTsA//ffBYPjk+WrPtnAJjXnc8KGZQF1iuaesnaGY+rOn6HZf0aV5AQ LibtlIMyN6lyptQ+Z+pvaNM9wXLiFOsgt13Cr1kbx3SNTeDZpCCfrfceNuPoFCN5wSV3 dcYXL/8h4e86u/QxW8q6IdC/vS+RHw9Gz/2od0N8of+3XZrFAlToNNvwYXaW9alIKksF Ke8w== X-Gm-Message-State: APjAAAWf6HH5BV0f+m/rQ1HAytWPYhGdP3Xp5sHGNNBc/Hgui3rpVz1x MKIOwjiqtfQN+L232ISWBt0= X-Received: by 2002:a6b:6405:: with SMTP id t5mr29898239iog.190.1556684680146; Tue, 30 Apr 2019 21:24:40 -0700 (PDT) Received: from nuc8.lan (h69-131-112-51.cntcnh.dsl.dynamic.tds.net. [69.131.112.51]) by smtp.gmail.com with ESMTPSA id b8sm2569728itb.20.2019.04.30.21.24.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 21:24:39 -0700 (PDT) From: Len Brown To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Len Brown Subject: [PATCH 05/18] x86 topology: Create topology_max_die_per_package() Date: Wed, 1 May 2019 00:24:14 -0400 Message-Id: X-Mailer: git-send-email 2.18.0-rc0 In-Reply-To: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1556657368.git.len.brown@intel.com> References: <6f53f0e494d743c79e18f6e3a98085711e6ddd0c.1556657368.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 2507edc30cc2..5f45488b1a9d 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