[PATCH v2 2/2] arm_mpam: Update architecture version check for MPAM MSC

Zeng Heng zengheng4 at huawei.com
Thu May 7 19:26:50 PDT 2026


Hi James,

On 2026/5/8 0:03, James Morse wrote:
> Hi Zeng,
> 
> On 03/02/2026 09:54, Zeng Heng wrote:
>> In addition to updating the CPU MPAM version check, the MPAM MSC version
>> check also need to be updated. mpam_msc_check_aidr() is added to check
>> the MSC AIDR register, ensuring that both the major and minor version
>> numbers fall within the supported range of the MPAM architecture version.
> 
>> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
>> index 744df3a6a078..a58031f0a280 100644
>> --- a/drivers/resctrl/mpam_devices.c
>> +++ b/drivers/resctrl/mpam_devices.c
>> @@ -202,6 +202,17 @@ static inline void _mpam_write_monsel_reg(struct mpam_msc *msc, u16 reg, u32 val
>>   
>>   #define mpam_write_monsel_reg(msc, reg, val)   _mpam_write_monsel_reg(msc, MSMON_##reg, val)
>>   
>> +static bool mpam_msc_check_aidr(struct mpam_msc *msc)
>> +{
>> +	u32 rev;
>> +
>> +	rev = __mpam_read_reg(msc, MPAMF_AIDR) & MPAMF_AIDR_ARCH_REV;
>> +
>> +	return rev == MPAM_ARCHITECTURE_V0_1 ||
>> +	       rev == MPAM_ARCHITECTURE_V1_0 ||
>> +	       rev == MPAM_ARCHITECTURE_V1_1;
>> +}
>> +
>>   static u64 mpam_msc_read_idr(struct mpam_msc *msc)
>>   {
>>   	u64 idr_high = 0, idr_low;
>> @@ -842,9 +853,8 @@ static int mpam_msc_hw_probe(struct mpam_msc *msc)
>>   
>>   	lockdep_assert_held(&msc->probe_lock);
>>   
>> -	idr = __mpam_read_reg(msc, MPAMF_AIDR);
>> -	if ((idr & MPAMF_AIDR_ARCH_MAJOR_REV) != MPAM_ARCHITECTURE_V1) {
>> -		dev_err_once(dev, "MSC does not match MPAM architecture v1.x\n");
> 
> This deliberately only checks the major number. (The MSC architecture always had a
> major and minor number). Before your change, MPAM v1.2 is supported, after we'd
> get an error for a MPAM v1.2 MSC. (if such a thing exists)
> 
> 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;
> |
> | 	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.


Best regards,
Zeng Heng



More information about the linux-arm-kernel mailing list