Re: [PATCH 11/33] arm_mpam: Add support for memory controller MSC on DT platforms
From: James Morse <james.morse@arm.com>
Date: 2025-09-10 19:31:34
Also in:
linux-acpi, linux-devicetree, lkml
Hi Shaopeng, On 09/09/2025 08:11, Shaopeng Tan (Fujitsu) wrote:
quoted
From: Shanker Donthineni <redacted> The device-tree binding has two examples for MSC associated with memory controllers. Add the support to discover the component_id from the device-tree and create 'memory' RIS.
quoted
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c index a0d9a699a6e7..71a1fb1a9c75 100644 --- a/drivers/resctrl/mpam_devices.c +++ b/drivers/resctrl/mpam_devices.c@@ -62,41 +62,63 @@ static int mpam_dt_parse_resource(struct mpam_msc*msc, struct device_node *np, u32 ris_idx) { int err = 0; - u32 level = 0; - unsigned long cache_id; - struct device_node *cache; + u32 class_id = 0, component_id = 0; + struct device_node *cache = NULL, *memory = NULL; + enum mpam_class_types type = MPAM_CLASS_UNKNOWN; do { + /* What kind of MSC is this? */ if (of_device_is_compatible(np, "arm,mpam-cache")) { cache = of_parse_phandle(np, "arm,mpam-device", 0); if (!cache) { pr_err("Failed to read phandle\n"); break; } + type = MPAM_CLASS_CACHE; } else if (of_device_is_compatible(np->parent, "cache")) { cache = of_node_get(np->parent); + type = MPAM_CLASS_CACHE; + } else if (of_device_is_compatible(np, "arm,mpam-memory")) { + memory = of_parse_phandle(np, "arm,mpam-device", 0); + if (!memory) { + pr_err("Failed to read phandle\n"); + break; + } + type = MPAM_CLASS_MEMORY; + } else if (of_device_is_compatible(np, "arm,mpam-memory-controller-msc")) { + memory = of_node_get(np->parent); + type = MPAM_CLASS_MEMORY; } else { - /* For now, only caches are supported */ - cache = NULL; + /* + * For now, only caches and memory controllers are + * supported. + */ break; }
There is no need "{}" here.Sure, but its more than one line, and all the previous parts of this else-if tree have them. Keeping this here make it much easier to read. Thanks, James