All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc: Add base support for ISA v3.1
@ 2020-04-03  4:10 Alistair Popple
  2020-04-03  4:10 ` [PATCH 2/2] powerpc/dt_cpu_ftrs: Advertise support for ISA v3.1 if selected Alistair Popple
  2020-04-03 15:32 ` [PATCH 1/2] powerpc: Add base support for ISA v3.1 Segher Boessenkool
  0 siblings, 2 replies; 8+ messages in thread
From: Alistair Popple @ 2020-04-03  4:10 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mikey, npiggin, Alistair Popple

Newer ISA versions are enabled by clearing all bits in the PCR
associated with previous versions of the ISA. Enable ISA v3.1 support
by updating the PCR mask to include ISA v3.0. This ensures all PCR
bits corresponding to earlier architecture versions get cleared
thereby enabling ISA v3.1.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 arch/powerpc/include/asm/cputable.h | 1 +
 arch/powerpc/include/asm/reg.h      | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 86efd5eb0389..5cd111c63b5a 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -213,6 +213,7 @@ static inline void cpu_feature_keys_init(void) { }
 #define CPU_FTR_P9_TIDR			LONG_ASM_CONST(0x0000800000000000)
 #define CPU_FTR_P9_TLBIE_ERAT_BUG	LONG_ASM_CONST(0x0001000000000000)
 #define CPU_FTR_P9_RADIX_PREFETCH_BUG	LONG_ASM_CONST(0x0002000000000000)
+#define CPU_FTR_ARCH_31			LONG_ASM_CONST(0x0004000000000000)
 
 #ifndef __ASSEMBLY__
 
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 5f5c0254ee3a..163773cf011b 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -487,10 +487,11 @@
  * determine both the compatibility level which we want to emulate and the
  * compatibility level which the host is capable of emulating.
  */
+#define   PCR_ARCH_300	0x10		/* Architecture 3.00 */
 #define   PCR_ARCH_207	0x8		/* Architecture 2.07 */
 #define   PCR_ARCH_206	0x4		/* Architecture 2.06 */
 #define   PCR_ARCH_205	0x2		/* Architecture 2.05 */
-#define   PCR_LOW_BITS	(PCR_ARCH_207 | PCR_ARCH_206 | PCR_ARCH_205)
+#define   PCR_LOW_BITS	(PCR_ARCH_207 | PCR_ARCH_206 | PCR_ARCH_205 | PCR_ARCH_300)
 #define   PCR_MASK	~(PCR_HIGH_BITS | PCR_LOW_BITS)	/* PCR Reserved Bits */
 #define	SPRN_HEIR	0x153	/* Hypervisor Emulated Instruction Register */
 #define SPRN_TLBINDEXR	0x154	/* P7 TLB control register */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] powerpc/dt_cpu_ftrs: Advertise support for ISA v3.1 if selected
  2020-04-03  4:10 [PATCH 1/2] powerpc: Add base support for ISA v3.1 Alistair Popple
@ 2020-04-03  4:10 ` Alistair Popple
  2020-04-03 15:32 ` [PATCH 1/2] powerpc: Add base support for ISA v3.1 Segher Boessenkool
  1 sibling, 0 replies; 8+ messages in thread
From: Alistair Popple @ 2020-04-03  4:10 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: mikey, npiggin, Alistair Popple

Enable Advertising support for cpu feature ISA v3.1 if advertised in the
device-tree.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 arch/powerpc/kernel/dt_cpu_ftrs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index ad75095c121f..7c00419bfb64 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -26,6 +26,7 @@
 /* Device-tree visible constants follow */
 #define ISA_V2_07B      2070
 #define ISA_V3_0B       3000
+#define ISA_V3_1        3100
 
 #define USABLE_PR               (1U << 0)
 #define USABLE_OS               (1U << 1)
@@ -658,6 +659,11 @@ static void __init cpufeatures_setup_start(u32 isa)
 		cur_cpu_spec->cpu_features |= CPU_FTR_ARCH_300;
 		cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_ARCH_3_00;
 	}
