[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25e99137-54ee-434d-8777-a771798e9da1@arm.com>
Date: Wed, 10 Sep 2025 20:31:28 +0100
From: James Morse <james.morse@....com>
To: "Shaopeng Tan (Fujitsu)" <tan.shaopeng@...itsu.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Cc: "shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>,
D Scott Phillips OS <scott@...amperecomputing.com>,
"carl@...amperecomputing.com" <carl@...amperecomputing.com>,
"lcherian@...vell.com" <lcherian@...vell.com>,
"bobo.shaobowang@...wei.com" <bobo.shaobowang@...wei.com>,
"baolin.wang@...ux.alibaba.com" <baolin.wang@...ux.alibaba.com>,
Jamie Iles <quic_jiles@...cinc.com>, Xin Hao <xhao@...ux.alibaba.com>,
"peternewman@...gle.com" <peternewman@...gle.com>,
"dfustini@...libre.com" <dfustini@...libre.com>,
"amitsinght@...vell.com" <amitsinght@...vell.com>,
David Hildenbrand <david@...hat.com>, Rex Nie <rex.nie@...uarmicro.com>,
Dave Martin <dave.martin@....com>, Koba Ko <kobak@...dia.com>,
Shanker Donthineni <sdonthineni@...dia.com>,
"fenghuay@...dia.com" <fenghuay@...dia.com>,
"baisheng.gao@...soc.com" <baisheng.gao@...soc.com>,
Jonathan Cameron <jonathan.cameron@...wei.com>, Rob Herring
<robh@...nel.org>, Rohit Mathew <rohit.mathew@....com>,
Rafael Wysocki <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>, Hanjun Guo
<guohanjun@...wei.com>, Sudeep Holla <sudeep.holla@....com>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Danilo Krummrich <dakr@...nel.org>
Subject: Re: [PATCH 11/33] arm_mpam: Add support for memory controller MSC on
DT platforms
Hi Shaopeng,
On 09/09/2025 08:11, Shaopeng Tan (Fujitsu) wrote:
>> From: Shanker Donthineni <sdonthineni@...dia.com>
>>
>> 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.
>> 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
Powered by blists - more mailing lists