Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1008919iob; Fri, 13 May 2022 19:27:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztgfR460VSYSaB+BthRXS0HiHhpPOyh/MQOdmiSbxjcBZSoPFZSyuBfNd/f5/8JZvWsGVR X-Received: by 2002:adf:f90d:0:b0:20c:de32:4d35 with SMTP id b13-20020adff90d000000b0020cde324d35mr5988526wrr.583.1652495251434; Fri, 13 May 2022 19:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652495251; cv=none; d=google.com; s=arc-20160816; b=eSIPGYCqoPIDoikcKzct32dtUG4wWfGwY+P0Al5ue6mHvJwp6Kc3JfK0Tzo/VQzlzn p2OZi0cE+KK9uPl8tTMb5HKnUGaZaMQLvv3mJFP8gg4AyPCyL89i7fBZ2MqKHqY0GVKR 7u+9lxVYQdYQ7dVd8jePntK5q+mHCuZpQBxwF7wiDwSITh1+bfdVaVnjiZ1m+I4a8JG3 5B8BmYIy0iXPPSV+XCdRl2MydINSer4UP8xm/sVSW7Gs8j2fCsPbPhUvAiVrdw/eGqeT H41vv2C1wDXnAG6COam3Rl/BnTuF+BOuOt8OFBzvp/e/B44HWjhq5RxYhQH+2FFTZab3 WCNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hmdwQx/sQRQVX+wTvpFFEkiU8w2sG0vwQ4gyM8YXZSE=; b=d6Twnjyisv0MRcTNadfjJKKLG9X5O4okIVl4Mj0HAmzBBFcj+gkeTXe1kUMkGq15DJ Ew+QM1vNV8ExsYumh4qFresGqyN+mbWuxij3YoCf7vn1zGqaCj4qvMJiL12SFDfnkVxj IIf2vnPl66FzWTjPDh9DSXW9+ymgmiof+jshIxhyFLC/xUdouNSLygJVjetuZkndfCCE j9kfxRqZpxGrumW7dqCAp8wfNoSuLPeQCCP/wSqQGdeDdg/x0VO9b9lIONmu7577xi7G WYuUUvMhVR8r6yjOHx3NT41wvCtvYrFMv7HQsUQLw8TCH4wWzCuScrnc3CH5doXvhaL4 9jWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c130-20020a1c3588000000b003944992aba2si3561772wma.156.2022.05.13.19.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 19:27:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6567030E222; Fri, 13 May 2022 17:42:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353896AbiELMm6 (ORCPT + 99 others); Thu, 12 May 2022 08:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348607AbiELMmx (ORCPT ); Thu, 12 May 2022 08:42:53 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6980166FA3; Thu, 12 May 2022 05:42:50 -0700 (PDT) Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1np89T-00025a-Rp; Thu, 12 May 2022 14:42:43 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Atish Patra , linux-riscv@lists.infradead.org Cc: "linux-kernel@vger.kernel.org List" , Albert Ou , Atish Patra , Damien Le Moal , DTML , Jisheng Zhang , Krzysztof Kozlowski , linux-riscv , Palmer Dabbelt , Paul Walmsley , Rob Herring , Anup Patel Subject: Re: [PATCH 1/2] RISC-V: Fix counter restart during overflow for RV32 Date: Thu, 12 May 2022 14:42:42 +0200 Message-ID: <23274575.ouqheUzb2q@diego> In-Reply-To: References: <20220511201107.2311757-1-atishp@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Donnerstag, 12. Mai 2022, 06:44:12 CEST schrieb Anup Patel: > On Thu, May 12, 2022 at 1:41 AM Atish Patra wrote: > > > > Pass the upper half of the initial value of the counter correctly > > for RV32. > > > > Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support") > > > > Signed-off-by: Atish Patra > > --- > > drivers/perf/riscv_pmu_sbi.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c > > index a1317a483512..24cea59612be 100644 > > --- a/drivers/perf/riscv_pmu_sbi.c > > +++ b/drivers/perf/riscv_pmu_sbi.c > > @@ -526,7 +526,7 @@ static inline void pmu_sbi_start_overflow_mask(struct riscv_pmu *pmu, > > max_period = riscv_pmu_ctr_get_width_mask(event); > > init_val = local64_read(&hwc->prev_count) & max_period; > > sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1, > > - flag, init_val, 0, 0); > > + flag, init_val, init_val >> 32, 0); > > This should be under "#if __riscv_xlen == 32". What's the difference between using CONFIG_32BIT and checking the __riscv_xlen flag value? CONFIG_32BIT seems to be a bit the more kernel'ish way to do this, but it looks like most SBI parts check the __riscv_xlen instead. In any case, looking at the opensbi-side of the call, this fix is abviously correct, so Reviewed-by: Heiko Stuebner