Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1231588imm; Wed, 6 Jun 2018 12:32:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJTSZPjxR8UIXuBv4Ya+IUonFsmesMmDKjhTjj5m3mwj6DBx7pi2srHH9Fxt2JeHVbLcIKG X-Received: by 2002:a63:842:: with SMTP id 63-v6mr3747475pgi.406.1528313570494; Wed, 06 Jun 2018 12:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528313570; cv=none; d=google.com; s=arc-20160816; b=O5TtJ4Vk46zZwJvUfgnrbgalEpIiWvoEMoGMTwMtpDYxD4OZJLWlf/Pv/f9tERQHKK rMNY0cN9o7ZG/K/4CoEBKsE3Q9PD1i1P/l4wz/io60iTp3YaKXqbMlg3AAskDUYIR5gP liiijXarn314cIFmkyL/2LAOp3ubF6saAYFcczKI5aK+HpDRzdcLBdFI1trRZycrSVSN j9W1DUNPsIGA1PcgeFukyz5GaaQJ91IBbtnPgTivc21LiF9QeKnklNBgfHSk3L+S32l1 /XydZoM/Gden8blrus9YY3ZfzyBHC3LMYM+jfUMktOGPqO/5cRWcASaQ5cX2Cknvo3VH oJAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=KseeInEa4DWucItVVzXcueQhIC5AdObs1iybKeDLz6s=; b=wVbjlSYp9fwP9ukz9y0nS47bAvegttOptnz8SoAixYgis3mGOc9jIeN1BAWEWViX7P DN8BzLt3Z7vcNJMvkDwC10/v09EEcgcC1mjwujzQgREaGvC+8J7mP6F+LULWr4b2XtJv +1PA0h7q5flyQo8oHwZHBQTuXN+xwI9GBsmDnU49qWEvcvf7QVRJcAaRDy/8w6dUH6CM m0EqjulgtkKxtPeoWjJUC1CWS21S9vnCzrTaNy8UfQbZ5rSpUL5x9DD1TqUzJaxuGiKE DdmLTTV4jxkYqIfMyGzHhkH01SefgltaMghq5KzN+1FlQ5oqq3uzFbN7zqcxy59Pcbxe 9H4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dmGbEE7k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14-v6si42350109pgc.216.2018.06.06.12.32.36; Wed, 06 Jun 2018 12:32:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dmGbEE7k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752274AbeFFTaP (ORCPT + 99 others); Wed, 6 Jun 2018 15:30:15 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:43444 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751546AbeFFTaM (ORCPT ); Wed, 6 Jun 2018 15:30:12 -0400 Received: by mail-pf0-f194.google.com with SMTP id j20-v6so3612184pff.10; Wed, 06 Jun 2018 12:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KseeInEa4DWucItVVzXcueQhIC5AdObs1iybKeDLz6s=; b=dmGbEE7kgXqQAnaPfRinPUf0UdfA4t19hgTvLjqo6fCIw+CmE0KjhxiUWGJb2rXIEq 4J0UHxoYc9oIOyFE7XsKaTBqwOsSxIke2TsGGBxGEAYQidfj/yb42LaIS5npRz3eDUXn yLtxdyrr3DXGYTIxUQLCzxOzaaC8Jd+5UwrdcuwLXYBGNvrl/I3ld5+Ak+31duIBswl6 MECd6GXwx72jRT/xjxGN7PAWpkxm8Ew1xO9VXyjEVou2JvOqouvXWkTz10y7tCkq0V+S MyIdK5ZDA4uD9BqtcmKqk+azQQ/JA4hVAG2uRrxUk7GJo749p/zQlxLt7+zLqaeCF18j 95rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KseeInEa4DWucItVVzXcueQhIC5AdObs1iybKeDLz6s=; b=lWnz0mg1+n/DWhSa7VOyEE2fsUzIVkSf3l9hih3qm4NNX0gEmYpqvcXh1zSKGPW8zi j6Sdkn1X4/5YJJPmdX1d04DujMJB8ux4q3QgB1D9IRzkbnd3GsRAhct6/qfTJWLEtryJ E3QXXFbLA0h+sIj2VlfubTBDkVCa70cKB80xZaN8gVh5EXhfWvydaj5ecaBHYYD1eCAk EAreCloTzNKI3SNECHz5EPTGLh3h85euP06CuUuFHhzZycPVH5x9W7QF6clhWECRfatY uaPyhleMsoz+89V9ww6vVd6EEVTJTDLA1lKbzF1HnVmeBERo5f+nRcZN/wEiOexn+gff fT9Q== X-Gm-Message-State: APt69E2vnW6z5ejrpON3YOdiuZgGCppdf8zIg7yCi6/Mxl96R1UVij+1 QGvbbf05QpWAg6BmOaUKgcHCDAla X-Received: by 2002:a63:618e:: with SMTP id v136-v6mr3629004pgb.100.1528313412318; Wed, 06 Jun 2018 12:30:12 -0700 (PDT) Received: from [192.168.1.70] (c-24-6-192-50.hsd1.ca.comcast.net. [24.6.192.50]) by smtp.gmail.com with ESMTPSA id k15-v6sm3431573pfi.37.2018.06.06.12.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 12:30:11 -0700 (PDT) Subject: Re: [PATCH v4 2/3] arm: shmobile: Add the R9A06G032 SMP enabler driver To: Michel Pollet , "linux-renesas-soc@vger.kernel.org" , Simon Horman Cc: Michel Pollet , Mark Rutland , Phil Edworthy , Florian Fainelli , Rajendra Nayak , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Stefan Wahren , Magnus Damm , Russell King , Douglas Anderson , Chen-Yu Tsai , Rob Herring , Carlo Caione , =?UTF-8?Q?Andreas_F=c3=a4rber?= , Frank Rowand , "linux-arm-kernel@lists.infradead.org" References: <1528198148-23308-1-git-send-email-michel.pollet@bp.renesas.com> <1528198148-23308-3-git-send-email-michel.pollet@bp.renesas.com> <0481173f-6384-98d6-707c-89dc5ef103f0@gmail.com> From: Frank Rowand Message-ID: Date: Wed, 6 Jun 2018 12:30:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michel, On 06/05/18 23:36, Michel Pollet wrote: > Hi Frank, > > On 05 June 2018 18:34, Frank wrote: >> On 06/05/18 04:28, Michel Pollet wrote: >>> The Renesas R9A06G032 second CA7 is parked in a ROM pen at boot time, >>> it requires a special enable method to get it started. >>> >>> Signed-off-by: Michel Pollet >>> --- >>> arch/arm/mach-shmobile/Makefile | 1 + >>> arch/arm/mach-shmobile/smp-r9a06g032.c | 79 >>> ++++++++++++++++++++++++++++++++++ >>> 2 files changed, 80 insertions(+) >>> create mode 100644 arch/arm/mach-shmobile/smp-r9a06g032.c >>> >>> diff --git a/arch/arm/mach-shmobile/Makefile >>> b/arch/arm/mach-shmobile/Makefile index 1939f52..d7fc98f 100644 >>> --- a/arch/arm/mach-shmobile/Makefile >>> +++ b/arch/arm/mach-shmobile/Makefile >>> @@ -34,6 +34,7 @@ smp-$(CONFIG_ARCH_SH73A0)+= smp-sh73a0.o >> headsmp-scu.o platsmp-scu.o >>> smp-$(CONFIG_ARCH_R8A7779)+= smp-r8a7779.o headsmp-scu.o >> platsmp-scu.o >>> smp-$(CONFIG_ARCH_R8A7790)+= smp-r8a7790.o >>> smp-$(CONFIG_ARCH_R8A7791)+= smp-r8a7791.o >>> +smp-$(CONFIG_ARCH_R9A06G032)+= smp-r9a06g032.o >>> smp-$(CONFIG_ARCH_EMEV2)+= smp-emev2.o headsmp-scu.o >> platsmp-scu.o >>> >>> # PM objects >>> diff --git a/arch/arm/mach-shmobile/smp-r9a06g032.c >>> b/arch/arm/mach-shmobile/smp-r9a06g032.c >>> new file mode 100644 >>> index 0000000..cd40e6e >>> --- /dev/null >>> +++ b/arch/arm/mach-shmobile/smp-r9a06g032.c >>> @@ -0,0 +1,79 @@ >>> +// SPDX-License-Identifier: GPL-2.0 >>> +/* >>> + * R9A06G032 Second CA7 enabler. >>> + * >>> + * Copyright (C) 2018 Renesas Electronics Europe Limited >>> + * >>> + * Michel Pollet , >> >>> + * Derived from action,s500-smp >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +/* >>> + * The second CPU is parked in ROM at boot time. It requires waking >>> +it after >>> + * writing an address into the BOOTADDR register of sysctrl. >>> + * >>> + * So the default value of the "cpu-release-addr" corresponds to >> BOOTADDR... >>> + * >>> + * *However* the BOOTADDR register is not available when the kernel >>> + * starts in NONSEC mode. >>> + * >>> + * So for NONSEC mode, the bootloader re-parks the second CPU into a >>> +pen >>> + * in SRAM, and changes the "cpu-release-addr" of linux's DT to a >>> +SRAM address, >>> + * which is not restricted. >> >> The binding document for cpu-release-addr does not have a definition for 32 >> bit arm. The existing definition is only 64 bit arm. Please add the definition >> for 32 bit arm to patch 1. > > Hmmm I do find a definition in > Documentation/devicetree/bindings/arm/cpus.txt -- just under where I > added my 'enable-method' -- And it is already used as 32 bits in at least > arch/arm/boot/dts/stih407-family.dtsi. From cpus.txt: - cpu-release-addr Usage: required for systems that have an "enable-method" property value of "spin-table". Value type: Definition: # On ARM v8 64-bit systems must be a two cell property identifying a 64-bit zero-initialised memory location. The definition specifies a two cell property for 64-bit systems. Please add to the definition that cpu-release-addr is a one cell property for 32-bit systems. -Frank > > What do you want me to add to this exactly? Do you want me to just > change "required for systems that have an "enable-method" property > value of "spin-table" to also specify renesas,r9a06g032 ? > > Thanks! > Michel > >> >> -Frank >> >> >>> + */ >>> + >>> +static void __iomem *cpu_bootaddr; >>> + >>> +static DEFINE_SPINLOCK(cpu_lock); >>> + >>> +static int r9a06g032_smp_boot_secondary(unsigned int cpu, struct >>> +task_struct *idle) { >>> +if (!cpu_bootaddr) >>> +return -ENODEV; >>> + >>> +spin_lock(&cpu_lock); >>> + >>> +writel(__pa_symbol(secondary_startup), cpu_bootaddr); >>> +arch_send_wakeup_ipi_mask(cpumask_of(cpu)); >>> + >>> +spin_unlock(&cpu_lock); >>> + >>> +return 0; >>> +} >>> + >>> +static void __init r9a06g032_smp_prepare_cpus(unsigned int max_cpus) >>> +{ >>> +struct device_node *dn; >>> +int ret; >>> +u32 bootaddr; >>> + >>> +dn = of_get_cpu_node(1, NULL); >>> +if (!dn) { >>> +pr_err("CPU#1: missing device tree node\n"); >>> +return; >>> +} >>> +/* >>> + * Determine the address from which the CPU is polling. >>> + * The bootloader *does* change this property >>> + */ >>> +ret = of_property_read_u32(dn, "cpu-release-addr", &bootaddr); >>> +of_node_put(dn); >>> +if (ret) { >>> +pr_err("CPU#1: invalid cpu-release-addr property\n"); >>> +return; >>> +} >>> +pr_info("CPU#1: cpu-release-addr %08x\n", bootaddr); >>> + >>> +cpu_bootaddr = ioremap(bootaddr, sizeof(bootaddr)); } >>> + >>> +static const struct smp_operations r9a06g032_smp_ops __initconst = { >>> +.smp_prepare_cpus = r9a06g032_smp_prepare_cpus, >>> +.smp_boot_secondary = r9a06g032_smp_boot_secondary, }; >>> +CPU_METHOD_OF_DECLARE(r9a06g032_smp, "renesas,r9a06g032-smp", >>> +&r9a06g032_smp_ops); >>> > > > > > Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709. >