Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
To: Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Besar Wicaksono <bwicaksono@nvidia.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	jiangtianfeng@linux.alibaba.com
Subject: [PATCH 1/2] perf/arm_cspmu: nvidia: Reject missing TGT address-filter resource
Date: Fri, 27 Nov 2026 15:10:09 +0800	[thread overview]
Message-ID: <20261127071021.820833-2-jiangtianfeng@linux.alibaba.com> (raw)
In-Reply-To: <20261127071021.820833-1-jiangtianfeng@linux.alibaba.com>

acpi_dev_get_memory_resources() can return 0 with an empty resource list.
In that case pcie_tgt_init_data() leaves addr_filter_reg as NULL but
returns success. A later address-filter event then writes to registers
computed from that NULL base.

Reject an empty resource list with -ENODEV and keep the existing ioremap
error propagation. This turns missing firmware resources into a probe
failure instead of a runtime invalid MMIO access.

Qoder, an AI coding assistant, helped analyze the issue, develop the fix
and source-derived state model, and draft this description.

Fixes: 3dd73022306b ("perf/arm_cspmu: nvidia: Add Tegra410 PCIE-TGT PMU")
Signed-off-by: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
---
 drivers/perf/arm_cspmu/nvidia_cspmu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_cspmu/nvidia_cspmu.c b/drivers/perf/arm_cspmu/nvidia_cspmu.c
index af256f662731..a0257dc3249d 100644
--- a/drivers/perf/arm_cspmu/nvidia_cspmu.c
+++ b/drivers/perf/arm_cspmu/nvidia_cspmu.c
@@ -555,7 +555,10 @@ static int pcie_tgt_init_data(struct arm_cspmu *cspmu)
 
 	rentry = list_first_entry_or_null(
 		&resource_list, struct resource_entry, node);
-	if (rentry) {
+	if (!rentry) {
+		dev_err(dev, "no address filter resource\n");
+		ret = -ENODEV;
+	} else {
 		data->addr_filter_reg = devm_ioremap_resource(dev, rentry->res);
 		ret = 0;
 	}
-- 
2.47.3



  reply	other threads:[~2026-11-27  7:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  7:10 [PATCH 0/2] perf/arm_cspmu: nvidia: Fix TGT address-filter handling Jiangtian Feng
2026-11-27  7:10 ` Jiangtian Feng [this message]
2026-11-27  7:10 ` [PATCH 2/2] perf/arm_cspmu: nvidia: Fix TGT address-filter slot lifecycle Jiangtian Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127071021.820833-2-jiangtianfeng@linux.alibaba.com \
    --to=jiangtianfeng@linux.alibaba.com \
    --cc=bwicaksono@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox