All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: Add HWCAP2 aux entry
@ 2013-04-02 21:22 ` Nishanth Aravamudan
  0 siblings, 0 replies; 11+ messages in thread
From: Nishanth Aravamudan @ 2013-04-02 21:22 UTC (permalink / raw)
  To: benh
  Cc: Ryan Arnold, Steve Munroe, michaele, paulus, linuxppc-dev, linux-kernel

From: Michael Neuling <michael.neuling@au1.ibm.com>

We are currently out of free bits in AT_HWCAP. With POWER8, we have
several hardware features that we need to advertise. Tested on POWER and
x86.

Signed-off-by: Michael Neuling <michael.neuling@au1.ibm.com>
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>

diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index fb3245e..ccadad6 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -52,6 +52,7 @@ struct cpu_spec {
 	char		*cpu_name;
 	unsigned long	cpu_features;		/* Kernel features */
 	unsigned int	cpu_user_features;	/* Userland features */
+	unsigned int	cpu_user_features2;	/* Userland features v2 */
 	unsigned int	mmu_features;		/* MMU features */
 
 	/* cache line sizes */
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index ac9790f..cc0655a 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
    instruction set this cpu supports.  This could be done in userspace,
    but it's not easy, and we've already done it here.  */
 # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
+# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
 
 /* This yields a string that ld.so will use to load implementation
    specific libraries for optimization.  This is more specific in
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 3939829..51adc23 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -140,6 +140,13 @@ static int padzero(unsigned long elf_bss)
 #define ELF_BASE_PLATFORM NULL
 #endif
 
+/*
+ * Most archs don't need this
+ */
+#ifndef ELF_HWCAP2
+#define ELF_HWCAP2 (0)
+#endif
+
 static int
 create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
 		unsigned long load_addr, unsigned long interp_load_addr)
@@ -240,6 +247,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
 	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
  	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
 	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
+	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
 	NEW_AUX_ENT(AT_EXECFN, bprm->exec);
 	if (k_platform) {
 		NEW_AUX_ENT(AT_PLATFORM,
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 9c13e02..0b553d3 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -469,6 +469,13 @@ error_kill:
 #endif
 
 /*
+ * Most archs don't need this
+ */
+#ifndef ELF_HWCAP2
+#define ELF_HWCAP2 (0)
+#endif
+
+/*
  * present useful information to the program by shovelling it onto the new
  * process's stack
  */
@@ -483,7 +490,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 	size_t platform_len = 0, len;
 	char *k_platform, *k_base_platform;
 	char __user *u_platform, *u_base_platform, *p;
-	long hwcap;
 	int loop;
 	int nr;	/* reset for each csp adjustment */
 
@@ -502,8 +508,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 		return -EFAULT;
 #endif
 
-	hwcap = ELF_HWCAP;
-
 	/*
 	 * If this architecture has a platform capability string, copy it
 	 * to userspace.  In some cases (Sparc), this info is impossible
@@ -617,7 +621,8 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 
 	nr = 0;
 	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
-	NEW_AUX_ENT(AT_HWCAP,	hwcap);
+	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
+	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
 	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
 	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
 	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
index 61594d5..835c065 100644
--- a/include/uapi/linux/auxvec.h
+++ b/include/uapi/linux/auxvec.h
@@ -28,6 +28,7 @@
 #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
 				 * differ from AT_PLATFORM. */
 #define AT_RANDOM 25	/* address of 16 random bytes */
+#define AT_HWCAP2 26	/* extension of AT_HWCAP */
 
 #define AT_EXECFN  31	/* filename of program */
 


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

* [PATCH] powerpc: Add HWCAP2 aux entry
@ 2013-04-02 21:22 ` Nishanth Aravamudan
  0 siblings, 0 replies; 11+ messages in thread
From: Nishanth Aravamudan @ 2013-04-02 21:22 UTC (permalink / raw)
  To: benh
  Cc: michaele, Steve Munroe, linux-kernel, paulus, Ryan Arnold, linuxppc-dev

From: Michael Neuling <michael.neuling@au1.ibm.com>

We are currently out of free bits in AT_HWCAP. With POWER8, we have
several hardware features that we need to advertise. Tested on POWER and
x86.

Signed-off-by: Michael Neuling <michael.neuling@au1.ibm.com>
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>

diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index fb3245e..ccadad6 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -52,6 +52,7 @@ struct cpu_spec {
 	char		*cpu_name;
 	unsigned long	cpu_features;		/* Kernel features */
 	unsigned int	cpu_user_features;	/* Userland features */
+	unsigned int	cpu_user_features2;	/* Userland features v2 */
 	unsigned int	mmu_features;		/* MMU features */
 
 	/* cache line sizes */
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index ac9790f..cc0655a 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
    instruction set this cpu supports.  This could be done in userspace,
    but it's not easy, and we've already done it here.  */
 # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
+# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
 
 /* This yields a string that ld.so will use to load implementation
    specific libraries for optimization.  This is more specific in
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 3939829..51adc23 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -140,6 +140,13 @@ static int padzero(unsigned long elf_bss)
 #define ELF_BASE_PLATFORM NULL
 #endif
 
+/*
+ * Most archs don't need this
+ */
+#ifndef ELF_HWCAP2
+#define ELF_HWCAP2 (0)
+#endif
+
 static int
 create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
 		unsigned long load_addr, unsigned long interp_load_addr)
