Re: [PATCH v3 11/29] arm_mpam: Probe hardware to find the supported partid/pmg values
From: Jonathan Cameron <jonathan.cameron@huawei.com>
Date: 2025-10-24 17:40:57
Also in:
linux-acpi, lkml
On Fri, 17 Oct 2025 18:56:27 +0000 James Morse [off-list ref] wrote:
CPUs can generate traffic with a range of PARTID and PMG values, but each MSC may also have its own maximum size for these fields. Before MPAM can be used, the driver needs to probe each RIS on each MSC, to find the system-wide smallest value that can be used. The limits from requestors (e.g. CPUs) also need taking into account. While doing this, RIS entries that firmware didn't describe are created under MPAM_CLASS_UNKNOWN. While we're here, implement the mpam_register_requestor() call for the arch code to register the CPU limits. Future callers of this will tell us about the SMMU and ITS. Signed-off-by: James Morse <james.morse@arm.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Trivial stuff inline. I'd definitely not trust this reviewer who is horribly inconsistent ;)
Reviewed-by: Ben Horgan <ben.horgan@arm.com> Tested-by: Fenghua Yu <fenghuay@nvidia.com>
quoted hunk ↗ jump to hunk
static struct mpam_vmsc * mpam_vmsc_alloc(struct mpam_component *comp, struct mpam_msc *msc) {@@ -427,6 +500,7 @@ static int mpam_ris_create_locked(struct mpam_msc *msc, u8 ris_idx, cpumask_or(&comp->affinity, &comp->affinity, &ris->affinity); cpumask_or(&class->affinity, &class->affinity, &ris->affinity); list_add_rcu(&ris->vmsc_list, &vmsc->ris); + list_add_rcu(&ris->msc_list, &msc->ris);
This looks like it might the add I was missing earlier? If so and it can only be done now, move the del into this patch as well.
quoted hunk ↗ jump to hunk
return 0; }@@ -446,9 +520,36 @@ int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx, return err; } +static struct mpam_msc_ris *mpam_get_or_create_ris(struct mpam_msc *msc, + u8 ris_idx) +{ + int err; + struct mpam_msc_ris *ris; + + lockdep_assert_held(&mpam_list_lock); + + if (!test_bit(ris_idx, &msc->ris_idxs)) { + err = mpam_ris_create_locked(msc, ris_idx, MPAM_CLASS_UNKNOWN, + 0, 0); + if (err) + return ERR_PTR(err); + } + + list_for_each_entry(ris, &msc->ris, msc_list) { + if (ris->ris_idx == ris_idx) { + return ris;
I'm not seeing this change in later patches in this series, so brackets seem unnecessary and against kernel style.
+ } + } + + return ERR_PTR(-ENOENT); +}