linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support
@ 2014-06-10  5:04 Benjamin Herrenschmidt
  2014-06-12 15:13 ` Steve Munroe
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2014-06-10  5:04 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Diane Brent, Adhemerval Zanella, Jeffrey Scheel, Steve Munroe,
	Hanns-Joachim Uhl

The Vector Crypto category instructions are supported by current POWER8
chips, advertise them to userspace using a specific bit to properly
differentiate with chips of the same architecture level that might not
have them.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: <stable@vger.kernel.org> [v3.10+]
--

diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h
index 5b76579..de2c0e4 100644
--- a/arch/powerpc/include/uapi/asm/cputable.h
+++ b/arch/powerpc/include/uapi/asm/cputable.h
@@ -41,5 +41,6 @@
 #define PPC_FEATURE2_EBB		0x10000000
 #define PPC_FEATURE2_ISEL		0x08000000
 #define PPC_FEATURE2_TAR		0x04000000
+#define PPC_FEATURE2_VEC_CRYPTO		0x02000000
 
 #endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index c1faade..11da04a 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -109,7 +109,8 @@ extern void __restore_cpu_e6500(void);
 				 PPC_FEATURE_PSERIES_PERFMON_COMPAT)
 #define COMMON_USER2_POWER8	(PPC_FEATURE2_ARCH_2_07 | \
 				 PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_DSCR | \
-				 PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR)
+				 PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
+				 PPC_FEATURE2_VEC_CRYPTO)
 #define COMMON_USER_PA6T	(COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
 				 PPC_FEATURE_TRUE_LE | \
 				 PPC_FEATURE_HAS_ALTIVEC_COMP)

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

* Re: [PATCH] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support
  2014-06-10  5:04 [PATCH] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support Benjamin Herrenschmidt
@ 2014-06-12 15:13 ` Steve Munroe
  2014-06-12 22:03   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Munroe @ 2014-06-12 15:13 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev, Adhemerval Zanella, Michael J Wolf,
	Hanns-Joachim Uhl


[-- Attachment #1.1: Type: text/plain, Size: 3660 bytes --]


The precedent we have used is that features that refer to ISA Categories
include _HAS_ following the PPC_FEATURE[2]. So GLIBC specifies in hwcap.h:

/* Feature definitions in AT_HWCAP2.  */
#define PPC_FEATURE2_ARCH_2_07     0x80000000 /* ISA 2.07 */
#define PPC_FEATURE2_HAS_HTM       0x40000000 /* Hardware Transactional
                                                 Memory */
#define PPC_FEATURE2_HAS_DSCR      0x20000000 /* Data Stream Control
                                                 Register */
#define PPC_FEATURE2_HAS_EBB       0x10000000 /* Event Base Branching */
#define PPC_FEATURE2_HAS_ISEL      0x08000000 /* Integer Select */
#define PPC_FEATURE2_HAS_TAR       0x04000000 /* Target Address Register */

This was carried from the original AT_HWCAP defines.

$ grep _HAS_ ./sysdeps/powerpc/bits/hwcap.h
#define PPC_FEATURE_HAS_ALTIVEC	    0x10000000 /* SIMD/Vector Unit.  */
#define PPC_FEATURE_HAS_FPU	    0x08000000 /* Floating Point Unit.  */
#define PPC_FEATURE_HAS_MMU	    0x04000000 /* Memory Management Unit.  */
#define PPC_FEATURE_HAS_4xxMAC	    0x02000000 /* 4xx Multiply
Accumulator.  */
#define PPC_FEATURE_HAS_SPE	    0x00800000 /* Signal Processing ext.  */
#define PPC_FEATURE_HAS_EFP_SINGLE  0x00400000 /* SPE Float.  */
#define PPC_FEATURE_HAS_EFP_DOUBLE  0x00200000 /* SPE Double.  */
#define PPC_FEATURE_HAS_DFP	    0x00000400 /* Decimal FP Unit */
#define PPC_FEATURE_HAS_VSX	    0x00000080 /* P7 Vector Extension.  */

So could we agree on PPC_FEATURE2_HAS_VEC_CRYPTO or the shorter
PPC_FEATURE2_HAS_VCRYPTO?

Steven J. Munroe
Linux on Power Toolchain Architect
IBM Corporation, Linux Technology Center




From:	Benjamin Herrenschmidt <benh@kernel.crashing.org>
To:	linuxppc-dev@ozlabs.org
Cc:	Steve Munroe/Rochester/IBM@IBMUS, Hanns-Joachim Uhl
            <hannsj_uhl@de.ibm.com>, Diane Brent/Poughkeepsie/IBM@IBMUS,
            Jeffrey Scheel/Rochester/IBM@IBMUS, Adhemerval Zanella
            <azanella@linux.vnet.ibm.com>
Date:	06/10/2014 12:05 AM
Subject:	[PATCH] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category
            support



The Vector Crypto category instructions are supported by current POWER8
chips, advertise them to userspace using a specific bit to properly
differentiate with chips of the same architecture level that might not
have them.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: <stable@vger.kernel.org> [v3.10+]
--

diff --git a/arch/powerpc/include/uapi/asm/cputable.h
b/arch/powerpc/include/uapi/asm/cputable.h
index 5b76579..de2c0e4 100644
--- a/arch/powerpc/include/uapi/asm/cputable.h
+++ b/arch/powerpc/include/uapi/asm/cputable.h
@@ -41,5 +41,6 @@
 #define PPC_FEATURE2_EBB		 		 0x10000000
 #define PPC_FEATURE2_ISEL		 		 0x08000000
 #define PPC_FEATURE2_TAR		 		 0x04000000
+#define PPC_FEATURE2_VEC_CRYPTO		 		 0x02000000

 #endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
diff --git a/arch/powerpc/kernel/cputable.c
b/arch/powerpc/kernel/cputable.c
index c1faade..11da04a 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -109,7 +109,8 @@ extern void __restore_cpu_e6500(void);

PPC_FEATURE_PSERIES_PERFMON_COMPAT)
 #define COMMON_USER2_POWER8		 (PPC_FEATURE2_ARCH_2_07 | \
 		 		 		 		  PPC_FEATURE2_HTM_COMP |
PPC_FEATURE2_DSCR | \
-		 		 		 		  PPC_FEATURE2_ISEL |
PPC_FEATURE2_TAR)
+		 		 		 		  PPC_FEATURE2_ISEL |
PPC_FEATURE2_TAR | \
+		 		 		 		  PPC_FEATURE2_VEC_CRYPTO)
 #define COMMON_USER_PA6T		 (COMMON_USER_PPC64 | PPC_FEATURE_PA6T
|\
 		 		 		 		  PPC_FEATURE_TRUE_LE | \

PPC_FEATURE_HAS_ALTIVEC_COMP)



[-- Attachment #1.2: Type: text/html, Size: 6435 bytes --]

[-- Attachment #2: graycol.gif --]
[-- Type: image/gif, Size: 105 bytes --]

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

* Re: [PATCH] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support
  2014-06-12 15:13 ` Steve Munroe
@ 2014-06-12 22:03   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2014-06-12 22:03 UTC (permalink / raw)
  To: Steve Munroe
  Cc: linuxppc-dev, Adhemerval Zanella, Michael J Wolf,
	Hanns-Joachim Uhl

On Thu, 2014-06-12 at 10:13 -0500, Steve Munroe wrote:
> The precedent we have used is that features that refer to ISA Categories include _HAS_ following the PPC_FEATURE[2]. So GLIBC specifies in hwcap.h:
> 
> /* Feature definitions in AT_HWCAP2.  */
> #define PPC_FEATURE2_ARCH_2_07     0x80000000 /* ISA 2.07 */
> #define PPC_FEATURE2_HAS_HTM       0x40000000 /* Hardware Transactional
>                                                  Memory */
> #define PPC_FEATURE2_HAS_DSCR      0x20000000 /* Data Stream Control
>                                                  Register */
> #define PPC_FEATURE2_HAS_EBB       0x10000000 /* Event Base Branching */
> #define PPC_FEATURE2_HAS_ISEL      0x08000000 /* Integer Select */
> #define PPC_FEATURE2_HAS_TAR       0x04000000 /* Target Address Register */
> 
> This was carried from the original AT_HWCAP defines.

Off, they don't have the "HAS" in the kernel definitions...

> $ grep _HAS_ ./sysdeps/powerpc/bits/hwcap.h
> #define PPC_FEATURE_HAS_ALTIVEC    0x10000000 /* SIMD/Vector Unit.  */
> #define PPC_FEATURE_HAS_FPU    0x08000000 /* Floating Point Unit.  */
> #define PPC_FEATURE_HAS_MMU    0x04000000 /* Memory Management Unit.  */
> #define PPC_FEATURE_HAS_4xxMAC    0x02000000 /* 4xx Multiply Accumulator.  */
> #define PPC_FEATURE_HAS_SPE    0x00800000 /* Signal Processing ext.  */
> #define PPC_FEATURE_HAS_EFP_SINGLE  0x00400000 /* SPE Float.  */
> #define PPC_FEATURE_HAS_EFP_DOUBLE  0x00200000 /* SPE Double.  */
> #define PPC_FEATURE_HAS_DFP    0x00000400 /* Decimal FP Unit */
> #define PPC_FEATURE_HAS_VSX    0x00000080 /* P7 Vector Extension.  */
> 
> So could we agree on PPC_FEATURE2_HAS_VEC_CRYPTO or the shorter PPC_FEATURE2_HAS_VCRYPTO?

Well, I made it consistent with the other HWCAP2 bits exposed by the
kernel which seem to differ from the glibc versions :-(

In any case, I've merged it but I can do a follow up patch that adds
the _HAS_ everywhere, hopefully nobody in userspace use the kernel
definition and they use the glibc one instead.

In that case, go for VCRYPTO.

Cheers,
Ben.

> Steven J. Munroe
> Linux on Power Toolchain Architect
> IBM Corporation, Linux Technology Center
> 
> 
> Inactive hide details for Benjamin Herrenschmidt ---06/10/2014 12:05:07 AM---The Vector Crypto category instructions are supporBenjamin Herrenschmidt ---06/10/2014 12:05:07 AM---The Vector Crypto category instructions are supported by current POWER8 chips, advertise them to use
> 
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> To: linuxppc-dev@ozlabs.org
> Cc: Steve Munroe/Rochester/IBM@IBMUS, Hanns-Joachim Uhl <hannsj_uhl@de.ibm.com>, Diane Brent/Poughkeepsie/IBM@IBMUS, Jeffrey Scheel/Rochester/IBM@IBMUS, Adhemerval Zanella <azanella@linux.vnet.ibm.com>
> Date: 06/10/2014 12:05 AM
> Subject: [PATCH] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support
> 
> 
> 
> ______________________________________________________________________
> 
> 
> 
> The Vector Crypto category instructions are supported by current POWER8
> chips, advertise them to userspace using a specific bit to properly
> differentiate with chips of the same architecture level that might not
> have them.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: <stable@vger.kernel.org> [v3.10+]
> --
> 
> diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h
> index 5b76579..de2c0e4 100644
> --- a/arch/powerpc/include/uapi/asm/cputable.h
> +++ b/arch/powerpc/include/uapi/asm/cputable.h
> @@ -41,5 +41,6 @@
> #define PPC_FEATURE2_EBB 0x10000000
> #define PPC_FEATURE2_ISEL 0x08000000
> #define PPC_FEATURE2_TAR 0x04000000
> +#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
> 
> #endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
> diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
> index c1faade..11da04a 100644
> --- a/arch/powerpc/kernel/cputable.c
> +++ b/arch/powerpc/kernel/cputable.c
> @@ -109,7 +109,8 @@ extern void __restore_cpu_e6500(void);
>  PPC_FEATURE_PSERIES_PERFMON_COMPAT)
> #define COMMON_USER2_POWER8 (PPC_FEATURE2_ARCH_2_07 | \
>  PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_DSCR | \
> -  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR)
> +  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
> +  PPC_FEATURE2_VEC_CRYPTO)
> #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
>  PPC_FEATURE_TRUE_LE | \
>  PPC_FEATURE_HAS_ALTIVEC_COMP)
> 
> 
> 

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

end of thread, other threads:[~2014-06-12 22:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-10  5:04 [PATCH] powerpc: Add AT_HWCAP2 to indicate V.CRYPTO category support Benjamin Herrenschmidt
2014-06-12 15:13 ` Steve Munroe
2014-06-12 22:03   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).