+
+	if (isa >= 3100) {
+		cur_cpu_spec->cpu_features |= CPU_FTR_ARCH_31;
+		cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_ARCH_3_1;
+	}
 }
 
 static bool __init cpufeatures_process_feature(struct dt_cpu_feature *f)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc: Add base support for ISA v3.1
  2020-04-03  4:10 [PATCH 1/2] powerpc: Add base support for ISA v3.1 Alistair Popple
  2020-04-03  4:10 ` [PATCH 2/2] powerpc/dt_cpu_ftrs: Advertise support for ISA v3.1 if selected Alistair Popple
@ 2020-04-03 15:32 ` Segher Boessenkool
  2020-04-21  1:30   ` Alistair Popple
  2020-04-21 12:39   ` Michael Ellerman
  1 sibling, 2 replies; 8+ messages in thread
From: Segher Boessenkool @ 2020-04-03 15:32 UTC (permalink / raw)
  To: Alistair Popple; +Cc: mikey, linuxppc-dev, npiggin

Hi!

On Fri, Apr 03, 2020 at 03:10:54PM +1100, Alistair Popple wrote:
> +#define   PCR_ARCH_300	0x10		/* Architecture 3.00 */

It's called 3.0, not 3.00?


Segher

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc: Add base support for ISA v3.1
  2020-04-03 15:32 ` [PATCH 1/2] powerpc: Add base support for ISA v3.1 Segher Boessenkool
@ 2020-04-21  1:30   ` Alistair Popple
  2020-04-21  1:52     ` Alistair Popple
  2020-04-21 12:39   ` Michael Ellerman
  1 sibling, 1 reply; 8+ messages in thread
From: Alistair Popple @ 2020-04-21  1:30 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: mikey, linuxppc-dev, npiggin

On Saturday, 4 April 2020 2:32:08 AM AEST Segher Boessenkool wrote:
> Hi!
> 
> On Fri, Apr 03, 2020 at 03:10:54PM +1100, Alistair Popple wrote:
> > +#define   PCR_ARCH_300	0x10		/* Architecture 3.00 */
> 
> It's called 3.0, not 3.00?

Thanks. I'll fix that up.

- Alistair
 
> 
> Segher





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc: Add base support for ISA v3.1
  2020-04-21  1:30   ` Alistair Popple
@ 2020-04-21  1:52     ` Alistair Popple
  2020-04-21  1:58       ` Oliver O'Halloran
  0 siblings, 1 reply; 8+ messages in thread
From: Alistair Popple @ 2020-04-21  1:52 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: mikey, linuxppc-dev, npiggin

On Tuesday, 21 April 2020 11:30:52 AM AEST Alistair Popple wrote:
> On Saturday, 4 April 2020 2:32:08 AM AEST Segher Boessenkool wrote:
> > Hi!
> > 
> > On Fri, Apr 03, 2020 at 03:10:54PM +1100, Alistair Popple wrote:
> > > +#define   PCR_ARCH_300	0x10		/* Architecture 3.00 */
> > 
> > It's called 3.0, not 3.00?
> 
> Thanks. I'll fix that up.

Actually we have already defined it upstream as CPU_FTR_ARCH_300 in arch/
powerpc/include/asm/cputable.h and PVR_ARCH_300 in arch/powerpc/include/asm/
reg.h so for consistency we should make it the same here. So either we leave 
this patch as is or we change it to PCR_ARCH_30 along with the existing 
upstream #defines. Thoughts?

- Alistair

> - Alistair
> 
> > Segher





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc: Add base support for ISA v3.1
  2020-04-21  1:52     ` Alistair Popple
@ 2020-04-21  1:58       ` Oliver O'Halloran
  2020-04-21 17:50         ` Segher Boessenkool
  0 siblings, 1 reply; 8+ messages in thread
From: Oliver O'Halloran @ 2020-04-21  1:58 UTC (permalink / raw)
  To: Alistair Popple; +Cc: Michael Neuling, linuxppc-dev, Nicholas Piggin

On Tue, Apr 21, 2020 at 11:53 AM Alistair Popple <alistair@popple.id.au> wrote:
>
> On Tuesday, 21 April 2020 11:30:52 AM AEST Alistair Popple wrote:
> > On Saturday, 4 April 2020 2:32:08 AM AEST Segher Boessenkool wrote:
> > > Hi!
> > >
> > > On Fri, Apr 03, 2020 at 03:10:54PM +1100, Alistair Popple wrote:
> > > > +#define   PCR_ARCH_300   0x10            /* Architecture 3.00 */
> > >
> > > It's called 3.0, not 3.00?
> >
> > Thanks. I'll fix that up.
>
> Actually we have already defined it upstream as CPU_FTR_ARCH_300 in arch/
> powerpc/include/asm/cputable.h and PVR_ARCH_300 in arch/powerpc/include/asm/
> reg.h so for consistency we should make it the same here. So either we leave
> this patch as is or we change it to PCR_ARCH_30 along with the existing
> upstream #defines. Thoughts?

