1. 28 Mar, 2015 2 commits
    • Michael Ellerman's avatar
      powerpc: Add a proper syscall for switching endianness · 529d235a
      Michael Ellerman authored
      We currently have a "special" syscall for switching endianness. This is
      syscall number 0x1ebe, which is handled explicitly in the 64-bit syscall
      exception entry.
      
      That has a few problems, firstly the syscall number is outside of the
      usual range, which confuses various tools. For example strace doesn't
      recognise the syscall at all.
      
      Secondly it's handled explicitly as a special case in the syscall
      exception entry, which is complicated enough without it.
      
      As a first step toward removing the special syscall, we need to add a
      regular syscall that implements the same functionality.
      
      The logic is simple, it simply toggles the MSR_LE bit in the userspace
      MSR. This is the same as the special syscall, with the caveat that the
      special syscall clobbers fewer registers.
      
      This version clobbers r9-r12, XER, CTR, and CR0-1,5-7.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      529d235a
    • Tyrel Datwyler's avatar
      powerpc/pseries: Simplify check for suspendability during suspend/migration · c03e7374
      Tyrel Datwyler authored
      During suspend/migration operation we must wait for the VASI state reported
      by the hypervisor to become Suspending prior to making the ibm,suspend-me
      RTAS call. Calling routines to rtas_ibm_supend_me() pass a vasi_state variable
      that exposes the VASI state to the caller. This is unnecessary as the caller
      only really cares about the following three conditions; if there is an error
      we should bailout, success indicating we have suspended and woken back up so
      proceed to device tree update, or we are not suspendable yet so try calling
      rtas_ibm_suspend_me again shortly.
      
      This patch removes the extraneous vasi_state variable and simply uses the
      return code to communicate how to proceed. We either succeed, fail, or get
      -EAGAIN in which case we sleep for a second before trying to call
      rtas_ibm_suspend_me again. The behaviour of ppc_rtas() remains the same,
      but migrate_store() now returns the propogated error code on failure.
      Previously -1 was returned from migrate_store() in the  failure case which
      equates to -EPERM and was clearly wrong.
      Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Cc: Nathan Fontenont <nfont@linux.vnet.ibm.com>
      Cc: Cyril Bur <cyrilbur@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      c03e7374
  2. 27 Mar, 2015 2 commits
    • Philippe Bergheaud's avatar
      cxl: Fix a typo in ABI documentation · 52fd4750
      Philippe Bergheaud authored
      Fix the attribute name of the configuration record class ID.
      Signed-off-by: default avatarPhilippe Bergheaud <felix@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      52fd4750
    • Jan Stancek's avatar
      powerpc/perf: add missing put_cpu_var in power_pmu_event_init · 68de8867
      Jan Stancek authored
      One path in power_pmu_event_init() calls get_cpu_var(), but is
      missing matching call to put_cpu_var(), which causes preemption
      imbalance and crash in user-space:
      
        Page fault in user mode with in_atomic() = 1 mm = c000001fefa5a280
        NIP = 3fff9bf2cae0  MSR = 900000014280f032
        Oops: Weird page fault, sig: 11 [#23]
        SMP NR_CPUS=2048 NUMA PowerNV
        Modules linked in: <snip>
        CPU: 43 PID: 10285 Comm: a.out Tainted: G      D         4.0.0-rc5+ #1
        task: c000001fe82c9200 ti: c000001fe835c000 task.ti: c000001fe835c000
        NIP: 00003fff9bf2cae0 LR: 00003fff9bee4898 CTR: 00003fff9bf2cae0
        REGS: c000001fe835fea0 TRAP: 0401   Tainted: G      D          (4.0.0-rc5+)
        MSR: 900000014280f032 <SF,HV,VEC,VSX,EE,PR,FP,ME,IR,DR,RI>  CR: 22000028  XER: 00000000
        CFAR: 00003fff9bee4894 SOFTE: 1
         GPR00: 00003fff9bee494c 00003fffe01c2ee0 00003fff9c084410 0000000010020068
         GPR04: 0000000000000000 0000000000000002 0000000000000008 0000000000000001
         GPR08: 0000000000000001 00003fff9c074a30 00003fff9bf2cae0 00003fff9bf2cd70
         GPR12: 0000000052000022 00003fff9c10b700
        NIP [00003fff9bf2cae0] 0x3fff9bf2cae0
        LR [00003fff9bee4898] 0x3fff9bee4898
        Call Trace:
        ---[ end trace 5d3d952b5d4185d4 ]---
      
        BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:41
        in_atomic(): 1, irqs_disabled(): 0, pid: 10285, name: a.out
        INFO: lockdep is turned off.
        CPU: 43 PID: 10285 Comm: a.out Tainted: G      D         4.0.0-rc5+ #1
        Call Trace:
        [c000001fe835f990] [c00000000089c014] .dump_stack+0x98/0xd4 (unreliable)
        [c000001fe835fa10] [c0000000000e4138] .___might_sleep+0x1d8/0x2e0
        [c000001fe835faa0] [c000000000888da8] .down_read+0x38/0x110
        [c000001fe835fb30] [c0000000000bf2f4] .exit_signals+0x24/0x160
        [c000001fe835fbc0] [c0000000000abde0] .do_exit+0xd0/0xe70
        [c000001fe835fcb0] [c00000000001f4c4] .die+0x304/0x450
        [c000001fe835fd60] [c00000000088e1f4] .do_page_fault+0x2d4/0x900
        [c000001fe835fe30] [c000000000008664] handle_page_fault+0x10/0x30
        note: a.out[10285] exited with preempt_count 1
      
      Reproducer:
        #include <stdio.h>
        #include <unistd.h>
        #include <syscall.h>
        #include <sys/types.h>
        #include <sys/stat.h>
        #include <linux/perf_event.h>
        #include <linux/hw_breakpoint.h>
      
        static struct perf_event_attr event = {
                .type = PERF_TYPE_RAW,
                .size = sizeof(struct perf_event_attr),
                .sample_type = PERF_SAMPLE_BRANCH_STACK,
                .branch_sample_type = PERF_SAMPLE_BRANCH_ANY_RETURN,
        };
      
        int main()
        {
                syscall(__NR_perf_event_open, &event, 0, -1, -1, 0);
        }
      Signed-off-by: default avatarJan Stancek <jstancek@redhat.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      68de8867
  3. 26 Mar, 2015 4 commits
  4. 25 Mar, 2015 8 commits
  5. 24 Mar, 2015 1 commit
    • Tyrel Datwyler's avatar
      powerpc/pseries: Introduce api_version to migration sysfs interface · 288a298c
      Tyrel Datwyler authored
      The /sys/kernel/mobility/migration interface was added all the way back
      in 2.6.37. However, the drmgr userspace tool was never augmented to use
      this interface to perfrom migrations. Instead it has continued using a
      faux rtas call coupled with performing the device tree update processing
      in userspace and communicating it back to the kernel via the ugly
      /proc/ppc64/ofdt interface.
      
      Up until 3.12 the device tree update code in the kernel was badly broken
      and bit rotting. This code was fixed in 3.12 and is now utilized by the
      kernel suspend code as of 3.15. The kernel is now better suited to
      handle the post-mobility fixup of the device tree and drmgr should be
      transitioned to using the sysfs migration interface.
      
      This patch introduces the api_version sysfs file to /sys/kernel/mobility
      as a means for drmgr to query the current implementation level of the
      kernel migration code. This initial versioning indicates it is capable
      of perfroming all current PAPR requirements for migration including the
      post-mobility firmware activation and device tree update.
      Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.vnet.ibm.com>
      Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
      Cc: Cyril Bur <cyrilbur@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      288a298c
  6. 23 Mar, 2015 10 commits
  7. 20 Mar, 2015 1 commit
  8. 18 Mar, 2015 1 commit
  9. 17 Mar, 2015 11 commits