LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: linuxppc-dev@lists.ozlabs.org,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Vaibhav Jain <vaibhav@linux.ibm.com>,
	Harsh Prateek Bora <harshpb@linux.ibm.com>,
	Ritesh Harjani <ritesh.list@gmail.com>,
	Anushree Mathur <anushree.mathur@linux.ibm.com>,
	Gautam Menghani <gautam@linux.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/dt_cpu_ftrs: Set CPU_FTR_P11_PVR for Power11 and later processors
Date: Thu, 25 Jun 2026 16:04:48 +0200	[thread overview]
Message-ID: <db3168f1-91a4-4871-a68a-cdd42b1c6ea4@kernel.org> (raw)
In-Reply-To: <20260625184146.6de49c63-67-amachhiw@linux.ibm.com>



Le 25/06/2026 à 15:14, Amit Machhiwal a écrit :
> Hi Christophe,
> 
> <snip>
> 
>>>> diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
>>>> index 3af6c06af02f..e5853daa6a48 100644
>>>> --- a/arch/powerpc/kernel/dt_cpu_ftrs.c
>>>> +++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
>>>> @@ -704,6 +704,15 @@ static void __init cpufeatures_setup_start(u32 isa)
>>>>    	if (isa >= ISA_V3_1) {
>>>>    		cur_cpu_spec->cpu_features |= CPU_FTR_ARCH_31;
>>>>    		cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_ARCH_3_1;
>>>> +
>>>> +		/*
>>>> +		 * CPU_FTR_P11_PVR is a kernel-internal flag to identify
>>>> +		 * Power11 and later processors. While ISA v3.1 is supported
>>>> +		 * by Power10+, this flag specifically indicates Power11+
>>>> +		 * for code that needs to distinguish between P10 and P11.
>>>> +		 */
>>>> +		if (PVR_VER(mfspr(SPRN_PVR)) >= PVR_POWER11)
>>>
>>> Are we sure this test will always be correct ?
>>>
>>> For instance PVR_PA6T is higher than PVR_POWER11 allthough it is not ISA 3.1
>>>
>>> Wouldn't is be cleaner and safer to just do:
>>>
>>> 	PVR_VER(mfspr(SPRN_PVR)) == PVR_POWER11
>>
>> You're absolutely right to point out the PVR ordering concern. But PA6T
>> cannot actually reach this path because we're already gated by:
>>
>>    if (isa >= ISA_V3_1)
>>
>> and PA6T does not implement ISA v3.1.
>>
>> My rationale for using `>= PVR_POWER11` is that `CPU_FTR_P11_PVR` is
>> intended to be included for Power11 and later processors, not just
>> Power11 itself, as it identifies a CPU feature. Using `== PVR_POWER11`
>> would mean we'd need to revisit this code for every future generation.
>>
>> This approach is consistent with existing kernel code. For example, in
>> arch/powerpc/perf/hv-gpci.c:
>>
>>    /* sysinfo interface files are only available for power10 and above platforms */
>>    if (PVR_VER(mfspr(SPRN_PVR)) >= PVR_POWER10)
>>        add_sysinfo_interface_files();
>>
>> Also, I couldn't find any current users of `PVR_PA6T` or `PVR_BE` in the
>> kernel tree, so there doesn't appear to be a present-day ISA v3.1+
>> example where the comparison would misidentify a processor.
>>
>> Please let me know your further thoughts on this.
> 
> Just checking in — did my previous response address your concern, or do
> you have further comments?

That ok, no more comments.


Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>




      reply	other threads:[~2026-06-25 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-14 17:34 [PATCH] powerpc/dt_cpu_ftrs: Set CPU_FTR_P11_PVR for Power11 and later processors Amit Machhiwal
2026-06-16  5:26 ` Mukesh Kumar Chaurasiya
2026-06-16  5:39 ` Christophe Leroy (CS GROUP)
2026-06-16  6:38   ` Amit Machhiwal
2026-06-25 13:14     ` Amit Machhiwal
2026-06-25 14:04       ` Christophe Leroy (CS GROUP) [this message]

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=db3168f1-91a4-4871-a68a-cdd42b1c6ea4@kernel.org \
    --to=chleroy@kernel.org \
    --cc=anushree.mathur@linux.ibm.com \
    --cc=gautam@linux.ibm.com \
    --cc=harshpb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=vaibhav@linux.ibm.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