1. 13 9月, 2016 7 次提交
  2. 10 9月, 2016 1 次提交
  3. 29 8月, 2016 3 次提交
    • C
      powerpc: signals: Discard transaction state from signal frames · 78a3e888
      Cyril Bur 提交于
      Userspace can begin and suspend a transaction within the signal
      handler which means they might enter sys_rt_sigreturn() with the
      processor in suspended state.
      
      sys_rt_sigreturn() wants to restore process context (which may have
      been in a transaction before signal delivery). To do this it must
      restore TM SPRS. To achieve this, any transaction initiated within the
      signal frame must be discarded in order to be able to restore TM SPRs
      as TM SPRs can only be manipulated non-transactionally..
      >From the PowerPC ISA:
        TM Bad Thing Exception [Category: Transactional Memory]
         An attempt is made to execute a mtspr targeting a TM register in
         other than Non-transactional state.
      
      Not doing so results in a TM Bad Thing:
      [12045.221359] Kernel BUG at c000000000050a40 [verbose debug info unavailable]
      [12045.221470] Unexpected TM Bad Thing exception at c000000000050a40 (msr 0x201033)
      [12045.221540] Oops: Unrecoverable exception, sig: 6 [#1]
      [12045.221586] SMP NR_CPUS=2048 NUMA PowerNV
      [12045.221634] Modules linked in: xt_CHECKSUM iptable_mangle ipt_MASQUERADE
       nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4
       xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter
       ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables kvm_hv kvm
       uio_pdrv_genirq ipmi_powernv uio powernv_rng ipmi_msghandler autofs4 ses enclosure
       scsi_transport_sas bnx2x ipr mdio libcrc32c
      [12045.222167] CPU: 68 PID: 6178 Comm: sigreturnpanic Not tainted 4.7.0 #34
      [12045.222224] task: c0000000fce38600 ti: c0000000fceb4000 task.ti: c0000000fceb4000
      [12045.222293] NIP: c000000000050a40 LR: c0000000000163bc CTR: 0000000000000000
      [12045.222361] REGS: c0000000fceb7ac0 TRAP: 0700   Not tainted (4.7.0)
      [12045.222418] MSR: 9000000300201033 <SF,HV,ME,IR,DR,RI,LE,TM[SE]> CR: 28444280  XER: 20000000
      [12045.222625] CFAR: c0000000000163b8 SOFTE: 0 PACATMSCRATCH: 900000014280f033
      GPR00: 01100000b8000001 c0000000fceb7d40 c00000000139c100 c0000000fce390d0
      GPR04: 900000034280f033 0000000000000000 0000000000000000 0000000000000000
      GPR08: 0000000000000000 b000000000001033 0000000000000001 0000000000000000
      GPR12: 0000000000000000 c000000002926400 0000000000000000 0000000000000000
      GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      GPR24: 0000000000000000 00003ffff98cadd0 00003ffff98cb470 0000000000000000
      GPR28: 900000034280f033 c0000000fceb7ea0 0000000000000001 c0000000fce390d0
      [12045.223535] NIP [c000000000050a40] tm_restore_sprs+0xc/0x1c
      [12045.223584] LR [c0000000000163bc] tm_recheckpoint+0x5c/0xa0
      [12045.223630] Call Trace:
      [12045.223655] [c0000000fceb7d80] [c000000000026e74] sys_rt_sigreturn+0x494/0x6c0
      [12045.223738] [c0000000fceb7e30] [c0000000000092e0] system_call+0x38/0x108
      [12045.223806] Instruction dump:
      [12045.223841] 7c800164 4e800020 7c0022a6 f80304a8 7c0222a6 f80304b0 7c0122a6 f80304b8
      [12045.223955] 4e800020 e80304a8 7c0023a6 e80304b0 <7c0223a6> e80304b8 7c0123a6 4e800020
      [12045.224074] ---[ end trace cb8002ee240bae76 ]---
      
      It isn't clear exactly if there is really a use case for userspace
      returning with a suspended transaction, however, doing so doesn't (on
      its own) constitute a bad frame. As such, this patch simply discards
      the transactional state of the context calling the sigreturn and
      continues.
      Reported-by: NLaurent Dufour <ldufour@linux.vnet.ibm.com>
      Signed-off-by: NCyril Bur <cyrilbur@gmail.com>
      Tested-by: NLaurent Dufour <ldufour@linux.vnet.ibm.com>
      Reviewed-by: NLaurent Dufour <ldufour@linux.vnet.ibm.com>
      Acked-by: NSimon Guo <wei.guo.simon@gmail.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      78a3e888
    • M
      powerpc/powernv : Drop reference added by kset_find_obj() · a9cbf0b2
      Mukesh Ojha 提交于
      In a situation, where Linux kernel gets notified about duplicate error log
      from OPAL, it is been observed that kernel fails to remove sysfs entries
      (/sys/firmware/opal/elog/0xXXXXXXXX) of such error logs. This is because,
      we currently search the error log/dump kobject in the kset list via
      'kset_find_obj()' routine. Which eventually increment the reference count
      by one, once it founds the kobject.
      
      So, unless we decrement the reference count by one after it found the kobject,
      we would not be able to release the kobject properly later.
      
      This patch adds the 'kobject_put()' which was missing earlier.
      Signed-off-by: NMukesh Ojha <mukesh02@linux.vnet.ibm.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NVasant Hegde <hegdevasant@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      a9cbf0b2
    • N
      powerpc/tm: do not use r13 for tabort_syscall · cc7786d3
      Nicholas Piggin 提交于
      tabort_syscall runs with RI=1, so a nested recoverable machine
      check will load the paca into r13 and overwrite what we loaded
      it with, because exceptions returning to privileged mode do not
      restore r13.
      
      Fixes: b4b56f9e (powerpc/tm: Abort syscalls in active transactions)
      Cc: stable@vger.kernel.org
      Signed-off-by: NNick Piggin <npiggin@gmail.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      cc7786d3
  4. 22 8月, 2016 12 次提交
    • P
      powerpc: move hmi.c to arch/powerpc/kvm/ · 7c379526
      Paolo Bonzini 提交于
      hmi.c functions are unused unless sibling_subcore_state is nonzero, and
      that in turn happens only if KVM is in use.  So move the code to
      arch/powerpc/kvm/, putting it under CONFIG_KVM_BOOK3S_HV_POSSIBLE
      rather than CONFIG_PPC_BOOK3S_64.  The sibling_subcore_state is also
      included in struct paca_struct only if KVM is supported by the kernel.
      
      Cc: Daniel Axtens <dja@axtens.net>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: kvm-ppc@vger.kernel.org
      Cc: kvm@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      7c379526
    • C
      powerpc: sysdev: cpm: fix gpio save_regs functions · 41017a75
      Christophe Leroy 提交于
      of_mm_gpiochip_add_data() calls mm_gc->save_regs() before
      setting the data. Therefore ->save_regs() cannot use
      gpiochip_get_data()
      
      [    0.275940] Unable to handle kernel paging request for data at address 0x00000130
      [    0.283120] Faulting instruction address: 0xc01b44cc
      [    0.288175] Oops: Kernel access of bad area, sig: 11 [#1]
      [    0.293343] PREEMPT CMPC885
      [    0.296141] CPU: 0 PID: 1 Comm: swapper Not tainted 4.7.0-g65124df-dirty #68
      [    0.304131] task: c6074000 ti: c6080000 task.ti: c6080000
      [    0.309459] NIP: c01b44cc LR: c0011720 CTR: c0011708
      [    0.314372] REGS: c6081d90 TRAP: 0300   Not tainted  (4.7.0-g65124df-dirty)
      [    0.322267] MSR: 00009032 <EE,ME,IR,DR,RI>  CR: 24000028  XER: 20000000
      [    0.328813] DAR: 00000130 DSISR: c0000000
      GPR00: c01b6d0c c6081e40 c6074000 c6017000 c9028000 c601d028 c6081dd8 00000000
      GPR08: c601d028 00000000 ffffffff 00000001 24000044 00000000 c0002790 00000000
      GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 c05643b0 00000083
      GPR24: c04a1a6c c0560000 c04a8308 c04c6480 c0012498 c6017000 c7ffcc78 c6017000
      [    0.360806] NIP [c01b44cc] gpiochip_get_data+0x4/0xc
      [    0.365684] LR [c0011720] cpm1_gpio16_save_regs+0x18/0x44
      [    0.370972] Call Trace:
      [    0.373451] [c6081e50] [c01b6d0c] of_mm_gpiochip_add_data+0x70/0xdc
      [    0.379624] [c6081e70] [c00124c0] cpm_init_par_io+0x28/0x118
      [    0.385238] [c6081e80] [c04a8ac0] do_one_initcall+0xb0/0x17c
      [    0.390819] [c6081ef0] [c04a8cbc] kernel_init_freeable+0x130/0x1dc
      [    0.396924] [c6081f30] [c00027a4] kernel_init+0x14/0x110
      [    0.402177] [c6081f40] [c000b424] ret_from_kernel_thread+0x5c/0x64
      [    0.408233] Instruction dump:
      [    0.411168] 4182fafc 3f80c040 48234c6d 3bc0fff0 3b9c5ed0 4bfffaf4 81290020 712a0004
      [    0.418825] 4182fb34 48234c51 4bfffb2c 81230004 <80690130> 4e800020 7c0802a6 9421ffe0
      [    0.426763] ---[ end trace fe4113ee21d72ffa ]---
      
      fixes: e65078f1 ("powerpc: sysdev: cpm1: use gpiochip data pointer")
      fixes: a14a2d48 ("powerpc: cpm_common: use gpiochip data pointer")
      Cc: stable@vger.kernel.org
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      41017a75
    • N
      powerpc/pseries: PACA save area fix for MCE vs MCE · a74599a5
      Nicholas Piggin 提交于
      MCE must not enable MSR_RI until PACA_EXMC is no longer being used.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      a74599a5
    • N
      powerpc/pseries: PACA save area fix for general exception vs MCE · 3f3b5dc1
      Nicholas Piggin 提交于
      MCE must not use PACA_EXGEN. When a general exception enables MSR_RI,
      that means SPRN_SRR[01] and SPRN_SPRG are no longer used. However the
      PACA save area is still in use.
      Acked-by: NMahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      3f3b5dc1
    • 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
    • B
      powerpc, hotplug: Avoid to touch non-existent cpumasks. · 19ab58d1
      Boqun Feng 提交于
      We observed a kernel oops when running a PPC guest with config NR_CPUS=4
      and qemu option "-smp cores=1,threads=8":
      
      [   30.634781] Unable to handle kernel paging request for data at
      address 0xc00000014192eb17
      [   30.636173] Faulting instruction address: 0xc00000000003e5cc
      [   30.637069] Oops: Kernel access of bad area, sig: 11 [#1]
      [   30.637877] SMP NR_CPUS=4 NUMA pSeries
      [   30.638471] Modules linked in:
      [   30.638949] CPU: 3 PID: 27 Comm: migration/3 Not tainted
      4.7.0-07963-g9714b26 #1
      [   30.640059] task: c00000001e29c600 task.stack: c00000001e2a8000
      [   30.640956] NIP: c00000000003e5cc LR: c00000000003e550 CTR:
      0000000000000000
      [   30.642001] REGS: c00000001e2ab8e0 TRAP: 0300   Not tainted
      (4.7.0-07963-g9714b26)
      [   30.643139] MSR: 8000000102803033 <SF,VEC,VSX,FP,ME,IR,DR,RI,LE,TM[E]>  CR: 22004084  XER: 00000000
      [   30.644583] CFAR: c000000000009e98 DAR: c00000014192eb17 DSISR: 40000000 SOFTE: 0
      GPR00: c00000000140a6b8 c00000001e2abb60 c0000000016dd300 0000000000000003
      GPR04: 0000000000000000 0000000000000004 c0000000016e5920 0000000000000008
      GPR08: 0000000000000004 c00000014192eb17 0000000000000000 0000000000000020
      GPR12: c00000000140a6c0 c00000000ffffc00 c0000000000d3ea8 c00000001e005680
      GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      GPR20: 0000000000000000 c00000001e6b3a00 0000000000000000 0000000000000001
      GPR24: c00000001ff85138 c00000001ff85130 000000001eb6f000 0000000000000001
      GPR28: 0000000000000000 c0000000017014e0 0000000000000000 0000000000000018
      [   30.653882] NIP [c00000000003e5cc] __cpu_disable+0xcc/0x190
      [   30.654713] LR [c00000000003e550] __cpu_disable+0x50/0x190
      [   30.655528] Call Trace:
      [   30.655893] [c00000001e2abb60] [c00000000003e550] __cpu_disable+0x50/0x190 (unreliable)
      [   30.657280] [c00000001e2abbb0] [c0000000000aca0c] take_cpu_down+0x5c/0x100
      [   30.658365] [c00000001e2abc10] [c000000000163918] multi_cpu_stop+0x1a8/0x1e0
      [   30.659617] [c00000001e2abc60] [c000000000163cc0] cpu_stopper_thread+0xf0/0x1d0
      [   30.660737] [c00000001e2abd20] [c0000000000d8d70] smpboot_thread_fn+0x290/0x2a0
      [   30.661879] [c00000001e2abd80] [c0000000000d3fa8] kthread+0x108/0x130
      [   30.662876] [c00000001e2abe30] [c000000000009968] ret_from_kernel_thread+0x5c/0x74
      [   30.664017] Instruction dump:
      [   30.664477] 7bde1f24 38a00000 787f1f24 3b600001 39890008 7d204b78 7d05e214 7d0b07b4
      [   30.665642] 796b1f24 7d26582a 7d204a14 7d29f214 <7d4048a8> 7d4a3878 7d4049ad 40c2fff4
      [   30.666854] ---[ end trace 32643b7195717741 ]---
      
      The reason of this is that in __cpu_disable(), when we try to set the
      cpu_sibling_mask or cpu_core_mask of the sibling CPUs of the disabled
      one, we don't check whether the current configuration employs those
      sibling CPUs(hw threads). And if a CPU is not employed by a
      configuration, the percpu structures cpu_{sibling,core}_mask are not
      allocated, therefore accessing those cpumasks will result in problems as
      above.
      
      This patch fixes this problem by adding an addition check on whether the
      id is no less than nr_cpu_ids in the sibling CPU iteration code.
      Signed-off-by: NBoqun Feng <boqun.feng@gmail.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      19ab58d1
    • P
      powerpc: migrate exception table users off module.h and onto extable.h · 8a39b05f
      Paul Gortmaker 提交于
      These files were only including module.h for exception table
      related functions.  We've now separated that content out into its
      own file "extable.h" so now move over to that and avoid all the
      extra header content in module.h that we don't really need to compile
      these files.
      
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      8a39b05f
    • A
      powerpc/powernv/pci: fix iterator signedness · 60964816
      Andrzej Hajda 提交于
      Unsigned type is always non-negative, so the loop could not end in case
      condition is never true.
      
      The problem has been detected using semantic patch
      scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
      Signed-off-by: NAndrzej Hajda <a.hajda@samsung.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      60964816
    • M
      powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb) · 2dd9c11b
      Mauricio Faria de Oliveira 提交于
      This patch leverages 'struct pci_host_bridge' from the PCI subsystem
      in order to free the pci_controller only after the last reference to
      its devices is dropped (avoiding an oops in pcibios_release_device()
      if the last reference is dropped after pcibios_free_controller()).
      
      The patch relies on pci_host_bridge.release_fn() (and .release_data),
      which is called automatically by the PCI subsystem when the root bus
      is released (i.e., the last reference is dropped).  Those fields are
      set via pci_set_host_bridge_release() (e.g. in the platform-specific
      implementation of pcibios_root_bridge_prepare()).
      
      It introduces the 'pcibios_free_controller_deferred()' .release_fn()
      and it expects .release_data to hold a pointer to the pci_controller.
      
      The function implictly calls 'pcibios_free_controller()', so an user
      must *NOT* explicitly call it if using the new _deferred() callback.
      
      The functionality is enabled for pseries (although it isn't platform
      specific, and may be used by cxl).
      
      Details on not-so-elegant design choices:
      
       - Use 'pci_host_bridge.release_data' field as pointer to associated
         'struct pci_controller' so *not* to 'pci_bus_to_host(bridge->bus)'
         in pcibios_free_controller_deferred().
      
         That's because pci_remove_root_bus() sets 'host_bridge->bus = NULL'
         (so, if the last reference is released after pci_remove_root_bus()
         runs, which eventually reaches pcibios_free_controller_deferred(),
         that would hit a null pointer dereference).
      
         The cxl/vphb.c code calls pci_remove_root_bus(), and the cxl folks
         are interested in this fix.
      
      Test-case #1 (hold references)
      
        # ls -ld /sys/block/sd* | grep -m1 0021:01:00.0
        <...> /sys/block/sdaa -> ../devices/pci0021:01/0021:01:00.0/<...>
      
        # ls -ld /sys/block/sd* | grep -m1 0021:01:00.1
        <...> /sys/block/sdab -> ../devices/pci0021:01/0021:01:00.1/<...>
      
        # cat >/dev/sdaa & pid1=$!
        # cat >/dev/sdab & pid2=$!
      
        # drmgr -w 5 -d 1 -c phb -s 'PHB 33' -r
        Validating PHB DLPAR capability...yes.
        [  594.306719] pci_hp_remove_devices: PCI: Removing devices on bus 0021:01
        [  594.306738] pci_hp_remove_devices:    Removing 0021:01:00.0...
        ...
        [  598.236381] pci_hp_remove_devices:    Removing 0021:01:00.1...
        ...
        [  611.972077] pci_bus 0021:01: busn_res: [bus 01-ff] is released
        [  611.972140] rpadlpar_io: slot PHB 33 removed
      
        # kill -9 $pid1
        # kill -9 $pid2
        [  632.918088] pcibios_free_controller_deferred: domain 33, dynamic 1
      
      Test-case #2 (don't hold references)
      
        # drmgr -w 5 -d 1 -c phb -s 'PHB 33' -r
        Validating PHB DLPAR capability...yes.
        [  916.357363] pci_hp_remove_devices: PCI: Removing devices on bus 0021:01
        [  916.357386] pci_hp_remove_devices:    Removing 0021:01:00.0...
        ...
        [  920.566527] pci_hp_remove_devices:    Removing 0021:01:00.1...
        ...
        [  933.955873] pci_bus 0021:01: busn_res: [bus 01-ff] is released
        [  933.955977] pcibios_free_controller_deferred: domain 33, dynamic 1
        [  933.955999] rpadlpar_io: slot PHB 33 removed
      Suggested-By: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NMauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
      Reviewed-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Reviewed-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Tested-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> # cxl
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      2dd9c11b
    • M
      powerpc: mpc8349emitx: Delete unnecessary assignment for the field "owner" · f5ed841c
      Markus Elfring 提交于
      The field "owner" is set by the core.
      Thus delete an unneeded initialisation.
      
      Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      f5ed841c
    • M
      powerpc/512x: Delete unnecessary assignment for the field "owner" · e72e799c
      Markus Elfring 提交于
      The field "owner" is set by the core.
      Thus delete an unneeded initialisation.
      
      Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
      Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      e72e799c
    • G
      powerpc: cputhreads: Add missing include file · e340eca9
      Guenter Roeck 提交于
      Powerpc builds may fail with the following build error.
      
      Error log:
      In file included from ./arch/powerpc/include/asm/mmu_context.h:11:0,
                       from ./include/linux/mmu_context.h:4,
      		 from mm/mmu_context.c:8:
      ./arch/powerpc/include/asm/cputhreads.h: In function 'get_tensr':
      ./arch/powerpc/include/asm/cputhreads.h:101:2: error:
      	implicit declaration of function 'cpu_has_feature'
      
      The problem can be triggered by configuring ppc64e_defconfig and selecting
      CONFIG_TICK_CPU_ACCOUNTING instead of CONFIG_VIRT_CPU_ACCOUNTING_NATIVE.
      
      Fixes: b92a226e ("powerpc: Move cpu_has_feature() to a separate file")
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      e340eca9
  5. 12 8月, 2016 2 次提交
  6. 10 8月, 2016 7 次提交
    • N
      powerpc/vdso: Fix build rules to rebuild vdsos correctly · b9a4a0d0
      Nicholas Piggin 提交于
      When using if_changed, we need to add FORCE as a dependency (see
      Documentation/kbuild/makefiles.txt) otherwise we don't get command line
      change checking amongst other things. This has resulted in vdsos not
      being rebuilt when switching between big and little endian.
      
      The vdso64/32ld commands have to be changed around to avoid pulling
      FORCE into the linker command line (code copied from x86).
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      b9a4a0d0
    • M
      powerpc/Makefile: Use cflags-y/aflags-y for setting endian options · 164af597
      Michael Ellerman 提交于
      When we introduced the little endian support, we added the endian flags
      to CC directly using override. I don't know the history of why we did
      that, I suspect no one does.
      
      Although this mostly works, it has one bug, which is that CROSS32CC
      doesn't get -mbig-endian. That means when the compiler is little endian
      by default and the user is building big endian, vdso32 is incorrectly
      compiled as little endian and the kernel fails to build.
      
      Instead we can add the endian flags to cflags-y/aflags-y, and then
      append those to KBUILD_CFLAGS/KBUILD_AFLAGS.
      
      This has the advantage of being 1) less ugly, 2) the documented way of
      adding flags in the arch Makefile and 3) it fixes building vdso32 with a
      LE toolchain.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      164af597
    • B
      powerpc/32: Fix crash during static key init · 97f6e0cc
      Benjamin Herrenschmidt 提交于
      We cannot do those initializations from apply_feature_fixups() as
      this function runs in a very restricted environment on 32-bit where
      the kernel isn't running at its linked address and the PTRRELOC()
      macro must be used for any global accesss.
      
      Instead, split them into a separtate steup_feature_keys() function
      which is called in a more suitable spot on ppc32.
      
      Fixes: 309b315b ("powerpc: Call jump_label_init() in apply_feature_fixups()")
      Reported-and-tested-by: NChristian Kujau <lists@nerdbynature.de>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      97f6e0cc
    • B
      powerpc: Update obsolete comment in setup_32.c about early_init() · f9cc1d1f
      Benjamin Herrenschmidt 提交于
      We don't identify the machine type anymore...
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      f9cc1d1f
    • B
      powerpc: Print the kernel load address at the end of prom_init() · 7d70c63c
      Benjamin Herrenschmidt 提交于
      This makes it easier to debug crashes that happen very early before
      the kernel takes over Open Firmware by allowing us to relate the OF
      reported crashing addresses to offsets within the kernel.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      7d70c63c
    • C
      powerpc/ptrace: Fix coredump since ptrace TM changes · c7a318ba
      Cyril Bur 提交于
      Commit 8d460f61 ("powerpc/process: Add the function
      flush_tmregs_to_thread") added flush_tmregs_to_thread() and included
      the assumption that it would only be called for a task which is not
      current.
      
      Although this is correct for ptrace, when generating a core dump, some
      of the routines which call flush_tmregs_to_thread() are called. This
      leads to a WARNing such as:
      
        Not expecting ptrace on self: TM regs may be incorrect
        ------------[ cut here ]------------
        WARNING: CPU: 123 PID: 7727 at arch/powerpc/kernel/process.c:1088 flush_tmregs_to_thread+0x78/0x80
        CPU: 123 PID: 7727 Comm: libvirtd Not tainted 4.8.0-rc1-gcc6x-g61e8a0d5 #1
        task: c000000fe631b600 task.stack: c000000fe63b0000
        NIP: c00000000001a1a8 LR: c00000000001a1a4 CTR: c000000000717780
        REGS: c000000fe63b3420 TRAP: 0700   Not tainted  (4.8.0-rc1-gcc6x-g61e8a0d5)
        MSR: 900000010282b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE,TM[E]>  CR: 28004222  XER: 20000000
        ...
        NIP [c00000000001a1a8] flush_tmregs_to_thread+0x78/0x80
        LR [c00000000001a1a4] flush_tmregs_to_thread+0x74/0x80
        Call Trace:
         flush_tmregs_to_thread+0x74/0x80 (unreliable)
         vsr_get+0x64/0x1a0
         elf_core_dump+0x604/0x1430
         do_coredump+0x5fc/0x1200
         get_signal+0x398/0x740
         do_signal+0x54/0x2b0
         do_notify_resume+0x98/0xb0
         ret_from_except_lite+0x70/0x74
      
      So fix flush_tmregs_to_thread() to detect the case where it is called on
      current, and a transaction is active, and in that case flush the TM regs
      to the thread_struct.
      
      This patch also moves flush_tmregs_to_thread() into ptrace.c as it is
      only called from that file.
      
      Fixes: 8d460f61 ("powerpc/process: Add the function flush_tmregs_to_thread")
      Signed-off-by: NCyril Bur <cyrilbur@gmail.com>
      [mpe: Flesh out change log]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      c7a318ba
    • C
      powerpc/32: Fix csum_partial_copy_generic() · 1bc8b816
      Christophe Leroy 提交于
      Commit 7aef4136 ("powerpc32: rewrite csum_partial_copy_generic()
      based on copy_tofrom_user()") introduced a bug when destination
      address is odd and initial csum is not null
      
      In that (rare) case the initial csum value has to be rotated one byte
      as well as the resulting value is
      
      This patch also fixes related comments
      
      Fixes: 7aef4136 ("powerpc32: rewrite csum_partial_copy_generic() based on copy_tofrom_user()")
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      1bc8b816
  7. 09 8月, 2016 8 次提交