1. 03 Jun, 2015 26 commits
  2. 02 Jun, 2015 14 commits
    • Michael Ellerman's avatar
      selftests/powerpc: Add install support to more powerpc tests · 989898b7
      Michael Ellerman authored
      These tests were merged in parallel to the install support, update them
      now to use it.
      
      This also adds cross compile support for the VPHN test which was missing
      it.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      989898b7
    • Cyril Bur's avatar
      powerpc/configs: Replace pseries_le_defconfig with a Makefile target using merge_config · ea4d1a87
      Cyril Bur authored
      Rather than continuing to maintain a copy of pseries_defconfig with
      CONFIG_CPU_LITTLE_ENDIAN enabled, use the generic merge_config script
      and use an le.config to enable little endian on top of pseries_defconfig
      without the need for a duplicated _defconfig file.
      
      This method will require less maintenance in the future and will ensure
      that both 'defconfigs' are always in sync.
      
      It is worth noting that the seemingly more simple approach of:
      
        pseries_le_defconfig: pseries_defconfig
        	$(Q)$(MAKE) le.config
      
      Will not work when building using O=builddir.
      
      The obvious fix to that:
      
        pseries_le_defconfig:
        	$(Q)$(MAKE) -f $(srctree)/Makefile pseries_defconfig le.config
      
      Also does not work. This is because if we have for example:
      
      config FOO
      	depends on CPU_BIG_ENDIAN
      	select BAR
      
      Then BAR will be enabled by the first call to kconfig (via
      pseries_defconfig), and then will remain enabled after we merge
      le.config, even though FOO will have been turned off.
      
      The solution is to ensure to only invoke the kconfig logic once, after
      we have merged all the config fragments. This ensures nothing is
      select'ed on that should then be disabled by the later merged configs.
      This is done through the explicit call to make olddefconfig
      Signed-off-by: default avatarCyril Bur <cyrilbur@gmail.com>
      Reviewed-by: default avatarSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
      [mpe: Massage change log, fix white space and use ARCH not SRCARCH]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      ea4d1a87
    • Cyril Bur's avatar
      powerpc/configs: Merge pseries_defconfig and pseries_le_defconfig · a1c97df2
      Cyril Bur authored
      These two configs should be identical with the exception of big or little
      endian.
      
      The big endian version has XMON_DEFAULT turned on while the little endian
      has XMON_DEFAULT not set. It makes the most sense for defconfigs not to use
      xmon by default, production systems should get back up as quickly as
      possible, not sit in xmon.
      
      In the event debugging is required, the option can be enabled or xmon=on
      can be specified on commandline.
      Signed-off-by: default avatarCyril Bur <cyrilbur@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      a1c97df2
    • Jiang Liu's avatar
      powerpc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc · c1231a78
      Jiang Liu authored
      Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we
      already have a pointer to corresponding irq_desc.
      Signed-off-by: default avatarJiang Liu <jiang.liu@linux.intel.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      c1231a78
    • Anton Blanchard's avatar
      powerpc: Non relocatable system call doesn't need a trampoline · d20be433
      Anton Blanchard authored
      We need to use a trampoline when using LOAD_HANDLER(), because the
      destination needs to be in the first 64kB. An absolute branch has
      no such limitations, so just jump there.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      d20be433
    • Anton Blanchard's avatar
      powerpc: Relocatable system call no longer uses the LR · 05b05f28
      Anton Blanchard authored
      We had some code to restore the LR in the relocatable system call path
      back when we used the LR to do an indirect branch.
      
      Commit 6a404806 ("powerpc: Avoid link stack corruption in MMU
      on syscall entry path") changed this to use the CTR which is volatile
      across system calls so does not need restoring.
      
      Remove the stale comment and the restore of the LR.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      05b05f28
    • Anton Blanchard's avatar
      powerpc/perf: Fix book3s kernel to userspace backtraces · 72e349f1
      Anton Blanchard authored
      When we take a PMU exception or a software event we call
      perf_read_regs(). This overloads regs->result with a boolean that
      describes if we should use the sampled instruction address register
      (SIAR) or the regs.
      
      If the exception is in kernel, we start with the kernel regs and
      backtrace through the kernel stack. At this point we switch to the
      userspace regs and backtrace the user stack with perf_callchain_user().
      
      Unfortunately these regs have not got the perf_read_regs() treatment,
      so regs->result could be anything. If it is non zero,
      perf_instruction_pointer() decides to use the SIAR, and we get issues
      like this:
      
      0.11%  qemu-system-ppc  [kernel.kallsyms]        [k] _raw_spin_lock_irqsave
             |
             ---_raw_spin_lock_irqsave
                |
                |--52.35%-- 0
                |          |
                |          |--46.39%-- __hrtimer_start_range_ns
                |          |          kvmppc_run_core
                |          |          kvmppc_vcpu_run_hv
                |          |          kvmppc_vcpu_run
                |          |          kvm_arch_vcpu_ioctl_run
                |          |          kvm_vcpu_ioctl
                |          |          do_vfs_ioctl
                |          |          sys_ioctl
                |          |          system_call
                |          |          |
                |          |          |--67.08%-- _raw_spin_lock_irqsave <--- hi mum
                |          |          |          |
                |          |          |           --100.00%-- 0x7e714
                |          |          |                     0x7e714
      
      Notice the bogus _raw_spin_irqsave when we transition from kernel
      (system_call) to userspace (0x7e714). We inserted what was in the SIAR.
      
      Add a check in regs_use_siar() to check that the regs in question
      are from a PMU exception. With this fix the backtrace makes sense:
      
           0.47%  qemu-system-ppc  [kernel.vmlinux]         [k] _raw_spin_lock_irqsave
                  |
                  ---_raw_spin_lock_irqsave
                     |
                     |--53.83%-- 0
                     |          |
                     |          |--44.73%-- hrtimer_try_to_cancel
                     |          |          kvmppc_start_thread
                     |          |          kvmppc_run_core
                     |          |          kvmppc_vcpu_run_hv
                     |          |          kvmppc_vcpu_run
                     |          |          kvm_arch_vcpu_ioctl_run
                     |          |          kvm_vcpu_ioctl
                     |          |          do_vfs_ioctl
                     |          |          sys_ioctl
                     |          |          system_call
                     |          |          __ioctl
                     |          |          0x7e714
                     |          |          0x7e714
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      72e349f1
    • Michael Ellerman's avatar
      powerpc/mm: Fix build break with STRICT_MM_TYPECHECKS && DEBUG_PAGEALLOC · 09f3f326
      Michael Ellerman authored
      If both STRICT_MM_TYPECHECKS and DEBUG_PAGEALLOC are enabled, the code
      in kernel_map_linear_page() is built, and so we fail with:
      
        arch/powerpc/mm/hash_utils_64.c:1478:2:
        error: incompatible type for argument 1 of 'htab_convert_pte_flags'
      
      Fix it by using pgprot_val().
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      09f3f326
    • Daniel Axtens's avatar
      powerpc/powernv: Move dma_set_mask() from pnv_phb to pci_controller_ops · 763d2d8d
      Daniel Axtens authored
      Previously, dma_set_mask() on powernv was convoluted:
       0) Call dma_set_mask() (a/p/kernel/dma.c)
       1) In dma_set_mask(), ppc_md.dma_set_mask() exists, so call it.
       2) On powernv, that function pointer is pnv_dma_set_mask().
          In pnv_dma_set_mask(), the device is pci, so call pnv_pci_dma_set_mask().
       3) In pnv_pci_dma_set_mask(), call pnv_phb->set_dma_mask() if it exists.
       4) It only exists in the ioda case, where it points to
          pnv_pci_ioda_dma_set_mask(), which is the final function.
      
      So the call chain is:
       dma_set_mask() ->
        pnv_dma_set_mask() ->
         pnv_pci_dma_set_mask() ->
          pnv_pci_ioda_dma_set_mask()
      
      Both ppc_md and pnv_phb function pointers are used.
      
      Rip out the ppc_md call, pnv_dma_set_mask() and pnv_pci_dma_set_mask().
      
      Instead:
       0) Call dma_set_mask() (a/p/kernel/dma.c)
       1) In dma_set_mask(), the device is pci, and pci_controller_ops.dma_set_mask()
          exists, so call pci_controller_ops.dma_set_mask()
       2) In the ioda case, that points to pnv_pci_ioda_dma_set_mask().
      
      The new call chain is
       dma_set_mask() ->
        pnv_pci_ioda_dma_set_mask()
      
      Now only the pci_controller_ops function pointer is used.
      
      The fallback paths for p5ioc2 are the same.
      
      Previously, pnv_pci_dma_set_mask() would find no pnv_phb->set_dma_mask()
      function, to it would call __set_dma_mask().
      
      Now, dma_set_mask() finds no ppc_md call or pci_controller_ops call,
      so it calls __set_dma_mask().
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      763d2d8d
    • Daniel Axtens's avatar
      powerpc/pci: add dma_set_mask to pci_controller_ops · 3405c257
      Daniel Axtens authored
      Some systems only need to deal with DMA masks for PCI devices.
      For these systems, we can avoid the need for a platform hook and
      instead use a pci controller based hook.
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      3405c257
    • Daniel Axtens's avatar
      powerpc/powernv: Specialise pci_controller_ops for each controller type · 92ae0353
      Daniel Axtens authored
      Remove powernv generic PCI controller operations. Replace it with
      controller ops for each of the two supported PHBs.
      
      As an added bonus, make the two new structs const, which will help
      guard against bugs such as the one introduced in 65ebf4b6
      ("powerpc/powernv: Move controller ops from ppc_md to controller_ops")
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      92ae0353
    • Daniel Axtens's avatar
      powerpc: Remove MSI-related PCI controller ops from ppc_md · 1f88d586
      Daniel Axtens authored
      Remove unneeded ppc_md functions. Patch callsites to use pci_controller_ops
      functions exclusively.
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      1f88d586
    • Daniel Axtens's avatar
      powerpc/mpic_u3msi: Move MSI-related ops to pci_controller_ops · 14f95acd
      Daniel Axtens authored
      Move the u3 MPIC msi subsystem to use the pci_controller_ops structure
      rather than ppc_md for MSI related PCI controller operations.
      
      As with fsl_msi, operations are plugged in at the subsys level, after
      controller creation. Again, we iterate over all controllers and
      populate them with the MSI ops.
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      14f95acd
    • Daniel Axtens's avatar
      powerpc/pasemi: Move MSI-related ops to pci_controller_ops · 83922966
      Daniel Axtens authored
      Move the PaSemi MPIC msi subsystem to use the pci_controller_ops
      structure rather than ppc_md for MSI related PCI controller
      operations.
      
      As with fsl_msi, operations are plugged in at the subsys level, after
      controller creation. Again, we iterate over all controllers and
      populate them with the MSI ops.
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      83922966