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 62EABC433F5 for ; Fri, 8 Apr 2022 08:07:54 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H3AUcZwAYQCJyeuFN1GcWBnS7cBO4iv+TMZm5Qu/tPQ=; b=srgHBw+G4iGvUd tloxIeezR8elCSc4spHFsOCnRumq4QfPIut+3Mw4Dabe6SXiSRxXPD2cAXd8KBNbrgzx4fKURcIEW F/HC3rBu4SlcQghpkjX3xG3uJYKLdQI4n/hM+GszOZcF4hJheXpd1wCCSBYGtfQu6c6xQh6oPr8sN p/Avn0nfM7d/d+47Mx4kaijLvbNaiL2lsLjzO1VoSQPITY44bVoJnhUgf0odRjtOsCoasL7BFpBZ1 iYfYE/RuLK3WbD8++uNQT3WuxL9rgxh+D972ztDUT7dRAdCsDNOfPz+waE2ZCD7q9kXIV3gpzPA9p ZtSgvMW2rQJgj4CIu9rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncjdO-00FiuA-5I; Fri, 08 Apr 2022 08:06:23 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncja1-00FhKS-Pr for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2022 08:02:55 +0000 Received: by mail-ej1-x630.google.com with SMTP id l7so10290392ejn.2 for ; Fri, 08 Apr 2022 01:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=R9Md63+7fr/H3jBSeDn6jW2GcrFtPS6wpqfkErlWzYs=; b=wXNxS+sXTeFjGclx/evzx327C3xVpMS4QBc7+yw9rYbeVDC6oSkDRn2RkOVSaDK1TG 8oUK0NAPDSS9UkzMn/f/WFIEszV7CK8uaO0JW/+RpG6BS1CbB8x9HdS0iRJanDEOGIp9 2TT8iErw0dgR2GNxrXRIM1iJPzExQIlNw4C5D3OGi11+813vRdDoUgQAMOv6P6KC3e/r MdwjRfX6NvAkIZbttaCDTBtxgD+zAN9AcqJRFUiindDTpv+99wYVETna4uuzl5aflirm QWep79zBfnF+J+YcL7EPP4o8guH7DcN6oJlpXVBbr2EhX8DXWyvxHSvam/gu5XdKE941 RVkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=R9Md63+7fr/H3jBSeDn6jW2GcrFtPS6wpqfkErlWzYs=; b=ri3yC2i1w08C6uK36RYAWA37Dvp9J7mdtG1xBVWcZUgolz80lab9fsaHU9x5cZyz6h kbCjqilSMwDzjbspzlUs0ZCBK557HOuR1LokPEDX8iEwHLGSRWfbCfCg0b8QiomEEbRH 1zPAcrTY5cPCA+fM0bK4GEbISyuLeVIje7EEDF5PErGXigSB8p1ngR2owUnMUCyLKb+v 6cn+QoNIBD9Wi+4dvS5+OI8YcFQb3e7SS4Duv7VW6WilnZzl7fSk4wXw7qIz1LMDIrRq yn3VPZJzhzStid3RxSAqVQ6/ktOcyuUm6LfLpKkFSxeqcdFdofFO8YOzgU90iVIsV6T0 EIng== X-Gm-Message-State: AOAM531JQ8GVyKXaB72HT0zTYYd8YdqUaUDOrTWJvKZMmgWSWxhBUZnS e1h0f/5HdV9uTZi5v2KCkrV1/w== X-Google-Smtp-Source: ABdhPJw2gfzBuf2XdCtgNaMTM0ghNsz5J1dYtRJ4Ror0ozVjlCbuufkcCCmi2st+vP5tn+jNhrRFWw== X-Received: by 2002:a17:907:1c0c:b0:6e0:9b15:29d5 with SMTP id nc12-20020a1709071c0c00b006e09b1529d5mr17347893ejc.416.1649404969626; Fri, 08 Apr 2022 01:02:49 -0700 (PDT) Received: from [192.168.0.187] (xdsl-188-155-201-27.adslplus.ch. [188.155.201.27]) by smtp.gmail.com with ESMTPSA id d7-20020a170906174700b006e80a7e3111sm3826217eje.17.2022.04.08.01.02.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Apr 2022 01:02:49 -0700 (PDT) Message-ID: Date: Fri, 8 Apr 2022 10:02:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v3 3/4] clocksource/drivers/exynos_mct: Support local-timers property Content-Language: en-US To: Vincent Whitchurch , tglx@linutronix.de, daniel.lezcano@linaro.org Cc: kernel@axis.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, alim.akhtar@samsung.com, devicetree@vger.kernel.org, robh+dt@kernel.org References: <20220407074432.424578-1-vincent.whitchurch@axis.com> <20220407074432.424578-4-vincent.whitchurch@axis.com> From: Krzysztof Kozlowski In-Reply-To: <20220407074432.424578-4-vincent.whitchurch@axis.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220408_010253_949921_A729FA14 X-CRM114-Status: GOOD ( 23.39 ) 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 07/04/2022 09:44, Vincent Whitchurch wrote: > If the device tree indicates that the hardware requires that the > processor only use certain local timers, respect that. > > Signed-off-by: Vincent Whitchurch > --- > > Notes: > v3: > - Use array in devicetree > - Remove addition of global variable > - Split out FRC sharing changes > > drivers/clocksource/exynos_mct.c | 51 ++++++++++++++++++++++++++++---- > 1 file changed, 45 insertions(+), 6 deletions(-) > > diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c > index 12023831dedf..4093a71ff618 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) > @@ -66,6 +66,8 @@ > #define MCT_L0_IRQ 4 > /* Max number of IRQ as per DT binding document */ > #define MCT_NR_IRQS 20 > +/* Max number of local timers */ > +#define MCT_NR_LOCAL (MCT_NR_IRQS - MCT_L0_IRQ) > > enum { > MCT_INT_SPI, > @@ -456,7 +458,6 @@ static int exynos4_mct_starting_cpu(unsigned int cpu) > per_cpu_ptr(&percpu_mct_tick, cpu); > struct clock_event_device *evt = &mevt->evt; > > - mevt->base = EXYNOS4_MCT_L_BASE(cpu); > snprintf(mevt->name, sizeof(mevt->name), "mct_tick%d", cpu); > > evt->name = mevt->name; > @@ -528,7 +529,9 @@ static int __init exynos4_timer_resources(struct device_node *np) > } > Document the arguments, especially focusing on the keys and the contents of local_idx. The code is getting to a state with 3 or 4 variables having similar meaning (IRQ number, local IRQ number, local IRQ index). > static int __init exynos4_timer_interrupts(struct device_node *np, > - unsigned int int_type) > + unsigned int int_type, > + u32 *local_idx, const u32 * > + size_t nr_local) > { > int nr_irqs, i, err, cpu; > > @@ -561,13 +564,19 @@ static int __init exynos4_timer_interrupts(struct device_node *np, > } else { > for_each_possible_cpu(cpu) { > int mct_irq; > + unsigned int irqidx; irq_idx > struct mct_clock_event_device *pcpu_mevt = > per_cpu_ptr(&percpu_mct_tick, cpu); > > + if (cpu >= nr_local) > + break; > + > + irqidx = MCT_L0_IRQ + local_idx[cpu]; > + > pcpu_mevt->evt.irq = -1; > - if (MCT_L0_IRQ + cpu >= ARRAY_SIZE(mct_irqs)) > + if (irqidx >= ARRAY_SIZE(mct_irqs)) > break; > - mct_irq = mct_irqs[MCT_L0_IRQ + cpu]; > + mct_irq = mct_irqs[irqidx]; > > irq_set_status_flags(mct_irq, IRQ_NOAUTOEN); > if (request_irq(mct_irq, > @@ -583,6 +592,15 @@ static int __init exynos4_timer_interrupts(struct device_node *np, > } > } > > + for_each_possible_cpu(cpu) { > + struct mct_clock_event_device *mevt = per_cpu_ptr(&percpu_mct_tick, cpu); > + > + if (cpu >= nr_local) It looks like an error condition, so this should not be handled silently because later base==0 will be used. Probably old code has similar problem... Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel