Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2277723pxa; Mon, 17 Aug 2020 05:57:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIgADKEHdsGEPX4gNZboOhVhzHXEXzGbDyjZG5iAY09jaFwhyISlvL3wul9pha/p02Ggmf X-Received: by 2002:aa7:c606:: with SMTP id h6mr15153163edq.288.1597669076156; Mon, 17 Aug 2020 05:57:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597669076; cv=none; d=google.com; s=arc-20160816; b=ixCAq6YVmstI5FtSM4Z3dVr3Yuj1WH2jVoy1Ok0xppAljHuupbeQiJp0SCeqm42s+M 8XhryS7w/D9+6CrE7AtZ2mALa9n3485nUyXldf+R/la7t/NV/1xOwmdZiEUbd8h9Edjk K1gAyEb8Ai5K0P85msTgxwg3uQSzYddyeNVghMn87oy9XlEqMEU4hTZ10nSxRnQAdbuS 4ZhLZHpBpWzF/tc8032McvG6gxe9rmXB/bcJyNhib/NImoj8XjLNN+sGq4vrOCiuGxUE qXe+5sulvAx1O5+BPiCuP31MCofMnQYF7c8tyM8VgVglINlrnEjrQsFgJyYZ2cqeRDoF zYHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=7DgDPz99fB0aEPWO4VuX9/D1mdi7YXCIAdRb8Id+4Ys=; b=gPwWlMu1RKER1YYMMfBzBa1QrB5q+6b8s+oGrrnnJNZ3axZb+GMgtF7ACANOQlYvQV CWVK658dkQI5v3pV5fBqw52i2TP88pNxu7R5gR8fxCicrBJJEtJVesG+sFzF8NRZ5rzV EGLfTUIA0tLMqfbI2092AjE9/Jpx2xqrPnFYYkMjav5J3ceCEFnDB42LBd7pgQYvyVxQ VMUAmsTO8GLoLqGeHRSK0aQILUnloj6NFbDaEPZeaDuDRMDPegIG3oQ5rjFmYUZ2AhlQ UlEmPf9JRN4eZ+5K/E46fZSPKjOgzrKOeqgtzsRZAn6X5Sa06u+qLOXHluhkv04En5YC qoLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q5my1Mwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si10930148ejx.479.2020.08.17.05.57.33; Mon, 17 Aug 2020 05:57:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q5my1Mwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728498AbgHQM4v (ORCPT + 99 others); Mon, 17 Aug 2020 08:56:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:47972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbgHQM4u (ORCPT ); Mon, 17 Aug 2020 08:56:50 -0400 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 ADC552072E; Mon, 17 Aug 2020 12:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597669009; bh=ERpMAdayk233Labrw+Lu7muZTEwuPknh19NdvGNHSMI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=q5my1Mwo8/rP50v751943fs0FGAFtFae1A+Dz+biD7l+GcRGAiMRNkn8qGgI7zspP cEpukEBSMsw3z7ejoG8++F6AGY8JyrdeuevwPlIHFlvr6yP17ft7SPLeS6htKMEAqd XXVaERjnM8M8XvIYIw2P3xjXzpyt9obh8PR2A21U= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k7egy-003ZLe-9G; Mon, 17 Aug 2020 13:56:48 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 17 Aug 2020 13:56:48 +0100 From: Marc Zyngier To: Keqian Zhu Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Steven Price , Andrew Jones , Catalin Marinas , Will Deacon , James Morse , Suzuki K Poulose , wanghaibin.wang@huawei.com Subject: Re: [PATCH 2/2] clocksource: arm_arch_timer: Correct fault programming of CNTKCTL_EL1.EVNTI In-Reply-To: <20200817122415.6568-3-zhukeqian1@huawei.com> References: <20200817122415.6568-1-zhukeqian1@huawei.com> <20200817122415.6568-3-zhukeqian1@huawei.com> User-Agent: Roundcube Webmail/1.4.7 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-08-17 13:24, 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. > > Signed-off-by: Marc Zyngier I have never given you this tag, you are making it up. Please read Documentation/process/submitting-patches.rst to understand what tag you can put by yourself. At best, put "Suggested-by" tag, as this is different from what I posted anyway. Thanks, M. > 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 6e11c60..4140a37 100644 > --- a/drivers/clocksource/arm_arch_timer.c > +++ b/drivers/clocksource/arm_arch_timer.c > @@ -794,10 +794,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--; > /* enable event stream */ > arch_timer_evtstrm_enable(min(pos, 15)); -- Jazz is not dead. It just smells funny...