From patchwork Tue Feb 6 10:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 13546991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05E5BC4829A for ; Tue, 6 Feb 2024 10:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Wo/tm46OzsZ41lD0mK+R5yngvCNK51Qk5gCJfX763rQ=; b=m/HmqMZ3rmOMZ2 bE5VqtZPcCQdfYFrY3ZefF0jtB9Izp+obT7RLj/gGuhBbQLQ52bt76YznWci514n5JhBA4pYd8inl RtRMAmY/YxP9sJNy9bnI042pdi0Jlx8NP7rKs9lENbAraiXb197X5Zyoa9+dmdv6vpNOBpfOtBFin HQL1Hv9F+FLugpWsDDAQ+yndgPZD07kWbQOHt7KJHGmRAzggCB6K1FEJ8Hq4eQbyfLTp+flSPk4SY pURMmk7oCxR1eBiI/ZYkZatj9PIRLQf+x1VukkNEc/84zZdYCor3O4Df1JKs54M1Am6lqbPS3FU/i sUXE4tFTv8ap2qBx38xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXIgs-0000000725l-3dLX; Tue, 06 Feb 2024 10:28:34 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXIgq-0000000724a-3yUm for linux-arm-kernel@bombadil.infradead.org; Tue, 06 Feb 2024 10:28:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ToCLExYaPNBfASSAUKKCU9To1IBS6L3nzYrCsi6iddU=; b=bok4pCiypVbTqIGoaXDQJvmSue mpRIXigch6rJ0gviLWQ0EYTkkiOrAbY9N1HyR3dbKxcTm+Rgbh0L7LkSSGu++1FCf3P/DNoePD9rB kD9dOgOqXBUh2f6RmtAo/q2W6NICB7y/WZcw8cnJtf9TtQUzU/z2hDFNRQ3XLzv/vF8a88cNyxYMn xWHc7WdRF8HI/37evpQyFfop56RD8Qyvk2lSTRBAEQj5OIo1iS6gXepO0BuzSmEv4kAQycROxnWyV hB3O4xO13JZlDLWZ7wJWeOd4o9EHlaOkjEMnAQZbfoDOizydyCWxgjys+7NWEzkQ4D/m74w0faySd vDeRatWw==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXIgZ-0000000CUNO-2bF7 for linux-arm-kernel@lists.infradead.org; Tue, 06 Feb 2024 10:28:26 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C453E139F; Tue, 6 Feb 2024 02:28:54 -0800 (PST) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 15F963F641; Tue, 6 Feb 2024 02:28:10 -0800 (PST) From: Robin Murphy To: will@kernel.org Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, suzuki.poulose@arm.com, ilkka@os.amperecomputing.com, bwicaksono@nvidia.com, YWan@nvidia.com, rwiley@nvidia.com Subject: [PATCH v3 3/5] perf/arm_cspmu: Simplify counter reset Date: Tue, 6 Feb 2024 10:27:56 +0000 Message-Id: <3105815327989f6bb7bb068994d0eb4096b4ef64.1706718007.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.39.2.101.g768bb238c484.dirty In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240206_102823_404551_EFDEF0A4 X-CRM114-Status: GOOD ( 10.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org arm_cspmu_reset_counters() inherently also stops them since it is writing 0 to PMCR.E, so there should be no need to do that twice. Also tidy up the reset routine itself for consistency with the start and stop routines, and to be clear at first glance that it is simply writing a constant value. Reviewed-by: Ilkka Koskinen Signed-off-by: Robin Murphy --- drivers/perf/arm_cspmu/arm_cspmu.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index b888473ec71f..b54dc7fd6ca5 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -525,11 +525,7 @@ static int arm_cspmu_alloc_attr_groups(struct arm_cspmu *cspmu) static inline void arm_cspmu_reset_counters(struct arm_cspmu *cspmu) { - u32 pmcr = 0; - - pmcr |= PMCR_P; - pmcr |= PMCR_C; - writel(pmcr, cspmu->base0 + PMCR); + writel(PMCR_C | PMCR_P, cspmu->base0 + PMCR); } static inline void arm_cspmu_start_counters(struct arm_cspmu *cspmu) @@ -1187,7 +1183,6 @@ static int arm_cspmu_register_pmu(struct arm_cspmu *cspmu) }; /* Hardware counter init */ - arm_cspmu_stop_counters(cspmu); arm_cspmu_reset_counters(cspmu); ret = perf_pmu_register(&cspmu->pmu, cspmu->name, -1);