[PATCH RFC 11/15] arm_mpam: Fix mpam_dt_create_foundling_msc() to create MSC platform devices

From: Yin Li

Date: Tue Aug 11 2026 - 09:59:07 EST


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 b0e67c8349c7..eac3bc695fd1 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -2358,23 +2358,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;
- 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);
+ }
}
}


--
2.34.1