I used 300 for consistency with the existing three digit definitions
when I added the CPU_FTR macro. It doesn't really matter since these
are all internal definitions, but I SAY THE BIKESHED SHOULD BE THREE
DIGITS LONG.

Oliver

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc: Add base support for ISA v3.1
  2020-04-03 15:32 ` [PATCH 1/2] powerpc: Add base support for ISA v3.1 Segher Boessenkool
  2020-04-21  1:30   ` Alistair Popple
@ 2020-04-21 12:39   ` Michael Ellerman
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2020-04-21 12:39 UTC (permalink / raw)
  To: Segher Boessenkool, Alistair Popple; +Cc: mikey, linuxppc-dev, npiggin

Segher Boessenkool <segher@kernel.crashing.org> writes:
> Hi!
>
> On Fri, Apr 03, 2020 at 03:10:54PM +1100, Alistair Popple wrote:
>> +#define   PCR_ARCH_300	0x10		/* Architecture 3.00 */
>
> It's called 3.0, not 3.00?

It should actually be 3.0B shouldn't it?

cheers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] powerpc: Add base support for ISA v3.1
  2020-04-21  1:58       ` Oliver O'Halloran
@ 2020-04-21 17:50         ` Segher Boessenkool
  0 siblings, 0 replies; 8+ messages in thread
From: Segher Boessenkool @ 2020-04-21 17:50 UTC (permalink / raw)
  To: Oliver O'Halloran
  Cc: Alistair Popple, Michael Neuling, linuxppc-dev, Nicholas Piggin

Hi,

On Tue, Apr 21, 2020 at 11:58:31AM +1000, Oliver O'Halloran wrote:
> On Tue, Apr 21, 2020 at 11:53 AM Alistair Popple <alistair@popple.id.au> wrote:
> >
> > On Tuesday, 21 April 2020 11:30:52 AM AEST Alistair Popple wrote:
> > > On Saturday, 4 April 2020 2:32:08 AM AEST Segher Boessenkool wrote:
> > > > Hi!
> > > >
> > > > On Fri, Apr 03, 2020 at 03:10:54PM +1100, Alistair Popple wrote:
> > > > > +#define   PCR_ARCH_300   0x10            /* Architecture 3.00 */
> > > >
> > > > It's called 3.0, not 3.00?
> > >
> > > Thanks. I'll fix that up.
> >
> > Actually we have already defined it upstream as CPU_FTR_ARCH_300 in arch/
> > powerpc/include/asm/cputable.h and PVR_ARCH_300 in arch/powerpc/include/asm/
> > reg.h so for consistency we should make it the same here. So either we leave
> > this patch as is or we change it to PCR_ARCH_30 along with the existing
> > upstream #defines. Thoughts?
> 
> I used 300 for consistency with the existing three digit definitions
> when I added the CPU_FTR macro. It doesn't really matter since these
> are all internal definitions, but I SAY THE BIKESHED SHOULD BE THREE
> DIGITS LONG.

You can do in your own symbols whatever you want, but the comment is
refering to an existing real-world version of the ISA, namely, 3.0 :-)

(It's important to get names right, and especially in the canonical
places, like this one.  IMO of course).


Segher

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-21 17:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03  4:10 [PATCH 1/2] powerpc: Add base support for ISA v3.1 Alistair Popple
2020-04-03  4:10 ` [PATCH 2/2] powerpc/dt_cpu_ftrs: Advertise support for ISA v3.1 if selected Alistair Popple
2020-04-03 15:32 ` [PATCH 1/2] powerpc: Add base support for ISA v3.1 Segher Boessenkool
2020-04-21  1:30   ` Alistair Popple
2020-04-21  1:52     ` Alistair Popple
2020-04-21  1:58       ` Oliver O'Halloran
2020-04-21 17:50         ` Segher Boessenkool
2020-04-21 12:39   ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.