浏览代码

powerpc: Enable AT_BASE_PLATFORM aux vector

Stash the first platform string matched by identify_cpu() in
powerpc_base_platform, and supply that to the ELF loader for the value
of AT_BASE_PLATFORM.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Nathan Lynch 17 年之前
父节点
当前提交
9115d13453
共有 3 个文件被更改,包括 21 次插入0 次删除
  1. 11 0
      arch/powerpc/kernel/cputable.c
  2. 2 0
      include/asm-powerpc/cputable.h
  3. 8 0
      include/asm-powerpc/elf.h

+ 11 - 0
arch/powerpc/kernel/cputable.c

@@ -23,6 +23,9 @@
 struct cpu_spec* cur_cpu_spec = NULL;
 struct cpu_spec* cur_cpu_spec = NULL;
 EXPORT_SYMBOL(cur_cpu_spec);
 EXPORT_SYMBOL(cur_cpu_spec);
 
 
+/* The platform string corresponding to the real PVR */
+const char *powerpc_base_platform;
+
 /* NOTE:
 /* NOTE:
  * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
  * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
  * the responsibility of the appropriate CPU save/restore functions to
  * the responsibility of the appropriate CPU save/restore functions to
@@ -1652,6 +1655,14 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
 			} else
 			} else
 				*t = *s;
 				*t = *s;
 			*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
 			*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
+
+			/*
+			 * Set the base platform string once; assumes
+			 * we're called with real pvr first.
+			 */
+			if (powerpc_base_platform == NULL)
+				powerpc_base_platform = t->platform;
+
 #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
 #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
 			/* ppc64 and booke expect identify_cpu to also call
 			/* ppc64 and booke expect identify_cpu to also call
 			 * setup_cpu for that processor. I will consolidate
 			 * setup_cpu for that processor. I will consolidate

+ 2 - 0
include/asm-powerpc/cputable.h

@@ -127,6 +127,8 @@ extern struct cpu_spec *identify_cpu(unsigned long offset, unsigned int pvr);
 extern void do_feature_fixups(unsigned long value, void *fixup_start,
 extern void do_feature_fixups(unsigned long value, void *fixup_start,
 			      void *fixup_end);
 			      void *fixup_end);
 
 
+extern const char *powerpc_base_platform;
+
 #endif /* __ASSEMBLY__ */
 #endif /* __ASSEMBLY__ */
 
 
 /* CPU kernel features */
 /* CPU kernel features */

+ 8 - 0
include/asm-powerpc/elf.h

@@ -217,6 +217,14 @@ typedef elf_vrregset_t elf_fpxregset_t;
 
 
 #define ELF_PLATFORM	(cur_cpu_spec->platform)
 #define ELF_PLATFORM	(cur_cpu_spec->platform)
 
 
+/* While ELF_PLATFORM indicates the ISA supported by the platform, it
+ * may not accurately reflect the underlying behavior of the hardware
+ * (as in the case of running in Power5+ compatibility mode on a
+ * Power6 machine).  ELF_BASE_PLATFORM allows ld.so to load libraries
+ * that are tuned for the real hardware.
+ */
+#define ELF_BASE_PLATFORM (powerpc_base_platform)
+
 #ifdef __powerpc64__
 #ifdef __powerpc64__
 # define ELF_PLAT_INIT(_r, load_addr)	do {	\
 # define ELF_PLAT_INIT(_r, load_addr)	do {	\
 	_r->gpr[2] = load_addr; 		\
 	_r->gpr[2] = load_addr; 		\