From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95D53C2B9F8 for ; Tue, 25 May 2021 19:04:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 423BA61378 for ; Tue, 25 May 2021 19:04:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 423BA61378 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=snejp.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rSDAiW8KrjLpKzCv3fngyoo0MhPZoM6ahAbaa4lJF7c=; b=ka14RTiNd3m6HI hSAXZ4tYzMiPBhRVINE3L3vADutCFJcJVr0YstpkINOsFSYhm/yo0LYcMPx4MvOUkYGf6waT+rYnE spbHxjnEhTunfH/SZ67OITSPOiz6o66lvmdCyJl+TX7QR0LIUHSHK+n5mJmHq3Y6wB1WLucUgs+Wk qWvbXGIxXr7e3tvKxY/7eF+GmW6xDA5BKBEfHz1ebYPSEpyDybM8Eu128GjS4GI/LRZAqSPX3YcMQ TWGUKWo4Op9xqq8jbzUVBFF61QQtz82lt/RV+QmJb6KxFVkWMgNi8puaoofsfHSlUJEyEH6mGr1rh 4traOx1olcE9RJEsQpGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llcIw-007Veq-M2; Tue, 25 May 2021 19:01:28 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llc09-007Mmr-Lh for linux-arm-kernel@lists.infradead.org; Tue, 25 May 2021 18:42:08 +0000 Received: by mail-wm1-x32a.google.com with SMTP id z130so17307591wmg.2 for ; Tue, 25 May 2021 11:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=snejp.pl; s=gmail; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uA8zy8FMFOfbUuugs0P0F3l39RYnpQwCDdJbsxFoBTI=; b=AfETKzCfYnpqwmxs4oM7m4JogaxlXXgr5SdBL5nyCsmwp4GFOvrSnArzR8BCONT9sR Ko2myp/YeGR+nB2ftHfgMMOCUgZgmc1CkY44r1W3IhkFvuJYhSltKEqExkDNlfUY6lRr pujOw7vc5djCRRU0Mu6Jjb0ox3Z1iI7wdy+yZiFElI9tI4HNAeFbbyAwS7zJzfRnnUcV p4NgepHT5NtHbdaq7cvckZu1iXFI/ZwYMZDR6hQohm7k0T48PdAEcI5gKMoJFx7vi1SN 2U1DC6i7bHqeSwR8KsDOk8We6YVGYbcKVOuN8UJwvFHS2JDZUNZL3pM5vusaHNxOIFM2 Pg2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uA8zy8FMFOfbUuugs0P0F3l39RYnpQwCDdJbsxFoBTI=; b=saCICmxgJ/4q3RIitqPS332pjrZAJCqha0wpshGtTIXWgt7MyyqWTgahfL6tZbxPDj N68JOA366TmfezXZsANe7Byv2EV7bUyfI/5F6zLyWhwPtIv6NCKzgqLq6G9iuG7ClrH5 +xVNcfAVrKOoA8f4aq+4I9+f/8/uFe2wGTCzqSHvIHhxStZcvVSL4TT73rIHsq/gCiWS QqH03pgvESiXceuk6bXhBUBkOWae+pLfR0ow5M0ZhK/3A9FvdcA9xyDDGPranLnIPtVM ROyvKBlcvVRLS/Xh/BcXzK4297AERjyhHUd8YeDNXmykcm1LZpOYaaoDp/b9FCErC0/r Ss3A== X-Gm-Message-State: AOAM530ft1ZGx/tEVDKszPyS7kz9l2Bo4JCdE1KchEMWNrX6r+x7/zDY yFDP9pMhiGjFWhau9CyOLeiZLQ== X-Google-Smtp-Source: ABdhPJz9UBTRCNLv5q13a+UC8+jySNwiA5n/OC1n2KousY/xWSpRFiV/wbtBLYxSGjEmJlOeD2A5dQ== X-Received: by 2002:a05:600c:3542:: with SMTP id i2mr23107352wmq.124.1621968115511; Tue, 25 May 2021 11:41:55 -0700 (PDT) Received: from PackardBell (public-gprs171801.centertel.pl. [46.134.10.90]) by smtp.googlemail.com with ESMTPSA id g10sm17381448wrq.12.2021.05.25.11.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 11:41:54 -0700 (PDT) Received: from localhost (PackardBell [local]) by PackardBell (OpenSMTPD) with ESMTPA id d3d72a31; Tue, 25 May 2021 18:41:51 +0000 (UTC) Date: Tue, 25 May 2021 20:41:51 +0200 From: Bartosz Dudziak To: Stephan Gerhold Cc: Rob Herring , Andy Gross , Bjorn Andersson , Russell King , David Sterba , Jens Axboe , Lorenzo Pieralisi , Kumar Gala , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/2] arm: qcom: Add SMP support for Cortex-A7 Message-ID: <20210525184151.GA1543@PackardBell> References: <20210513153442.52941-1-bartosz.dudziak@snejp.pl> <20210513153442.52941-3-bartosz.dudziak@snejp.pl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210525_114201_939070_57DB9081 X-CRM114-Status: GOOD ( 32.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Tue, May 25, 2021 at 02:20:59PM +0200, Stephan Gerhold wrote: > Hi, > > On Thu, May 13, 2021 at 05:34:42PM +0200, Bartosz Dudziak wrote: > > Implement support for Cortex-A7 CPU release sequence. > > > > Signed-off-by: Bartosz Dudziak > > --- > > arch/arm/mach-qcom/platsmp.c | 72 ++++++++++++++++++++++++++++++++++++ > > 1 file changed, 72 insertions(+) > > > > diff --git a/arch/arm/mach-qcom/platsmp.c b/arch/arm/mach-qcom/platsmp.c > > index 630a038f45..10780bf14a 100644 > > --- a/arch/arm/mach-qcom/platsmp.c > > +++ b/arch/arm/mach-qcom/platsmp.c > > @@ -29,6 +29,7 @@ > > #define COREPOR_RST BIT(5) > > #define CORE_RST BIT(4) > > #define L2DT_SLP BIT(3) > > +#define CORE_MEM_CLAMP BIT(1) > > #define CLAMP BIT(0) > > > > #define APC_PWR_GATE_CTL 0x14 > > @@ -75,6 +76,63 @@ static int scss_release_secondary(unsigned int cpu) > > return 0; > > } > > > > +static int cortex_a7_release_secondary(unsigned int cpu) > > +{ > > + int ret = 0; > > + void __iomem *reg; > > + struct device_node *cpu_node, *acc_node; > > + u32 reg_val; > > + > > + cpu_node = of_get_cpu_node(cpu, NULL); > > + if (!cpu_node) > > + return -ENODEV; > > + > > + acc_node = of_parse_phandle(cpu_node, "qcom,acc", 0); > > + if (!acc_node) { > > + ret = -ENODEV; > > + goto out_acc; > > + } > > + > > + reg = of_iomap(acc_node, 0); > > + if (!reg) { > > + ret = -ENOMEM; > > + goto out_acc_map; > > + } > > + > > + /* Put the CPU into reset. */ > > + reg_val = CORE_RST | COREPOR_RST | CLAMP | CORE_MEM_CLAMP; > > + writel(reg_val, reg + APCS_CPU_PWR_CTL); > > + > > + /* Turn on the BHS, set the BHS_CNT to 16 XO clock cycles */ > > + writel(BHS_EN | (0x10 << BHS_CNT_SHIFT), reg + APC_PWR_GATE_CTL); > > + /* Wait for the BHS to settle */ > > + udelay(2); > > + > > + reg_val &= ~CORE_MEM_CLAMP; > > + writel(reg_val, reg + APCS_CPU_PWR_CTL); > > + > > + reg_val |= L2DT_SLP; > > + writel(reg_val, reg + APCS_CPU_PWR_CTL); > > + udelay(2); > > + > > + reg_val = (reg_val | BIT(17)) & ~CLAMP; > > + writel(reg_val, reg + APCS_CPU_PWR_CTL); > > + udelay(2); > > + > > + /* Release CPU out of reset and bring it to life. */ > > + reg_val &= ~(CORE_RST | COREPOR_RST); > > + writel(reg_val, reg + APCS_CPU_PWR_CTL); > > + reg_val |= CORE_PWRD_UP; > > + writel(reg_val, reg + APCS_CPU_PWR_CTL); > > + > > I think you forgot to add > > iounmap(reg); > > here :) > Thank you, i have missed it. > > +out_acc_map: > > + of_node_put(acc_node); > > +out_acc: > > + of_node_put(cpu_node); > > + > > + return ret; > > +} > > + > > static int kpssv1_release_secondary(unsigned int cpu) > > { > > int ret = 0; > > @@ -281,6 +339,11 @@ static int msm8660_boot_secondary(unsigned int cpu, struct task_struct *idle) > > return qcom_boot_secondary(cpu, scss_release_secondary); > > } > > > > +static int cortex_a7_boot_secondary(unsigned int cpu, struct task_struct *idle) > > +{ > > + return qcom_boot_secondary(cpu, cortex_a7_release_secondary); > > +} > > + > > static int kpssv1_boot_secondary(unsigned int cpu, struct task_struct *idle) > > { > > return qcom_boot_secondary(cpu, kpssv1_release_secondary); > > @@ -315,6 +378,15 @@ static const struct smp_operations smp_msm8660_ops __initconst = { > > }; > > CPU_METHOD_OF_DECLARE(qcom_smp, "qcom,gcc-msm8660", &smp_msm8660_ops); > > > > +static const struct smp_operations qcom_smp_cortex_a7_ops __initconst = { > > + .smp_prepare_cpus = qcom_smp_prepare_cpus, > > + .smp_boot_secondary = cortex_a7_boot_secondary, > > +#ifdef CONFIG_HOTPLUG_CPU > > + .cpu_die = qcom_cpu_die, > > +#endif > > +}; > > +CPU_METHOD_OF_DECLARE(qcom_smp_cortex_a7, "qcom,cpss-acc", &qcom_smp_cortex_a7_ops); > > + > > I'm a bit curious about the name "CPSS". Is that something you came up > with yourself similar to KPSS? There is a slight naming collision here > with the "Chip peripheral subsystem" (CPSS) on APQ8064E (Snapdragon 600), > see https://developer.qualcomm.com/download/sd600/snapdragon-600-device-spec.pdf > > Thanks, > Stephan Yes, the "CPSS" is something i came up with when i was looking at KPSS bindings. Sorry that i did not check for a naming collision. I will think about a better name and send a v2 patch on the weekend with iounmap() included. Thanks for the review, Bartosz _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel