From patchwork Fri Jun 27 03:49:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 4433301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7227C9F319 for ; Fri, 27 Jun 2014 03:55:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A45E2201EF for ; Fri, 27 Jun 2014 03:55:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD854201C0 for ; Fri, 27 Jun 2014 03:55:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0NDZ-0005F5-CU; Fri, 27 Jun 2014 03:52:53 +0000 Received: from mail-pa0-f51.google.com ([209.85.220.51]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0NDN-0004l4-E0 for linux-arm-kernel@lists.infradead.org; Fri, 27 Jun 2014 03:52:41 +0000 Received: by mail-pa0-f51.google.com with SMTP id hz1so4063790pad.10 for ; Thu, 26 Jun 2014 20:52:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TQKgtxFk3SuUJsjQUKTS599oMDvb2lHIa1IPgFnydfA=; b=g+MEYqjSi4yulAI6CZF1fdnER4HO8yYveZwR7QzVqM20SSYaDsWZU0ETW+q9kn61vU m3L7A1+T+ePX42MPe5HhbRs1K+Ftz8Dn21vDs2uL/aLmagod4PJQox/jP0FiGxgxkweI Q86uB0KEdca28EAKA+wfyiC1zc1Mvgw1XQBHo4EuXdDCGn7l5zqgud3zWXW3LM85QoOK 3pKZpbXAT58pse5PS+DyFDSrXJDInsm5hXUVb2vz+kTbdUBDXYPDH1y7Xn38NM1YMjIP S4uZLq1gOQ9vrqAn4YslO8yZeXh+URR2vBQYMnutEdpQRxbfOr+7Vnrn3uJnvgXoDSLw 0B0w== X-Gm-Message-State: ALoCoQmLbS17HhxnmbjoKunRkPy89yaX8g4wQDaDdZjZTaSwDEw8FfFBgXMYNk6O8fQADwRAncJF X-Received: by 10.69.20.74 with SMTP id ha10mr27225454pbd.127.1403841139714; Thu, 26 Jun 2014 20:52:19 -0700 (PDT) Received: from localhost ([183.247.163.231]) by mx.google.com with ESMTPSA id ln2sm44312158pab.35.2014.06.26.20.52.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 26 Jun 2014 20:52:19 -0700 (PDT) From: Hanjun Guo To: "Rafael J. Wysocki" , Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH v4 08/13] ARM64 / ACPI: Introduce arch_fix_phys_package_id() for cpu topology Date: Fri, 27 Jun 2014 11:49:31 +0800 Message-Id: <1403840976-7456-9-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1403840976-7456-1-git-send-email-hanjun.guo@linaro.org> References: <1403840976-7456-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140626_205241_511592_4DA2AF98 X-CRM114-Status: GOOD ( 11.53 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , lorenzo.pieralisi@arm.com, rric@kernel.org, Arnd Bergmann , linaro-acpi@lists.linaro.org, linux-kernel@vger.kernel.org, Grant Likely , Hanjun Guo , Sudeep Holla , Bjorn Helgaas , Charles.Garcia-Tobin@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP arch_fix_phys_package_id() will be called in ACPI core to use the slot number provided by ACPI to update the physical package id, then we can get the right value in the "physical id" field of /proc/cpuinfo. Reviewed-by: Grant Likely Signed-off-by: Hanjun Guo --- arch/arm64/include/asm/topology.h | 2 ++ arch/arm64/kernel/topology.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h index 7ebcd31..2b216d4 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -23,11 +23,13 @@ extern struct cpu_topology cpu_topology[NR_CPUS]; void init_cpu_topology(void); void store_cpu_topology(unsigned int cpuid); const struct cpumask *cpu_coregroup_mask(int cpu); +void arch_fix_phys_package_id(int num, u32 slot); #else static inline void init_cpu_topology(void) { } static inline void store_cpu_topology(unsigned int cpuid) { } +static inline void arch_fix_phys_package_id(int num, u32 slot) { } #endif diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 43514f9..c547885 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -281,3 +281,17 @@ void __init init_cpu_topology(void) if (parse_dt_topology()) reset_cpu_topology(); } + +/* + * Use the CPU slot number provided by ACPI to update the physical + * package id when cpuid_topo->cluster_id is not available, then we + * can get the right value in the "physical id" field of /proc/cpuinfo. + */ +void arch_fix_phys_package_id(int num, u32 slot) +{ + struct cpu_topology *cpuid_topo = &cpu_topology[num]; + + if (cpuid_topo->cluster_id == -1) + cpuid_topo->cluster_id = slot; +} +EXPORT_SYMBOL_GPL(arch_fix_phys_package_id);