Thread (117 messages) 117 messages, 10 authors, 2025-08-15

Re: [RFC PATCH 17/36] arm_mpam: Add cpuhp callbacks to probe MSC hardware

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Date: 2025-08-05 08:46:38
Also in: lkml

On Fri, 11 Jul 2025 18:36:29 +0000
James Morse [off-list ref] wrote:
Because an MSC can only by accessed from the CPUs in its cpu-affinity
set we need to be running on one of those CPUs to probe the MSC
hardware.

Do this work in the cpuhp callback. Probing the hardware will only
happen before MPAM is enabled, walk all the MSCs and probe those we can
reach that haven't already been probed.

Later once MPAM is enabled, this cpuhp callback will be replaced by
one that avoids the global list.

Enabling a static key will also take the cpuhp lock, so can't be done
from the cpuhp callback. Whenever a new MSC has been probed schedule
work to test if all the MSCs have now been probed.

CC: Lecopzer Chen <redacted>
Signed-off-by: James Morse <james.morse@arm.com>
Hi James,

One trivial thing noticed whilst testing..
quoted hunk ↗ jump to hunk
@@ -513,9 +541,84 @@ int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx,
 	return err;
 }
 
-static void mpam_discovery_complete(void)
+static int mpam_msc_hw_probe(struct mpam_msc *msc)
 {
-	pr_err("Discovered all MSC\n");
+	u64 idr;
+	int err;
+
+	lockdep_assert_held(&msc->probe_lock);
+
+	mutex_lock(&msc->part_sel_lock);
+	idr = mpam_read_partsel_reg(msc, AIDR);
+	if ((idr & MPAMF_AIDR_ARCH_MAJOR_REV) != MPAM_ARCHITECTURE_V1) {
+		pr_err_once("%s does not match MPAM architecture v1.0\n",
You are only checking MAJOR REV which is probably the right thing to do
but in that case maybe change the message to be v1.x ?
+			    dev_name(&msc->pdev->dev));
+		err = -EIO;
+	} else {
+		msc->probed = true;
+		err = 0;
+	}
+	mutex_unlock(&msc->part_sel_lock);
+
+	return err;
+}
+
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help