From patchwork Sat Jul 27 10:42:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 18619 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f198.google.com (mail-gh0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4367625AC6 for ; Sat, 27 Jul 2013 10:47:36 +0000 (UTC) Received: by mail-gh0-f198.google.com with SMTP id r13sf3536009ghr.5 for ; Sat, 27 Jul 2013 03:47:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=Sm+N0+grxA73Wf4ubc0tTyQzDmRC2i+4oQIJh2yah0E=; b=Qby9MofyYXSmcc1rJvk+Aoj8DQCLHZv5o2A5TRKCBhphFkzFlh5+/htLX4rOGLqyl8 ABN40yHyHhtzVXlb1sNy7Ta9m686nX23wFFn+DkE2TnrfeDLCexgp415kZt18/I9fAZS lP5elmeGlGC7SJF82twRm/n3+OyzOYE7M2EodusqVHmL0wgJSqVcTij10XL6m8l0vvwR BidN5TmrYLNI/5rifVxJH/OdMRObS2LoUQH8BLstZ0KKjaDkuxg46UlUpoED+h2/d4ir YtdvgBvmj/i5F0KwBpo1sWgwaOqrCT0rWb8NRBGitFLaXEIVawHxYV+Yp7oHYBQ0kHNs mhWA== X-Received: by 10.224.64.202 with SMTP id f10mr49534471qai.2.1374922055728; Sat, 27 Jul 2013 03:47:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.66 with SMTP id 2ls1398914qec.47.gmail; Sat, 27 Jul 2013 03:47:35 -0700 (PDT) X-Received: by 10.52.117.174 with SMTP id kf14mr18804471vdb.26.1374922055613; Sat, 27 Jul 2013 03:47:35 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id zj7si1583573vdb.12.2013.07.27.03.47.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Jul 2013 03:47:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id ij15so1097015vcb.2 for ; Sat, 27 Jul 2013 03:47:35 -0700 (PDT) X-Received: by 10.220.164.202 with SMTP id f10mr5338987vcy.25.1374922055540; Sat, 27 Jul 2013 03:47:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp26944vcb; Sat, 27 Jul 2013 03:47:34 -0700 (PDT) X-Received: by 10.67.23.3 with SMTP id hw3mr59984707pad.54.1374922054449; Sat, 27 Jul 2013 03:47:34 -0700 (PDT) Received: from mail-pb0-f45.google.com (mail-pb0-f45.google.com [209.85.160.45]) by mx.google.com with ESMTPS id zr1si37651318pbc.240.2013.07.27.03.47.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Jul 2013 03:47:34 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.45 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.160.45; Received: by mail-pb0-f45.google.com with SMTP id mc8so2914995pbc.18 for ; Sat, 27 Jul 2013 03:47:34 -0700 (PDT) X-Received: by 10.66.146.42 with SMTP id sz10mr58612812pab.78.1374922053946; Sat, 27 Jul 2013 03:47:33 -0700 (PDT) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id at2sm8917423pac.11.2013.07.27.03.45.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 27 Jul 2013 03:47:33 -0700 (PDT) From: Hanjun Guo To: Catalin Marinas , Will Deacon Cc: Russell King , Vincent Guittot , linux-arm-kernel@lists.infradead.org, patches@linaro.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Al Stone , Graeme Gregory , Naresh Bhat , Tomasz Nowicki , Hanjun Guo Subject: [RFC][PATCH 2/2] ARM64: introduce cluster id and make a difference between socket id Date: Sat, 27 Jul 2013 18:42:08 +0800 Message-Id: <1374921728-9007-2-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374921728-9007-1-git-send-email-hanjun.guo@linaro.org> References: <1374921728-9007-1-git-send-email-hanjun.guo@linaro.org> X-Gm-Message-State: ALoCoQmzie2jFjatnlteHmnm1bjhdpq4+YVOprm1PySw9A0H76mggvIkANcxhuhE30L5QHG4bsl0 X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In the cpu topology information, we define topology_physical_package_id() as cpu socket id, which means that the socket id is the idenfication for physical processor, not for a cluster in a cpu die. On ARM64 platform, multi cluster in a cpu die will be normal, here is a example with 2 cores in a cluster and 2 cluster in a socket: |--------------------------------------| | socket | | | | |---------------| |---------------| | | | cluster | | cluster | | | | | | | | | | |----| |----| | | |----| |----| | | | | |core| |core| | | |core| |core| | | | | |----| |----| | | |----| |----| | | | | | | | | | |---------------| |---------------| | | | |--------------------------------------| ARM64 extended the MPIDR into 64 bit and introduce another affinity level, we can use this affinity level for socket id and use the third highest level affinity for cluster id, which make the socket id behavior in its original way. Signed-off-by: Hanjun Guo --- arch/arm64/include/asm/topology.h | 1 + arch/arm64/kernel/topology.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h index 8631808..ff68ecc 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -8,6 +8,7 @@ struct cputopo_arm64 { int thread_id; int core_id; + int cluster_id; int socket_id; cpumask_t thread_sibling; cpumask_t core_sibling; diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 1eb0435..6d1e5a6 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -80,12 +80,14 @@ void store_cpu_topology(unsigned int cpuid) /* core performance interdependency */ cpuid_topo->thread_id = MPIDR_AFFINITY_LEVEL_0(mpidr); cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL_1(mpidr); - cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL_2(mpidr); + cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL_2(mpidr); + cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL_3(mpidr); } else { /* largely independent cores */ cpuid_topo->thread_id = -1; cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL_0(mpidr); - cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL_1(mpidr); + cpuid_topo->cluster_id = MPIDR_AFFINITY_LEVEL_1(mpidr); + cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL_2(mpidr); } } else { /* @@ -95,6 +97,7 @@ void store_cpu_topology(unsigned int cpuid) */ cpuid_topo->thread_id = -1; cpuid_topo->core_id = 0; + cpuid_topo->cluster_id = -1; cpuid_topo->socket_id = -1; } @@ -120,6 +123,7 @@ void __init init_cpu_topology(void) topo->thread_id = -1; topo->core_id = -1; + topo->cluster_id = -1; topo->socket_id = -1; cpumask_clear(&topo->core_sibling); cpumask_clear(&topo->thread_sibling);