From patchwork Fri Jul 31 08:37:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 51751 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 0D16622A8D for ; Fri, 31 Jul 2015 08:39:46 +0000 (UTC) Received: by labby2 with SMTP id by2sf2982193lab.3 for ; Fri, 31 Jul 2015 01:39:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:cc:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=387uTDxZh8NNkUF2Zlcl+9KES0dgouEeeX8eKCjvS+o=; b=Qam6o7+zroCkQu9xJZsz3safjXTpGj8SPBas29KjkOBj9nA/RljF6eHrI056Sd1kHf qmLjnoeuAz3bvaap/nHSd4++94+44GYi9XrHg2lBpfHGQRrb4ToxvsEEzQyqkUOizgu4 o84QGWsuhhHMpQWGFsNsoff/mRUoPeeSBFg78nNqYTGwtVfj0LqGbj8tONyflPASRzCu Z3g7FVnfmFUZxa0ed4VrlA4umJEZypdifgb5loKXeSS5gRRYHD3GG1R1+zpCJakD5CzD JAaP7FHn4peN/dwKK1JGxCjDKClet5KZfudhxW04SzxO04kI7n4MjQRM/+59joZwUyMg +91A== X-Gm-Message-State: ALoCoQmuysK49wzc/250AIuyHULyG+J01YkdlFmRc6jhXrov3bY0KUHlVEXgazPxAI1VynWnMRll X-Received: by 10.152.120.69 with SMTP id la5mr567393lab.7.1438331985083; Fri, 31 Jul 2015 01:39:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.39 with SMTP id b7ls261047lae.85.gmail; Fri, 31 Jul 2015 01:39:44 -0700 (PDT) X-Received: by 10.152.36.7 with SMTP id m7mr1552109laj.87.1438331984733; Fri, 31 Jul 2015 01:39:44 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id l9si3006002lam.36.2015.07.31.01.39.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 01:39:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbyj8 with SMTP id yj8so42017733lbb.0 for ; Fri, 31 Jul 2015 01:39:44 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr1621627lal.35.1438331984568; Fri, 31 Jul 2015 01:39:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp227364lba; Fri, 31 Jul 2015 01:39:43 -0700 (PDT) X-Received: by 10.70.31.5 with SMTP id w5mr4424165pdh.3.1438331981219; Fri, 31 Jul 2015 01:39:41 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id c3si8788526pat.105.2015.07.31.01.39.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 01:39:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; 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 1ZL5pi-0003ng-W8; Fri, 31 Jul 2015 08:38:27 +0000 Received: from mail-lb0-f180.google.com ([209.85.217.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZL5pf-0003hr-DB for linux-arm-kernel@lists.infradead.org; Fri, 31 Jul 2015 08:38:24 +0000 Received: by lbqc9 with SMTP id c9so16667518lbq.1 for ; Fri, 31 Jul 2015 01:38:01 -0700 (PDT) X-Received: by 10.152.23.234 with SMTP id p10mr1619874laf.52.1438331881337; Fri, 31 Jul 2015 01:38:01 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by smtp.gmail.com with ESMTPSA id p5sm748860lba.36.2015.07.31.01.37.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 01:38:00 -0700 (PDT) From: Linus Walleij To: arm@kernel.org Subject: [PATCH] ARM: ux500: fix ux500 secondary CPU boot regression Date: Fri, 31 Jul 2015 10:37:54 +0200 Message-Id: <1438331874-1682-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150731_013823_632994_32A552FD X-CRM114-Status: GOOD ( 23.66 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.180 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.217.180 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Linus Walleij , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This fixes a SMP boot regression on the Ux500. commit 2d6dd1711346d1708eacdbb1b5e8a5a573562fd1 "ARM: ux500: remove static maps from platsmp" commit: 58202033faca18198af21dabb7e75481d4a2cd8a "ARM: ux500: get SCU base from device tree" both assumed that we can use of_ioremap() and thus ioremap() in the early platform boot hook in the smp_init_cpus() callback from the struct smp_operations vtable. This is however way too early: ioremap() is not really working. The remaps do not persist and the secondary CPU does not boot. It is necessary to use a static remapping for the SCU in order to remap it in .smp_init_cpus(), so this patch does a half-measure by populating a static map with the physical address found in the DT. Further, the static ioremap() of the backupram in the same early hook did not really work either. For this there was possible to to a better fix: move the remapping to .smp_prepare_cpus() and take this opportunity to get the address from the device tree. There is a better fix for the long term. The .smp_init_cpus() hook is not really needed, and both remaps can be deferred to the .smp_prepare_cpus() if the CPU topology is correctly described on the device tree so that arm_dt_init_cpu_maps() can call set_cpu_possible() without us having to go into the SCU to count the CPUs like this, but that fix has to be postponed to the next development cycle since it gets too invasive and includes patching the device tree. Signed-off-by: Linus Walleij --- ARM SoC folks: please apply this directly for fixes if you're OK with it. Sorry for screwing up, this was the best I could come up with. Static maps die hard it seems. --- arch/arm/mach-ux500/platsmp.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index 62b1de922bd8..55335da3ff5f 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c @@ -22,6 +22,9 @@ #include #include #include +#include +#include + #include "setup.h" @@ -117,6 +120,9 @@ static void __init wakeup_secondary(void) mb(); } +/* Arbitrarily chosen, let's get rid of this ASAP */ +#define SCU_VIRT_ADDRESS 0xf1000000 + /* * Initialise the CPU possible map early - this describes the CPUs * which may be present or become present in the system. @@ -125,13 +131,26 @@ static void __init ux500_smp_init_cpus(void) { unsigned int i, ncores; struct device_node *np; + struct map_desc scu_desc = { + .virtual = SCU_VIRT_ADDRESS, + .type = MT_DEVICE, + }; + struct resource res; np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); - scu_base = of_iomap(np, 0); - of_node_put(np); - if (!scu_base) + if (of_address_to_resource(np, 0, &res)) { + pr_err("PLATSMP: unable to get SCU resource\n"); return; - backupram = ioremap(U8500_BACKUPRAM0_BASE, SZ_8K); + } + scu_desc.pfn = __phys_to_pfn(res.start); + scu_desc.length = resource_size(&res); + iotable_init(&scu_desc, 1); + /* As in devicemaps_init() */ + local_flush_tlb_all(); + flush_cache_all(); + of_node_put(np); + scu_base = (void *) SCU_VIRT_ADDRESS; + ncores = scu_get_core_count(scu_base); /* sanity check */ @@ -147,6 +166,19 @@ static void __init ux500_smp_init_cpus(void) static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) { + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "ste,dbx500-backupram"); + if (!np) { + pr_err("No backupram base address\n"); + return; + } + backupram = of_iomap(np, 0); + of_node_put(np); + if (!backupram) { + pr_err("No backupram remap\n"); + return; + } scu_enable(scu_base); wakeup_secondary(); }