From patchwork Fri Oct 21 16:54:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 4781 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0147923EF5 for ; Fri, 21 Oct 2011 16:55:02 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id E3749A182E2 for ; Fri, 21 Oct 2011 16:55:01 +0000 (UTC) Received: by bkbzs2 with SMTP id zs2so7060600bkb.11 for ; Fri, 21 Oct 2011 09:55:01 -0700 (PDT) Received: by 10.223.17.3 with SMTP id q3mr25883045faa.28.1319216101504; Fri, 21 Oct 2011 09:55:01 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.1.71 with SMTP id 7cs22845lak; Fri, 21 Oct 2011 09:55:01 -0700 (PDT) Received: by 10.216.22.129 with SMTP id t1mr10874765wet.20.1319216100555; Fri, 21 Oct 2011 09:55:00 -0700 (PDT) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id z32si10148972weq.133.2011.10.21.09.55.00 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Oct 2011 09:55:00 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) smtp.mail=vincent.guittot@linaro.org Received: by wyf28 with SMTP id 28so4817080wyf.37 for ; Fri, 21 Oct 2011 09:55:00 -0700 (PDT) Received: by 10.216.24.68 with SMTP id w46mr5882428wew.44.1319216099919; Fri, 21 Oct 2011 09:54:59 -0700 (PDT) Received: from localhost.localdomain (pas72-1-88-161-60-229.fbx.proxad.net. [88.161.60.229]) by mx.google.com with ESMTPS id i29sm22791992wbp.22.2011.10.21.09.54.58 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Oct 2011 09:54:59 -0700 (PDT) From: Vincent Guittot To: linaro-dev@lists.linaro.org Cc: patches@linaro.org, Vincent Guittot Subject: [RFC PATCH 03/11] ARM: cpu topology: Add dedicated quadcore CA-9 topology for powersaving mode Date: Fri, 21 Oct 2011 18:54:41 +0200 Message-Id: <1319216081-2469-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.4.1 Signed-off-by: Vincent Guittot --- arch/arm/kernel/topology.c | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 34512fe..faf66f3 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -107,18 +108,36 @@ static void default_cpu_topology_mask(void) } /* - * For Cortex-A9 MPcore dual core, we emulate a multi-package single core - * topology in power mode. + * For Cortex-A9 MPcore, we emulate a multi-package topology in power mode. + * The goal is to gathers tasks on 1 virtual package */ static void power_cpu_topology_mask_CA9(void) { - unsigned int cpuid; + + unsigned int cpuid, cpu; + for_each_possible_cpu(cpuid) { - struct cputopo_arm *cpuid_topo = &(cpu_topology[cpuid]); + struct cputopo_arm *cpuid_topo = &cpu_topology[cpuid]; - cpumask_set_cpu(cpuid, &cpuid_topo->core_sibling); - cpumask_set_cpu(cpuid, &cpuid_topo->thread_sibling); + for_each_possible_cpu(cpu) { + struct cputopo_arm *cpu_topo = &cpu_topology[cpu]; + if ((cpuid_topo->socket_id == cpu_topo->socket_id) + && ((cpuid & 0x1) == (cpu & 0x1))) { + cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); + if (cpu != cpuid) + cpumask_set_cpu(cpu, + &cpuid_topo->core_sibling); + + if (cpuid_topo->core_id == cpu_topo->core_id) { + cpumask_set_cpu(cpuid, + &cpu_topo->thread_sibling); + if (cpu != cpuid) + cpumask_set_cpu(cpu, + &cpuid_topo->thread_sibling); + } + } + } } smp_wmb(); }