Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp693797rdg; Thu, 12 Oct 2023 19:44:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFbldd+rAlpv9Fjdi8BwYAjrtUY0PNj+LQ9CtWohtczJ2kGF71UqOX4kTBbmZhTZA/DXPA X-Received: by 2002:a17:90b:3505:b0:278:faf8:af9f with SMTP id ls5-20020a17090b350500b00278faf8af9fmr23941098pjb.20.1697165081796; Thu, 12 Oct 2023 19:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697165081; cv=none; d=google.com; s=arc-20160816; b=gvL2Eaxc7DgCp7f5hhSNIVg+OHKeH6kMqVty7ieEe4OGMCfhe1+hWC5M9k/K4PmbUa 9pcoxPSw/iNEu1jeJ7ATRdyX+FOUq6PvbRL/C5YmPUKMPKSa/Sq4XSY2mAIIb55pg7zr YBQbmWywSDx8wiiVxrdgjT/NJ3FXILxHRphcNX+klfqe0nHYtAToK3Ii0vBij1rOJAGp hv8ZmMaOJOTynccWEidhsYqtHWgSa2iv1NhrPFd1vMzBUYiqoIxs1B0WtXBaji+87ZOQ eR5mAENVmuQjWize5v6TDl1k1WWI8ymyCPKIKCW4U7DqTNhGD5dCYQDjTxREJrhd3fX8 wyIA== 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 :message-id:date:subject:cc:to:from; bh=yUbzzaaO9mvfORd1wUKJpJfQMuVr83NXXkYWjlv9C0g=; fh=kwnwj0X+S4TllrEg5iHhBG/UhsfkVLGkh5vCN1af17g=; b=QsqH+7E2h1rz6RMr1bP6hQtv9VMcyQXwC9f2prPadvLse0sx0ILWdo7927WtcsPP8u CICxAgdwJfF02flVGWiynve7i+GmfxhKPV19b0AxuL2AkyipUFDSmePlacC5W+ZeIsY6 0hBvnU76O0tiwikVN20um9GS1UprrxxXr8aRhjp7r66ZS9C8TW8ffFyKDq7z12EjnP5/ sZm0RYH0Bjkq5WLhCaPNBmDrVOEHSorEQB0S0ZKQAnEi9oPSB3fcx6c4cnW3BytjaKAu sCYjwImEOHwi7JfF1A8MOUTSQFnBaXfwSlqefm/oOy0cVvji0/l2ebMiUnAOKrNOEdEn Nilw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x4-20020a170902ea8400b001c36018fdaasi3466727plb.219.2023.10.12.19.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 19:44:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6BE42829F651; Thu, 12 Oct 2023 19:44:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229469AbjJMCo1 (ORCPT + 99 others); Thu, 12 Oct 2023 22:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjJMCo1 (ORCPT ); Thu, 12 Oct 2023 22:44:27 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 18E8083 for ; Thu, 12 Oct 2023 19:44:25 -0700 (PDT) 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 267A611FB; Thu, 12 Oct 2023 19:45:05 -0700 (PDT) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.41.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 52BE93F7A6; Thu, 12 Oct 2023 19:44:22 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: Anshuman Khandual , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org, James Clark Subject: [PATCH V2] drivers: perf: arm_pmuv3: Read PMMIR_EL1 unconditionally Date: Fri, 13 Oct 2023 08:13:54 +0530 Message-Id: <20231013024354.1289070-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 12 Oct 2023 19:44:39 -0700 (PDT) Currently the PMUv3 driver only reads PMMIR_EL1 if the PMU implements FEAT_PMUv3p4 and the STALL_SLOT event, but the check for STALL_SLOT event isn't necessary and can be removed. The check for STALL_SLOT event was introduced with the read of PMMIR_EL1 in commit f5be3a61fdb5dd11 ("arm64: perf: Add support caps under sysfs") When this logic was written, the ARM ARM said: | If STALL_SLOT is not implemented, it is IMPLEMENTATION DEFINED whether | the PMMIR System registers are implemented. ... and thus the driver had to check for STALL_SLOT event to verify that PMMIR_EL1 was implemented and accesses to PMMIR_EL1 would not be UNDEFINED. Subsequently, the architecture was retrospectively tightened to require that any FEAT_PMUv3p4 implementation implements PMMIR_EL1. Since the G.b release of the ARM ARM, the wording regarding STALL_SLOT event has been removed, and the description of PMMIR_EL1 says: | This register is present only when FEAT_PMUv3p4 is implemented. Drop the unnecessary check for STALL_SLOT event when reading PMMIR_EL1. Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: James Clark Signed-off-by: Anshuman Khandual --- This applies on v6.6-rc5 Changes in V2: - Updated commit message to include previous context about STALL_SLOT check Changes in V1: https://lore.kernel.org/all/20231009075631.193208-1-anshuman.khandual@arm.com/ drivers/perf/arm_pmuv3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index 144593092727..92fefc1bc7f6 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -1126,7 +1126,7 @@ static void __armv8pmu_probe_pmu(void *info) pmceid, ARMV8_PMUV3_MAX_COMMON_EVENTS); /* store PMMIR register for sysfs */ - if (is_pmuv3p4(pmuver) && (pmceid_raw[1] & BIT(31))) + if (is_pmuv3p4(pmuver)) cpu_pmu->reg_pmmir = read_pmmir(); else cpu_pmu->reg_pmmir = 0; -- 2.25.1