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=-20.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,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 D20E7C433FE for ; Thu, 3 Dec 2020 14:58:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 65045206EC for ; Thu, 3 Dec 2020 14:58:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 65045206EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1dkOUCrP7d4M2iltFSptCkw3bTZCoHXu6odbWm2eS7o=; b=0AGC+hhH6wYVmoNMvI2K2VuSc XNBgUajAqvjB4lkeihNxGGtAhkaFOWiylAzpP2T0+mWyDoHSdrkAY5TgeYdEPNh+3EJKUiyll5eI8 RY8bAbIz8d0q1jrmAosuhtJ/bCKiticdNqA7qDgwJpP+l/YbrjW3UOOwNzQQxq9rdspthd32qneBr 7n9dSehi2Be8M2vriATll+Xeqp8theDiZkE3Tf/EohUQbeqnQZ7QHZRtPpHPrj3U/H+cDKjd1Etug vJ7CYUIw997A5o0DNXyEUUi9YyiYAQN3cWkNXnlOexcyh4dAPIp7ZudSgqI72dtFTOyOqIT5+Qp80 C67J8I2XA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkq2y-0005lA-S1; Thu, 03 Dec 2020 14:57:28 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkq2w-0005kb-EU for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2020 14:57:27 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA2E4206D6; Thu, 3 Dec 2020 14:57:23 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kkq2r-00FhLT-G9; Thu, 03 Dec 2020 14:57:21 +0000 MIME-Version: 1.0 Date: Thu, 03 Dec 2020 14:57:21 +0000 From: Marc Zyngier To: Keqian Zhu Subject: Re: [PATCH v2 2/2] clocksource: arm_arch_timer: Correct fault programming of CNTKCTL_EL1.EVNTI In-Reply-To: <20200818032814.15968-3-zhukeqian1@huawei.com> References: <20200818032814.15968-1-zhukeqian1@huawei.com> <20200818032814.15968-3-zhukeqian1@huawei.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: zhukeqian1@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, steven.price@arm.com, drjones@redhat.com, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, wanghaibin.wang@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201203_095726_661135_326CE4B1 X-CRM114-Status: GOOD ( 20.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jones , kvm@vger.kernel.org, Suzuki K Poulose , Catalin Marinas , linux-kernel@vger.kernel.org, Steven Price , James Morse , wanghaibin.wang@huawei.com, Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-08-18 04:28, Keqian Zhu wrote: > ARM virtual counter supports event stream, it can only trigger an event > when the trigger bit (the value of CNTKCTL_EL1.EVNTI) of CNTVCT_EL0 > changes, > so the actual period of event stream is 2^(cntkctl_evnti + 1). For > example, > when the trigger bit is 0, then virtual counter trigger an event for > every > two cycles. > > Fixes: 037f637767a8 ("drivers: clocksource: add support for > ARM architected timer event stream") Fixes: tags should on a single line. > Suggested-by: Marc Zyngier > Signed-off-by: Keqian Zhu > --- > drivers/clocksource/arm_arch_timer.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/clocksource/arm_arch_timer.c > b/drivers/clocksource/arm_arch_timer.c > index 777d38c..e3b2ee0 100644 > --- a/drivers/clocksource/arm_arch_timer.c > +++ b/drivers/clocksource/arm_arch_timer.c > @@ -824,10 +824,14 @@ static void arch_timer_configure_evtstream(void) > { > int evt_stream_div, pos; > > - /* Find the closest power of two to the divisor */ > - evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ; > + /* > + * Find the closest power of two to the divisor. As the event > + * stream can at most be generated at half the frequency of the > + * counter, use half the frequency when computing the divider. > + */ > + evt_stream_div = arch_timer_rate / ARCH_TIMER_EVT_STREAM_FREQ / 2; > pos = fls(evt_stream_div); > - if (pos > 1 && !(evt_stream_div & (1 << (pos - 2)))) > + if ((pos == 1) || (pos > 1 && !(evt_stream_div & (1 << (pos - 2))))) > pos--; You don't explain why you are special-casing pos == 1. > /* enable event stream */ > arch_timer_evtstrm_enable(min(pos, 15)); Also, please Cc the subsystem maintainers: CLOCKSOURCE, CLOCKEVENT DRIVERS M: Daniel Lezcano M: Thomas Gleixner L: linux-kernel@vger.kernel.org S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core F: Documentation/devicetree/bindings/timer/ F: drivers/clocksource/ Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel