Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zeng Heng <zengheng4@huawei.com>
To: James Morse <james.morse@arm.com>, <ben.horgan@arm.com>,
	<xry111@xry111.site>, <catalin.marinas@arm.com>, <maz@kernel.org>,
	<ardb@kernel.org>, <yang@os.amperecomputing.com>,
	<ryan.roberts@arm.com>, <kevin.brodsky@arm.com>,
	<reinette.chatre@intel.com>, <miko.lenczewski@arm.com>,
	<will@kernel.org>, <suzuki.poulose@arm.com>, <thuth@redhat.com>,
	<james.clark@linaro.org>, <lpieralisi@kernel.org>,
	<broonie@kernel.org>, <oupton@kernel.org>,
	<anshuman.khandual@arm.com>, <yeoreum.yun@arm.com>,
	<leo.yan@arm.com>, <mrigendra.chaubey@gmail.com>,
	<fenghuay@nvidia.com>, <ahmed.genidi@arm.com>,
	<mark.rutland@arm.com>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<wangkefeng.wang@huawei.com>
Subject: Re: [PATCH v2 2/2] arm_mpam: Update architecture version check for MPAM MSC
Date: Fri, 8 May 2026 10:26:50 +0800	[thread overview]
Message-ID: <01ef61ca-7ba7-b282-7ec6-b1df5c301aa5@huawei.com> (raw)
In-Reply-To: <b9900d7a-eaaf-4f1a-b79e-aa968a7b6e29@arm.com>

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


  reply	other threads:[~2026-05-08  2:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03  9:54 [PATCH v2 0/2] arm_mpam: Add support for the MPAM v0.1 architecture version Zeng Heng
2026-02-03  9:54 ` [PATCH v2 1/2] arm64: cpufeature: " Zeng Heng
2026-05-07 14:09   ` James Morse
2026-05-08  6:04     ` Zeng Heng
2026-02-03  9:54 ` [PATCH v2 2/2] arm_mpam: Update architecture version check for MPAM MSC Zeng Heng
2026-05-07 16:03   ` James Morse
2026-05-08  2:26     ` Zeng Heng [this message]
2026-05-08  3:47       ` Zeng Heng
2026-05-08  9:37         ` Ben Horgan
2026-05-08  9:56           ` Ben Horgan
2026-05-08 16:07             ` James Morse
2026-03-07  8:50 ` [PATCH v2 0/2] arm_mpam: Add support for the MPAM v0.1 architecture version Zeng Heng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01ef61ca-7ba7-b282-7ec6-b1df5c301aa5@huawei.com \
    --to=zengheng4@huawei.com \
    --cc=ahmed.genidi@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=ben.horgan@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=fenghuay@nvidia.com \
    --cc=james.clark@linaro.org \
    --cc=james.morse@arm.com \
    --cc=kevin.brodsky@arm.com \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=miko.lenczewski@arm.com \
    --cc=mrigendra.chaubey@gmail.com \
    --cc=oupton@kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=ryan.roberts@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=thuth@redhat.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    --cc=xry111@xry111.site \
    --cc=yang@os.amperecomputing.com \
    --cc=yeoreum.yun@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox