Re: [PATCH RFC v2 07/10] arm_mpam: Fix mpam_dt_create_foundling_msc() to create MSC platform devices

From: Yin Li

Date: Tue Sep 22 2026 - 23:00:04 EST




On 9/14/2026 5:37 PM, Yin Li wrote:
The original code created a platform device for the cache node itself
rather than for the MSC, so the MSC was never created. Instead, walk
the cache's children using for_each_child_of_node_scoped() and create
the platform device for the MSC child node, skipping cache parents
that firmware has marked disabled.

Co-developed-by: Huang Yiwei <huang.yiwei@xxxxxxxxxxxxxxxx>
Signed-off-by: Huang Yiwei <huang.yiwei@xxxxxxxxxxxxxxxx>
Signed-off-by: Yin Li <yin.li@xxxxxxxxxxxxxxxx>
---
drivers/resctrl/mpam_devices.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 480e38cfa86d..7ef3ed55b066 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -2366,23 +2366,20 @@ static struct platform_driver mpam_msc_driver = {
*/
static void mpam_dt_create_foundling_msc(void)
{
- struct platform_device *pdev;
- struct device_node *cache;
-
- for_each_compatible_node(cache, NULL, "cache") {
- struct device_node *cache_device;
-
- if (of_node_check_flag(cache, OF_POPULATED))
- continue;
-
- cache_device = of_find_matching_node_and_match(cache, mpam_of_match, NULL);
- if (!cache_device)
+ for_each_compatible_node_scoped(cache, NULL, "cache") {
+ if (!of_device_is_available(cache))
continue;

Hi,

As sashiko-bot said:Checking of_device_is_available(cache) here introduces a mismatch with mpam_dt_count_msc(), which only checks whether the MSC node itself is available, not its parent cache. And in practice, cache nodes are rarely if ever marked as disabled in the device tree, so this check adds unnecessary inconsistency without a real benefit.

I'll remove the cache availability check in the next version to keep the two consistent.

Thanks,
Yin


- of_node_put(cache_device);
- pdev = of_platform_device_create(cache, "cache", NULL);
- if (!pdev)
- pr_err_once("Failed to create MSC devices under caches\n");
+ for_each_child_of_node_scoped(cache, child) {
+ if (!of_match_node(mpam_of_match, child))
+ continue;
+ if (!of_device_is_available(child))
+ continue;
+ if (of_node_check_flag(child, OF_POPULATED))
+ continue;
+ if (!of_platform_device_create(child, NULL, NULL))
+ pr_err("Failed to create MSC device for %pOF\n", child);
+ }
}
}


--
Thx and BRs,
Yin