Commit 9115d13453dee22473a1e8cacc90a8d64a9c4bc9

Authored by Nathan Lynch
Committed by Benjamin Herrenschmidt
1 parent 483fad1c3f

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>

Showing 3 changed files with 21 additions and 0 deletions Side-by-side Diff

arch/powerpc/kernel/cputable.c
... ... @@ -23,6 +23,9 @@
23 23 struct cpu_spec* cur_cpu_spec = NULL;
24 24 EXPORT_SYMBOL(cur_cpu_spec);
25 25  
  26 +/* The platform string corresponding to the real PVR */
  27 +const char *powerpc_base_platform;
  28 +
26 29 /* NOTE:
27 30 * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
28 31 * the responsibility of the appropriate CPU save/restore functions to
... ... @@ -1652,6 +1655,14 @@
1652 1655 } else
1653 1656 *t = *s;
1654 1657 *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
  1658 +
  1659 + /*
  1660 + * Set the base platform string once; assumes
  1661 + * we're called with real pvr first.
  1662 + */
  1663 + if (powerpc_base_platform == NULL)
  1664 + powerpc_base_platform = t->platform;
  1665 +
1655 1666 #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
1656 1667 /* ppc64 and booke expect identify_cpu to also call
1657 1668 * setup_cpu for that processor. I will consolidate
include/asm-powerpc/cputable.h
... ... @@ -127,6 +127,8 @@
127 127 extern void do_feature_fixups(unsigned long value, void *fixup_start,
128 128 void *fixup_end);
129 129  
  130 +extern const char *powerpc_base_platform;
  131 +
130 132 #endif /* __ASSEMBLY__ */
131 133  
132 134 /* CPU kernel features */
include/asm-powerpc/elf.h
... ... @@ -217,6 +217,14 @@
217 217  
218 218 #define ELF_PLATFORM (cur_cpu_spec->platform)
219 219  
  220 +/* While ELF_PLATFORM indicates the ISA supported by the platform, it
  221 + * may not accurately reflect the underlying behavior of the hardware
  222 + * (as in the case of running in Power5+ compatibility mode on a
  223 + * Power6 machine). ELF_BASE_PLATFORM allows ld.so to load libraries
  224 + * that are tuned for the real hardware.
  225 + */
  226 +#define ELF_BASE_PLATFORM (powerpc_base_platform)
  227 +
220 228 #ifdef __powerpc64__
221 229 # define ELF_PLAT_INIT(_r, load_addr) do { \
222 230 _r->gpr[2] = load_addr; \