From patchwork Sat Jun 7 16:10:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 31515 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 325A720CBB for ; Sat, 7 Jun 2014 16:10:35 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id jz11sf1363677veb.0 for ; Sat, 07 Jun 2014 09:10:34 -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:date:from:to:cc:subject:in-reply-to :message-id:references:user-agent:mime-version:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=cBqq2HXczQ67NftbPUTCsU+y+b/HeHhxSvrLauki98M=; b=RLhobYHjxuawZkT0EytXIA1pz6QKv7CnkFEvZBRKKgL7Jy96ybcLY2qsVhM1NvH/Je Lmj1pglJ1MISYVRigPScb85CXtIZVK4wANj5bjeL5UgeCEyH+8bpOCMwclkHVaN251kD tTQ8kKpllaSp/F54dkKiBWnHxcUgeid5fJZ37CswKDG3oK1YRxdhPuplBMHJy4bDDA+b Vw2K2FDlhA2JFwg+7/HHLxIvcpF+oUrOLCRpneazBqkO6RneM1DP0ywS6z7kE0sKRgC3 Nqa5XJweO+PiPAf2yMrCieh7Dt2+N5Nw3keW/cXKKDnPv4uCi17stdtqme5+97sbRzbO R3jQ== X-Gm-Message-State: ALoCoQl2wntYRAYOMHXIiV/V4glBkljYfxmmilYCrrh9G9j1u9hVEsuvgEom1R8kGik2+BAEjA/L X-Received: by 10.58.135.130 with SMTP id ps2mr8025054veb.8.1402157434789; Sat, 07 Jun 2014 09:10:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.99 with SMTP id y90ls1100062qgd.82.gmail; Sat, 07 Jun 2014 09:10:34 -0700 (PDT) X-Received: by 10.52.249.76 with SMTP id ys12mr11610672vdc.63.1402157434626; Sat, 07 Jun 2014 09:10:34 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id b16si9303479veh.25.2014.06.07.09.10.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Jun 2014 09:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hy10so329792vcb.29 for ; Sat, 07 Jun 2014 09:10:34 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr12089109vca.45.1402157434458; Sat, 07 Jun 2014 09:10:34 -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.221.54.6 with SMTP id vs6csp27721vcb; Sat, 7 Jun 2014 09:10:33 -0700 (PDT) X-Received: by 10.68.193.100 with SMTP id hn4mr12961043pbc.50.1402157433156; Sat, 07 Jun 2014 09:10:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yr4si25928387pbb.4.2014.06.07.09.10.32; Sat, 07 Jun 2014 09:10:32 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752939AbaFGQKb (ORCPT + 8 others); Sat, 7 Jun 2014 12:10:31 -0400 Received: from mail-qg0-f54.google.com ([209.85.192.54]:45256 "EHLO mail-qg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752930AbaFGQKa (ORCPT ); Sat, 7 Jun 2014 12:10:30 -0400 Received: by mail-qg0-f54.google.com with SMTP id q108so6996028qgd.27 for ; Sat, 07 Jun 2014 09:10:29 -0700 (PDT) X-Received: by 10.224.162.210 with SMTP id w18mr18199503qax.21.1402157429162; Sat, 07 Jun 2014 09:10:29 -0700 (PDT) Received: from xanadu.home (modemcable177.143-130-66.mc.videotron.ca. [66.130.143.177]) by mx.google.com with ESMTPSA id h78sm8018114qgd.10.2014.06.07.09.10.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Jun 2014 09:10:28 -0700 (PDT) Date: Sat, 7 Jun 2014 12:10:27 -0400 (EDT) From: Nicolas Pitre To: Abhilash Kesavan cc: Doug Anderson , linux-samsung-soc , "Turquette, Mike" , Kevin Hilman , Tushar Behera , Thomas Abraham , linux-arm-kernel , Olof Johansson , Sonny Rao , Javier Martinez Canillas , Arun Kumar Subject: Re: Problems booting exynos5420 with >1 CPU In-Reply-To: Message-ID: References: <539145B4.5000200@gmail.com> User-Agent: Alpine 2.11 (LFD 23 2013-08-11) MIME-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nicolas.pitre@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.220.170 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Sat, 7 Jun 2014, Abhilash Kesavan wrote: > Hi Nicolas, > > The first man of the incoming cluster enables its snoops via the > power_up_setup function. During secondary boot-up, this does not occur > for the boot cluster. Hence, I enable the snoops for the boot cluster > as a one-time setup from the u-boot prompt. After secondary boot-up > there is no modification that I do. OK that's good. > Where should this be ideally done ? If I remember correctly, the CCI can be safely activated only when the cache is disabled. So that means the CCI should ideally be turned on for the boot cluster (and *only* for the boot CPU) by the bootloader. Now... If you _really_ prefer to do it from the kernel to avoid difficulties with bootloader updates, then it should be possible to do it from the kernel by temporarily turning the cache off. This is not a small thing but the MCPM infrastructure can be leveraged. Here's what I tried on a TC2 which might just work for you as well: Of course it is not because I'm helping you sidestepping firmware problems that I'll stop shaming those who came up with that firmware design. ;-) Nicolas --- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c index 86fd60fefb..1cc49de308 100644 --- a/arch/arm/common/mcpm_entry.c +++ b/arch/arm/common/mcpm_entry.c @@ -12,11 +12,13 @@ #include #include #include +#include #include #include #include #include +#include extern unsigned long mcpm_entry_vectors[MAX_NR_CLUSTERS][MAX_CPUS_PER_CLUSTER]; @@ -146,6 +148,44 @@ int mcpm_cpu_powered_up(void) return 0; } +static int go_down(unsigned long _arg) +{ + void (*cache_disable)(void) = (void *)_arg; + unsigned int mpidr = read_cpuid_mpidr(); + unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); + unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); + phys_reset_t phys_reset; + + mcpm_set_entry_vector(cpu, cluster, cpu_resume); + setup_mm_for_reboot(); + + __mcpm_cpu_going_down(cpu, cluster); + BUG_ON(!__mcpm_outbound_enter_critical(cpu, cluster)); + cache_disable(); + __mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN); + __mcpm_cpu_down(cpu, cluster); + + phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset); + phys_reset(virt_to_phys(mcpm_entry_point)); + BUG(); +} + +int mcpm_loopback(void (*cache_disable)(void)) +{ + int ret; + + local_irq_disable(); + local_fiq_disable(); + ret = cpu_pm_enter(); + if (!ret) { + ret = cpu_suspend((unsigned long)cache_disable, go_down); + cpu_pm_exit(); + } + local_fiq_enable(); + local_irq_enable(); + return ret; +} + struct sync_struct mcpm_sync; /* diff --git a/arch/arm/mach-vexpress/tc2_pm.c b/arch/arm/mach-vexpress/tc2_pm.c index 29e7785a54..abecdd734f 100644 --- a/arch/arm/mach-vexpress/tc2_pm.c +++ b/arch/arm/mach-vexpress/tc2_pm.c @@ -323,6 +323,26 @@ static void __naked tc2_pm_power_up_setup(unsigned int affinity_level) " b cci_enable_port_for_self "); } +int mcpm_loopback(void (*cache_disable)(void)); + +static void tc2_cache_down(void) +{ + pr_warn("TC2: disabling cache\n"); + if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A15) { + /* + * On the Cortex-A15 we need to disable + * L2 prefetching before flushing the cache. + */ + asm volatile( + "mcr p15, 1, %0, c15, c0, 3 \n\t" + "isb \n\t" + "dsb " + : : "r" (0x400) ); + } + v7_exit_coherency_flush(all); + cci_disable_port_by_cpu(read_cpuid_mpidr()); +} + static int __init tc2_pm_init(void) { int ret, irq; @@ -370,6 +390,7 @@ static int __init tc2_pm_init(void) ret = mcpm_platform_register(&tc2_pm_power_ops); if (!ret) { mcpm_sync_init(tc2_pm_power_up_setup); + BUG_ON(mcpm_loopback(tc2_cache_down) != 0); pr_info("TC2 power management initialized\n"); } return ret;