Skip to content

Commit

Permalink
MIPS: AT_HWCAP aux vector infrastructure
Browse files Browse the repository at this point in the history
In order for userland to determine whether various features are safe to
use, it will need to know both that the hardware supports those features
and that the kernel is recent enough & configured appropriately to
support them. For example under the O32 modeless FP proposal the dynamic
linker & ifunc resolvers will need this information.  The kernel is the
only thing in a position to know availability accurately, so the kernel
needs to provide the information to userland. This patch introduces the
infrastructure to provide the AT_HWCAP aux vector to userland in order
to provide that information. It also defines the 2 currently specified
flags, which indicate MIPSr6 & MSA support.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Matthew Fortune <matthew.fortune@imgtec.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Alex Smith <alex@alex-smith.me.uk>
Cc: linux-kernel@vger.kernel.org
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: Ingo Molnar <mingo@kernel.org>
Patchwork: https://patchwork.linux-mips.org/patch/10797/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Paul Burton authored and Ralf Baechle committed Sep 3, 2015
1 parent bf82cb3 commit e14f1db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/mips/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ do { \
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 (0)
#define ELF_HWCAP (elf_hwcap)
extern unsigned int elf_hwcap;
#include <asm/hwcap.h>

/*
* This yields a string that ld.so will use to load implementation
Expand Down
8 changes: 8 additions & 0 deletions arch/mips/include/uapi/asm/hwcap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _UAPI_ASM_HWCAP_H
#define _UAPI_ASM_HWCAP_H

/* HWCAP flags */
#define HWCAP_MIPS_R6 (1 << 0)
#define HWCAP_MIPS_MSA (1 << 1)

#endif /* _UAPI_ASM_HWCAP_H */
3 changes: 3 additions & 0 deletions arch/mips/kernel/cpu-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#include <asm/spram.h>
#include <asm/uaccess.h>

/* Hardware capabilities */
unsigned int elf_hwcap __read_mostly;

/*
* Get the FPU Implementation/Revision.
*/
Expand Down

0 comments on commit e14f1db

Please sign in to comment.