From patchwork Fri Apr 25 13:20:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 4062511 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 B1AD29F38E for ; Fri, 25 Apr 2014 13:26:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C31342034F for ; Fri, 25 Apr 2014 13:26:07 +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 EB56820381 for ; Fri, 25 Apr 2014 13:26:06 +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 1Wdg6a-00085u-1Q; Fri, 25 Apr 2014 13:23:52 +0000 Received: from mail-pd0-f178.google.com ([209.85.192.178]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wdg6W-0007jb-LJ for linux-arm-kernel@lists.infradead.org; Fri, 25 Apr 2014 13:23:48 +0000 Received: by mail-pd0-f178.google.com with SMTP id fp1so983416pdb.9 for ; Fri, 25 Apr 2014 06:23:26 -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=QD3+dh3LV0km/iCiI0+t/Pj+/MWvkL9SZw++SSbmgl4=; b=eoHC7UcOB7No9Ml1/ttMrxk1IafISFPt+zYwRBq1DJnr6Gige8eZlcMfY43vdCu+Aq 32uXi0gOtZoxot6dg7RGJOxFZaPlMxsVXlMH5qkJXDO+9uo6SoMKLBoXP6/RxbQYSmUv d8q+T3ysMWMfU7dt3p9K4/aEpfsmHPpG+oMKYk2rnPBUhFTs/Mnewjw0UyZLwiVlPukr uN1CKvN90AwfTtQgcPR8cTp95tLsMfMJmRrReprmFq0oACysneDpPW97ZeqqQJqNUlgT njMtSWELO1Kb/dnzMfyAzEmI60d0JQmdIj70G3ly6KRMKKttE7OSFGowIXJ9J5Twy+cq KFvQ== X-Gm-Message-State: ALoCoQl5N6BkQXLIH3VxMzwHmMXN6EDJsG6yBGROAIx1fxHESq3Kh/jSiCuhlZmpggRzNslZpya/ X-Received: by 10.67.29.131 with SMTP id jw3mr7791535pad.141.1398432206566; Fri, 25 Apr 2014 06:23:26 -0700 (PDT) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id sv10sm15932343pbc.74.2014.04.25.06.23.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 25 Apr 2014 06:23:25 -0700 (PDT) From: Hanjun Guo To: linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH v3 part1 07/11] ARM64 / ACPI: Introduce arch_fix_phys_package_id() for cpu topology Date: Fri, 25 Apr 2014 21:20:13 +0800 Message-Id: <1398432017-8506-8-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398432017-8506-1-git-send-email-hanjun.guo@linaro.org> References: <1398432017-8506-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140425_062348_717358_DE397F3E X-CRM114-Status: GOOD ( 11.49 ) X-Spam-Score: 0.6 (/) Cc: Mark Rutland , Rob Herring , Arnd Bergmann , Mark Brown , Catalin Marinas , linaro-acpi@lists.linaro.org, "Rafael J. Wysocki" , Will Deacon , Olof Johansson , Hanjun Guo , Sudeep Holla , Grant Likely , Charles.Garcia-Tobin@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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.8 required=5.0 tests=BAYES_00, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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. 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 0172e6d..0b0e24f 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -26,11 +26,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 3e06b0b..51ea4a1 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -93,3 +93,17 @@ void __init init_cpu_topology(void) cpumask_clear(&cpu_topo->thread_sibling); } } + +/* + * Use the CPU 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. + */ +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);