@@ -240,6 +247,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
 	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
  	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
 	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
+	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
 	NEW_AUX_ENT(AT_EXECFN, bprm->exec);
 	if (k_platform) {
 		NEW_AUX_ENT(AT_PLATFORM,
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 9c13e02..0b553d3 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -469,6 +469,13 @@ error_kill:
 #endif
 
 /*
+ * Most archs don't need this
+ */
+#ifndef ELF_HWCAP2
+#define ELF_HWCAP2 (0)
+#endif
+
+/*
  * present useful information to the program by shovelling it onto the new
  * process's stack
  */
@@ -483,7 +490,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 	size_t platform_len = 0, len;
 	char *k_platform, *k_base_platform;
 	char __user *u_platform, *u_base_platform, *p;
-	long hwcap;
 	int loop;
 	int nr;	/* reset for each csp adjustment */
 
@@ -502,8 +508,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 		return -EFAULT;
 #endif
 
-	hwcap = ELF_HWCAP;
-
 	/*
 	 * If this architecture has a platform capability string, copy it
 	 * to userspace.  In some cases (Sparc), this info is impossible
@@ -617,7 +621,8 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 
 	nr = 0;
 	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
-	NEW_AUX_ENT(AT_HWCAP,	hwcap);
+	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
+	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
 	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
 	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
 	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
index 61594d5..835c065 100644
--- a/include/uapi/linux/auxvec.h
+++ b/include/uapi/linux/auxvec.h
@@ -28,6 +28,7 @@
 #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
 				 * differ from AT_PLATFORM. */
 #define AT_RANDOM 25	/* address of 16 random bytes */
+#define AT_HWCAP2 26	/* extension of AT_HWCAP */
 
 #define AT_EXECFN  31	/* filename of program */
 

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

* Re: [PATCH] powerpc: Add HWCAP2 aux entry
  2013-04-02 21:22 ` Nishanth Aravamudan
@ 2013-04-05  7:06   ` Michael Ellerman
  -1 siblings, 0 replies; 11+ messages in thread
From: Michael Ellerman @ 2013-04-05  7:06 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: benh, michaele, Steve Munroe, linux-kernel, paulus, Ryan Arnold,
	linuxppc-dev, akpm, vda.linux, viro

Hi guys,

Added some folks to CC, blame scripts/get_maintainer.pl.

Comment below ..


On Tue, Apr 02, 2013 at 02:22:05PM -0700, Nishanth Aravamudan wrote:
> From: Michael Neuling <michael.neuling@au1.ibm.com>
> 
> We are currently out of free bits in AT_HWCAP. With POWER8, we have
> several hardware features that we need to advertise. Tested on POWER and
> x86.
> 
> Signed-off-by: Michael Neuling <michael.neuling@au1.ibm.com>
> Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> 
> diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
> index fb3245e..ccadad6 100644
> --- a/arch/powerpc/include/asm/cputable.h
> +++ b/arch/powerpc/include/asm/cputable.h
> @@ -52,6 +52,7 @@ struct cpu_spec {
>  	char		*cpu_name;
>  	unsigned long	cpu_features;		/* Kernel features */
>  	unsigned int	cpu_user_features;	/* Userland features */
> +	unsigned int	cpu_user_features2;	/* Userland features v2 */
>  	unsigned int	mmu_features;		/* MMU features */
>  
>  	/* cache line sizes */
> diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
> index ac9790f..cc0655a 100644
> --- a/arch/powerpc/include/asm/elf.h
> +++ b/arch/powerpc/include/asm/elf.h
> @@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
>     instruction set this cpu supports.  This could be done in userspace,
>     but it's not easy, and we've already done it here.  */
>  # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
> +# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
>  
>  /* This yields a string that ld.so will use to load implementation
>     specific libraries for optimization.  This is more specific in
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 3939829..51adc23 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -140,6 +140,13 @@ static int padzero(unsigned long elf_bss)
>  #define ELF_BASE_PLATFORM NULL
>  #endif
>  
> +/*
> + * Most archs don't need this
> + */
> +#ifndef ELF_HWCAP2
> +#define ELF_HWCAP2 (0)
> +#endif
> +
>  static int
>  create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
>  		unsigned long load_addr, unsigned long interp_load_addr)
> @@ -240,6 +247,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
>  	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
>   	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
>  	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
> +	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);


Wouldn't it be safer to not emit AT_HWCAP2 unless it is defined by the arch?

That way the change would only impact powerpc.


cheers



> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index 9c13e02..0b553d3 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -469,6 +469,13 @@ error_kill:
>  #endif
>  
>  /*
> + * Most archs don't need this
> + */
> +#ifndef ELF_HWCAP2
> +#define ELF_HWCAP2 (0)
> +#endif
> +
> +/*
>   * present useful information to the program by shovelling it onto the new
>   * process's stack
>   */
> @@ -483,7 +490,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  	size_t platform_len = 0, len;
>  	char *k_platform, *k_base_platform;
>  	char __user *u_platform, *u_base_platform, *p;
> -	long hwcap;
>  	int loop;
>  	int nr;	/* reset for each csp adjustment */
>  
> @@ -502,8 +508,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  		return -EFAULT;
>  #endif
>  
> -	hwcap = ELF_HWCAP;
> -
>  	/*
>  	 * If this architecture has a platform capability string, copy it
>  	 * to userspace.  In some cases (Sparc), this info is impossible
> @@ -617,7 +621,8 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  
>  	nr = 0;
>  	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
> -	NEW_AUX_ENT(AT_HWCAP,	hwcap);
> +	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
> +	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
>  	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
>  	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
>  	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
> diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
> index 61594d5..835c065 100644
> --- a/include/uapi/linux/auxvec.h
> +++ b/include/uapi/linux/auxvec.h
> @@ -28,6 +28,7 @@
>  #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
>  				 * differ from AT_PLATFORM. */
>  #define AT_RANDOM 25	/* address of 16 random bytes */
> +#define AT_HWCAP2 26	/* extension of AT_HWCAP */
>  
>  #define AT_EXECFN  31	/* filename of program */
>  
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

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

* Re: [PATCH] powerpc: Add HWCAP2 aux entry
@ 2013-04-05  7:06   ` Michael Ellerman
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Ellerman @ 2013-04-05  7:06 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: michaele, vda.linux, Steve Munroe, linux-kernel, paulus, viro,
	Ryan Arnold, linuxppc-dev, akpm

Hi guys,

Added some folks to CC, blame scripts/get_maintainer.pl.

Comment below ..


On Tue, Apr 02, 2013 at 02:22:05PM -0700, Nishanth Aravamudan wrote:
> From: Michael Neuling <michael.neuling@au1.ibm.com>
> 
> We are currently out of free bits in AT_HWCAP. With POWER8, we have
> several hardware features that we need to advertise. Tested on POWER and
> x86.
> 
> Signed-off-by: Michael Neuling <michael.neuling@au1.ibm.com>
> Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> 
> diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
> index fb3245e..ccadad6 100644
> --- a/arch/powerpc/include/asm/cputable.h
> +++ b/arch/powerpc/include/asm/cputable.h
> @@ -52,6 +52,7 @@ struct cpu_spec {
>  	char		*cpu_name;
>  	unsigned long	cpu_features;		/* Kernel features */
>  	unsigned int	cpu_user_features;	/* Userland features */
> +	unsigned int	cpu_user_features2;	/* Userland features v2 */
>  	unsigned int	mmu_features;		/* MMU features */
>  
>  	/* cache line sizes */
> diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
> index ac9790f..cc0655a 100644
> --- a/arch/powerpc/include/asm/elf.h
> +++ b/arch/powerpc/include/asm/elf.h
> @@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
>     instruction set this cpu supports.  This could be done in userspace,
>     but it's not easy, and we've already done it here.  */
>  # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
> +# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
>  
>  /* This yields a string that ld.so will use to load implementation
>     specific libraries for optimization.  This is more specific in
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 3939829..51adc23 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -140,6 +140,13 @@ static int padzero(unsigned long elf_bss)
>  #define ELF_BASE_PLATFORM NULL
>  #endif
>  
> +/*
> + * Most archs don't need this
> + */
> +#ifndef ELF_HWCAP2
> +#define ELF_HWCAP2 (0)
> +#endif
> +
>  static int
>  create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
>  		unsigned long load_addr, unsigned long interp_load_addr)
> @@ -240,6 +247,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
>  	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
>   	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
>  	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
> +	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);


Wouldn't it be safer to not emit AT_HWCAP2 unless it is defined by the arch?

That way the change would only impact powerpc.


cheers



> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index 9c13e02..0b553d3 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -469,6 +469,13 @@ error_kill:
>  #endif
>  
>  /*
> + * Most archs don't need this
> + */
> +#ifndef ELF_HWCAP2
> +#define ELF_HWCAP2 (0)
> +#endif
> +
> +/*
>   * present useful information to the program by shovelling it onto the new
>   * process's stack
>   */
> @@ -483,7 +490,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  	size_t platform_len = 0, len;
>  	char *k_platform, *k_base_platform;
>  	char __user *u_platform, *u_base_platform, *p;
> -	long hwcap;
>  	int loop;
>  	int nr;	/* reset for each csp adjustment */
>  
> @@ -502,8 +508,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  		return -EFAULT;
>  #endif
>  
> -	hwcap = ELF_HWCAP;
> -
>  	/*
>  	 * If this architecture has a platform capability string, copy it
>  	 * to userspace.  In some cases (Sparc), this info is impossible
> @@ -617,7 +621,8 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  
>  	nr = 0;
>  	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
> -	NEW_AUX_ENT(AT_HWCAP,	hwcap);
> +	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
> +	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
>  	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
>  	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
>  	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
> diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
> index 61594d5..835c065 100644
> --- a/include/uapi/linux/auxvec.h
> +++ b/include/uapi/linux/auxvec.h
> @@ -28,6 +28,7 @@
>  #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
>  				 * differ from AT_PLATFORM. */
>  #define AT_RANDOM 25	/* address of 16 random bytes */
> +#define AT_HWCAP2 26	/* extension of AT_HWCAP */
>  
>  #define AT_EXECFN  31	/* filename of program */
>  
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

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

* [PATCH] powerpc: Add HWCAP2 aux entry
       [not found]   ` <27144.1366001074@ale.ozlabs.ibm.com>
@ 2013-04-18  3:33     ` Michael Neuling
  2013-04-18  3:41         ` Michael Neuling
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Neuling @ 2013-04-18  3:33 UTC (permalink / raw)
  To: Michael Ellerman, Nishanth Aravamudan
  Cc: vda.linux, Steve Munroe, linux-kernel, paulus, viro, Ryan Arnold,
	linuxppc-dev, akpm

We are currently out of free bits in AT_HWCAP. With POWER8, we have
several hardware features that we need to advertise. 

Tested on POWER and x86.

Signed-off-by: Michael Neuling <michael@neuling.org>
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
---

> Wouldn't it be safer to not emit AT_HWCAP2 unless it is defined by the arch?
> 
> That way the change would only impact powerpc.

Should be addressed with this version.

Mikey

diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index fb3245e..ccadad6 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -52,6 +52,7 @@ struct cpu_spec {
 	char		*cpu_name;
 	unsigned long	cpu_features;		/* Kernel features */
 	unsigned int	cpu_user_features;	/* Userland features */
+	unsigned int	cpu_user_features2;	/* Userland features v2 */
 	unsigned int	mmu_features;		/* MMU features */
 
 	/* cache line sizes */
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index ac9790f..cc0655a 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
    instruction set this cpu supports.  This could be done in userspace,
    but it's not easy, and we've already done it here.  */
 # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
+# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
 
 /* This yields a string that ld.so will use to load implementation
    specific libraries for optimization.  This is more specific in
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 3939829..1f8b5d5 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -240,6 +240,9 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
 	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
  	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
 	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
+#ifdef ELF_HWCAP2
+	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
+#endif
 	NEW_AUX_ENT(AT_EXECFN, bprm->exec);
 	if (k_platform) {
 		NEW_AUX_ENT(AT_PLATFORM,
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 9c13e02..bf2381d 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -483,7 +483,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 	size_t platform_len = 0, len;
 	char *k_platform, *k_base_platform;
 	char __user *u_platform, *u_base_platform, *p;
-	long hwcap;
 	int loop;
 	int nr;	/* reset for each csp adjustment */
 
@@ -502,8 +501,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 		return -EFAULT;
 #endif
 
-	hwcap = ELF_HWCAP;
-
 	/*
 	 * If this architecture has a platform capability string, copy it
 	 * to userspace.  In some cases (Sparc), this info is impossible
@@ -617,7 +614,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 
 	nr = 0;
 	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
-	NEW_AUX_ENT(AT_HWCAP,	hwcap);
+	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
+#ifdef ELF_HWCAP2
+	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
+#endif
 	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
 	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
 	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
index 61594d5..835c065 100644
--- a/include/uapi/linux/auxvec.h
+++ b/include/uapi/linux/auxvec.h
@@ -28,6 +28,7 @@
 #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
 				 * differ from AT_PLATFORM. */
 #define AT_RANDOM 25	/* address of 16 random bytes */
+#define AT_HWCAP2 26	/* extension of AT_HWCAP */
 
 #define AT_EXECFN  31	/* filename of program */
 

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

* Re: [PATCH] powerpc: Add HWCAP2 aux entry
  2013-04-18  3:33     ` Michael Neuling
@ 2013-04-18  3:41         ` Michael Neuling
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Neuling @ 2013-04-18  3:41 UTC (permalink / raw)
  To: akpm
  Cc: vda.linux, Steve Munroe, linux-kernel, paulus, viro, Ryan Arnold,
	linuxppc-dev, michael, Nishanth Aravamudan

akpm,

If you're happy with this, is it something you can take in your tree?

Mikey

Michael Neuling <mikey@neuling.org> wrote:
> We are currently out of free bits in AT_HWCAP. With POWER8, we have
> several hardware features that we need to advertise. 
> 
> Tested on POWER and x86.
> 
> Signed-off-by: Michael Neuling <michael@neuling.org>
> Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> ---
> 
> > Wouldn't it be safer to not emit AT_HWCAP2 unless it is defined by the arch?
> > 
> > That way the change would only impact powerpc.
> 
> Should be addressed with this version.
> 
> Mikey
> 
> diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
> index fb3245e..ccadad6 100644
> --- a/arch/powerpc/include/asm/cputable.h
> +++ b/arch/powerpc/include/asm/cputable.h
> @@ -52,6 +52,7 @@ struct cpu_spec {
>  	char		*cpu_name;
>  	unsigned long	cpu_features;		/* Kernel features */
>  	unsigned int	cpu_user_features;	/* Userland features */
> +	unsigned int	cpu_user_features2;	/* Userland features v2 */
>  	unsigned int	mmu_features;		/* MMU features */
>  
>  	/* cache line sizes */
> diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
> index ac9790f..cc0655a 100644
> --- a/arch/powerpc/include/asm/elf.h
> +++ b/arch/powerpc/include/asm/elf.h
> @@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
>     instruction set this cpu supports.  This could be done in userspace,
>     but it's not easy, and we've already done it here.  */
>  # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
> +# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
>  
>  /* This yields a string that ld.so will use to load implementation
>     specific libraries for optimization.  This is more specific in
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 3939829..1f8b5d5 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -240,6 +240,9 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
>  	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
>   	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
>  	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
> +#ifdef ELF_HWCAP2
> +	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
> +#endif
>  	NEW_AUX_ENT(AT_EXECFN, bprm->exec);
>  	if (k_platform) {
>  		NEW_AUX_ENT(AT_PLATFORM,
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index 9c13e02..bf2381d 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -483,7 +483,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  	size_t platform_len = 0, len;
>  	char *k_platform, *k_base_platform;
>  	char __user *u_platform, *u_base_platform, *p;
> -	long hwcap;
>  	int loop;
>  	int nr;	/* reset for each csp adjustment */
>  
> @@ -502,8 +501,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  		return -EFAULT;
>  #endif
>  
> -	hwcap = ELF_HWCAP;
> -
>  	/*
>  	 * If this architecture has a platform capability string, copy it
>  	 * to userspace.  In some cases (Sparc), this info is impossible
> @@ -617,7 +614,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  
>  	nr = 0;
>  	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
> -	NEW_AUX_ENT(AT_HWCAP,	hwcap);
> +	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
> +#ifdef ELF_HWCAP2
> +	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
> +#endif
>  	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
>  	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
>  	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
> diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
> index 61594d5..835c065 100644
> --- a/include/uapi/linux/auxvec.h
> +++ b/include/uapi/linux/auxvec.h
> @@ -28,6 +28,7 @@
>  #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
>  				 * differ from AT_PLATFORM. */
>  #define AT_RANDOM 25	/* address of 16 random bytes */
> +#define AT_HWCAP2 26	/* extension of AT_HWCAP */
>  
>  #define AT_EXECFN  31	/* filename of program */
>  
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

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

* Re: [PATCH] powerpc: Add HWCAP2 aux entry
@ 2013-04-18  3:41         ` Michael Neuling
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Neuling @ 2013-04-18  3:41 UTC (permalink / raw)
  To: akpm
  Cc: vda.linux, Nishanth Aravamudan, Steve Munroe, linux-kernel,
	paulus, viro, Ryan Arnold, linuxppc-dev

akpm,

If you're happy with this, is it something you can take in your tree?

Mikey

Michael Neuling <mikey@neuling.org> wrote:
> We are currently out of free bits in AT_HWCAP. With POWER8, we have
> several hardware features that we need to advertise. 
> 
> Tested on POWER and x86.
> 
> Signed-off-by: Michael Neuling <michael@neuling.org>
> Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> ---
> 
> > Wouldn't it be safer to not emit AT_HWCAP2 unless it is defined by the arch?
> > 
> > That way the change would only impact powerpc.
> 
> Should be addressed with this version.
> 
> Mikey
> 
> diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
> index fb3245e..ccadad6 100644
> --- a/arch/powerpc/include/asm/cputable.h
> +++ b/arch/powerpc/include/asm/cputable.h
> @@ -52,6 +52,7 @@ struct cpu_spec {
>  	char		*cpu_name;
>  	unsigned long	cpu_features;		/* Kernel features */
>  	unsigned int	cpu_user_features;	/* Userland features */
> +	unsigned int	cpu_user_features2;	/* Userland features v2 */
>  	unsigned int	mmu_features;		/* MMU features */
>  
>  	/* cache line sizes */
> diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
> index ac9790f..cc0655a 100644
> --- a/arch/powerpc/include/asm/elf.h
> +++ b/arch/powerpc/include/asm/elf.h
> @@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
>     instruction set this cpu supports.  This could be done in userspace,
>     but it's not easy, and we've already done it here.  */
>  # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
> +# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
>  
>  /* This yields a string that ld.so will use to load implementation
>     specific libraries for optimization.  This is more specific in
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 3939829..1f8b5d5 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -240,6 +240,9 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
>  	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
>   	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
>  	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
> +#ifdef ELF_HWCAP2
> +	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
> +#endif
>  	NEW_AUX_ENT(AT_EXECFN, bprm->exec);
>  	if (k_platform) {
>  		NEW_AUX_ENT(AT_PLATFORM,
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index 9c13e02..bf2381d 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -483,7 +483,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  	size_t platform_len = 0, len;
>  	char *k_platform, *k_base_platform;
>  	char __user *u_platform, *u_base_platform, *p;
> -	long hwcap;
>  	int loop;
>  	int nr;	/* reset for each csp adjustment */
>  
> @@ -502,8 +501,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  		return -EFAULT;
>  #endif
>  
> -	hwcap = ELF_HWCAP;
> -
>  	/*
>  	 * If this architecture has a platform capability string, copy it
>  	 * to userspace.  In some cases (Sparc), this info is impossible
> @@ -617,7 +614,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
>  
>  	nr = 0;
>  	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
> -	NEW_AUX_ENT(AT_HWCAP,	hwcap);
> +	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
> +#ifdef ELF_HWCAP2
> +	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
> +#endif
>  	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
>  	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
>  	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
> diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
> index 61594d5..835c065 100644
> --- a/include/uapi/linux/auxvec.h
> +++ b/include/uapi/linux/auxvec.h
> @@ -28,6 +28,7 @@
>  #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
>  				 * differ from AT_PLATFORM. */
>  #define AT_RANDOM 25	/* address of 16 random bytes */
> +#define AT_HWCAP2 26	/* extension of AT_HWCAP */
>  
>  #define AT_EXECFN  31	/* filename of program */
>  
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

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

* Re: [PATCH] powerpc: Add HWCAP2 aux entry
  2013-04-18  3:41         ` Michael Neuling
@ 2013-04-23  0:41           ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2013-04-23  0:41 UTC (permalink / raw)
  To: Michael Neuling
  Cc: akpm, vda.linux, Nishanth Aravamudan, Steve Munroe, linux-kernel,
	paulus, viro, Ryan Arnold, linuxppc-dev

On Thu, 2013-04-18 at 13:41 +1000, Michael Neuling wrote:
> akpm,
> 
> If you're happy with this, is it something you can take in your tree?

Andrew ? Or give me an ack ? :-) I'm happy to carry this, we need that
rather urgently and we have the glibc folks on board.

Cheers,
Ben.

> Mikey
> 
> Michael Neuling <mikey@neuling.org> wrote:
> > We are currently out of free bits in AT_HWCAP. With POWER8, we have
> > several hardware features that we need to advertise. 
> > 
> > Tested on POWER and x86.
> > 
> > Signed-off-by: Michael Neuling <michael@neuling.org>
> > Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> > ---
> > 
> > > Wouldn't it be safer to not emit AT_HWCAP2 unless it is defined by the arch?
> > > 
> > > That way the change would only impact powerpc.
> > 
> > Should be addressed with this version.
> > 
> > Mikey
> > 
> > diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
> > index fb3245e..ccadad6 100644
> > --- a/arch/powerpc/include/asm/cputable.h
> > +++ b/arch/powerpc/include/asm/cputable.h
> > @@ -52,6 +52,7 @@ struct cpu_spec {
> >  	char		*cpu_name;
> >  	unsigned long	cpu_features;		/* Kernel features */
> >  	unsigned int	cpu_user_features;	/* Userland features */
> > +	unsigned int	cpu_user_features2;	/* Userland features v2 */
> >  	unsigned int	mmu_features;		/* MMU features */
> >  
> >  	/* cache line sizes */
> > diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
> > index ac9790f..cc0655a 100644
> > --- a/arch/powerpc/include/asm/elf.h
> > +++ b/arch/powerpc/include/asm/elf.h
> > @@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
> >     instruction set this cpu supports.  This could be done in userspace,
> >     but it's not easy, and we've already done it here.  */
> >  # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
> > +# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
> >  
> >  /* This yields a string that ld.so will use to load implementation
> >     specific libraries for optimization.  This is more specific in
> > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> > index 3939829..1f8b5d5 100644
> > --- a/fs/binfmt_elf.c
> > +++ b/fs/binfmt_elf.c
> > @@ -240,6 +240,9 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
> >  	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
> >   	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
> >  	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
> > +#ifdef ELF_HWCAP2
> > +	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
> > +#endif
> >  	NEW_AUX_ENT(AT_EXECFN, bprm->exec);
> >  	if (k_platform) {
> >  		NEW_AUX_ENT(AT_PLATFORM,
> > diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> > index 9c13e02..bf2381d 100644
> > --- a/fs/binfmt_elf_fdpic.c
> > +++ b/fs/binfmt_elf_fdpic.c
> > @@ -483,7 +483,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
> >  	size_t platform_len = 0, len;
> >  	char *k_platform, *k_base_platform;
> >  	char __user *u_platform, *u_base_platform, *p;
> > -	long hwcap;
> >  	int loop;
> >  	int nr;	/* reset for each csp adjustment */
> >  
> > @@ -502,8 +501,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
> >  		return -EFAULT;
> >  #endif
> >  
> > -	hwcap = ELF_HWCAP;
> > -
> >  	/*
> >  	 * If this architecture has a platform capability string, copy it
> >  	 * to userspace.  In some cases (Sparc), this info is impossible
> > @@ -617,7 +614,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
> >  
> >  	nr = 0;
> >  	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
> > -	NEW_AUX_ENT(AT_HWCAP,	hwcap);
> > +	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
> > +#ifdef ELF_HWCAP2
> > +	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
> > +#endif
> >  	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
> >  	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
> >  	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
> > diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
> > index 61594d5..835c065 100644
> > --- a/include/uapi/linux/auxvec.h
> > +++ b/include/uapi/linux/auxvec.h
> > @@ -28,6 +28,7 @@
> >  #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
> >  				 * differ from AT_PLATFORM. */
> >  #define AT_RANDOM 25	/* address of 16 random bytes */
> > +#define AT_HWCAP2 26	/* extension of AT_HWCAP */
> >  
> >  #define AT_EXECFN  31	/* filename of program */
> >  
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/linuxppc-dev
> > 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev



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

* Re: [PATCH] powerpc: Add HWCAP2 aux entry
@ 2013-04-23  0:41           ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2013-04-23  0:41 UTC (permalink / raw)
  To: Michael Neuling
  Cc: vda.linux, Nishanth Aravamudan, linux-kernel, Steve Munroe,
	paulus, viro, akpm, linuxppc-dev, Ryan Arnold

On Thu, 2013-04-18 at 13:41 +1000, Michael Neuling wrote:
> akpm,
> 
> If you're happy with this, is it something you can take in your tree?

Andrew ? Or give me an ack ? :-) I'm happy to carry this, we need that
rather urgently and we have the glibc folks on board.

Cheers,
Ben.

> Mikey
> 
> Michael Neuling <mikey@neuling.org> wrote:
> > We are currently out of free bits in AT_HWCAP. With POWER8, we have
> > several hardware features that we need to advertise. 
> > 
> > Tested on POWER and x86.
> > 
> > Signed-off-by: Michael Neuling <michael@neuling.org>
> > Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> > ---
> > 
> > > Wouldn't it be safer to not emit AT_HWCAP2 unless it is defined by the arch?
> > > 
> > > That way the change would only impact powerpc.
> > 
> > Should be addressed with this version.
> > 
> > Mikey
> > 
> > diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
> > index fb3245e..ccadad6 100644
> > --- a/arch/powerpc/include/asm/cputable.h
> > +++ b/arch/powerpc/include/asm/cputable.h
> > @@ -52,6 +52,7 @@ struct cpu_spec {
> >  	char		*cpu_name;
> >  	unsigned long	cpu_features;		/* Kernel features */
> >  	unsigned int	cpu_user_features;	/* Userland features */
> > +	unsigned int	cpu_user_features2;	/* Userland features v2 */
> >  	unsigned int	mmu_features;		/* MMU features */
> >  
> >  	/* cache line sizes */
> > diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
> > index ac9790f..cc0655a 100644
> > --- a/arch/powerpc/include/asm/elf.h
> > +++ b/arch/powerpc/include/asm/elf.h
> > @@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
> >     instruction set this cpu supports.  This could be done in userspace,
> >     but it's not easy, and we've already done it here.  */
> >  # define ELF_HWCAP	(cur_cpu_spec->cpu_user_features)
> > +# define ELF_HWCAP2	(cur_cpu_spec->cpu_user_features2)
> >  
> >  /* This yields a string that ld.so will use to load implementation
> >     specific libraries for optimization.  This is more specific in
> > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> > index 3939829..1f8b5d5 100644
> > --- a/fs/binfmt_elf.c
> > +++ b/fs/binfmt_elf.c
> > @@ -240,6 +240,9 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
> >  	NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid));
> >   	NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
> >  	NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
> > +#ifdef ELF_HWCAP2
> > +	NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2);
> > +#endif
> >  	NEW_AUX_ENT(AT_EXECFN, bprm->exec);
> >  	if (k_platform) {
> >  		NEW_AUX_ENT(AT_PLATFORM,
> > diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> > index 9c13e02..bf2381d 100644
> > --- a/fs/binfmt_elf_fdpic.c
> > +++ b/fs/binfmt_elf_fdpic.c
> > @@ -483,7 +483,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
> >  	size_t platform_len = 0, len;
> >  	char *k_platform, *k_base_platform;
> >  	char __user *u_platform, *u_base_platform, *p;
> > -	long hwcap;
> >  	int loop;
> >  	int nr;	/* reset for each csp adjustment */
> >  
> > @@ -502,8 +501,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
> >  		return -EFAULT;
> >  #endif
> >  
> > -	hwcap = ELF_HWCAP;
> > -
> >  	/*
> >  	 * If this architecture has a platform capability string, copy it
> >  	 * to userspace.  In some cases (Sparc), this info is impossible
> > @@ -617,7 +614,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
> >  
> >  	nr = 0;
> >  	csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
> > -	NEW_AUX_ENT(AT_HWCAP,	hwcap);
> > +	NEW_AUX_ENT(AT_HWCAP,	ELF_HWCAP);
> > +#ifdef ELF_HWCAP2
> > +	NEW_AUX_ENT(AT_HWCAP2,	ELF_HWCAP2);
> > +#endif
> >  	NEW_AUX_ENT(AT_PAGESZ,	PAGE_SIZE);
> >  	NEW_AUX_ENT(AT_CLKTCK,	CLOCKS_PER_SEC);
> >  	NEW_AUX_ENT(AT_PHDR,	exec_params->ph_addr);
> > diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
> > index 61594d5..835c065 100644
> > --- a/include/uapi/linux/auxvec.h
> > +++ b/include/uapi/linux/auxvec.h
> > @@ -28,6 +28,7 @@
> >  #define AT_BASE_PLATFORM 24	/* string identifying real platform, may
> >  				 * differ from AT_PLATFORM. */
> >  #define AT_RANDOM 25	/* address of 16 random bytes */
> > +#define AT_HWCAP2 26	/* extension of AT_HWCAP */
> >  
> >  #define AT_EXECFN  31	/* filename of program */
> >  
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/linuxppc-dev
> > 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: [PATCH] powerpc: Add HWCAP2 aux entry
  2013-04-23  0:41           ` Benjamin Herrenschmidt
@ 2013-04-24 19:36             ` Andrew Morton
  -1 siblings, 0 replies; 11+ messages in thread
From: Andrew Morton @ 2013-04-24 19:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Michael Neuling, vda.linux, Nishanth Aravamudan, Steve Munroe,
	linux-kernel, paulus, viro, Ryan Arnold, linuxppc-dev

On Tue, 23 Apr 2013 10:41:42 +1000 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Thu, 2013-04-18 at 13:41 +1000, Michael Neuling wrote:
> > akpm,
> > 
> > If you're happy with this, is it something you can take in your tree?
> 
> Andrew ? Or give me an ack ? :-) I'm happy to carry this, we need that
> rather urgently and we have the glibc folks on board.

Looks good to me - please proceed with the patch.

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

* Re: [PATCH] powerpc: Add HWCAP2 aux entry
@ 2013-04-24 19:36             ` Andrew Morton
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Morton @ 2013-04-24 19:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Michael Neuling, vda.linux, Nishanth Aravamudan, linux-kernel,
	Steve Munroe, paulus, viro, Ryan Arnold, linuxppc-dev

On Tue, 23 Apr 2013 10:41:42 +1000 Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Thu, 2013-04-18 at 13:41 +1000, Michael Neuling wrote:
> > akpm,
> > 
> > If you're happy with this, is it something you can take in your tree?
> 
> Andrew ? Or give me an ack ? :-) I'm happy to carry this, we need that
> rather urgently and we have the glibc folks on board.

Looks good to me - please proceed with the patch.

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

end of thread, other threads:[~2013-04-24 19:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-02 21:22 [PATCH] powerpc: Add HWCAP2 aux entry Nishanth Aravamudan
2013-04-02 21:22 ` Nishanth Aravamudan
2013-04-05  7:06 ` Michael Ellerman
2013-04-05  7:06   ` Michael Ellerman
     [not found]   ` <27144.1366001074@ale.ozlabs.ibm.com>
2013-04-18  3:33     ` Michael Neuling
2013-04-18  3:41       ` Michael Neuling
2013-04-18  3:41         ` Michael Neuling
2013-04-23  0:41         ` Benjamin Herrenschmidt
2013-04-23  0:41           ` Benjamin Herrenschmidt
2013-04-24 19:36           ` Andrew Morton
2013-04-24 19:36             ` Andrew Morton

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.