From patchwork Thu Jun 6 17:11:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James King X-Patchwork-Id: 17654 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f200.google.com (mail-gg0-f200.google.com [209.85.161.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6AA5825DEA for ; Thu, 6 Jun 2013 17:12:15 +0000 (UTC) Received: by mail-gg0-f200.google.com with SMTP id k5sf2903232ggd.7 for ; Thu, 06 Jun 2013 10:12:15 -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 :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=xPZx+SY7V4uZaxbbJTAVzgQ+1Jcdt1GpeUMx43yLq2E=; b=VbL1ZamkybZ6Kvc56tgx5mY2I4C+w7LwuwNER8FWFJf7IRaOd7Q3fowmZ782k0X4jd S6L3fbW8Nw7YIzD8CKRAUdH53W2+QPai6U6fPgNOxRtGlO3/3gqWdqn8oKPq4758TsF/ cpM4el4S0onWkk8lBTJz/QWLDmbaggV3Id48FjwC6k2PRnQp7Zf/wjRaicuHr0HbeT+m jg+kAWzxF8BWXNV0U3YEbd9lOHs0I0CQVZuUfaEYVPKB+KpgLG1QZXLhRjGkoKfyXCME 8nJxsbHOKCncDfZDjsZ2mo2Cd9DOVxIWkEAsCHgisWIM2cN+mCdzoxiB7oWuM6V4MM8M +IQQ== X-Received: by 10.236.229.201 with SMTP id h69mr18171275yhq.49.1370538734987; Thu, 06 Jun 2013 10:12:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.137 with SMTP id lk9ls1549725qeb.68.gmail; Thu, 06 Jun 2013 10:12:14 -0700 (PDT) X-Received: by 10.52.88.107 with SMTP id bf11mr756682vdb.115.1370538734539; Thu, 06 Jun 2013 10:12:14 -0700 (PDT) Received: from mail-ve0-x232.google.com (mail-ve0-x232.google.com [2607:f8b0:400c:c01::232]) by mx.google.com with ESMTPS id fb8si2375939vcb.79.2013.06.06.10.12.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 10:12:14 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::232; Received: by mail-ve0-f178.google.com with SMTP id pb11so2374143veb.23 for ; Thu, 06 Jun 2013 10:12:14 -0700 (PDT) X-Received: by 10.220.246.8 with SMTP id lw8mr22208800vcb.8.1370538734438; Thu, 06 Jun 2013 10:12:14 -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.10.206 with SMTP id pb14csp75930vcb; Thu, 6 Jun 2013 10:12:13 -0700 (PDT) X-Received: by 10.194.104.105 with SMTP id gd9mr33124350wjb.1.1370538733249; Thu, 06 Jun 2013 10:12:13 -0700 (PDT) Received: from mail-wg0-x236.google.com (mail-wg0-x236.google.com [2a00:1450:400c:c00::236]) by mx.google.com with ESMTPS id o9si7684563wia.7.2013.06.06.10.12.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 10:12:13 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::236 is neither permitted nor denied by best guess record for domain of james.king@linaro.org) client-ip=2a00:1450:400c:c00::236; Received: by mail-wg0-f54.google.com with SMTP id j13so2383798wgh.9 for ; Thu, 06 Jun 2013 10:12:12 -0700 (PDT) X-Received: by 10.194.11.72 with SMTP id o8mr32907895wjb.0.1370538732721; Thu, 06 Jun 2013 10:12:12 -0700 (PDT) Received: from james-linaro.lan (79-77-215-0.dynamic.dsl.as9105.com. [79.77.215.0]) by mx.google.com with ESMTPSA id ca19sm17125274wib.3.2013.06.06.10.12.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 10:12:11 -0700 (PDT) From: James King To: grant.likely@linaro.org, rob.herring@calxeda.com, rob@landley.net, linux@arm.linux.org.uk, lorenzo.pieralisi@arm.com, nico@linaro.org, vincent.guittot@linaro.org, namhyung@kernel.org, a.p.zijlstra@chello.nl, devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: james.king@linaro.org, patches@linaro.org, linaro-kernel@lists.linaro.org Subject: [PATCH] arm/dt: Don't add disabled CPUs to system topology Date: Thu, 6 Jun 2013 18:11:25 +0100 Message-Id: <1370538685-22386-1-git-send-email-james.king@linaro.org> X-Mailer: git-send-email 1.8.1.2 X-Gm-Message-State: ALoCoQlw0IHUoaDN86wiPNB3Vs99WWAWnLwtzkHZz61U0+1JEVD9TGKxpQcgWMbkBgkNoxTcIOx6 X-Original-Sender: james.king@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::232 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: , If CPUs are marked as disabled in the devicetree, make sure they do not exist in the system CPU information and CPU topology information. In this case these CPUs will not be able to be added to the system later using hot-plug. This allows a single chip with many CPUs to be easily used in a variety of hardware devices where they may have different actual processing requirements (eg for thermal/cost reasons). - Change devicetree.c to ignore any cpu nodes marked as disabled, this effectively limits the number of active cpu cores so no need for the max_cpus=x in the chosen node. - Change topology.c to ignore any cpu nodes marked as disabled, this is where the scheduler would learn about big/LITTLE cores so this effectively keeps the scheduler in sync. Signed-off-by: James King Acked-by: Nicolas Pitre --- Documentation/devicetree/bindings/arm/cpus.txt | 5 +++++ arch/arm/kernel/devtree.c | 6 ++++++ arch/arm/kernel/topology.c | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt index f32494d..9fbcbc5 100644 --- a/Documentation/devicetree/bindings/arm/cpus.txt +++ b/Documentation/devicetree/bindings/arm/cpus.txt @@ -45,6 +45,10 @@ For the ARM architecture every CPU node must contain the following properties: "marvell,xsc3" "marvell,xscale" +And optionally set the following properties: + +- status: can be set to "disabled" to remove that CPU from the system CPU topology + Example: cpus { @@ -73,5 +77,6 @@ Example: device_type = "cpu"; compatible = "arm,cortex-a7"; reg = <0x101>; + status = "disabled"; }; }; diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 5af04f6..f4ba8ee 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -112,6 +112,12 @@ void __init arm_dt_init_cpu_maps(void) return; /* + * Check if the cpu is marked as "disabled", if so ignore. + */ + if (!of_device_is_available(cpu)) + continue; + + /* * Duplicate MPIDRs are a recipe for disaster. * Scan all initialized entries and check for * duplicates. If any is found just bail out. diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index f10316b..90f8fb3 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -116,6 +116,10 @@ static void __init parse_dt_topology(void) if (cpu_eff->compatible == NULL) continue; + /* Check if the cpu is marked as "disabled", if so ignore. */ + if (!of_device_is_available(cn)) + continue; + rate = of_get_property(cn, "clock-frequency", &len); if (!rate || len != 4) { pr_err("%s missing clock-frequency property\n",