1. 27 8月, 2013 1 次提交
    • B
      powerpc: Don't Oops when accessing /proc/powerpc/lparcfg without hypervisor · f5f6cbb6
      Benjamin Herrenschmidt 提交于
      /proc/powerpc/lparcfg is an ancient facility (though still actively used)
      which allows access to some informations relative to the partition when
      running underneath a PAPR compliant hypervisor.
      
      It makes no sense on non-pseries machines. However, currently, not only
      can it be created on these if the kernel has pseries support, but accessing
      it on such a machine will crash due to trying to do hypervisor calls.
      
      In fact, it should also not do HV calls on older pseries that didn't have
      an hypervisor either.
      
      Finally, it has the plumbing to be a module but is a "bool" Kconfig option.
      
      This fixes the whole lot by turning it into a machine_device_initcall
      that is only created on pseries, and adding the necessary hypervisor
      check before calling the H_GET_EM_PARMS hypercall
      
      CC: <stable@vger.kernel.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      f5f6cbb6
  2. 09 8月, 2013 5 次提交
    • M
      powerpc/tm: Fix context switching TAR, PPR and DSCR SPRs · 28e61cc4
      Michael Neuling 提交于
      If a transaction is rolled back, the Target Address Register (TAR), Processor
      Priority Register (PPR) and Data Stream Control Register (DSCR) should be
      restored to the checkpointed values before the transaction began.  Any changes
      to these SPRs inside the transaction should not be visible in the abort
      handler.
      
      Currently Linux doesn't save or restore the checkpointed TAR, PPR or DSCR.  If
      we preempt a processes inside a transaction which has modified any of these, on
      process restore, that same transaction may be aborted we but we won't see the
      checkpointed versions of these SPRs.
      
      This adds checkpointed versions of these SPRs to the thread_struct and adds the
      save/restore of these three SPRs to the treclaim/trechkpt code.
      
      Without this if any of these SPRs are modified during a transaction, users may
      incorrectly see a speculated SPR value even if the transaction is aborted.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Cc: <stable@vger.kernel.org> [v3.10]
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      28e61cc4
    • M
      powerpc: Save the TAR register earlier · c2d52644
      Michael Neuling 提交于
      This moves us to save the Target Address Register (TAR) a earlier in
      __switch_to.  It introduces a new function save_tar() to do this.
      
      We need to save the TAR earlier as we will overwrite it in the transactional
      memory reclaim/recheckpoint path.  We are going to do this in a subsequent
      patch which will fix saving the TAR register when it's modified inside a
      transaction.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Cc: <stable@vger.kernel.org> [v3.10]
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      c2d52644
    • M
      powerpc: Fix context switch DSCR on POWER8 · 2517617e
      Michael Neuling 提交于
      POWER8 allows the DSCR to be accessed directly from userspace via a new SPR
      number 0x3 (Rather than 0x11.  DSCR SPR number 0x11 is still used on POWER8 but
      like POWER7, is only accessible in HV and OS modes).  Currently, we allow this
      by setting H/FSCR DSCR bit on boot.
      
      Unfortunately this doesn't work, as the kernel needs to see the DSCR change so
      that it knows to no longer restore the system wide version of DSCR on context
      switch (ie. to set thread.dscr_inherit).
      
      This clears the H/FSCR DSCR bit initially.  If a process then accesses the DSCR
      (via SPR 0x3), it'll trap into the kernel where we set thread.dscr_inherit in
      facility_unavailable_exception().
      
      We also change _switch() so that we set or clear the H/FSCR DSCR bit based on
      the thread.dscr_inherit.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Cc: <stable@vger.kernel.org> [v3.10]
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      2517617e
    • M
      powerpc: Fix hypervisor facility unavaliable vector number · 88f09412
      Michael Neuling 提交于
      Currently if we take hypervisor facility unavaliable (from 0xf80/0x4f80) we
      mark it as an OS facility unavaliable (0xf60) as the two share the same code
      path.
      
      The becomes a problem in facility_unavailable_exception() as we aren't able to
      see the hypervisor facility unavailable exceptions.
      
      Below fixes this by duplication the required macros.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Cc: <stable@vger.kernel.org> [v3.10]
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      88f09412
    • M
      powerpc/eeh: Add missing procfs entry for PowerNV · 144136dd
      Mike Qiu 提交于
      The procfs entry for global statistics has been missed on PowerNV
      platform and the patch is going to add that.
      Signed-off-by: NMike Qiu <qiudayu@linux.vnet.ibm.com>
      Acked-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      144136dd
  3. 01 8月, 2013 1 次提交
  4. 24 7月, 2013 12 次提交
    • G
      powerpc/eeh: Introdce flag to protect sysfs · ab55d218
      Gavin Shan 提交于
      The patch introduces flag EEH_DEV_SYSFS to keep track that the sysfs
      entries for the corresponding EEH device (then PCI device) has been
      added or removed, in order to avoid race condition.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ab55d218
    • G
      powerpc/eeh: Fix unbalanced enable for IRQ · 91150af3
      Gavin Shan 提交于
      The patch fixes following issue:
      
      Unbalanced enable for IRQ 23
      ------------[ cut here ]------------
      WARNING: at kernel/irq/manage.c:437
      :
      NIP [c00000000016de8c] .__enable_irq+0x11c/0x140
      LR [c00000000016de88] .__enable_irq+0x118/0x140
      Call Trace:
      [c000003ea1f23880] [c00000000016de88] .__enable_irq+0x118/0x140 (unreliable)
      [c000003ea1f23910] [c00000000016df08] .enable_irq+0x58/0xa0
      [c000003ea1f239a0] [c0000000000388b4] .eeh_enable_irq+0xc4/0xe0
      [c000003ea1f23a30] [c000000000038a28] .eeh_report_reset+0x78/0x130
      [c000003ea1f23ac0] [c000000000037508] .eeh_pe_dev_traverse+0x98/0x170
      [c000003ea1f23b60] [c0000000000391ac] .eeh_handle_normal_event+0x2fc/0x3d0
      [c000003ea1f23bf0] [c000000000039538] .eeh_handle_event+0x2b8/0x2c0
      [c000003ea1f23c90] [c000000000039600] .eeh_event_handler+0xc0/0x170
      [c000003ea1f23d30] [c0000000000da9a0] .kthread+0xf0/0x100
      [c000003ea1f23e30] [c00000000000a1dc] .ret_from_kernel_thread+0x5c/0x80
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      91150af3
    • G
      powerpc/eeh: Don't use pci_dev during BAR restore · 4b83bd45
      Gavin Shan 提交于
      While restoring BARs for one specific PCI device, the pci_dev
      instance should have been released. So it's not reliable to use
      the pci_dev instance on restoring BARs. However, we still need
      some information (e.g. PCIe capability position, header type) from
      the pci_dev instance. So we have to store those information to
      EEH device in advance.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      4b83bd45
    • G
      powerpc/eeh: Use partial hotplug for EEH unaware drivers · f5c57710
      Gavin Shan 提交于
      When EEH error happens to one specific PE, some devices with drivers
      supporting EEH won't except hotplug on the device. However, there
      might have other deivces without driver, or with driver without EEH
      support. For the case, we need do partial hotplug in order to make
      sure that the PE becomes absolutely quite during reset. Otherise,
      the PE reset might fail and leads to failure of error recovery.
      
      The current code doesn't handle that 'mixed' case properly, it either
      uses the error callbacks to the drivers, or tries hotplug, but doesn't
      handle a PE (EEH domain) composed of a combination of the two.
      
      The patch intends to support so-called "partial" hotplug for EEH:
      Before we do reset, we stop and remove those PCI devices without
      EEH sensitive driver. The corresponding EEH devices are not detached
      from its PE, but with special flag. After the reset is done, those
      EEH devices with the special flag will be scanned one by one.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      f5c57710
    • G
      powerpc/pci: Partial tree hotplug support · ab444ec9
      Gavin Shan 提交于
      When EEH error happens to one specific PE, the device drivers
      of its attached EEH devices (PCI devices) are checked to see
      the further action: reset with complete hotplug, or reset without
      hotplug. However, that's not enough for those PCI devices whose
      drivers can't support EEH, or those PCI devices without driver.
      So we need do so-called "partial hotplug" on basis of PCI devices.
      In the situation, part of PCI devices of the specific PE are
      unplugged and plugged again after PE reset.
      
      The patch changes pcibios_add_pci_devices() so that it can support
      full hotplug and so-called "partial" hotplug based on device-tree
      or real hardware. It's notable that pci_of_scan.c has been changed
      for a bit in order to support the "partial" hotplug based on dev-tree.
      
      Most of the generic code already supports that, we just need to
      plumb it properly on our side.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ab444ec9
    • G
      powerpc/eeh: Use safe list traversal when walking EEH devices · 9feed42e
      Gavin Shan 提交于
      Currently, we're trasversing the EEH devices list using list_for_each_entry().
      That's not safe enough because the EEH devices might be removed from
      its parent PE while doing iteration. The patch replaces that with
      list_for_each_entry_safe().
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      9feed42e
    • G
      powerpc/eeh: Keep PE during hotplug · 807a827d
      Gavin Shan 提交于
      When we do normal hotplug, the PE (shadow EEH structure) shouldn't be
      kept around.
      
      However, we need to keep it if the hotplug an artifial one caused by
      EEH errors recovery.
      
      Since we remove EEH device through the PCI hook pcibios_release_device(),
      the flag "purge_pe" passed to various functions is meaningless. So the patch
      removes the meaningless flag and introduce new flag "EEH_PE_KEEP"
      to save the PE while doing hotplug during EEH error recovery.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      807a827d
    • G
      powerpc/pci: Override pcibios_release_device() · 008a4938
      Gavin Shan 提交于
      The patch overrides pcibios_release_device() to release EEH
      resources (EEH cache, unbinding EEH device) for the indicated PCI
      device.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      008a4938
    • G
      powerpc/eeh: Export functions for hotplug · f2856491
      Gavin Shan 提交于
      Make some functions public in order to support hotplug on either specific
      PCI bus or PCI device in future.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      f2856491
    • G
      powerpc/eeh: Remove reference to PCI device · 0ba17888
      Gavin Shan 提交于
      We will rely on pcibios_release_device() to remove the EEH cache
      and unbind EEH device for the specific PCI device. So we shouldn't
      hold the reference to the PCI device from EEH cache and EEH device.
      Otherwise, pcibios_release_device() won't be called as we expected.
      The patch removes the reference to the PCI device in EEH core.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      0ba17888
    • A
      powerpc/modules: Module CRC relocation fix causes perf issues · 0e0ed640
      Anton Blanchard 提交于
      Module CRCs are implemented as absolute symbols that get resolved by
      a linker script. We build an intermediate .o that contains an
      unresolved symbol for each CRC. genksysms parses this .o, calculates
      the CRCs and writes a linker script that "resolves" the symbols to
      the calculated CRC.
      
      Unfortunately the ppc64 relocatable kernel sees these CRCs as symbols
      that need relocating and relocates them at boot. Commit d4703aef
      (module: handle ppc64 relocating kcrctabs when CONFIG_RELOCATABLE=y)
      added a hook to reverse the bogus relocations. Part of this patch
      created a symbol at 0x0:
      
      # head -2 /proc/kallsyms
      0000000000000000 T reloc_start
      c000000000000000 T .__start
      
      This reloc_start symbol is causing lots of confusion to perf. It
      thinks reloc_start is a massive function that stretches from 0x0 to
      0xc000000000000000 and we get various cryptic errors out of perf,
      including:
      
      problem incrementing symbol count, skipping event
      
      This patch removes the  reloc_start linker script label and instead
      defines it as PHYSICAL_START. We also need to wrap it with
      CONFIG_PPC64 because the ppc32 kernel can set a non zero
      PHYSICAL_START at compile time and we wouldn't want to subtract
      it from the CRCs in that case.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Cc: <stable@kernel.org>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      0e0ed640
    • M
      powerpc: Add second POWER8 PVR entry · 33959f88
      Michael Neuling 提交于
      POWER8 comes with two different PVRs.  This patch enables the additional
      PVR in the cputable.
      
      The existing entry (PVR=0x4b) is renamed to POWER8E and the new entry
      (PVR=0x4d) is given POWER8.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      33959f88
  5. 10 7月, 2013 1 次提交
  6. 04 7月, 2013 3 次提交
    • Z
      powerpc: Remove savemaxmem parameter setup · 427fcd23
      Zhang Yanfei 提交于
      saved_max_pfn is used to know the amount of memory that the previous
      kernel used.  And for powerpc, we set saved_max_pfn by passing the kernel
      commandline parameter "savemaxmem=".
      
      The only user of saved_max_pfn in powerpc is read_oldmem interface.  Since
      we have removed read_oldmem, we don't need this parameter anymore.
      Signed-off-by: NZhang Yanfei <zhangyanfei@cn.fujitsu.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Matt Fleming <matt.fleming@intel.com>
      Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      427fcd23
    • J
      mm: enhance free_reserved_area() to support poisoning memory with zero · dbe67df4
      Jiang Liu 提交于
      Address more review comments from last round of code review.
      1) Enhance free_reserved_area() to support poisoning freed memory with
         pattern '0'. This could be used to get rid of poison_init_mem()
         on ARM64.
      2) A previous patch has disabled memory poison for initmem on s390
         by mistake, so restore to the original behavior.
      3) Remove redundant PAGE_ALIGN() when calling free_reserved_area().
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: <sworddragon2@aol.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Jianguo Wu <wujianguo@huawei.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: Michel Lespinasse <walken@google.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Tang Chen <tangchen@cn.fujitsu.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wen Congyang <wency@cn.fujitsu.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dbe67df4
    • J
      mm: change signature of free_reserved_area() to fix building warnings · 11199692
      Jiang Liu 提交于
      Change signature of free_reserved_area() according to Russell King's
      suggestion to fix following build warnings:
      
        arch/arm/mm/init.c: In function 'mem_init':
        arch/arm/mm/init.c:603:2: warning: passing argument 1 of 'free_reserved_area' makes integer from pointer without a cast [enabled by default]
          free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, 0, NULL);
          ^
        In file included from include/linux/mman.h:4:0,
                         from arch/arm/mm/init.c:15:
        include/linux/mm.h:1301:22: note: expected 'long unsigned int' but argument is of type 'void *'
         extern unsigned long free_reserved_area(unsigned long start, unsigned long end,
      
         mm/page_alloc.c: In function 'free_reserved_area':
      >> mm/page_alloc.c:5134:3: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast [enabled by default]
         In file included from arch/mips/include/asm/page.h:49:0,
                          from include/linux/mmzone.h:20,
                          from include/linux/gfp.h:4,
                          from include/linux/mm.h:8,
                          from mm/page_alloc.c:18:
         arch/mips/include/asm/io.h:119:29: note: expected 'const volatile void *' but argument is of type 'long unsigned int'
         mm/page_alloc.c: In function 'free_area_init_nodes':
         mm/page_alloc.c:5030:34: warning: array subscript is below array bounds [-Warray-bounds]
      
      Also address some minor code review comments.
      Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: <sworddragon2@aol.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jeremy Fitzhardinge <jeremy@goop.org>
      Cc: Jianguo Wu <wujianguo@huawei.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: Michel Lespinasse <walken@google.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Tang Chen <tangchen@cn.fujitsu.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wen Congyang <wency@cn.fujitsu.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      11199692
  7. 02 7月, 2013 2 次提交
  8. 01 7月, 2013 15 次提交
    • M
      powerpc/perf: Core EBB support for 64-bit book3s · 330a1eb7
      Michael Ellerman 提交于
      Add support for EBB (Event Based Branches) on 64-bit book3s. See the
      included documentation for more details.
      
      EBBs are a feature which allows the hardware to branch directly to a
      specified user space address when a PMU event overflows. This can be
      used by programs for self-monitoring with no kernel involvement in the
      inner loop.
      
      Most of the logic is in the generic book3s code, primarily to avoid a
      proliferation of PMU callbacks.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      330a1eb7
    • M
      powerpc/perf: Drop MMCRA from thread_struct · 2ac138ca
      Michael Ellerman 提交于
      In commit 59affcd3 "Context switch more PMU related SPRs" I added more
      PMU SPRs to thread_struct, later modified in commit b11ae951. To add
      insult to injury it turns out we don't need to switch MMCRA as it's
      only user readable, and the value is recomputed by the PMU code.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      2ac138ca
    • M
      powerpc: Wire up the HV facility unavailable exception · b14b6260
      Michael Ellerman 提交于
      Similar to the facility unavailble exception, except the facilities are
      controlled by HFSCR.
      
      Adapt the facility_unavailable_exception() so it can be called for
      either the regular or Hypervisor facility unavailable exceptions.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      CC: <stable@vger.kernel.org> [v3.10]
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      b14b6260
    • M
      powerpc: Rename and flesh out the facility unavailable exception handler · 021424a1
      Michael Ellerman 提交于
      The exception at 0xf60 is not the TM (Transactional Memory) unavailable
      exception, it is the "Facility Unavailable Exception", rename it as
      such.
      
      Flesh out the handler to acknowledge the fact that it can be called for
      many reasons, one of which is TM being unavailable.
      
      Use STD_EXCEPTION_COMMON() for the exception body, for some reason we
      had it open-coded, I've checked the generated code is identical.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      CC: <stable@vger.kernel.org> [v3.10]
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      021424a1
    • M
      powerpc: Remove KVMTEST from RELON exception handlers · c9f69518
      Michael Ellerman 提交于
      KVMTEST is a macro which checks whether we are taking an exception from
      guest context, if so we branch out of line and eventually call into the
      KVM code to handle the switch.
      
      When running real guests on bare metal (HV KVM) the hardware ensures
      that we never take a relocation on exception when transitioning from
      guest to host. For PR KVM we disable relocation on exceptions ourself in
      kvmppc_core_init_vm(), as of commit a413f474 "Disable relocation on
      exceptions whenever PR KVM is active".
      
      So convert all the RELON macros to use NOTEST, and drop the remaining
      KVM_HANDLER() definitions we have for 0xe40 and 0xe80.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      CC: <stable@vger.kernel.org> [v3.9+]
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      c9f69518
    • M
      powerpc: Remove unreachable relocation on exception handlers · 1d567cb4
      Michael Ellerman 提交于
      We have relocation on exception handlers defined for h_data_storage and
      h_instr_storage. However we will never take relocation on exceptions for
      these because they can only come from a guest, and we never take
      relocation on exceptions when we transition from guest to host.
      
      We also have a handler for hmi_exception (Hypervisor Maintenance) which
      is defined in the architecture to never be delivered with relocation on,
      see see v2.07 Book III-S section 6.5.
      
      So remove the handlers, leaving a branch to self just to be double extra
      paranoid.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      CC: <stable@vger.kernel.org> [v3.9+]
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      1d567cb4
    • C
      powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries · 8246aca7
      Chen Gang 提交于
      the smp_release_cpus is a normal funciton and called in normal environments,
        but it calls the __initdata spinning_secondaries.
        need modify spinning_secondaries to match smp_release_cpus.
      
      the related warning:
        (the linker report boot_paca.33377, but it should be spinning_secondaries)
      
      -----------------------------------------------------------------------------
      
      WARNING: arch/powerpc/kernel/built-in.o(.text+0x23176): Section mismatch in reference from the function .smp_release_cpus() to the variable .init.data:boot_paca.33377
      The function .smp_release_cpus() references
      the variable __initdata boot_paca.33377.
      This is often because .smp_release_cpus lacks a __initdata
      annotation or the annotation of boot_paca.33377 is wrong.
      
      WARNING: arch/powerpc/kernel/built-in.o(.text+0x231fe): Section mismatch in reference from the function .smp_release_cpus() to the variable .init.data:boot_paca.33377
      The function .smp_release_cpus() references
      the variable __initdata boot_paca.33377.
      This is often because .smp_release_cpus lacks a __initdata
      annotation or the annotation of boot_paca.33377 is wrong.
      
      -----------------------------------------------------------------------------
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      8246aca7
    • C
      powerpc/nvram64: Need return the related error code on failure occurs · 7029705a
      Chen Gang 提交于
      When error occurs, need return the related error code to let upper
      caller know about it.
      
      ppc_md.nvram_size() can return the error code (e.g. core99_nvram_size()
      in 'arch/powerpc/platforms/powermac/nvram.c').
      
      Also set ret value when only need it, so can save structions for normal
      cases.
      Signed-off-by: NChen Gang <gang.chen@asianux.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      7029705a
    • L
      powerpc: Set cpu sibling mask before online cpu · cce606fe
      Li Zhong 提交于
      It seems following race is possible:
      
      	cpu0					cpux
      smp_init->cpu_up->_cpu_up
      	__cpu_up
      		kick_cpu(1)
      -------------------------------------------------------------------------
      		waiting online			...
      		...				notify CPU_STARTING
      							set cpux active
      						set cpux online
      -------------------------------------------------------------------------
      		finish waiting online
      		...
      sched_init_smp
      	init_sched_domains(cpu_active_mask)
      		build_sched_domains
      						set cpux sibling info
      -------------------------------------------------------------------------
      
      Execution of cpu0 and cpux could be concurrent between two separator
      lines.
      
      So if the cpux sibling information was set too late (normally
      impossible, but could be triggered by adding some delay in
      start_secondary, after setting cpu online), build_sched_domains()
      running on cpu0 might see cpux active, with an empty sibling mask, then
      cause some bad address accessing like following:
      
      [    0.099855] Unable to handle kernel paging request for data at address 0xc00000038518078f
      [    0.099868] Faulting instruction address: 0xc0000000000b7a64
      [    0.099883] Oops: Kernel access of bad area, sig: 11 [#1]
      [    0.099895] PREEMPT SMP NR_CPUS=16 DEBUG_PAGEALLOC NUMA pSeries
      [    0.099922] Modules linked in:
      [    0.099940] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-rc1-00120-gb973425c-dirty #16
      [    0.099956] task: c0000001fed80000 ti: c0000001fed7c000 task.ti: c0000001fed7c000
      [    0.099971] NIP: c0000000000b7a64 LR: c0000000000b7a40 CTR: c0000000000b4934
      [    0.099985] REGS: c0000001fed7f760 TRAP: 0300   Not tainted  (3.10.0-rc1-00120-gb973425c-dirty)
      [    0.099997] MSR: 8000000000009032 <SF,EE,ME,IR,DR,RI>  CR: 24272828  XER: 20000003
      [    0.100045] SOFTE: 1
      [    0.100053] CFAR: c000000000445ee8
      [    0.100064] DAR: c00000038518078f, DSISR: 40000000
      [    0.100073]
      GPR00: 0000000000000080 c0000001fed7f9e0 c000000000c84d48 0000000000000010
      GPR04: 0000000000000010 0000000000000000 c0000001fc55e090 0000000000000000
      GPR08: ffffffffffffffff c000000000b80b30 c000000000c962d8 00000003845ffc5f
      GPR12: 0000000000000000 c00000000f33d000 c00000000000b9e4 0000000000000000
      GPR16: 0000000000000000 0000000000000000 0000000000000001 0000000000000000
      GPR20: c000000000ccf750 0000000000000000 c000000000c94d48 c0000001fc504000
      GPR24: c0000001fc504000 c0000001fecef848 c000000000c94d48 c000000000ccf000
      GPR28: c0000001fc522090 0000000000000010 c0000001fecef848 c0000001fed7fae0
      [    0.100293] NIP [c0000000000b7a64] .get_group+0x84/0xc4
      [    0.100307] LR [c0000000000b7a40] .get_group+0x60/0xc4
      [    0.100318] Call Trace:
      [    0.100332] [c0000001fed7f9e0] [c0000000000dbce4] .lock_is_held+0xa8/0xd0 (unreliable)
      [    0.100354] [c0000001fed7fa70] [c0000000000bf62c] .build_sched_domains+0x728/0xd14
      [    0.100375] [c0000001fed7fbe0] [c000000000af67bc] .sched_init_smp+0x4fc/0x654
      [    0.100394] [c0000001fed7fce0] [c000000000adce24] .kernel_init_freeable+0x17c/0x30c
      [    0.100413] [c0000001fed7fdb0] [c00000000000ba08] .kernel_init+0x24/0x12c
      [    0.100431] [c0000001fed7fe30] [c000000000009f74] .ret_from_kernel_thread+0x5c/0x68
      [    0.100445] Instruction dump:
      [    0.100456] 38800010 38a00000 4838e3f5 60000000 7c6307b4 2fbf0000 419e0040 3d220001
      [    0.100496] 78601f24 39491590 e93e0008 7d6a002a <7d69582a> f97f0000 7d4a002a e93e0010
      [    0.100559] ---[ end trace 31fd0ba7d8756001 ]---
      
      This patch tries to move the sibling maps updating before
      notify_cpu_starting() and cpu online, and a write barrier there to make
      sure sibling maps are updated before active and online mask.
      Signed-off-by: NLi Zhong <zhong@linux.vnet.ibm.com>
      Reviewed-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      cce606fe
    • P
      powerpc: Delete __cpuinit usage from all users · 061d19f2
      Paul Gortmaker 提交于
      The __cpuinit type of throwaway sections might have made sense
      some time ago when RAM was more constrained, but now the savings
      do not offset the cost and complications.  For example, the fix in
      commit 5e427ec2 ("x86: Fix bit corruption at CPU resume time")
      is a good example of the nasty type of bugs that can be created
      with improper use of the various __init prefixes.
      
      After a discussion on LKML[1] it was decided that cpuinit should go
      the way of devinit and be phased out.  Once all the users are gone,
      we can then finally remove the macros themselves from linux/init.h.
      
      This removes all the powerpc uses of the __cpuinit macros.  There
      are no __CPUINIT users in assembly files in powerpc.
      
      [1] https://lkml.org/lkml/2013/5/20/589
      
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Josh Boyer <jwboyer@gmail.com>
      Cc: Matt Porter <mporter@kernel.crashing.org>
      Cc: Kumar Gala <galak@kernel.crashing.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      061d19f2
    • J
      powerpc/idle: Convert use of typedef ctl_table to struct ctl_table · cc293bf7
      Joe Perches 提交于
      This typedef is unnecessary and should just be removed.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      cc293bf7
    • K
      powerpc: Don't flush/invalidate the d/icache for an unknown relocation type · 348c2298
      Kevin Hao 提交于
      For an unknown relocation type since the value of r4 is just the 8bit
      relocation type, the sum of r4 and r7 may yield an invalid memory
      address. For example:
          In normal case:
                   r4 = c00xxxxx
                   r7 = 40000000
                   r4 + r7 = 000xxxxx
      
          For an unknown relocation type:
                   r4 = 000000xx
                   r7 = 40000000
                   r4 + r7 = 400000xx
         400000xx is an invalid memory address for a board which has just
         512M memory.
      
      And for operations such as dcbst or icbi may cause bus error for an
      invalid memory address on some platforms and then cause the board
      reset. So we should skip the flush/invalidate the d/icache for
      an unknown relocation type.
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Acked-by: NSuzuki K. Poulose <suzuki@in.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      348c2298
    • G
      powerpc/eeh: Avoid build warnings · eeb6361f
      Gavin Shan 提交于
      The patch is for avoiding following build warnings:
      
         The function .pnv_pci_ioda_fixup() references
         the function __init .eeh_init().
         This is often because .pnv_pci_ioda_fixup lacks a __init
      
         The function .pnv_pci_ioda_fixup() references
         the function __init .eeh_addr_cache_build().
         This is often because .pnv_pci_ioda_fixup lacks a __init
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      eeb6361f
    • G
      powerpc/eeh: Refactor the output message · 56ca4fde
      Gavin Shan 提交于
      We needn't the the whole backtrace other than one-line message in
      the error reporting interrupt handler. For errors triggered by
      access PCI config space or MMIO, we replace "WARN(1, ...)" with
      pr_err() and dump_stack(). The patch also adds more output messages
      to indicate what EEH core is doing. Besides, some printk() are
      replaced with pr_warning().
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      56ca4fde
    • G
      powerpc/eeh: Fix address catch for PowerNV · 88b6d14b
      Gavin Shan 提交于
      On the PowerNV platform, the EEH address cache isn't built correctly
      because we skipped the EEH devices without binding PE. The patch
      fixes that.
      Signed-off-by: NGavin Shan <shangw@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      88b6d14b