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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8936FC433FE for ; Mon, 7 Mar 2022 09:33:55 +0000 (UTC) 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=2GwnK9CmJfK5HV+LGpdn5Y6mUpC5tkkUi5YZVDcqboI=; b=RiYBcXrxqtxlEI f7/lNKFNXmlUx3Zmg4+JAZn9PL6kvcQvTXnzX1S/z/fRofRO6v8d+aQxwnzJzDUCr4UIFw8ni8Uzk EwSKWTXgpBL2AxbpqSy59J/UH88GjnKzL+I2oqG0GHDFYoSl5GgdzgBD//Akl2GreraOf3/cP++Gq 1b2z/ymv82fHc/nb15qMzEG2scmTsmUTLCG4lKEdTERMPRAKMxPP3It31YkfU6NSs6OqJJw8LWlUj /Jd7wHGTh665lXFW0fZ71zu7l1XOklFuYCxOfn4H0PsaVaEU2CCznZEXLbjpRMjU8MyT7thFXu4Ig bEpXDsSiRgAkXdpmzsfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nR9iv-00Gms5-WA; Mon, 07 Mar 2022 09:32:14 +0000 Received: from smtp1.axis.com ([195.60.68.17]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nR9be-00GjZh-JT for linux-arm-kernel@lists.infradead.org; Mon, 07 Mar 2022 09:24:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1646645082; x=1678181082; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=4CmVi/4Nf+c+fLXTqFUvrIaFiJk/ULe4N6+IxCPq3IQ=; b=Gt0ZkIjoorxdOfgGSzxnsnTYg240l65dXRg9vOu3WXicINeQqF2RnQ0a 7cCBmwcbIH4p71Z+fioNsj749nWluo2iDpgdbYaoM+iOgo/PBwrj6Si4h sBmw6mIfoO9xXvzaOd29jiix37rlKUWJDe5NR9hEZEU+PPMpPie1qaXdK QL+hGMqQsDYqbto719hY352flEygD7OsGFwk0koJhnmMIZqYGJiSZXPLo xqR53A5+9fNpdGXBAFOAMNAd4eYUploU1PwRL41d4cwDscUvzHmtsiss1 qzpPaA35cFh2cCpbj9DHvAGyxs+tAOuz6vweixSniXSYQvNVMU7CLhEFF A==; Date: Mon, 7 Mar 2022 10:24:37 +0100 From: Vincent Whitchurch To: Krzysztof Kozlowski CC: Daniel Lezcano , Thomas Gleixner , kernel , Alim Akhtar , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-samsung-soc@vger.kernel.org" Subject: Re: [PATCH] clocksource/drivers/exynos_mct: Support using only local timer Message-ID: <20220307092437.GA32457@axis.com> References: <20220307083255.1577365-1-vincent.whitchurch@axis.com> <08992f48-6cb6-8dc0-33d2-f18f942d2bee@canonical.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <08992f48-6cb6-8dc0-33d2-f18f942d2bee@canonical.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220307_012443_018425_F67BD9FC X-CRM114-Status: GOOD ( 45.19 ) 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 On Mon, Mar 07, 2022 at 10:06:26AM +0100, Krzysztof Kozlowski wrote: > On 07/03/2022 09:32, Vincent Whitchurch wrote: > > The ARTPEC-8 SoC has a quad-core Cortex-A53 and a single-core Cortex-A5 > > which share one MCT with one global and eight local timers. > > > > The Cortex-A53 boots first and starts the global FRC and also registers > > a clock events device using the global timer. (This global timer clock > > events is usually replaced by arch timer clock events for each of the > > cores.) > > > > When the A5 boots, we should not use the global timer interrupts or > > write to the global timer registers. This is because even if there are > > four global comparators, the control bits for all four are in the same > > registers, and we would need to synchronize between the cpus. Instead, > > the global timer FRC (already started by the A53) should be used as the > > clock source, and one of the local timers which are not used by the A53 > > can be used for clock events on the A5. > > > > To support this, add a module param to set the local timer starting > > index. If this parameter is non-zero, the global timer clock events > > device is not registered and we don't write to the global FRC if it is > > already started. > > > > Signed-off-by: Vincent Whitchurch > > --- > > drivers/clocksource/exynos_mct.c | 29 ++++++++++++++++++++++++----- > > 1 file changed, 24 insertions(+), 5 deletions(-) > > This should not be send separately from the previous patch. OK, I will put it in a series. > > > > > diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c > > index f29c812b70c9..7ea2919b1808 100644 > > --- a/drivers/clocksource/exynos_mct.c > > +++ b/drivers/clocksource/exynos_mct.c > > @@ -33,7 +33,7 @@ > > #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248) > > #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C) > > #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300) > > -#define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x)) > > +#define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * (x))) > > #define EXYNOS4_MCT_L_MASK (0xffffff00) > > > > #define MCT_L_TCNTB_OFFSET (0x00) > > @@ -77,6 +77,13 @@ static unsigned long clk_rate; > > static unsigned int mct_int_type; > > static int mct_irqs[MCT_NR_IRQS]; > > > > +/* > > + * First local timer index to use. If non-zero, global > > + * timer is not written to. > > + */ > > +static unsigned int mct_local_idx; > > +module_param_named(local_idx, mct_local_idx, int, 0); > > No, it's a no go. Please use dedicated compatible if you need specific > quirks. I could add a compatible, but please note that the hardware itself does not have any quirks, it's only the usage of the hardware from one of the Linux kernels (see the explanation below) which is different. Is it correct to use a compatible to distinguish between these kind of software-determined usage differences? > > > + > > struct mct_clock_event_device { > > struct clock_event_device evt; > > unsigned long base; > > @@ -157,6 +164,17 @@ static void exynos4_mct_frc_start(void) > > u32 reg; > > > > reg = readl_relaxed(reg_base + EXYNOS4_MCT_G_TCON); > > + > > + /* > > + * If the FRC is already running, we don't need to start it again. We > > + * could probably just do this on all systems, but, to avoid any risk > > + * for regressions, we only do it on systems where it's absolutely > > + * necessary (i.e., on systems where writes to the global registers > > + * need to be avoided). > > + */ > > + if (mct_local_idx && (reg & MCT_G_TCON_START)) > > + return; > > I don't get it. exynos4_mct_frc_start() is called exactly only once in > the system - during init. Not once per every CPU or cluster (I > understood you have two clusters, right?). Not quite. The Cortex-A53 and the Cortex-A5 do not have cache-coherency between them, so they are not run in an SMP configuration. From the Cortex-A53's perspective, the Cortex-A5 looks like any other hardware block. The Cortex-A5 could just as well have run some other operating system, but I run Linux on it. So there are two separate, independent Linux kernels running on the SoC. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel