Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4050458ybi; Tue, 18 Jun 2019 10:53:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2Jv2cZMm6azOfmNtwWHOcNu2qDQ4SES2FEqtzrANEF/amFebA6yCRMFX3H0Pyb8qOXc9g X-Received: by 2002:a17:902:e10f:: with SMTP id cc15mr15749757plb.102.1560880425346; Tue, 18 Jun 2019 10:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560880425; cv=none; d=google.com; s=arc-20160816; b=pM35q/6HoABKfa+K2gNWMM+ksf00GYHCKXfGM3MVBEcLsuVT45SWR0mFLm2iztrejM PYIZwE3p/iRqUVZ2yVR5W/49peFTEV6lYYRTju/2lx13gHVSOnP/4vEhjrP4wRiSZ1nE 8S1rAYBnisHOMcMZ2qDmbyv8ZNegRFXZOFvEQzrcB7XZQ+W/GBBrDU2JSM0tUf0B4lUZ wJ0YRQZ7iVoiTy4d4Z7g5sfifIdSwcCx50scNy5rxYfkxw8N7UVTwk/3Qq4Hs6R/6sGa FYTSv7D5A2MhhdIlC/NW60ryHZYJncHTnkyELmy1aIiWfqxziWp+RQvd/ii0u8hI/Hsq fOhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ApieX7VXDwCOrZQ81Jbq9eZuL60Vh2ruYmDXsMnL8Ow=; b=DakIt1SQarsNeeNjqj0Gezl3t9SfgHf0v2PNFJWUgr9mg4mPrP008YsvP/oEK4y9QU GxkNF5DsNaHsbqf9FeV7OeLJN9/Evsk9qpYt2BichzTEEk5yof2Db7+LxBGz+zBRwNcu glpog1YGezvG316M1JxO2leqOTzP6H4SmABhbas6nBngyHq/FE8xqiVt5II4fQrPxBCe WsrYg9Z1WuStUq44wRbFSPL9XZb8j986r26ucst4lWhWuz9SE5siDbh8faGBCorW1KOP 0WTFL6Hq0izEXwg56LnFN83b+8crtNMdAm5I3Wc34bhX+5Fnr3slFJULMHLDAXI3Sgfw oZ1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=La1MNho7; 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=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si13153662plp.96.2019.06.18.10.53.30; Tue, 18 Jun 2019 10:53:45 -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=@nvidia.com header.s=n1 header.b=La1MNho7; 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=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730195AbfFRRwj (ORCPT + 99 others); Tue, 18 Jun 2019 13:52:39 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:8237 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729774AbfFRRwi (ORCPT ); Tue, 18 Jun 2019 13:52:38 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 18 Jun 2019 10:52:37 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 18 Jun 2019 10:52:37 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 18 Jun 2019 10:52:37 -0700 Received: from [10.21.132.143] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 18 Jun 2019 17:52:36 +0000 Subject: Re: [PATCH v3 8/8] clocksource/drivers/tegra: Set up maximum-ticks limit properly To: Dmitry Osipenko , Daniel Lezcano , Thierry Reding , "Peter De Schrijver" CC: , References: <20190618140358.13148-1-digetx@gmail.com> <20190618140358.13148-9-digetx@gmail.com> From: Jon Hunter Message-ID: Date: Tue, 18 Jun 2019 18:52:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190618140358.13148-9-digetx@gmail.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1560880357; bh=ApieX7VXDwCOrZQ81Jbq9eZuL60Vh2ruYmDXsMnL8Ow=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=La1MNho78M+DAYF1CayGQe/pOXM6zLTzsxz5k6HYOt+MwUY6PpzbOFJpdCW/bBDNA fCSJVuVTBSILd4XSuOpydWJK+SbVm8YLfT1ijWoo7YJ3t4SgajQzfoVufLQ/Xrzxex xmPlieBfF+VltCnHmuBqK8B92MLsxng5sarU6dxXl8hoaT4TP6h8WsUy8XcxrMbv6R WWGxgaQOst6c6gbZeyBnKo8pwugPAGTI9x8pvP0mkBn2yOfcwJjLCyrUu1q1RVZ3It 6d5FvA+TzIoO5U7I0+8X0y5fiE0RudOhhA5ws19/2z+4f9/Tb8sCrJjPGRz+W97T5J oqCgiCKJIGsJg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/06/2019 15:03, Dmitry Osipenko wrote: > Tegra's timer has 29 bits for the counter and for the "load" register > which sets counter to a load-value. The counter's value is lower than > the actual value by 1 because it starts to decrement after one tick, > hence the maximum number of ticks that hardware can handle equals to > 29 bits + 1. > > Signed-off-by: Dmitry Osipenko > --- > drivers/clocksource/timer-tegra.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/clocksource/timer-tegra.c b/drivers/clocksource/timer-tegra.c > index b84324288749..355b29ff6362 100644 > --- a/drivers/clocksource/timer-tegra.c > +++ b/drivers/clocksource/timer-tegra.c > @@ -137,9 +137,17 @@ static int tegra_timer_setup(unsigned int cpu) > irq_force_affinity(to->clkevt.irq, cpumask_of(cpu)); > enable_irq(to->clkevt.irq); > > + /* > + * Tegra's timer uses n+1 scheme for the counter, i.e. timer will > + * fire after one tick if 0 is loaded and thus minimum number of > + * ticks is 1. In result both of the clocksource's tick limits are > + * higher than a minimum and maximum that hardware register can > + * take by 1, this is then taken into account by set_next_event > + * callback. > + */ > clockevents_config_and_register(&to->clkevt, timer_of_rate(to), > 1, /* min */ > - 0x1fffffff); /* 29 bits */ > + 0x1fffffff + 1); /* max 29 bits + 1 */ > > return 0; > } > Acked-by: Jon Hunter Cheers Jon -- nvpublic