powerpc: Add HWCAP2 aux entry
authorMichael Neuling <mikey@neuling.org>
Wed, 17 Apr 2013 17:33:11 +0000 (17:33 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 26 Apr 2013 06:08:16 +0000 (16:08 +1000)
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>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/elf.h
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
include/uapi/linux/auxvec.h

index fb3245e928eabfe3152eaa49f2139fd84d906bef..ccadad6db4e460d4260475aafccd8e601ca08bec 100644 (file)
@@ -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 */
index ac9790fc383697185545626ed981495186d7a47b..cc0655a702a739236d29168293478153385ecfc6 100644 (file)
@@ -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
index 86af964c2425d7077467bf54eaecde3d2d4c4911..f1c64a27257ef6fb4c7e52747045633eedb1205c 100644 (file)
@@ -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,
index 9c13e023e2b72368004bad13033a7709ee5c62a6..bf2381d00132b1d1cad9d813a69343b844b8e43e 100644 (file)
@@ -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);
index 61594d598e7b5ea62c0d82e8a0caa18c6d60c2c9..835c065cc7e17d4489729140df35aca1a2b4a45c 100644 (file)
@@ -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 */