1. 06 3月, 2017 2 次提交
    • S
      powerpc: Update to new option-vector-5 format for CAS · 014d02cb
      Suraj Jitindar Singh 提交于
      On POWER9 the ibm,client-architecture-support (CAS) negotiation process
      has been updated to change how the host to guest negotiation is done for
      the new hash/radix mmu as well as the nest mmu, process tables and guest
      translation shootdown (GTSE).
      
      This is documented in the unreleased PAPR ACR "CAS option vector
      additions for P9".
      
      The host tells the guest which options it supports in
      ibm,arch-vec-5-platform-support. The guest then chooses a subset of these
      to request in the CAS call and these are agreed to in the
      ibm,architecture-vec-5 property of the chosen node.
      
      Thus we read ibm,arch-vec-5-platform-support and make our selection before
      calling CAS. We then parse the ibm,architecture-vec-5 property of the
      chosen node to check whether we should run as hash or radix.
      
      ibm,arch-vec-5-platform-support format:
      
      index value pairs: <index, val> ... <index, val>
      
      index: Option vector 5 byte number
      val:   Some representation of supported values
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Acked-by: NPaul Mackerras <paulus@ozlabs.org>
      [mpe: Don't print about unknown options, be consistent with OV5_FEAT]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      014d02cb
    • S
      powerpc: Parse the command line before calling CAS · 12cc9fd6
      Suraj Jitindar Singh 提交于
      On POWER9 the hypervisor requires the guest to decide whether it would
      like to use a hash or radix mmu model at the time it calls
      ibm,client-architecture-support (CAS) based on what the hypervisor has
      said it's allowed to do. It is possible to disable radix by passing
      "disable_radix" on the command line. The next patch will add support for
      the new CAS format, thus we need to parse the command line before calling
      CAS so we can correctly select which mmu we would like to use.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Reviewed-by: NPaul Mackerras <paulus@ozlabs.org>
      Acked-by: NBalbir Singh <bsingharora@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      12cc9fd6
  2. 21 2月, 2017 1 次提交
    • M
      powerpc/pseries: Advertise Hot Plug Event support to firmware · 3dbbaf20
      Michael Roth 提交于
      With the inclusion of commit 333f7b76 ("powerpc/pseries: Implement
      indexed-count hotplug memory add") and commit 75384347
      ("powerpc/pseries: Implement indexed-count hotplug memory remove"), we
      now have complete handling of the RTAS hotplug event format as described
      by PAPR via ACR "PAPR Changes for Hotplug RTAS Events".
      
      This capability is indicated by byte 6, bit 2 (5 in IBM numbering) of
      architecture option vector 5, and allows for greater control over
      cpu/memory/pci hot plug/unplug operations.
      
      Existing pseries kernels will utilize this capability based on the
      existence of the /event-sources/hot-plug-events DT property, so we
      only need to advertise it via CAS and do not need a corresponding
      FW_FEATURE_* value to test for.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      3dbbaf20
  3. 10 2月, 2017 1 次提交
  4. 31 1月, 2017 1 次提交
    • P
      powerpc/64: Enable use of radix MMU under hypervisor on POWER9 · cc3d2940
      Paul Mackerras 提交于
      To use radix as a guest, we first need to tell the hypervisor via
      the ibm,client-architecture call first that we support POWER9 and
      architecture v3.00, and that we can do either radix or hash and
      that we would like to choose later using an hcall (the
      H_REGISTER_PROC_TBL hcall).
      
      Then we need to check whether the hypervisor agreed to us using
      radix.  We need to do this very early on in the kernel boot process
      before any of the MMU initialization is done.  If the hypervisor
      doesn't agree, we can't use radix and therefore clear the radix
      MMU feature bit.
      
      Later, when we have set up our process table, which points to the
      radix tree for each process, we need to install that using the
      H_REGISTER_PROC_TBL hcall.
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      cc3d2940
  5. 24 1月, 2017 1 次提交
    • D
      powerpc: Add missing error check to prom_find_boot_cpu() · af2b7fa1
      Darren Stevens 提交于
      prom_init.c calls 'instance-to-package' twice, but the return
      is not checked during prom_find_boot_cpu(). The result is then
      passed to prom_getprop(), which could be PROM_ERROR. Add a return check
      to prevent this.
      
      This was found on a pasemi system, where CFE doesn't have a working
      'instance-to package' prom call.
      
      Before Commit 5c0484e2 ('powerpc: Endian safe trampoline') the area
      around addr 0 was mostly 0's and this doesn't cause a problem. Once the
      macro 'FIXUP_ENDIAN' has been added to head_64.S, the low memory area
      now has non-zero values, which cause the prom_getprop() call
      to hang.
      
      mpe: Also confirmed that under SLOF if 'instance-to-package' did fail
      with PROM_ERROR we would crash in SLOF. So the bug is not specific to
      CFE, it's just that other open firmwares don't trigger it because they
      have a working 'instance-to-package'.
      
      Fixes: 5c0484e2 ("powerpc: Endian safe trampoline")
      Cc: stable@vger.kernel.org # v3.13+
      Signed-off-by: NDarren Stevens <darren@stevens-zone.net>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      af2b7fa1
  6. 30 11月, 2016 2 次提交
    • M
      powerpc/prom: Switch to using structs for ibm_architecture_vec · 76ffb578
      Michael Ellerman 提交于
      Now that we've defined structures to describe each of the client
      architecture vectors, we can use those to construct the value we pass to
      firmware.
      
      This avoids the tricks we previously played with the W() macro, allows
      us to properly endian annotate fields, and should help to avoid bugs
      introduced by failing to have the correct number of zero pad bytes
      between fields.
      
      It also means we can avoid hard coding IBM_ARCH_VEC_NRCORES_OFFSET in
      order to update the max_cpus value and instead just set it.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      76ffb578
    • M
      powerpc/prom: Define structs for client architecture vectors · d03d1d65
      Michael Ellerman 提交于
      The "client architecture vectors" are a series of structures we pass to
      firmware to define various things, such as what processors we support
      and many other options.
      
      Each structure is entirely different so we have to define a different
      struct for each one, but that's OK.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      d03d1d65
  7. 18 11月, 2016 1 次提交
  8. 13 9月, 2016 3 次提交
  9. 22 8月, 2016 1 次提交
    • M
      powerpc/prom: Fix sub-processor option passed to ibm, client-architecture-support · 66443efa
      Michael Ellerman 提交于
      When booting from an OpenFirmware which supports it, we use the
      "ibm,client-architecture-support" firmware call to communicate
      our capabilities to firmware.
      
      The format of the structure we pass to firmware is specified in
      PAPR (Power Architecture Platform Requirements), or the public version
      LoPAPR (Linux on Power Architecture Platform Reference).
      
      Referring to table 244 in LoPAPR v1.1, option vector 5 contains a 4 byte
      field at bytes 17-20 for the "Platform Facilities Enable". This is
      followed by a 1 byte field at byte 21 for "Sub-Processor Represenation
      Level".
      
      Comparing to the code, there we have the Platform Facilities
      options (OV5_PFO_*) at byte 17, but we fail to pad that field out to its
      full width of 4 bytes. This means the OV5_SUB_PROCESSORS option is
      incorrectly placed at byte 18.
      
      Fix it by adding zero bytes for bytes 18, 19, 20, and comment the bytes
      to hopefully make it clearer in future.
      
      As far as I'm aware nothing actually consumes this value at this time,
      so the effect of this bug is nil in practice.
      
      It does mean we've been incorrectly setting bit 15 of the "Platform
      Facilities Enable" option for the past ~3 1/2 years, so we should avoid
      allocating that bit to anything else in future.
      
      Fixes: df77c799 ("powerpc/pseries: Update ibm,architecture.vec for PAPR 2.7/POWER8")
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      66443efa
  10. 10 8月, 2016 1 次提交
  11. 08 6月, 2016 1 次提交
    • M
      powerpc/pseries: Fix IBM_ARCH_VEC_NRCORES_OFFSET since POWER8NVL was added · 2c2a63e3
      Michael Ellerman 提交于
      The recent commit 7cc85103 ("powerpc/pseries: Add POWER8NVL support
      to ibm,client-architecture-support call") added a new PVR mask & value
      to the start of the ibm_architecture_vec[] array.
      
      However it missed the fact that further down in the array, we hard code
      the offset of one of the fields, and then at boot use that value to
      patch the value in the array. This means every update to the array must
      also update the #define, ugh.
      
      This means that on pseries machines we will misreport to firmware the
      number of cores we support, by a factor of threads_per_core.
      
      Fix it for now by updating the #define.
      
      Fixes: 7cc85103 ("powerpc/pseries: Add POWER8NVL support to ibm,client-architecture-support call")
      Cc: stable@vger.kernel.org # v4.0+
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      2c2a63e3
  12. 01 6月, 2016 1 次提交
  13. 17 12月, 2015 1 次提交
  14. 19 10月, 2015 3 次提交
  15. 13 7月, 2015 1 次提交
  16. 08 6月, 2015 1 次提交
  17. 10 4月, 2015 1 次提交
    • M
      powerpc: Reword the "returning from prom_init" message · 7e862d7e
      Michael Ellerman 提交于
      We get way too many bug reports that say "the kernel is hung in
      prom_init", which stems from the fact that the last piece of output
      people see is "returning from prom_init".
      
      The kernel is almost never hung in prom_init(), it's just that it's
      crashed somewhere after prom_init() but prior to the console coming up.
      
      The existing message should give a clue to that, ie. "returning from"
      indicates that prom_init() has finished, but it doesn't seem to work.
      Let's try something different.
      
      This prints:
      
        Quiescing Open Firmware ...
        Booting Linux via __start() ...
      
      Which hopefully makes it clear that prom_init() is not the problem, and
      although __start() probably isn't either, it's at least the right place
      to begin looking.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Wistfully-Acked-by: NJeremy Kerr <jk@ozlabs.org>
      7e862d7e
  18. 25 6月, 2014 1 次提交
    • M
      powerpc/powernv: Remove OPAL v1 takeover · e2500be2
      Michael Ellerman 提交于
      In commit 27f44888 "Add OPAL takeover from PowerVM" we added support
      for "takeover" on OPAL v1 machines.
      
      This was a mode of operation where we would boot under pHyp, and query
      for the presence of OPAL. If detected we would then do a special
      sequence to take over the machine, and the kernel would end up running
      in hypervisor mode.
      
      OPAL v1 was never a supported product, and was never shipped outside
      IBM. As far as we know no one is still using it.
      
      Newer versions of OPAL do not use the takeover mechanism. Although the
      query for OPAL should be harmless on machines with newer OPAL, we have
      seen a machine where it causes a crash in Open Firmware.
      
      The code in early_init_devtree() to copy boot_command_line into cmd_line
      was added in commit 817c21ad "Get kernel command line accross OPAL
      takeover", and AFAIK is only used by takeover, so should also be
      removed.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      e2500be2
  19. 13 1月, 2014 1 次提交
    • B
      powerpc: Check return value of instance-to-package OF call · 10348f59
      Benjamin Herrenschmidt 提交于
      On PA-Semi firmware, the instance-to-package callback doesn't seem
      to be implemented. We didn't check for error, however, thus
      subsequently passed the -1 value returned into stdout_node to
      thins like prom_getprop etc...
      
      Thus caused the firmware to load values around 0 (physical) internally
      as node structures. It somewhat "worked" as long as we had a NULL in the
      right place (address 8) at the beginning of the kernel, we didn't "see"
      the bug. But commit 5c0484e2
      "powerpc: Endian safe trampoline" changed the kernel entry point causing
      that old bug to now cause a crash early during boot.
      
      This fixes booting on PA-Semi board by properly checking the return
      value from instance-to-package.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Tested-by: NOlof Johansson <olof@lixom.net>
      ---
      10348f59
  20. 11 10月, 2013 1 次提交
  21. 25 9月, 2013 1 次提交
  22. 11 9月, 2013 1 次提交
    • V
      powerpc: Fix section mismatch warning for prom_rtas_call · 620e5050
      Vladimir Murzin 提交于
      While cross-building for PPC64 I've got
      
      WARNING: vmlinux.o(.text.unlikely+0x1ba): Section mismatch in
      reference from the function .prom_rtas_call() to the variable
      .init.data:dt_string_start The function .prom_rtas_call() references
      the variable __initdata dt_string_start.  This is often because
      .prom_rtas_call lacks a __initdata annotation or the annotation of
      dt_string_start is wrong.
      
      WARNING: vmlinux.o(.meminit.text+0xeb0): Section mismatch in reference
      from the function .free_area_init_core.isra.47() to the function
      .init.text:.set_pageblock_order() The function __meminit
      .free_area_init_core.isra.47() references a function __init
      .set_pageblock_order().  If .set_pageblock_order is only used by
      .free_area_init_core.isra.47 then annotate .set_pageblock_order with a
      matching annotation.
      
      Fix it by proper annotation of prom_rtas_call.
      Signed-off-by: NVladimir Murzin <murzin.v@gmail.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      620e5050
  23. 14 8月, 2013 2 次提交
    • B
    • B
      powerpc/pmac: Early debug output on screen on 64-bit macs · 7191b615
      Benjamin Herrenschmidt 提交于
      We have a bunch of CONFIG_PPC_EARLY_DEBUG_* options that are intended
      for bringup/debug only. They hard wire a machine specific udbg backend
      very early on (before we even probe the platform), and use whatever
      tricks are available on each machine/cpu to be able to get some kind
      of output out there early on.
      
      So far, on powermac with no serial ports, we have CONFIG_PPC_EARLY_DEBUG_BOOTX
      to use the low-level btext engine on the screen, but it doesn't do much, at
      least on 64-bit. It only really gets enabled after the platform has been
      probed and the MMU enabled.
      
      This adds a way to enable it much earlier. From prom_init.c (while still
      running with Open Firmware), we grab the screen details and set things up
      using the physical address of the frame buffer.
      
      Then btext itself uses the "rm_ci" feature of the 970 processor (Real
      Mode Cache Inhibited) to access it while in real mode.
      
      We need to do a little bit of reorg of the btext code to inline things
      better, in order to limit how much we touch memory while in this mode as
      the consequences might be ... interesting.
      
      This successfully allowed me to debug problems early on with the G5
      (related to gold being broken vs. ppc64 kernels).
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      7191b615
  24. 24 7月, 2013 1 次提交
  25. 26 4月, 2013 3 次提交
  26. 13 3月, 2013 1 次提交
    • A
      powerpc: Fix -mcmodel=medium breakage in prom_init.c · 1674400a
      Anton Blanchard 提交于
      Commit 5ac47f7a (powerpc: Relocate prom_init.c on 64bit) made
      prom_init.c position independent by manually relocating its entries
      in the TOC.
      
      We get the address of the TOC entries with the __prom_init_toc_start
      linker symbol. If __prom_init_toc_start ends up as an entry in the
      TOC then we need to add an offset to get the current address. This is
      the case for older toolchains.
      
      On the other hand, if we have a newer toolchain that supports
      -mcmodel=medium then __prom_init_toc_start will be created by a
      relative offset from r2 (the TOC pointer). Since r2 has already been
      relocated, nothing more needs to be done.  Adding an offset in this
      case is wrong and Aaro Koskinen and Alexander Graf have noticed noticed
      G5 and OpenBIOS breakage.
      
      Alan Modra suggested we just use r2 to get at the TOC which is simpler
      and works with both old and new toolchains.
      Reported-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Tested-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      1674400a
  27. 10 1月, 2013 2 次提交
    • A
      powerpc: Remove RELOC() macro · 5827d416
      Anton Blanchard 提交于
      Now we relocate prom_init.c on 64bit we can finally remove the
      nasty RELOC() macro.
      
      Finally a patch that I can claim has a net positive effect on
      the kernel. It doesn't happen very often.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      5827d416
    • A
      powerpc: Relocate prom_init.c on 64bit · 5ac47f7a
      Anton Blanchard 提交于
      The ppc64 kernel can get loaded at any address which means
      our very early init code in prom_init.c must be relocatable. We do
      this with a pretty nasty RELOC() macro that we wrap accesses of
      variables with. It is very fragile and sometimes we forget to add a
      RELOC() to an uncommon path or sometimes a compiler change breaks it.
      
      32bit has a much more elegant solution where we build prom_init.c
      with -mrelocatable and then process the relocations manually.
      Unfortunately we can't do the equivalent on 64bit and we would
      have to build the entire kernel relocatable (-pie), resulting in a
      large increase in kernel footprint (megabytes of relocation data).
      The relocation data will be marked __initdata but it still creates
      more pressure on our already tight memory layout at boot.
      
      Alan Modra pointed out that the 64bit ABI is relocatable even
      if we don't build with -pie, we just need to relocate the TOC.
      This patch implements that idea and relocates the TOC entries of
      prom_init.c. An added bonus is there are very few relocations to
      process which helps keep boot times on simulators down.
      
      gcc does not put 64bit integer constants into the TOC but to be
      safe we may want a build time script which passes through the
      prom_init.c TOC entries to make sure everything looks reasonable.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      5ac47f7a
  28. 15 11月, 2012 1 次提交
  29. 05 9月, 2012 1 次提交
  30. 23 8月, 2012 1 次提交