The Linux Kernel Mailing List
 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 11:47:08 +0800	[thread overview]
Message-ID: <cdddd32a-a485-0ef9-180b-edf29f4738bd@huawei.com> (raw)
In-Reply-To: <01ef61ca-7ba7-b282-7ec6-b1df5c301aa5@huawei.com>

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@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.
> 



  reply	other threads:[~2026-05-08  3:47 UTC|newest]

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

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=cdddd32a-a485-0ef9-180b-edf29f4738bd@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