[PATCH v2 2/2] arm_mpam: Update architecture version check for MPAM MSC
Zeng Heng
zengheng4 at huawei.com
Thu May 7 20:47:08 PDT 2026
Hi James,
On 2026/5/8 10:26, Zeng Heng wrote:
>> I think its simpler to rule out the unsupported combinations,
>> something like:
>> | static bool mpam_msc_check_aidr(struct mpam_msc *msc)
>> | {
>> | u32 rev;
>> |
>> | rev = __mpam_read_reg(msc, MPAMF_AIDR) & MPAMF_AIDR_ARCH_REV;
>> |
>> | /*
>> | * v0.0 and >v2.x aren't supported, but anything else should be
>> backward
>> | * compatible to v0.1 or v1.0.
>> | */
>> | if (!rev)
>> | return false;
>> | if (rev & MPAMF_AIDR_ARCH_MAJOR_REV > MPAM_ARCHITECTURE_V1)
>> | return false;
>> |
Oops, after more complete version number testing, I found there's an
operator precedence issue here. The correct fix is:
if ((rev & MPAMF_AIDR_ARCH_MAJOR_REV) > MPAM_ARCHITECTURE_V1)
return false;
Note that '>' has higher precedence than '&'.
With this fix included:
Tested-by: Zeng Heng <zengheng4 at huawei.com>
>> | return true;
>> | }
>>
>>> + if (!mpam_msc_check_aidr(msc)) {
>>> + dev_err_once(dev, "MSC does not match MPAM architecture\n");
>>> return -EIO;
>>> }
>>
>> I'd like to keep the 'v1.x' in this message - this should help folk
>> with old stable
>> kernels running on new hardware work out why the feature isn't available.
>> (assuming they have some documentation that says v2.0 in it!)
>>
>> I've rebased this with the above changes, which I'll post shortly for
>> fixes.
>>
>>
>
> Agreed. Keep the backward compatibility extension for versions
> (compatible with v0.x(x>0) and 1.x), and remove the redundant
> MPAM_ARCHITECTURE_Vx_x macro definitions.
>
> I've verified locally that everything works fine.
>
More information about the linux-arm-kernel
mailing list