1. 30 Jan, 2015 22 commits
  2. 28 Jan, 2015 7 commits
  3. 27 Jan, 2015 2 commits
    • Pranith Kumar's avatar
      powerpc/powernv: Skip registering log region when CONFIG_PRINTK=n · 6501ab5e
      Pranith Kumar authored
      When CONFIG_PRINTK=n, log_buf_addr_get() returns NULL and log_buf_len_get()
      return 0. Check for these return values and skip registering the dump buffer.
      Signed-off-by: default avatarPranith Kumar <bobby.prani@gmail.com>
      Reviewed-by: default avatarStewart Smith <stewart@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      6501ab5e
    • Cyril Bur's avatar
      powerpc/pseries: Fix endian problems with LE migration · 3df76a9d
      Cyril Bur authored
      RTAS events require arguments be passed in big endian while hypercalls
      have their arguments passed in registers and the values should therefore
      be in CPU endian.
      
      The "ibm,suspend_me" 'RTAS' call makes a sequence of hypercalls to setup
      one true RTAS call. This means that "ibm,suspend_me" is handled
      specially in the ppc_rtas() syscall.
      
      The ppc_rtas() syscall has its arguments in big endian and can therefore
      pass these arguments directly to the RTAS call. "ibm,suspend_me" is
      handled specially from within ppc_rtas() (by calling rtas_ibm_suspend_me())
      which has left an endian bug on little endian systems due to the
      requirement of hypercalls. The return value from rtas_ibm_suspend_me()
      gets returned in cpu endian, and is left unconverted, also a bug on
      little endian systems.
      
      rtas_ibm_suspend_me() does not actually make use of the rtas_args that
      it is passed. This patch removes the convoluted use of the rtas_args
      struct to pass params to rtas_ibm_suspend_me() in favour of passing what
      it needs as actual arguments. This patch also ensures the two callers of
      rtas_ibm_suspend_me() pass function parameters in cpu endian and in the
      case of ppc_rtas(), converts the return value.
      
      migrate_store() (the other caller of rtas_ibm_suspend_me()) is from a
      sysfs file which deals with everything in cpu endian so this function
      only underwent cleanup.
      
      This patch has been tested with KVM both LE and BE and on PowerVM both
      LE and BE. Under QEMU/KVM the migration happens without touching these
      code pathes.
      
      For PowerVM there is no obvious regression on BE and the LE code path
      now provides the correct parameters to the hypervisor.
      Signed-off-by: default avatarCyril Bur <cyrilbur@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      3df76a9d
  4. 23 Jan, 2015 9 commits
    • Anton Blanchard's avatar
      selftests/powerpc: Add memcmp testcase · 521adf53
      Anton Blanchard authored
      Add a testcase for the new ppc64 memcmp.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      521adf53
    • Anton Blanchard's avatar
      powerpc: Add 64bit optimised memcmp · 15c2d45d
      Anton Blanchard authored
      I noticed ksm spending quite a lot of time in memcmp on a large
      KVM box. The current memcmp loop is very unoptimised - byte at a
      time compares with no loop unrolling. We can do much much better.
      
      Optimise the loop in a few ways:
      
      - Unroll the byte at a time loop
      
      - For large (at least 32 byte) comparisons that are also 8 byte
        aligned, use an unrolled modulo scheduled loop using 8 byte
        loads. This is similar to our glibc memcmp.
      
      A simple microbenchmark testing 10000000 iterations of an 8192 byte
      memcmp was used to measure the performance:
      
      baseline:	29.93 s
      
      modified:	 1.70 s
      
      Just over 17x faster.
      
      v2: Incorporated some suggestions from Segher:
      
      - Use andi. instead of rdlicl.
      
      - Convert bdnzt eq, to bdnz. It's just duplicating the earlier compare
        and was a relic from a previous version.
      
      - Don't use cr5, we have plans to use that CR field for fast local
        atomics.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      15c2d45d
    • Gavin Shan's avatar
      powerpc/powernv: Remove pnv_pci_probe_mode() · a113de37
      Gavin Shan authored
      The callback (ppc_md.pci_probe_mode()) is used to determine if the
      child PCI devices of the indicated PCI bus should be probed from
      device-tree or hardware. On PowerNV platform, we always expect
      probing PCI devices from hardware, which is PowerPC PCI core's
      default behaviour. Also, the callback had some delay implemented
      based on PHB's device node property "reset-clear-timestamp", which
      wasn't exported from skiboot. So we don't need this function and
      it's safe to remove it.
      Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      a113de37
    • Gavin Shan's avatar
      powerpc/eeh: Allow to set maximal frozen times · 1b28f170
      Gavin Shan authored
      When PE's frozen count hits maximal allowed frozen times, which is
      5 currently, it will be forced to be offline permanently. Once the
      PE is removed permanently, rebooting machine is required to bring
      the PE back. It's not convienent when testing EEH functionality.
      
      The patch exports the maximal allowed frozen times through debugfs
      entry (/sys/kernel/debug/powerpc/eeh_max_freezes).
      Requested-by: default avatarRyan Grimm <grimm@linux.vnet.ibm.com>
      Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      1b28f170
    • Gavin Shan's avatar
      powerpc/eeh: Introduce flag EEH_PE_REMOVED · 432227e9
      Gavin Shan authored
      The conditions that one specific PE's frozen count exceeds the maximal
      allowed times (EEH_MAX_ALLOWED_FREEZES) and it's in isolated or recovery
      state indicate the PE was removed permanently implicitly. The patch
      introduces flag EEH_PE_REMOVED to indicate that explicitly so that we
      don't depend on the fixed maximal allowed times, which can be varied as
      we do in subsequent patch.
      
      Flag EEH_PE_REMOVED is expected to be marked for the PE whose frozen
      count exceeds the maximal allowed times, or just failed from recovery.
      Requested-by: default avatarRyan Grimm <grimm@linux.vnet.ibm.com>
      Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      432227e9
    • Gavin Shan's avatar
      powerpc/eeh: Fix missed PE#0 on P7IOC · 2aa5cf9e
      Gavin Shan authored
      PE#0 should be regarded as valid for P7IOC, while it's invalid for
      PHB3. The patch adds flag EEH_VALID_PE_ZERO to differentiate those
      two cases. Without the patch, we possibly see frozen PE#0 state is
      cleared without EEH recovery taken on P7IOC as following kernel logs
      indicate:
      
      [root@ltcfbl8eb ~]# dmesg
             :
      pci 0000:00     : [PE# 000] Secondary bus 0 associated with PE#0
      pci 0000:01     : [PE# 001] Secondary bus 1 associated with PE#1
      pci 0001:00     : [PE# 000] Secondary bus 0 associated with PE#0
      pci 0001:01     : [PE# 001] Secondary bus 1 associated with PE#1
      pci 0002:00     : [PE# 000] Secondary bus 0 associated with PE#0
      pci 0002:01     : [PE# 001] Secondary bus 1 associated with PE#1
      pci 0003:00     : [PE# 000] Secondary bus 0 associated with PE#0
      pci 0003:01     : [PE# 001] Secondary bus 1 associated with PE#1
      pci 0003:20     : [PE# 002] Secondary bus 32..63 associated with PE#2
             :
      EEH: Clear non-existing PHB#3-PE#0
      EEH: PHB location: U78AE.001.WZS00M9-P1-002
      Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      2aa5cf9e
    • Gavin Shan's avatar
      powerpc/kernel: Avoid memory corruption at early stage · 6f20e7f2
      Gavin Shan authored
      When calling to early_setup(), we pick "boot_paca" up for the master CPU
      and initialize that with initialise_paca(). At that point, the SLB
      shadow buffer isn't populated yet. Updating the SLB shadow buffer should
      corrupt what we had in physical address 0 where the trap instruction is
      usually stored.
      
      This hasn't been observed to cause any trouble in practice, but is
      obviously fishy.
      
      Fixes: 6f4441ef ("powerpc: Dynamically allocate slb_shadow from memblock")
      Signed-off-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      6f20e7f2
    • Emil Medve's avatar
      powerpc: Replace cpumask_weight(cpu_possible_mask) with num_possible_cpus() · 53a448c3
      Emil Medve authored
      num_possible_cpus() is just a shorthand for it.
      Signed-off-by: default avatarEmil Medve <Emilian.Medve@Freescale.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      53a448c3
    • Naveen N. Rao's avatar
      powerpc/kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2 · bf794bf5
      Naveen N. Rao authored
      Currently, all non-dot symbols are being treated as function descriptors
      in ABIv1. This is incorrect and is resulting in perf probe not working:
      
        # perf probe do_fork
        Added new event:
        Failed to write event: Invalid argument
          Error: Failed to add events.
        # dmesg | tail -1
        [192268.073063] Could not insert probe at _text+768432: -22
      
      perf probe bases all kernel probes on _text and writes,
      for example, "p:probe/do_fork _text+768432" to
      /sys/kernel/debug/tracing/kprobe_events. In-kernel, _text is being
      considered to be a function descriptor and is resulting in the above
      error.
      
      Fix this by changing how we lookup symbol addresses on ppc64. We first
      check for the dot variant of a symbol and look at the non-dot variant
      only if that fails. In this manner, we avoid having to look at the
      function descriptor.
      
      While at it, also separate out how this works on ABIv2 where
      we don't have dot symbols, but need to use the local entry point.
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      bf794bf5