Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2926064rwb; Mon, 15 Aug 2022 14:11:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR6I8FOT9SeUJXyGrou7ra26oIXGsp0kfriytjpg90kywpEfB5ndrq3XFKFqvdVcpCRfIUpz X-Received: by 2002:a05:6402:358a:b0:43d:aa71:3033 with SMTP id y10-20020a056402358a00b0043daa713033mr16052173edc.248.1660597870472; Mon, 15 Aug 2022 14:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597870; cv=none; d=google.com; s=arc-20160816; b=Uecev2l5BDjYy1qhP6kjQa+2efX/LFZQOM7kwaSylQh9lNR2rF/fsbwUxhGbn1DSIn rPky5XcdiLMcjCVrSjk/CYFqErEYklQYBSnVwY+hq/t2QQiTOZxqVMjgdt9K+YNgKtSb DVb6noPv69XGrCjld7FLzljEuauDHXQoer3XpfDp8T25DzPeCDpES9dfPJNO68VMJOm7 w8ZYgrW0IhWFa1VvqkbJUd6WVPYq+2Ssrhn5vRxwO81HnVYFE6JfsV3uKyXfwAGxE24c yJv/RqQ0HzQgZqq1AlLrhDS2VVauO9Cg+DM03gKfXm3Ag6IuaoboJC4nsi9CbO+6x6S9 Igsg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wwk34lhDdN95YFkTgwVETUCc1qsaVRdrNoRq7n7aQYA=; b=D4/+GFmlC8AgHfTbCWWBaxaK6e+050FFcd0Qv3ZzUNUeOevCVO+qGbvmHA97H/4ftl M3l5TjM3K8JaRBd/dCCkGlNIakxSxeTY2RhpkMOI11HII08MH98xvDZsoMR0etf3Wx/Q OfIlbyKJsZhl+CiG3KBcwf32Iiuyw2lbKJj+nRReyRCkMSTrbqr7dFbHUrKLmMxBn8n+ W37VzNPz1s9Tf1invOG69yYVdRjPGW8ZVFnQPdgjuwOT/HsKTHtqnE7Z7kkX4vNtov4k 5b49Y40R0wD3erCa86nqDljdTuZM/o9KDDQ4HNXrB0ewFwi55MDK70cRJppG+p3bCzfB UAcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s1vBtTPN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a170906314a00b0072f6a9d159dsi8471139eje.173.2022.08.15.14.10.45; Mon, 15 Aug 2022 14:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s1vBtTPN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346194AbiHOUWf (ORCPT + 99 others); Mon, 15 Aug 2022 16:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347153AbiHOUNF (ORCPT ); Mon, 15 Aug 2022 16:13:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0E948C456; Mon, 15 Aug 2022 11:59:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86E1AB81106; Mon, 15 Aug 2022 18:59:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBF0BC433C1; Mon, 15 Aug 2022 18:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589944; bh=pLjjybbwiDt2+1ukD/u8ibPOrZ5Ksz4JOuFjMAdZSTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s1vBtTPNaiIL1xGE4SrK/TTCTmRMBX2cuvKO1R/FE8OBDlka1PHBr1Xxl64RbRve9 qEQS7W4gO41hXhMNauSda8ksc6CtserYHl7orslis9tYW+7pStpj0sPqLuZrWG1Nsn +JQUALjMp4pwHjQYqoxkHVylqZFaFyOdTaJTrHuY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atish Patra , Guo Ren , Palmer Dabbelt Subject: [PATCH 5.18 0069/1095] RISC-V: Fix counter restart during overflow for RV32 Date: Mon, 15 Aug 2022 19:51:08 +0200 Message-Id: <20220815180432.374524594@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Atish Patra commit acc1b919f47926b089be21b8aaa29ec91fef0aa2 upstream. 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 Reviewed-by: Guo Ren Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220711174632.4186047-2-atishp@rivosinc.com Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- drivers/perf/riscv_pmu_sbi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c index dca3537a8dcc..0cb694b794ae 100644 --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -525,8 +525,13 @@ static inline void pmu_sbi_start_overflow_mask(struct riscv_pmu *pmu, hwc = &event->hw; max_period = riscv_pmu_ctr_get_width_mask(event); init_val = local64_read(&hwc->prev_count) & max_period; +#if defined(CONFIG_32BIT) + sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1, + flag, init_val, init_val >> 32, 0); +#else sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1, flag, init_val, 0, 0); +#endif } ctr_ovf_mask = ctr_ovf_mask >> 1; idx++; -- 2.37.1