get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2230589/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2230589,
    "url": "http://patchwork.ozlabs.org/api/patches/2230589/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20260429215614.1793131-1-bwicaksono@nvidia.com/",
    "project": {
        "id": 21,
        "url": "http://patchwork.ozlabs.org/api/projects/21/?format=api",
        "name": "Linux Tegra Development",
        "link_name": "linux-tegra",
        "list_id": "linux-tegra.vger.kernel.org",
        "list_email": "linux-tegra@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260429215614.1793131-1-bwicaksono@nvidia.com>",
    "list_archive_url": null,
    "date": "2026-04-29T21:56:14",
    "name": "[v3] perf/arm_pmu: Skip PMCCNTR_EL0 on NVIDIA Olympus",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "40c466372b3182838dad58099f754b7078486f40",
    "submitter": {
        "id": 83903,
        "url": "http://patchwork.ozlabs.org/api/people/83903/?format=api",
        "name": "Besar Wicaksono",
        "email": "bwicaksono@nvidia.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20260429215614.1793131-1-bwicaksono@nvidia.com/mbox/",
    "series": [
        {
            "id": 502158,
            "url": "http://patchwork.ozlabs.org/api/series/502158/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/list/?series=502158",
            "date": "2026-04-29T21:56:14",
            "name": "[v3] perf/arm_pmu: Skip PMCCNTR_EL0 on NVIDIA Olympus",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/502158/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2230589/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2230589/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-tegra+bounces-14064-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-tegra@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256\n header.s=selector2 header.b=DMYNw2S7;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-tegra+bounces-14064-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com\n header.b=\"DMYNw2S7\"",
            "smtp.subspace.kernel.org;\n arc=fail smtp.client-ip=52.101.52.8",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=nvidia.com",
            "smtp.subspace.kernel.org;\n spf=fail smtp.mailfrom=nvidia.com"
        ],
        "Received": [
            "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5WNk5392z1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 07:56:54 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id D86BC301DAEC\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 21:56:52 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 9F07C38947F;\n\tWed, 29 Apr 2026 21:56:52 +0000 (UTC)",
            "from BL2PR02CU003.outbound.protection.outlook.com\n (mail-eastusazon11011008.outbound.protection.outlook.com [52.101.52.8])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D435030EF82;\n\tWed, 29 Apr 2026 21:56:50 +0000 (UTC)",
            "from MN0P222CA0023.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:531::27)\n by SN7PR12MB8002.namprd12.prod.outlook.com (2603:10b6:806:34b::10) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9870.18; Wed, 29 Apr\n 2026 21:56:43 +0000",
            "from BN3PEPF0000B06B.namprd21.prod.outlook.com\n (2603:10b6:208:531:cafe::25) by MN0P222CA0023.outlook.office365.com\n (2603:10b6:208:531::27) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9846.30 via Frontend Transport; Wed,\n 29 Apr 2026 21:56:42 +0000",
            "from mail.nvidia.com (216.228.117.160) by\n BN3PEPF0000B06B.mail.protection.outlook.com (10.167.243.70) with Microsoft\n SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.9891.0 via Frontend Transport; Wed, 29 Apr 2026 21:56:42 +0000",
            "from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com\n (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Wed, 29 Apr\n 2026 14:56:24 -0700",
            "from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail201.nvidia.com\n (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Wed, 29 Apr\n 2026 14:56:24 -0700",
            "from build-bwicaksono-noble-20251018.internal (10.127.8.11) by\n mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.2562.20 via\n Frontend Transport; Wed, 29 Apr 2026 14:56:23 -0700"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777499812; cv=fail;\n b=Mbg85f29NboGY5jRhGZeIJT76B+RMCk3mX7D/VM28IME4VdP4BXB90+lx5JdpneVs/v3DWIvgCi11Z1wQBcf5uam7MfB3x7mTFAqcjOwwr9xl4ThvoQYVrgT41I249fuUWHuHtzPgKr/n0bwuar/6vmJaTfs7+5AFzrbGrpgl1U=",
            "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=rmSjDkYISVR21z/N50GMgX519JFZFaVJl6rrLFpzSBpw+aAZpVhK2if7ng3FA3SBO/I55v/K7rxvdxJJ+Wni6bFjct4ecBIGnCZfwANg5rFONzk8oACLQQNuX9NeclmOxXxNTsLRvYABj+QVlmCFOpCyGItJZtsKAIgUKnC/KqtTkRTXDSuGKV+mPTcjgn0LDbwYJN6IfZvgSO0oyFYyS7ZMJTejQeqRpRCbtC8c4o5MJiB1iNSJwL+ZHCsIV6964+Ijpqj5UaAK5H+i5VJwuKQOZf1vkotz+LrakA7MRdNPXFrtlxj22M3ny0mOgwai5TuqJjOyO0+TAhHMeZ42Vg=="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777499812; c=relaxed/simple;\n\tbh=BVmXyScYwTBH328Zqf1uraLtkC2sOs6su9O2aFiDClk=;\n\th=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type;\n b=IfU6sniMv2X//PsMd5AnaEjL8esuV81JRPZ6k0I/JtO2AKemMMHxHPmOkcg5bor8xaeBLyq3HxUb/scUOZfRQJqhg/+pey2IkFuz1bcKFUFzeNkLVptSoYBBc/9tBo8SSYU0cjRBZiw27+UKE8igkGS5XIczKc9Lhyf5cR3GODo=",
            "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=rIt5F7TntgBDb/Bs4D9Ij7OPaAtFtXqF/sqzcpUCNyk=;\n b=J7hKpKJqJcMzHZsOxwxoxZIQRtKAsUaFRFF/YpqDbJa6u1M10PSYGm5QHDRd9kVIQfuMNYEC+uaEB3EfqYAwyq3ShW63vviqpjvr2IHctaUL+rrD8ezRRR1y87Pi7KSS9Oe1vzkfjkz2h/vB2iTyN/qQI7ajSXPT46QwVSbaKGRU+evL9MiubSMRjNVZWNnjjjSf6oTgN6pLU4wxP/+njd/lulWy1RCBlBXOxfRGxlmh0X9Rd0rYm/Rm1TFzPNDSXszUT85aYzLCkZM8wt6z2CI0Ae6aDqFQ//Ozn/VQvKp9sS0Y4Z7zPfVcjwEQT3vBHp9HtNBBVGehijbuf09tEQ=="
        ],
        "ARC-Authentication-Results": [
            "i=2; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=nvidia.com;\n spf=fail smtp.mailfrom=nvidia.com;\n dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com\n header.b=DMYNw2S7; arc=fail smtp.client-ip=52.101.52.8",
            "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.117.160) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com;\n dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;\n dkim=none (message not signed); arc=none (0)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=rIt5F7TntgBDb/Bs4D9Ij7OPaAtFtXqF/sqzcpUCNyk=;\n b=DMYNw2S7/sVo7fKoIqt32OGMG/Hj60asR02xttm4HEG7pZ97k4V2anTlNG7a4TMJiirnlc2TCD/52R6KNizATuf3owKziFDLSQkI570KEAX8GLojmJTM793zvrkBy4S72u/oENr13j0sTHlOneGtDFNuEtwwh54wjVtw0WmzIf2dVshSslVSUj6oCEKiPCauNNtE2zg9cGWtWRBDiL0I1Jdb85gc9M0/P9SVRd6RWFaoqT4PWkaWGMchfA6el2gxBawc1pekW1JYyMCdv8B3mCCv/cKU6bEgKh0mKDb6zYYXY1IF8Cnbxl0mmWxEhiVdJGbl2x+xHYjssB9uPRN6fQ==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.117.160)\n smtp.mailfrom=nvidia.com; dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=nvidia.com;",
        "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 216.228.117.160 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C",
        "From": "Besar Wicaksono <bwicaksono@nvidia.com>",
        "To": "<will@kernel.org>, <mark.rutland@arm.com>, <james.clark@linaro.org>,\n\t<yangyccccc@gmail.com>",
        "CC": "<linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>,\n\t<linux-tegra@vger.kernel.org>, <treding@nvidia.com>, <jonathanh@nvidia.com>,\n\t<vsethi@nvidia.com>, <rwiley@nvidia.com>, <sdonthineni@nvidia.com>,\n\t<mochs@nvidia.com>, <nirmoyd@nvidia.com>, <skelley@nvidia.com>, \"Besar\n Wicaksono\" <bwicaksono@nvidia.com>",
        "Subject": "[PATCH v3] perf/arm_pmu: Skip PMCCNTR_EL0 on NVIDIA Olympus",
        "Date": "Wed, 29 Apr 2026 21:56:14 +0000",
        "Message-ID": "<20260429215614.1793131-1-bwicaksono@nvidia.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-tegra@vger.kernel.org",
        "List-Id": "<linux-tegra.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-tegra+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-tegra+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-NV-OnPremToCloud": "ExternallySecured",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "BN3PEPF0000B06B:EE_|SN7PR12MB8002:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "d02e2cdc-e4ff-43cd-cb45-08dea63a32f3",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "\n\tBCL:0;ARA:13230040|376014|36860700016|82310400026|1800799024|18002099003|56012099003|13003099007;",
        "X-Microsoft-Antispam-Message-Info": "\n\tFC+/3YeyV4eNhEjsuqBAugq0tYtfTzb5whoBYSyeBXlq9Bp8Mp5pgzLR5RR4nWS3ImKPD5kVmgP3CDoFC9ktB8rt+eGv7vPUNvHE0JvFNJJmnDCqvaEnS17loa5oIkyfQCQyL0r74PWy2BgnIhGGEWZXDswiHrL+Jr0Tj/1K3InBfNJ7QzZUF/sTSVndnATIqNjrf4TGtak7NTai49a4ugzJ5ICvgBe/g11kvFgLVWBHdiJ10hK7ZZBKVlcsDCbnpYsUmLId5ryfZCJEGDZu0+AhxQGxS67fMCG1IBg9qFfC1tc5DdctxSN6ckFCu/VbmYwieh0iATEPd6ScehX6MKm0/4upgfr0uSGkF/PwTk7JLgM0icladqBn12OrCWoD14mGA8aioaRJSt6UmA+EoIbaFENZGF5CzQon9DfRenVj2Wzvl+PztWF2qOWi8x81n1LotPSVUygp9x2E+A9OcoJRzEt0kaKpBciojRpWO2feLbqOQo4uD5xMD1l5dBHOWoPfz+N9wq1AljJJjXvWo8vpSyHXjUHpoJTsku5QMZwfHdAKNRZcW9/ropPg6lAzjjTasRd10cfuxiGG7qNGRgOnN9EE7o5qUgpTySrjz+dE4+zHQLJrrLeADWElUYqdVF4bKR40Fqhic5LNQtX8L2TgBwmIkwkNSGktgLfdtb3CKkhqoBi0JrNhz8NT3zZmnHbtRo/Bd2FhxxBhM3T1LgmxNo/du4FSrvjFrrm5aOk+4rxRCJPaOBhXrRZTu6xK",
        "X-Forefront-Antispam-Report": "\n\tCIP:216.228.117.160;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(36860700016)(82310400026)(1800799024)(18002099003)(56012099003)(13003099007);DIR:OUT;SFP:1101;",
        "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1",
        "X-MS-Exchange-AntiSpam-MessageData-0": "\n\tyPTSiPLt7bnmxP5CiZORK1J0eDZi8z0PavULK+MelmZ5hs0fmI0IA95q86nH6ADb5/tlbZnLxIugTxr2hN5rYmaCCutw24eUiQCoHBFFMqiZ1w0gC/RBxid62dBcdyF3nRRZpEfduYnc9GM1kVgsuIiqD9HwPEzHciKaUYOHMAT0z8F+Fph3UIM9Mpe+AohxjI0PMj1+BvLLSBeLVPjtypXvhuH21nYFkGX8V7QBP4MY6NTM9N2EOuOYjUJQ9291+4FqbTREWt8bC3bXWQhhcGmutCtsb4a/MAqztBdDuJlBXdBz1iq286xhYQeDzBN7m2GqvVXPQcMDzN2ymgNubCz9Skz2sliuwVDKUmnHKWtncuMd7+K0SBB+OKLrv0PvqAE7bq/l4v3VMyMvLNqTmKrbpfMVpde8dh0zMYfCAwRarBt9u3XqP1Occ2Oc7y7/",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "29 Apr 2026 21:56:42.4554\n (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n d02e2cdc-e4ff-43cd-cb45-08dea63a32f3",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n\tBN3PEPF0000B06B.namprd21.prod.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "SN7PR12MB8002"
    },
    "content": "PMCCNTR_EL0 may continue to increment on NVIDIA Olympus CPUs while the\nPE is in WFI/WFE. That does not necessarily match the CPU_CYCLES event\ncounted by a programmable counter, so using PMCCNTR_EL0 for cycles can\ngive results that differ from the programmable counter path.\n\nExtend the existing PMCCNTR avoidance decision from the SMT case to\nalso cover Olympus. Store the result in the common arm_pmu state at\nregistration time, so arm_pmuv3 can keep using a single flag when\ndeciding whether CPU_CYCLES may use PMCCNTR_EL0.\n\nUse the cached MIDR from cpu_data to identify Olympus parts and avoid\nreading MIDR_EL1 in the event path.\n\nSigned-off-by: Besar Wicaksono <bwicaksono@nvidia.com>\n---\n\nChanges from v1:\n  * add CONFIG_ARM64 check to fix build error found by kernel test robot\n  * add explicit include of <asm/cputype.h>\nv1: https://lore.kernel.org/linux-arm-kernel/20260406232034.2566133-1-bwicaksono@nvidia.com/\n\nChanges from v2:\n  * Move the Olympus PMCCNTR avoidance check from arm_pmuv3.c to the\n    common arm_pmu registration path.\n  * Replace the PMUv3-only has_smt flag with avoid_pmccntr, covering both\n    the existing SMT restriction and the Olympus MIDR restriction.\n  * Use the cached per-CPU MIDR from cpu_data instead of calling\n    is_midr_in_range_list() from armv8pmu_can_use_pmccntr().\n  * Add the required asm/cpu.h include for cpu_data.\n  * Drop the use_pmccntr override patch from this revision.\nv2: https://lore.kernel.org/linux-arm-kernel/20260421203856.3539186-1-bwicaksono@nvidia.com/#t\n\n---\n drivers/perf/arm_pmu.c       | 78 +++++++++++++++++++++++++++++++++---\n drivers/perf/arm_pmuv3.c     |  8 +---\n include/linux/perf/arm_pmu.h |  2 +-\n 3 files changed, 75 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c\nindex 939bcbd433aa..7df185ee7b74 100644\n--- a/drivers/perf/arm_pmu.c\n+++ b/drivers/perf/arm_pmu.c\n@@ -24,6 +24,8 @@\n #include <linux/irq.h>\n #include <linux/irqdesc.h>\n \n+#include <asm/cpu.h>\n+#include <asm/cputype.h>\n #include <asm/irq_regs.h>\n \n static int armpmu_count_irq_users(const struct cpumask *affinity,\n@@ -920,6 +922,76 @@ void armpmu_free(struct arm_pmu *pmu)\n \tkfree(pmu);\n }\n \n+#ifdef CONFIG_ARM64\n+/*\n+ * List of CPUs that should avoid using PMCCNTR_EL0.\n+ */\n+static struct midr_range armpmu_avoid_pmccntr_cpus[] = {\n+\t/*\n+\t * The PMCCNTR_EL0 in Olympus CPU may still increment while in WFI/WFE state.\n+\t * This is an implementation specific behavior and not an erratum.\n+\t *\n+\t * From ARM DDI0487 D14.4:\n+\t *   It is IMPLEMENTATION SPECIFIC whether CPU_CYCLES and PMCCNTR count\n+\t *   when the PE is in WFI or WFE state, even if the clocks are not stopped.\n+\t *\n+\t * From ARM DDI0487 D24.5.2:\n+\t *   All counters are subject to any changes in clock frequency, including\n+\t *   clock stopping caused by the WFI and WFE instructions.\n+\t *   This means that it is CONSTRAINED UNPREDICTABLE whether or not\n+\t *   PMCCNTR_EL0 continues to increment when clocks are stopped by WFI and\n+\t *   WFE instructions.\n+\t */\n+\tMIDR_ALL_VERSIONS(MIDR_NVIDIA_OLYMPUS),\n+\t{}\n+};\n+\n+static bool armpmu_is_in_avoid_pmccntr_cpus(int cpu)\n+{\n+\tstruct midr_range const *r = armpmu_avoid_pmccntr_cpus;\n+\tu32 midr = (u32)per_cpu(cpu_data, cpu).reg_midr;\n+\n+\twhile (r->model) {\n+\t\tif (midr_is_cpu_model_range(midr, r->model, r->rv_min, r->rv_max))\n+\t\t\treturn true;\n+\t\tr++;\n+\t}\n+\n+\treturn false;\n+}\n+#else\n+static bool armpmu_is_in_avoid_pmccntr_cpus(int cpu)\n+{\n+\treturn false;\n+}\n+#endif\n+\n+static bool armpmu_avoid_pmccntr(struct arm_pmu *pmu)\n+{\n+\tint cpu = cpumask_first(&pmu->supported_cpus);\n+\n+\t/*\n+\t * By this stage we know our supported CPUs on either DT/ACPI platforms,\n+\t * detect the SMT implementation.\n+\t * On SMT CPUs, the PMCCNTR_EL0 increments from the processor clock rather\n+\t * than the PE clock (ARM DDI0487 L.b D13.1.3) which means it'll continue\n+\t * counting on a WFI PE if one of its SMT sibling is not idle on a\n+\t * multi-threaded implementation. So don't use it on SMT cores.\n+\t */\n+\tif (topology_core_has_smt(cpu))\n+\t\treturn true;\n+\n+\t/*\n+\t * On some CPUs, PMCCNTR_EL0 does not match the behavior of CPU_CYCLES\n+\t * programmable counter, so avoid routing cycles through PMCCNTR_EL0 to\n+\t * prevent inconsistency in the results.\n+\t */\n+\tif (armpmu_is_in_avoid_pmccntr_cpus(cpu))\n+\t\treturn true;\n+\n+\treturn false;\n+}\n+\n int armpmu_register(struct arm_pmu *pmu)\n {\n \tint ret;\n@@ -928,11 +1000,7 @@ int armpmu_register(struct arm_pmu *pmu)\n \tif (ret)\n \t\treturn ret;\n \n-\t/*\n-\t * By this stage we know our supported CPUs on either DT/ACPI platforms,\n-\t * detect the SMT implementation.\n-\t */\n-\tpmu->has_smt = topology_core_has_smt(cpumask_first(&pmu->supported_cpus));\n+\tpmu->avoid_pmccntr = armpmu_avoid_pmccntr(pmu);\n \n \tif (!pmu->set_event_filter)\n \t\tpmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;\ndiff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c\nindex 8014ff766cff..60f159a51992 100644\n--- a/drivers/perf/arm_pmuv3.c\n+++ b/drivers/perf/arm_pmuv3.c\n@@ -1002,13 +1002,7 @@ static bool armv8pmu_can_use_pmccntr(struct pmu_hw_events *cpuc,\n \tif (has_branch_stack(event))\n \t\treturn false;\n \n-\t/*\n-\t * The PMCCNTR_EL0 increments from the processor clock rather than\n-\t * the PE clock (ARM DDI0487 L.b D13.1.3) which means it'll continue\n-\t * counting on a WFI PE if one of its SMT sibling is not idle on a\n-\t * multi-threaded implementation. So don't use it on SMT cores.\n-\t */\n-\tif (cpu_pmu->has_smt)\n+\tif (cpu_pmu->avoid_pmccntr)\n \t\treturn false;\n \n \treturn true;\ndiff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h\nindex 52b37f7bdbf9..02d2c7f45b52 100644\n--- a/include/linux/perf/arm_pmu.h\n+++ b/include/linux/perf/arm_pmu.h\n@@ -119,7 +119,7 @@ struct arm_pmu {\n \n \t/* PMUv3 only */\n \tint\t\tpmuver;\n-\tbool\t\thas_smt;\n+\tbool\t\tavoid_pmccntr;\n \tu64\t\treg_pmmir;\n \tu64\t\treg_brbidr;\n #define ARMV8_PMUV3_MAX_COMMON_EVENTS\t\t0x40\n",
    "prefixes": [
        "v3"
    ]
}