[PATCH 09/33] ACPI / MPAM: Parse the MPAM table

Ben Horgan ben.horgan at arm.com
Thu Nov 13 06:24:01 PST 2025


Hi Fenghua,

On 11/13/25 02:33, Fenghua Yu wrote:
> Hi, Ben and James,
> 
> On 11/7/25 04:34, Ben Horgan wrote:
>> From: James Morse <james.morse at arm.com>
> 
> [SNIP]
> 
>> +static int acpi_mpam_parse_resource(struct mpam_msc *msc,
>> +                    struct acpi_mpam_resource_node *res)
>> +{
>> +    int level, nid;
>> +    u32 cache_id;
>> +
>> +    switch (res->locator_type) {
>> +    case ACPI_MPAM_LOCATION_TYPE_PROCESSOR_CACHE:
>> +        cache_id = res->locator.cache_locator.cache_reference;
>> +        level = find_acpi_cache_level_from_id(cache_id);
>> +        if (level <= 0) {
>> +            pr_err_once("Bad level (%d) for cache with id %u\n",
>> level, cache_id);
>> +            return -EINVAL;
>> +        }
>> +        return mpam_ris_create(msc, res->ris_index, MPAM_CLASS_CACHE,
>> +                       level, cache_id);
>> +    case ACPI_MPAM_LOCATION_TYPE_MEMORY:
>> +        nid = pxm_to_node(res->locator.memory_locator.proximity_domain);
>> +        if (nid == NUMA_NO_NODE) {
>> +            pr_debug("Bad proxmity domain %lld, using node 0 instead\n",
>> +                 res->locator.memory_locator.proximity_domain);
>> +            nid = 0;
>> +        }
>> +        return mpam_ris_create(msc, res->ris_index, MPAM_CLASS_MEMORY,
>> +                       255, nid);
> 
> nit.
> 
> Seems "255" is an ad-hoc value which won't be used for memory type?
> The "class_id" in mpam_ris_create() is confused: it may be level for
> cache or it may be 255 for memory.
> 
> To be clearer, maybe it's better to define and enum for class_id?
> Something like:
> enum mpam_class_id {
>     CLASS_ID_LEVEL_1 = 1,
>     CLASS_ID_LEVEL_2,
>     CLASS_ID_LEVEL_3,
>     CLASS_ID_NOT_USED = 255  <--- for memory type
> };

I've added a new define, MPAM_CLASS_ID_DEFAULT, which can be used for
memory and anything else that only needs one class_id.

> 
> Thanks.
> 
> -Fenghua

-- 
Thanks,

Ben




More information about the linux-arm-kernel mailing list