LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] gpio: gpiolib: set gpiochip_remove retval to void
From: Ben Dooks @ 2014-06-08 23:18 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Linux MIPS Mailing List, m, Linux-sh list, Linus Walleij,
	platform-driver-x86, linux-leds@vger.kernel.org, driverdevel,
	Alexandre Courbot, patches, linux-samsungsoc, Geert Uytterhoeven,
	linux-input@vger.kernel.org, Linux Media Mailing List,
	spear-devel, linux-gpio@vger.kernel.org, David Daney,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	linux-wireless, linux-kernel@vger.kernel.org, abdoulaye berthe,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <5388CB1B.3090802@metafoo.de>

On Fri, May 30, 2014 at 08:16:59PM +0200, Lars-Peter Clausen wrote:
> On 05/30/2014 07:33 PM, David Daney wrote:
> >On 05/30/2014 04:39 AM, Geert Uytterhoeven wrote:
> >>On Fri, May 30, 2014 at 1:30 PM, abdoulaye berthe <berthe.ab@gmail.com>
> >>wrote:
> >>>--- a/drivers/gpio/gpiolib.c
> >>>+++ b/drivers/gpio/gpiolib.c
> >>>@@ -1263,10 +1263,9 @@ static void gpiochip_irqchip_remove(struct
> >>>gpio_chip *gpiochip);
> >>>   *
> >>>   * A gpio_chip with any GPIOs still requested may not be removed.
> >>>   */
> >>>-int gpiochip_remove(struct gpio_chip *chip)
> >>>+void gpiochip_remove(struct gpio_chip *chip)
> >>>  {
> >>>         unsigned long   flags;
> >>>-       int             status = 0;
> >>>         unsigned        id;
> >>>
> >>>         acpi_gpiochip_remove(chip);
> >>>@@ -1278,24 +1277,15 @@ int gpiochip_remove(struct gpio_chip *chip)
> >>>         of_gpiochip_remove(chip);
> >>>
> >>>         for (id = 0; id < chip->ngpio; id++) {
> >>>-               if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) {
> >>>-                       status = -EBUSY;
> >>>-                       break;
> >>>-               }
> >>>-       }
> >>>-       if (status == 0) {
> >>>-               for (id = 0; id < chip->ngpio; id++)
> >>>-                       chip->desc[id].chip = NULL;
> >>>-
> >>>-               list_del(&chip->list);
> >>>+               if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags))
> >>>+                       panic("gpio: removing gpiochip with gpios still
> >>>requested\n");
> >>
> >>panic?
> >
> >NACK to the patch for this reason.  The strongest thing you should do here
> >is WARN.
> >
> >That said, I am not sure why we need this whole patch set in the first place.
> 
> Well, what currently happens when you remove a device that is a
> provider of a gpio_chip which is still in use, is that the kernel
> crashes. Probably with a rather cryptic error message. So this patch
> doesn't really change the behavior, but makes it more explicit what
> is actually wrong. And even if you replace the panic() by a WARN()
> it will again just crash slightly later.
> 
> This is a design flaw in the GPIO subsystem that needs to be fixed.

Surely then the best way is to error out to the module unload and
stop the driver being unloaded?

-- 
Ben Dooks, ben@fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

^ permalink raw reply

* Re: [PATCH 0/3] dmaengine: mpc512x: add device tree binding document and DMA channel lookup
From: Alexander Popov @ 2014-06-08 18:48 UTC (permalink / raw)
  To: Gerhard Sittig, Dan Williams, Vinod Koul, Lars-Peter Clausen,
	Arnd Bergmann, Anatolij Gustschin, Andy Shevchenko,
	Alexander Popov, linuxppc-dev, dmaengine, devicetree
In-Reply-To: <1400924009-23992-1-git-send-email-a13xp0p0v88@gmail.com>

2014-05-24 13:33 GMT+04:00 Alexander Popov <a13xp0p0v88@gmail.com>:
> This patch series introduces a device tree binding document for
> the MPC512x DMA controller and adds device tree based DMA channel lookup
> for it.

Hello, excuse me, could I have a feedback?
Should I fix anything?

Thanks a lot!
Alexander

> Alexander Popov (3):
>   dmaengine: mpc512x: add device tree binding document
>   dmaengine: of: add common xlate function for matching by channel id
>   dmaengine: mpc512x: register for device tree channel lookup
>
>  .../devicetree/bindings/dma/mpc512x-dma.txt        | 40 ++++++++++++++++++++++
>  arch/powerpc/boot/dts/mpc5121.dtsi                 |  1 +
>  drivers/dma/mpc512x_dma.c                          | 13 ++++++-
>  drivers/dma/of-dma.c                               | 35 +++++++++++++++++++
>  include/linux/of_dma.h                             |  4 +++
>  5 files changed, 92 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/mpc512x-dma.txt
>
> --
> 1.8.4.2
>

^ permalink raw reply

* [PATCH] KVM: PPC: Book3S PR: ppc64 ABIv2 build fixes
From: Anton Blanchard @ 2014-06-08  5:06 UTC (permalink / raw)
  To: agraf, benh, paulus; +Cc: linuxppc-dev, kvm-ppc

binutils knows that a branch to a function descriptor is actually
a branch to the function text. By removing the explicit branch to
dot symbols, we maintain both ABIv1 and ABIv2 compatibility.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: b/arch/powerpc/kvm/book3s_interrupts.S
===================================================================
--- a/arch/powerpc/kvm/book3s_interrupts.S
+++ b/arch/powerpc/kvm/book3s_interrupts.S
@@ -25,11 +25,9 @@
 #include <asm/exception-64s.h>
 
 #if defined(CONFIG_PPC_BOOK3S_64)
-#define FUNC(name) 		GLUE(.,name)
 #define GET_SHADOW_VCPU(reg)    addi	reg, r13, PACA_SVCPU
 
 #elif defined(CONFIG_PPC_BOOK3S_32)
-#define FUNC(name)		name
 #define GET_SHADOW_VCPU(reg)	lwz     reg, (THREAD + THREAD_KVM_SVCPU)(r2)
 
 #endif /* CONFIG_PPC_BOOK3S_XX */
@@ -93,7 +91,7 @@ kvm_start_entry:
 kvm_start_lightweight:
 	/* Copy registers into shadow vcpu so we can access them in real mode */
 	GET_SHADOW_VCPU(r3)
-	bl	FUNC(kvmppc_copy_to_svcpu)
+	bl	kvmppc_copy_to_svcpu
 	nop
 	REST_GPR(4, r1)
 
@@ -131,7 +129,7 @@ after_sprg3_load:
 	PPC_LL	r4, VCPU_SHADOW_MSR(r4)	/* get shadow_msr */
 
 	/* Jump to segment patching handler and into our guest */
-	bl	FUNC(kvmppc_entry_trampoline)
+	bl	kvmppc_entry_trampoline
 	nop
 
 /*
@@ -164,7 +162,7 @@ after_sprg3_load:
 	/* On 64-bit, interrupts are still off at this point */
 
 	GET_SHADOW_VCPU(r4)
-	bl	FUNC(kvmppc_copy_from_svcpu)
+	bl	kvmppc_copy_from_svcpu
 	nop
 
 #ifdef CONFIG_PPC_BOOK3S_64
@@ -203,7 +201,7 @@ after_sprg3_load:
 
 	/* Restore r3 (kvm_run) and r4 (vcpu) */
 	REST_2GPRS(3, r1)
-	bl	FUNC(kvmppc_handle_exit_pr)
+	bl	kvmppc_handle_exit_pr
 
 	/* If RESUME_GUEST, get back in the loop */
 	cmpwi	r3, RESUME_GUEST
Index: b/arch/powerpc/kvm/book3s_rmhandlers.S
===================================================================
--- a/arch/powerpc/kvm/book3s_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_rmhandlers.S
@@ -34,13 +34,7 @@
  *                                                                           *
  ****************************************************************************/
 
-#if defined(CONFIG_PPC_BOOK3S_64)
-
-#define FUNC(name) 		GLUE(.,name)
-
-#elif defined(CONFIG_PPC_BOOK3S_32)
-
-#define FUNC(name)		name
+#ifdef CONFIG_PPC_BOOK3S_32
 
 .macro INTERRUPT_TRAMPOLINE intno
 

^ permalink raw reply

* [git pull] Please pull powerpc.git next branch
From: Benjamin Herrenschmidt @ 2014-06-07  4:34 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, Linux Kernel list

Hi Linus !

Here is the bulk of the powerpc changes for this merge window. It got a bit
delayed in part because I wasn't paying attention, and in part because I
discovered I had a core PCI change without a PCI maintainer ack in it. Bjorn
eventually agreed it was ok to merge it though we'll probably improve it
later and I didn't want to rebase to add his ack.

There is going to be a bit more next week, essentially fixes that I still
want to sort through and test.

The biggest item this time is the support to build the ppc64 LE kernel
with our new v2 ABI. We previously supported v2 userspace but the kernel
itself was a tougher nut to crack. This is now sorted mostly thanks to Anton
and Rusty.

We also have a fairly big series from Cedric that add support for 64-bit
LE zImage boot wrapper. This was made harder by the fact that traditionally
our zImage wrapper was always 32-bit, but our new LE toolchains don't really
support 32-bit anymore (it's somewhat there but not really "supported") so
we didn't want to rely on it. This meant more churn that just endian fixes.

This brings some more LE bits as well, such as the ability to run in LE mode
without a hypervisor (ie. under OPAL firmware) by doing the right OPAL call
to reinitialize the CPU to take HV interrupts in the right mode and the usual
pile of endian fixes. 

There's another series from Gavin adding EEH improvements (one day we *will*
have a release with less than 20 EEH patches, I promise !).

Another highlight is the support for the "Split core" functionality on P8
by Michael. This allows a P8 core to be split into "sub cores" of 4 threads
which allows the subcores to run different guests under KVM (the HW still
doesn't support a partition per thread).

And then the usual misc bits and fixes ...

Cheers,
Ben.

The following changes since commit 011e4b02f1da156ac7fea28a9da878f3c23af739:

  powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode (2014-05-28 13:24:26 +1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git next

for you to fetch changes up to 0c0a3e5a100bbc4aaedd140e82b429227a76701b:

  powerpc/powernv: Add missing include to LPC code (2014-06-07 08:57:21 +1000)

----------------------------------------------------------------
Alexander Graf (2):
      powerpc: Use 64k io pages when we never see an HEA
      PPC: ePAPR: Fix hypercall on LE guest

Alistair Popple (4):
      IBM Currituck: Clean up board specific code before adding Akebono code
      IBM Akebono: Add the Akebono platform
      powerpc: Added PCI MSI support using the HSTA module
      ppc476: Enable a linker work around for IBM errata #46

Andrew Murray (1):
      powerpc/pci: Use of_pci_range_parser helper in pci_process_bridge_OF_ranges

Anton Blanchard (36):
      powerpc: Don't build assembly files with ABIv2
      powerpc: No need to use dot symbols when branching to a function
      powerpc: Remove superflous function descriptors in assembly only code
      powerpc: Don't use a function descriptor for system call table
      powerpc: Remove some unnecessary uses of _GLOBAL() and _STATIC()
      powerpc: Remove _INIT_GLOBAL(), _STATIC() and _INIT_STATIC()
      powerpc: Remove dot symbol usage in exception macros
      powerpc: Create DOTSYM to wrap dot symbol usage
      powerpc: Remove function descriptors and dot symbols on new ABI
      powerpc: ABIv2 function calls must place target address in r12
      powerpc: Ignore .TOC. relocations
      powerpc: Add ABIv2 support to ppc_function_entry
      powerpc: Use ppc_function_entry instead of open coding it
      powerpc: Fix branch patching code for ABIv2
      powerpc: Fix kernel thread creation on ABIv2
      powerpc: Fix ABIv2 issues with stack offsets in assembly code
      powerpc/tm: Use STK_PARAM
      powerpc/tm: Fix GOT save offset for ABIv2
      powerpc/tracing: TRACE_WITH_FRAME_BUFFER creates invalid stack frames
      powerpc: Fix SMP issues with ppc64le ABIv2
      powerpc: Fix ABIv2 issue with dereference_function_descriptor
      powerpc: Add _GLOBAL_TOC for ABIv2 assembly functions exported to modules
      powerpc: ftrace_caller, _mcount is exported to modules so needs _GLOBAL_TOC()
      powerpc/kprobes: Fix ABIv2 issues with kprobe_lookup_name
      powerpc/modules: Create is_module_trampoline()
      powerpc/modules: Create module_trampoline_target()
      powerpc/ftrace: Use module loader helpers to parse trampolines
      powerpc/ftrace: Fix ABIv2 issues with __ftrace_make_call
      powerpc: Build little endian ppc64 kernel with ABIv2
      selftests/powerpc: Update for ABIv2
      powerpc: 64bit sendfile is capped at 2GB
      powerpc/powernv: Fix endian issues in memory error handling code
      powerpc: Allow ppc_md platform hook to override memory_block_size_bytes
      powerpc/powernv: Set memory_block_size_bytes to 256MB
      powerpc: Exported functions __clear_user and copy_page use r2 so need _GLOBAL_TOC()
      powerpc/pseries: hcall functions are exported to modules, need _GLOBAL_TOC()

Benjamin Herrenschmidt (10):
      Merge commit 'f3cae355a962784101478504ef7f6a389ad62979' into next
      Merge remote-tracking branch 'anton/abiv2' into next
      Revert "powerpc/powernv: Fundamental reset on PLX ports"
      powerpc/powernv: Add calls to support little endian host
      powerpc/serial: Use saner flags when creating legacy ports
      powerpc/powernv: Provide debugfs access to the LPC bus via OPAL
      powerpc/powernv: Add missing include to LPC code

Cédric Le Goater (15):
      powerpc/boot: Fix do_div for 64bit wrapper
      powerpc/boot: Use a common prom_args struct in oflib
      powerpc/boot: Use prom_arg_t in oflib
      powerpc/boot: Add byteswapping routines in oflib
      powerpc/boot: Add PROM_ERROR define in oflib
      powerpc/boot: Rework of_claim() to make it 64bit friendly
      powerpc/boot: Define typedef ihandle as u32
      powerpc/boot: Fix compile warning in 64bit
      powerpc/boot: Define byteswapping routines for little endian
      powerpc/boot: Add 64bit and little endian support to addnote
      powerpc/boot: Add little endian support to elf utils
      powerpc/boot: Define a routine to enter prom
      powerpc/boot: Modify entry point for 64bit
      powerpc/boot: Add a global entry point for pseries
      powerpc/boot: Add support for 64bit little endian wrapper

Diana Craciun (3):
      powerpc/fsl: Added binding for Freescale CoreNet coherency fabric (CCF)
      powerpc/fsl: Updated device trees for platforms with corenet version 2
      powerpc/fsl: Updated corenet-cf compatible string for corenet1-cf chips

Gautham R. Shenoy (2):
      powerpc: powernv: Framework to show the correct clock in /proc/cpuinfo
      powerpc: powernv: Implement ppc_md.get_proc_freq()

Gavin Shan (25):
      powerpc/eeh: Remove EEH_PE_PHB_DEAD
      powerpc/powernv: Remove PNV_EEH_STATE_REMOVED
      powerpc/powernv: Move PNV_EEH_STATE_ENABLED around
      powerpc/powernv: Remove fields in PHB diag-data dump
      powerpc/eeh: EEH_PE_ISOLATED not reflect HW state
      powerpc/eeh: Block PCI-CFG access during PE reset
      powerpc/powernv: Use EEH PCI config accessors
      powerpc/eeh: Avoid I/O access during PE reset
      powerpc/eeh: Cleanup eeh_gather_pci_data()
      powerpc/eeh: Use cached capability for log dump
      powerpc/eeh: Cleanup EEH subsystem variables
      powerpc/eeh: Allow to disable EEH
      powerpc/eeh: No hotplug on permanently removed dev
      powerpc/powernv: Fix endless reporting frozen PE
      powerpc/pseries: Fix overwritten PE state
      powerpc/powernv: Reset root port in firmware
      powerpc/eeh: Make the delay for PE reset unified
      powerpc/pci: Mask linkDown on resetting PCI bus
      powrpc/powernv: Reset PHB in kdump kernel
      powerpc/eeh: Can't recover from non-PE-reset case
      powerpc/powernv: Fundamental reset on PLX ports
      powerpc/powernv: Missed IOMMU table type
      powerpc/powernv: Don't use pe->pbus to get the domain number
      powerpc/prom: Stop scanning dev-tree for fdump early
      powerpc/eeh: Fix build error for celleb

James Hogan (1):
      powerpc: Remove non-uapi linkage.h export

Jeff Bailey (1):
      powerpc: Clear ELF personality flag if ELFv2 is not requested.

Lijun Pan (1):
      powerpc/mpc85xx: Remove P1023 RDS support

Liu Gang (1):
      powerpc/rmu: Fix the error memory free parameters

Liu Ping Fan (1):
      powerpc/mm: use macro PGTABLE_EADDR_SIZE instead of digital

Martijn de Gouw (1):
      powerpc/85xx: Add OCA4080 board support

Michael Ellerman (10):
      powerpc/kvm/book3s_hv: Rework the secondary inhibit code
      powerpc/powernv: Make it possible to skip the IRQHAPPENED check in power7_nap()
      powerpc: Add threads_per_subcore
      powerpc: Check cpu_thread_in_subcore() in __cpu_up()
      powerpc/kvm/book3s_hv: Use threads_per_subcore in KVM
      powerpc/powernv: Add support for POWER8 split core on powernv
      powerpc/xmon: Fix up xmon format strings
      powerpc: Add cpu family documentation
      powerpc/mm: Check paca psize is up to date for huge mappings
      selftests/powerpc: Test the THP bug we fixed in the previous commit

Michael Neuling (2):
      powerpc/tm: Remove unnecessary r1 save
      powerpc/tm: Add checking to treclaim/trechkpt

Nishanth Aravamudan (2):
      powerpc/numa: Enable USE_PERCPU_NUMA_NODE_ID
      powerpc/numa: Enable CONFIG_HAVE_MEMORYLESS_NODES

Paul Gortmaker (2):
      powerpc: Drop return value from set_breakpoint as it is unused
      powerpc: Fix smp_processor_id() in preemptible splat in set_breakpoint

Philippe Bergheaud (1):
      powerpc: memcpy optimization for 64bit LE

Prabhakar Kushwaha (2):
      powerpc/mpc85xx:Add initial device tree support of T104x
      powerpc/fsl-booke: Add initial T104x_QDS board support

Preeti U Murthy (1):
      powerpc: Fix comment around arch specific definition of RECLAIM_DISTANCE

Rickard Strandqvist (2):
      macintosh/windfarm_pm121.c: Fix for possible null pointer dereference
      arch: powerpc/fadump: Cleaning up inconsistent NULL checks

Rusty Russell (12):
      powerpc: make module stub code endian independent
      powerpc: modules implement R_PPC64_TOCSAVE relocation.
      powerpc: EXPORT_SYMBOL(.TOC.)
      powerpc: module: handle MODVERSION for .TOC.
      powerpc: Fix up TOC. for modules.
      powerpc: Handle new ELFv2 module relocations
      powerpc: modules: comment about de-dotifying symbols when using the ELFv2 ABI.
      powerpc: modules: change r2 save/restore offset for ELFv2 ABI.
      powerpc: modules: use r12 for stub jump address.
      powerpc: modules: skip r2 setup for ELFv2
      powerpc: modules: implement stubs for ELFv2 ABI.
      powerpc/module: Fix stubs for BE

Sam bobroff (3):
      powerpc: Split __SYSFS_SPRSETUP macro
      powerpc: Fix regression of per-CPU DSCR setting
      powerpc: Document sysfs DSCR interface

Scott Wood (6):
      powerpc/fsl-rio: Fix fsl_rio_setup error paths and use-after-unmap
      powerpc/fsl-booke64: Set vmemmap_psize to 4K
      powerpc: fix build of epapr_paravirt on 64-bit book3s
      powerpc: Fix unused variable warning for epapr_has_idle
      powerpc/mpic: Don't init the fsl error int until after mpic init
      powerpc/fsl: Add fsl,portid-mapping to corenet1-cf chips

Stephen Chivers (1):
      powerpc/legacy_serial: Support MVME5100 UARTS with shifted registers

Stuart Yoder (1):
      powerpc: move epapr paravirt init of power_save to an initcall

Tang Yuantian (1):
      clk: qoriq: Update the clock bindings

Tony Breeds (1):
      powerpc/le: Show the endianess of the LPAR under PowerVM.

Ulrich Weigand (1):
      powerpc: Fix unsafe accesses to parameter area in ELFv2

Valentin Longchamp (3):
      devicetree: bindings: add Zarlink to the vendor prefixes
      devcietree: bindings: add some MFD Keymile FPGAs
      powerpc/mpc85xx: add support for Keymile's kmcoge4 board

Vasant Hegde (2):
      powerpc/powernv: Return secondary CPUs to firmware before FW update
      powerpc/powernv: Pass buffer size to OPAL validate flash call

Wang Dongsheng (1):
      fsl/pci: fix RC cannot detect PME message coming

Wei Yang (1):
      powerpc/eeh: Skip eeh sysfs when eeh is disabled

harninder rai (1):
      powerpc/mpc85xx: Add BSC9132 QDS Support

 Documentation/ABI/stable/sysfs-devices-system-cpu  |  25 ++
 .../clock/{corenet-clock.txt => qoriq-clock.txt}   |  10 +-
 Documentation/devicetree/bindings/mfd/bfticu.txt   |  25 ++
 Documentation/devicetree/bindings/mfd/qriox.txt    |  17 +
 .../devicetree/bindings/powerpc/4xx/akebono.txt    |  54 +++
 .../devicetree/bindings/powerpc/4xx/hsta.txt       |  19 +
 .../devicetree/bindings/powerpc/fsl/board.txt      |  17 +
 .../devicetree/bindings/powerpc/fsl/ccf.txt        |  46 +++
 .../devicetree/bindings/powerpc/fsl/cpus.txt       |  11 +
 .../devicetree/bindings/powerpc/fsl/pamu.txt       |  10 +
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 Documentation/powerpc/cpu_families.txt             | 221 +++++++++++
 arch/powerpc/Kconfig                               |   8 +
 arch/powerpc/Makefile                              |  16 +-
 arch/powerpc/boot/Makefile                         |  24 +-
 arch/powerpc/boot/addnote.c                        | 128 +++---
 arch/powerpc/boot/crt0.S                           | 180 ++++++++-
 arch/powerpc/boot/dcr.h                            |   4 +
 arch/powerpc/boot/dts/akebono.dts                  | 415 ++++++++++++++++++++
 arch/powerpc/boot/dts/b4860emu.dts                 |   7 +-
 arch/powerpc/boot/dts/bsc9132qds.dts               |  35 ++
 arch/powerpc/boot/dts/bsc9132qds.dtsi              | 101 +++++
 arch/powerpc/boot/dts/fsl/b4420si-post.dtsi        |   4 -
 arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi         |   2 +
 arch/powerpc/boot/dts/fsl/b4860si-post.dtsi        |   4 -
 arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi         |   4 +
 arch/powerpc/boot/dts/fsl/b4si-post.dtsi           |   3 +-
 arch/powerpc/boot/dts/fsl/bsc9132si-post.dtsi      | 185 +++++++++
 arch/powerpc/boot/dts/fsl/bsc9132si-pre.dtsi       |  66 ++++
 arch/powerpc/boot/dts/fsl/p2041si-post.dtsi        |   3 +-
 arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi         |   4 +
 arch/powerpc/boot/dts/fsl/p3041si-post.dtsi        |   3 +-
 arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi         |   4 +
 arch/powerpc/boot/dts/fsl/p4080si-post.dtsi        |   3 +-
 arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi         |   8 +
 arch/powerpc/boot/dts/fsl/p5020si-post.dtsi        |   3 +-
 arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi         |   2 +
 arch/powerpc/boot/dts/fsl/p5040si-post.dtsi        |   3 +-
 arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi         |   4 +
 arch/powerpc/boot/dts/fsl/t1040si-post.dtsi        | 430 +++++++++++++++++++++
 arch/powerpc/boot/dts/fsl/t1042si-post.dtsi        |  37 ++
 arch/powerpc/boot/dts/fsl/t104xsi-pre.dtsi         | 104 +++++
 arch/powerpc/boot/dts/fsl/t4240si-post.dtsi        |   3 +-
 arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi         |  12 +
 arch/powerpc/boot/dts/kmcoge4.dts                  | 152 ++++++++
 arch/powerpc/boot/dts/oca4080.dts                  | 118 ++++++
 arch/powerpc/boot/dts/p1023rds.dts                 | 219 -----------
 arch/powerpc/boot/dts/t1040qds.dts                 |  46 +++
 arch/powerpc/boot/dts/t1042qds.dts                 |  46 +++
 arch/powerpc/boot/dts/t104xqds.dtsi                | 166 ++++++++
 arch/powerpc/boot/dts/t4240emu.dts                 |  15 +-
 arch/powerpc/boot/elf_util.c                       |   4 +
 arch/powerpc/boot/of.c                             |   4 +-
 arch/powerpc/boot/of.h                             |  19 +-
 arch/powerpc/boot/ofconsole.c                      |   6 +-
 arch/powerpc/boot/oflib.c                          |  92 +++--
 arch/powerpc/boot/ppc_asm.h                        |  12 +
 arch/powerpc/boot/pseries-head.S                   |   8 +
 arch/powerpc/boot/stdio.c                          |  14 +
 arch/powerpc/boot/swab.h                           |  29 ++
 arch/powerpc/boot/treeboot-akebono.c               | 163 ++++++++
 arch/powerpc/boot/util.S                           |   4 +-
 arch/powerpc/boot/wrapper                          |  20 +-
 arch/powerpc/boot/zImage.lds.S                     |  25 +-
 arch/powerpc/configs/44x/akebono_defconfig         | 148 +++++++
 arch/powerpc/configs/85xx/kmp204x_defconfig        | 225 +++++++++++
 arch/powerpc/configs/corenet32_smp_defconfig       |   1 +
 arch/powerpc/configs/mpc85xx_defconfig             |   1 -
 arch/powerpc/configs/mpc85xx_smp_defconfig         |   1 -
 arch/powerpc/include/asm/code-patching.h           |  40 +-
 arch/powerpc/include/asm/context_tracking.h        |   4 +-
 arch/powerpc/include/asm/cputhreads.h              |   7 +
 arch/powerpc/include/asm/debug.h                   |   3 +-
 arch/powerpc/include/asm/eeh.h                     |  46 ++-
 arch/powerpc/include/asm/elf.h                     |   2 +
 arch/powerpc/include/asm/exception-64e.h           |   6 +-
 arch/powerpc/include/asm/exception-64s.h           |   2 +-
 arch/powerpc/include/asm/ftrace.h                  |   2 +
 arch/powerpc/include/asm/hw_breakpoint.h           |   2 +-
 arch/powerpc/include/asm/irqflags.h                |   8 +-
 arch/powerpc/include/asm/kprobes.h                 |   5 +-
 arch/powerpc/include/asm/kvm_ppc.h                 |   7 +
 arch/powerpc/include/asm/linkage.h                 |   2 +
 arch/powerpc/include/asm/machdep.h                 |   8 +
 arch/powerpc/include/asm/module.h                  |   4 +
 arch/powerpc/include/asm/opal.h                    |  18 +-
 arch/powerpc/include/asm/paca.h                    |   3 +
 arch/powerpc/include/asm/ppc-pci.h                 |   1 +
 arch/powerpc/include/asm/ppc_asm.h                 |  72 ++--
 arch/powerpc/include/asm/processor.h               |   2 +-
 arch/powerpc/include/asm/reg.h                     |  10 +
 arch/powerpc/include/asm/sections.h                |   2 +
 arch/powerpc/include/asm/smp.h                     |   8 -
 arch/powerpc/include/asm/string.h                  |   4 -
 arch/powerpc/include/asm/systbl.h                  |   8 +-
 arch/powerpc/include/asm/topology.h                |  15 +-
 arch/powerpc/include/uapi/asm/Kbuild               |   1 -
 arch/powerpc/include/uapi/asm/elf.h                |  10 +-
 arch/powerpc/kernel/asm-offsets.c                  |   1 +
 arch/powerpc/kernel/cpu_setup_fsl_booke.S          |  28 +-
 arch/powerpc/kernel/eeh.c                          | 212 ++++++----
 arch/powerpc/kernel/eeh_driver.c                   | 118 +++++-
 arch/powerpc/kernel/eeh_pe.c                       |  47 ++-
 arch/powerpc/kernel/eeh_sysfs.c                    |   3 +
 arch/powerpc/kernel/entry_64.S                     | 126 +++---
 arch/powerpc/kernel/epapr_paravirt.c               |  19 +-
 arch/powerpc/kernel/exceptions-64e.S               | 140 +++----
 arch/powerpc/kernel/exceptions-64s.S               | 206 +++++-----
 arch/powerpc/kernel/fadump.c                       |  13 +-
 arch/powerpc/kernel/ftrace.c                       | 137 ++-----
 arch/powerpc/kernel/head_64.S                      | 117 +++---
 arch/powerpc/kernel/hw_breakpoint.c                |   8 +-
 arch/powerpc/kernel/idle_book3e.S                  |   2 +-
 arch/powerpc/kernel/idle_power4.S                  |   2 +-
 arch/powerpc/kernel/idle_power7.S                  |  13 +-
 arch/powerpc/kernel/legacy_serial.c                |  36 +-
 arch/powerpc/kernel/misc_64.S                      |  46 ++-
 arch/powerpc/kernel/module_64.c                    | 279 ++++++++++---
 arch/powerpc/kernel/pci-common.c                   | 108 +++---
 arch/powerpc/kernel/pci_of_scan.c                  |   9 +
 arch/powerpc/kernel/ppc_ksyms.c                    |   2 -
 arch/powerpc/kernel/process.c                      |  32 +-
 arch/powerpc/kernel/prom_init_check.sh             |   2 +-
 arch/powerpc/kernel/rtas_pci.c                     |  66 +++-
 arch/powerpc/kernel/setup-common.c                 |  20 +-
 arch/powerpc/kernel/setup_64.c                     |  12 +-
 arch/powerpc/kernel/signal.c                       |   2 +-
 arch/powerpc/kernel/smp.c                          |  43 +--
 arch/powerpc/kernel/sysfs.c                        |  51 ++-
 arch/powerpc/kernel/systbl.S                       |  18 +-
 arch/powerpc/kernel/tm.S                           |  69 ++--
 arch/powerpc/kvm/book3s_hv.c                       |  34 +-
 arch/powerpc/kvm/book3s_hv_builtin.c               |  31 ++
 arch/powerpc/kvm/book3s_hv_interrupts.S            |   2 +-
 arch/powerpc/kvm/book3s_hv_rmhandlers.S            |  37 +-
 arch/powerpc/kvm/powerpc.c                         |   2 +-
 arch/powerpc/lib/Makefile                          |   2 -
 arch/powerpc/lib/copypage_64.S                     |   4 +-
 arch/powerpc/lib/copypage_power7.S                 |  12 +-
 arch/powerpc/lib/copyuser_64.S                     |   2 +-
 arch/powerpc/lib/copyuser_power7.S                 |  32 +-
 arch/powerpc/lib/hweight_64.S                      |   8 +-
 arch/powerpc/lib/mem_64.S                          |   4 +-
 arch/powerpc/lib/memcpy_64.S                       |  26 +-
 arch/powerpc/lib/memcpy_power7.S                   |  26 +-
 arch/powerpc/lib/string_64.S                       |   2 +-
 arch/powerpc/mm/hash_low_64.S                      |  44 ++-
 arch/powerpc/mm/hash_utils_64.c                    |  92 +++--
 arch/powerpc/mm/slb.c                              |  12 +-
 arch/powerpc/mm/slb_low.S                          |  14 +-
 arch/powerpc/mm/tlb_nohash.c                       |   7 +-
 arch/powerpc/platforms/44x/Kconfig                 |  42 ++
 arch/powerpc/platforms/44x/Makefile                |   3 +-
 .../platforms/44x/{currituck.c => ppc476.c}        | 120 ++++--
 arch/powerpc/platforms/44x/ppc476_modules.lds      |  15 +
 arch/powerpc/platforms/85xx/Kconfig                |  19 +-
 arch/powerpc/platforms/85xx/Makefile               |   3 +-
 arch/powerpc/platforms/85xx/bsc913x_qds.c          |  74 ++++
 arch/powerpc/platforms/85xx/corenet_generic.c      |   9 +-
 .../platforms/85xx/{p1023_rds.c => p1023_rdb.c}    |  36 +-
 arch/powerpc/platforms/85xx/smp.c                  |   3 +-
 arch/powerpc/platforms/Kconfig.cputype             |   5 +
 arch/powerpc/platforms/cell/smp.c                  |   5 +-
 arch/powerpc/platforms/embedded6xx/Kconfig         |   1 +
 arch/powerpc/platforms/pasemi/powersave.S          |   2 +-
 arch/powerpc/platforms/powernv/Makefile            |   2 +-
 arch/powerpc/platforms/powernv/eeh-ioda.c          | 264 +++++++------
 arch/powerpc/platforms/powernv/eeh-powernv.c       |   4 +
 arch/powerpc/platforms/powernv/opal-flash.c        |  50 ++-
 arch/powerpc/platforms/powernv/opal-lpc.c          | 151 ++++++++
 .../powerpc/platforms/powernv/opal-memory-errors.c |   8 +-
 arch/powerpc/platforms/powernv/opal-takeover.S     |   2 +
 arch/powerpc/platforms/powernv/opal-wrappers.S     |   5 +-
 arch/powerpc/platforms/powernv/opal.c              |  22 ++
 arch/powerpc/platforms/powernv/pci-ioda.c          |  26 +-
 arch/powerpc/platforms/powernv/pci.c               | 202 +++++-----
 arch/powerpc/platforms/powernv/pci.h               |  11 +-
 arch/powerpc/platforms/powernv/powernv.h           |   2 +
 arch/powerpc/platforms/powernv/setup.c             |  56 ++-
 arch/powerpc/platforms/powernv/smp.c               |  25 +-
 arch/powerpc/platforms/powernv/subcore-asm.S       |  95 +++++
 arch/powerpc/platforms/powernv/subcore.c           | 392 +++++++++++++++++++
 arch/powerpc/platforms/powernv/subcore.h           |  18 +
 arch/powerpc/platforms/pseries/eeh_pseries.c       |  43 ++-
 arch/powerpc/platforms/pseries/hotplug-memory.c    |  17 +-
 arch/powerpc/platforms/pseries/hvCall.S            |  10 +-
 arch/powerpc/platforms/pseries/pseries.h           |   2 +
 arch/powerpc/platforms/pseries/setup.c             |   7 +
 arch/powerpc/platforms/pseries/smp.c               |   5 +-
 arch/powerpc/platforms/wsp/scom_smp.c              |   3 +-
 arch/powerpc/sysdev/Kconfig                        |   6 +
 arch/powerpc/sysdev/Makefile                       |   1 +
 arch/powerpc/sysdev/fsl_pci.c                      |   3 +-
 arch/powerpc/sysdev/fsl_rio.c                      |  10 +-
 arch/powerpc/sysdev/fsl_rmu.c                      |   6 +-
 arch/powerpc/sysdev/mpic.c                         |   8 +-
 arch/powerpc/sysdev/ppc4xx_hsta_msi.c              | 215 +++++++++++
 arch/powerpc/sysdev/ppc4xx_pci.c                   |  21 +-
 arch/powerpc/xmon/xmon.c                           |  28 +-
 drivers/cpufreq/powernv-cpufreq.c                  |   1 +
 drivers/cpufreq/unicore2-cpufreq.c                 |   4 +-
 drivers/macintosh/windfarm_pm121.c                 |  16 +-
 drivers/pci/pci.c                                  |  21 +-
 tools/testing/selftests/powerpc/Makefile           |   2 +-
 .../selftests/powerpc/copyloops/asm/ppc_asm.h      |   5 +-
 tools/testing/selftests/powerpc/mm/Makefile        |  18 +
 .../selftests/powerpc/mm/hugetlb_vs_thp_test.c     |  72 ++++
 207 files changed, 6903 insertions(+), 1778 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-devices-system-cpu
 rename Documentation/devicetree/bindings/clock/{corenet-clock.txt => qoriq-clock.txt} (95%)
 create mode 100644 Documentation/devicetree/bindings/mfd/bfticu.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/qriox.txt
 create mode 100644 Documentation/devicetree/bindings/powerpc/4xx/akebono.txt
 create mode 100644 Documentation/devicetree/bindings/powerpc/4xx/hsta.txt
 create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/ccf.txt
 create mode 100644 Documentation/powerpc/cpu_families.txt
 create mode 100644 arch/powerpc/boot/dts/akebono.dts
 create mode 100644 arch/powerpc/boot/dts/bsc9132qds.dts
 create mode 100644 arch/powerpc/boot/dts/bsc9132qds.dtsi
 create mode 100644 arch/powerpc/boot/dts/fsl/bsc9132si-post.dtsi
 create mode 100644 arch/powerpc/boot/dts/fsl/bsc9132si-pre.dtsi
 create mode 100644 arch/powerpc/boot/dts/fsl/t1040si-post.dtsi
 create mode 100644 arch/powerpc/boot/dts/fsl/t1042si-post.dtsi
 create mode 100644 arch/powerpc/boot/dts/fsl/t104xsi-pre.dtsi
 create mode 100644 arch/powerpc/boot/dts/kmcoge4.dts
 create mode 100644 arch/powerpc/boot/dts/oca4080.dts
 delete mode 100644 arch/powerpc/boot/dts/p1023rds.dts
 create mode 100644 arch/powerpc/boot/dts/t1040qds.dts
 create mode 100644 arch/powerpc/boot/dts/t1042qds.dts
 create mode 100644 arch/powerpc/boot/dts/t104xqds.dtsi
 create mode 100644 arch/powerpc/boot/pseries-head.S
 create mode 100644 arch/powerpc/boot/swab.h
 create mode 100644 arch/powerpc/boot/treeboot-akebono.c
 create mode 100644 arch/powerpc/configs/44x/akebono_defconfig
 create mode 100644 arch/powerpc/configs/85xx/kmp204x_defconfig
 rename arch/powerpc/platforms/44x/{currituck.c => ppc476.c} (72%)
 create mode 100644 arch/powerpc/platforms/44x/ppc476_modules.lds
 create mode 100644 arch/powerpc/platforms/85xx/bsc913x_qds.c
 rename arch/powerpc/platforms/85xx/{p1023_rds.c => p1023_rdb.c} (75%)
 create mode 100644 arch/powerpc/platforms/powernv/subcore-asm.S
 create mode 100644 arch/powerpc/platforms/powernv/subcore.c
 create mode 100644 arch/powerpc/platforms/powernv/subcore.h
 create mode 100644 arch/powerpc/sysdev/ppc4xx_hsta_msi.c
 create mode 100644 tools/testing/selftests/powerpc/mm/Makefile
 create mode 100644 tools/testing/selftests/powerpc/mm/hugetlb_vs_thp_test.c

^ permalink raw reply

* [PATCH] crypto/nx: disable NX on little endian builds
From: Anton Blanchard @ 2014-06-07  1:33 UTC (permalink / raw)
  To: benh, paulus, nfont, mhcerri, herbert, davem; +Cc: linuxppc-dev, linux-crypto

The NX driver has endian issues so disable it for now.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 03ccdb0..8280a7a3 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -313,7 +313,7 @@ config CRYPTO_DEV_S5P
 
 config CRYPTO_DEV_NX
 	bool "Support for IBM Power7+ in-Nest cryptographic acceleration"
-	depends on PPC64 && IBMVIO
+	depends on PPC64 && IBMVIO && !CPU_LITTLE_ENDIAN
 	default n
 	help
 	  Support for Power7+ in-Nest cryptographic acceleration.

^ permalink raw reply related

* [PATCH] powernv: Fix permissions on sysparam sysfs entries
From: Anton Blanchard @ 2014-06-07  1:29 UTC (permalink / raw)
  To: benh, paulus, joel, neelegup; +Cc: linuxppc-dev

Everyone can write to these files, which is not what we want.

Cc: stable@vger.kernel.org # 3.15
Signed-off-by: Anton Blanchard <anton@samba.org>
---

diff --git a/arch/powerpc/platforms/powernv/opal-sysparam.c b/arch/powerpc/platforms/powernv/opal-sysparam.c
index d202f9b..9d1acf2 100644
--- a/arch/powerpc/platforms/powernv/opal-sysparam.c
+++ b/arch/powerpc/platforms/powernv/opal-sysparam.c
@@ -260,10 +260,10 @@ void __init opal_sys_param_init(void)
 			attr[i].kobj_attr.attr.mode = S_IRUGO;
 			break;
 		case OPAL_SYSPARAM_WRITE:
-			attr[i].kobj_attr.attr.mode = S_IWUGO;
+			attr[i].kobj_attr.attr.mode = S_IWUSR;
 			break;
 		case OPAL_SYSPARAM_RW:
-			attr[i].kobj_attr.attr.mode = S_IRUGO | S_IWUGO;
+			attr[i].kobj_attr.attr.mode = S_IRUGO | S_IWUSR;
 			break;
 		default:
 			break;

^ permalink raw reply related

* Re: [PATCH] powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode
From: Srivatsa S. Bhat @ 2014-06-06 21:16 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: ego, matt, mahesh, kexec, linux-kernel, suzuki, ebiederm, paulus,
	linuxppc-dev, Vivek Goyal
In-Reply-To: <5391B413.100@linux.vnet.ibm.com>

On 06/06/2014 05:59 PM, Srivatsa S. Bhat wrote:
> On 06/04/2014 03:39 AM, Benjamin Herrenschmidt wrote:
>> On Wed, 2014-06-04 at 01:58 +0530, Srivatsa S. Bhat wrote:
>>> Yep, that makes sense. But unfortunately I don't have enough insight into
>>> why exactly powerpc has to online the CPUs before doing a kexec. I just
>>> know from the commit log and the comment mentioned above (and from my own
>>> experiments) that the CPUs will get stuck if they were offline. Perhaps
>>> somebody more knowledgeable can explain this in detail and suggest a proper
>>> long-term solution.
>>>
>>> Matt, Ben, any thoughts on this?
>>
>> The problem is with our "soft offline" which we do on some platforms. When we
>> offline we don't actually send the CPUs back to firmware or anything like that.
>>
>> We put them into a very low low power loop inside Linux.
>>
>> The new kernel has no way to extract them from that loop. So we must re-"online"
>> them before we kexec so they can be passed to the new kernel normally (or returned
>> to firmware like we do on powernv).
>>
> 
> Thanks a lot for the explanation Ben!
> 
> I thought about this and this is what I think: whether the CPU is in the kernel
> or in the firmware is a hard-boundary. But once we know it is still in the
> kernel, whether it is online or offline is a soft-boundary, something that
> ideally shouldn't make any difference to kexec.
> 
> Then I looked at what is that special state that kexec expects the online CPUs
> to be in, before performing kexec, and I found that that state is entered via
> kexec_smp_down().
> 
> Which means, if we poke the soft-offline CPUs and make them execute
> kexec_smp_down(), we should be able to do a successful kexec without having to
> actually online them. After all, the core kexec code doesn't mandate that they
> should be online. So if we satisfy powerpc's requirement that all the CPUs are
> in a sane state, that should be good enough. (This would be similar to how the
> subcore code wakes up offline CPUs to perform the split-core procedure).
> 
> I know, this is all theory for now since I haven't tested it yet, but I think
> we can make this work.
> 
> Below are the 4 preliminary patches I'm have so far, to implement this.
> 

And with the following hunk added (which I had forgotten earlier), it worked just
fine on powernv :-)


diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 2ef6c58..84e91293 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -243,6 +243,9 @@ static void wake_offline_cpus(void)
 {
 	int cpu = 0;
 
+	if (ppc_md.kexec_wake_prepare)
+		ppc_md.kexec_wake_prepare();
+
 	for_each_present_cpu(cpu) {
 		if (!cpu_online(cpu)) {
 			printk(KERN_INFO "kexec: Waking offline cpu %d.\n",

I tried putting the machine into ST mode, and in a separate experiment, I kept
just CPU 0 online in the first kernel, and then issued a kexec. The second kernel
booted successfully with all the CPUs in both the cases.

I haven't explored the crashed-kernel case though, it might need some auditing
to check if the code handles that as well.

Regards,
Srivatsa S. Bhat

^ permalink raw reply related

* Re: [linuxppc-release] [PATCH][v10] powerpc/mpc85xx:Add initial device tree support of T104x
From: Scott Wood @ 2014-06-06 20:47 UTC (permalink / raw)
  To: Liu Shengzhou-B36685
  Cc: Aggrwal Poonam-B10812, Jain Priyanka-B32167,
	linuxppc-dev@lists.ozlabs.org, Kushwaha Prabhakar-B32579
In-Reply-To: <c0213fde8dd24026af31ccce2fec21bf@DM2PR03MB398.namprd03.prod.outlook.com>

On Fri, 2014-06-06 at 00:04 -0500, Liu Shengzhou-B36685 wrote:
> 
> > -----Original Message-----
> > From: linuxppc-release-bounces@linux.freescale.net [mailto:linuxppc-
> > release-bounces@linux.freescale.net] On Behalf Of Prabhakar Kushwaha
> > Sent: Monday, April 21, 2014 7:34 PM
> > To: linuxppc-dev@lists.ozlabs.org
> > Cc: Wood Scott-B07421; Jain Priyanka-B32167; Aggrwal Poonam-B10812;
> > Kushwaha Prabhakar-B32579
> > Subject: [linuxppc-release] [PATCH][v10] powerpc/mpc85xx:Add initial
> > device tree support of T104x
> > 
> > The QorIQ T1040/T1042 processor support four integrated 64-bit e5500 PA
> > processor cores with high-performance data path acceleration architecture
> > and network peripheral interfaces required for networking &
> > telecommunications.
> > 
> > +
> > +	iommu@20000 {
> > +		compatible = "fsl,pamu-v1.0", "fsl,pamu";
> > +		reg = <0x20000 0x1000>;
> > +		ranges = <0 0x20000 0x1000>;
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		interrupts = <
> > +			24 2 0 0
> > +			16 2 1 30>;
> > +		pamu0: pamu@0 {
> > +			reg = <0 0x1000>;
> > +			fsl,primary-cache-geometry = <128 1>;
> > +			fsl,secondary-cache-geometry = <16 2>;
> > +		};
> 
> 
> [Shengzhou]  T1040 RM says:
> Hardware coherent PAMU Look-aside caches to improve performance
> * A 32-entry, direct-mapped primary PAACT cache
> * A 128-entry, 2-way, set-associative secondary PAACT cache
> It appears it should be: 
>        fsl,primary-cache-geometry = <32 1>;
>        fsl,secondary-cache-geometry = <128 2>;
> 
> is there any reason that it was "<128 1>,  <16 2>" ?

The B4 device trees are also suspicous.

-Scott

^ permalink raw reply

* Re: [PATCH] powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode
From: Srivatsa S. Bhat @ 2014-06-06 19:00 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: ego, matt, mahesh, kexec, linux-kernel, suzuki, ebiederm, paulus,
	linuxppc-dev
In-Reply-To: <20140606182720.GL1526@redhat.com>

On 06/06/2014 11:57 PM, Vivek Goyal wrote:
> On Fri, Jun 06, 2014 at 06:00:43PM +0530, Srivatsa S. Bhat wrote:
>> On 06/04/2014 07:16 PM, Vivek Goyal wrote:
>>> On Wed, Jun 04, 2014 at 08:09:25AM +1000, Benjamin Herrenschmidt wrote:
>>>> On Wed, 2014-06-04 at 01:58 +0530, Srivatsa S. Bhat wrote:
>>>>> Yep, that makes sense. But unfortunately I don't have enough insight into
>>>>> why exactly powerpc has to online the CPUs before doing a kexec. I just
>>>>> know from the commit log and the comment mentioned above (and from my own
>>>>> experiments) that the CPUs will get stuck if they were offline. Perhaps
>>>>> somebody more knowledgeable can explain this in detail and suggest a proper
>>>>> long-term solution.
>>>>>
>>>>> Matt, Ben, any thoughts on this?
>>>>
>>>> The problem is with our "soft offline" which we do on some platforms. When we
>>>> offline we don't actually send the CPUs back to firmware or anything like that.
>>>>
>>>> We put them into a very low low power loop inside Linux.
>>>>
>>>> The new kernel has no way to extract them from that loop. So we must re-"online"
>>>> them before we kexec so they can be passed to the new kernel normally (or returned
>>>> to firmware like we do on powernv).
>>>
>>> Srivatsa,
>>>
>>> Looks like your patch has been merged.
>>>
>>> I don't like the following change in arch independent code.
>>>
>>> /*
>>>  * migrate_to_reboot_cpu() disables CPU hotplug assuming  that
>>>  * no further code needs to use CPU hotplug (which is true in
>>>  * the reboot case). However, the kexec path depends on  using
>>>  * CPU hotplug again; so re-enable it here. 
>>>  */
>>>                cpu_hotplug_enable();
>>>
>>> As it is very powerpc specific requirement, can you enable hotplug in powerpc
>>> arch dependent code as a short term solution.
>>>
>>
>> I didn't do that because that would mean that the _disable() would be
>> performed inside kernel/kexec.c and the corresponding _enable() would
>> be performed in arch/powerpc/kernel/machine_kexec_64.c -- with no apparent
>> connection between them, which would have made them hard to relate.
> 
> Which we are doing anyway. The difference is that now we are doing it
> for all arches.
> 
> If this is powerpc specific requirement, then we should limit this to
> powerpc only and not let spill over in generic code.
> 
> And putting a big fat comment should take care of being able to figure
> out why arch code is overwriting the generic code's decision. By putting
> it in generic code and enforcing this on all arches does not buy us
> anything, IMHO.
> 

Yep, I see your point. Sorry about that!

Actually, I originally thought of fixing cpu_hotplug_disable/enable itself:
their true intent is to prevent *userspace* (i.e., from sysfs) from performing
CPU hotplug after a certain quiescent point in the kernel, and not to prevent
the kernel's own cpu hotplug attempts. But currently it prevents _all_ hotplug,
including those that are initiated from within the kernel, which is the reason
why kexec was effectively locking itself out on powerpc. I explored options to
fix that (which would in turn fix the powerpc problem automatically, without
having to add any code to kernel/kexec.c or even arch/powerpc code). But it
turned out to be too difficult and ugly given the current CPU hotplug locking
scheme. I'll revisit that once CPU hotplug locking is cleaned up.

But anyway, the powerpc kexec fix that I'm working on right now is not only a
much better solution, but it will also restore the original kexec code in
kernel/kexec.c, by removing the _enable() call.

Thank you!

Regards,
Srivatsa S. Bhat

^ permalink raw reply

* Re: [PATCH] powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode
From: Vivek Goyal @ 2014-06-06 18:27 UTC (permalink / raw)
  To: Srivatsa S. Bhat
  Cc: ego, matt, mahesh, kexec, linux-kernel, suzuki, ebiederm, paulus,
	linuxppc-dev
In-Reply-To: <5391B473.2050809@linux.vnet.ibm.com>

On Fri, Jun 06, 2014 at 06:00:43PM +0530, Srivatsa S. Bhat wrote:
> On 06/04/2014 07:16 PM, Vivek Goyal wrote:
> > On Wed, Jun 04, 2014 at 08:09:25AM +1000, Benjamin Herrenschmidt wrote:
> >> On Wed, 2014-06-04 at 01:58 +0530, Srivatsa S. Bhat wrote:
> >>> Yep, that makes sense. But unfortunately I don't have enough insight into
> >>> why exactly powerpc has to online the CPUs before doing a kexec. I just
> >>> know from the commit log and the comment mentioned above (and from my own
> >>> experiments) that the CPUs will get stuck if they were offline. Perhaps
> >>> somebody more knowledgeable can explain this in detail and suggest a proper
> >>> long-term solution.
> >>>
> >>> Matt, Ben, any thoughts on this?
> >>
> >> The problem is with our "soft offline" which we do on some platforms. When we
> >> offline we don't actually send the CPUs back to firmware or anything like that.
> >>
> >> We put them into a very low low power loop inside Linux.
> >>
> >> The new kernel has no way to extract them from that loop. So we must re-"online"
> >> them before we kexec so they can be passed to the new kernel normally (or returned
> >> to firmware like we do on powernv).
> > 
> > Srivatsa,
> > 
> > Looks like your patch has been merged.
> > 
> > I don't like the following change in arch independent code.
> > 
> > /*
> >  * migrate_to_reboot_cpu() disables CPU hotplug assuming  that
> >  * no further code needs to use CPU hotplug (which is true in
> >  * the reboot case). However, the kexec path depends on  using
> >  * CPU hotplug again; so re-enable it here. 
> >  */
> >                cpu_hotplug_enable();
> > 
> > As it is very powerpc specific requirement, can you enable hotplug in powerpc
> > arch dependent code as a short term solution.
> > 
> 
> I didn't do that because that would mean that the _disable() would be
> performed inside kernel/kexec.c and the corresponding _enable() would
> be performed in arch/powerpc/kernel/machine_kexec_64.c -- with no apparent
> connection between them, which would have made them hard to relate.

Which we are doing anyway. The difference is that now we are doing it
for all arches.

If this is powerpc specific requirement, then we should limit this to
powerpc only and not let spill over in generic code.

And putting a big fat comment should take care of being able to figure
out why arch code is overwriting the generic code's decision. By putting
it in generic code and enforcing this on all arches does not buy us
anything, IMHO.


> 
> > Ideally one needs to fix the requirement of online all cpus in powerpc
> > as a long term solution and then get rid of hotplug enable call.
> > 
> 
> Yes, I agree. I'm trying out a solution at the moment (see the 4
> preliminary patches I sent in my reply to Ben). If that works, we won't
> need the enable call on powerpc.

Thanks. This will help.

Thanks
Vivek

^ permalink raw reply

* Re: [PATCH v9 3/3] drivers/vfio: EEH support for VFIO PCI device
From: Alex Williamson @ 2014-06-06 18:20 UTC (permalink / raw)
  To: Gavin Shan; +Cc: aik, agraf, kvm-ppc, qiudayu, linuxppc-dev
In-Reply-To: <1402030856-11106-4-git-send-email-gwshan@linux.vnet.ibm.com>

On Fri, 2014-06-06 at 15:00 +1000, Gavin Shan wrote:
> The patch adds new IOCTL commands for sPAPR VFIO container device
> to support EEH functionality for PCI devices, which have been passed
> through from host to somebody else via VFIO.
> 
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> Acked-by: Alexander Graf <agraf@suse.de>
> ---
>  Documentation/vfio.txt              | 87 +++++++++++++++++++++++++++++++++++--
>  drivers/vfio/Makefile               |  1 +
>  drivers/vfio/pci/vfio_pci.c         | 18 ++++++--
>  drivers/vfio/vfio_iommu_spapr_tce.c | 17 +++++++-
>  drivers/vfio/vfio_spapr_eeh.c       | 87 +++++++++++++++++++++++++++++++++++++
>  include/linux/vfio.h                | 23 ++++++++++
>  include/uapi/linux/vfio.h           | 34 +++++++++++++++
>  7 files changed, 259 insertions(+), 8 deletions(-)
>  create mode 100644 drivers/vfio/vfio_spapr_eeh.c
> 
> diff --git a/Documentation/vfio.txt b/Documentation/vfio.txt
> index b9ca023..3fa4538 100644
> --- a/Documentation/vfio.txt
> +++ b/Documentation/vfio.txt
> @@ -305,7 +305,15 @@ faster, the map/unmap handling has been implemented in real mode which provides
>  an excellent performance which has limitations such as inability to do
>  locked pages accounting in real time.
>  
> -So 3 additional ioctls have been added:
> +4) According to sPAPR specification, A Partitionable Endpoint (PE) is an I/O
> +subtree that can be treated as a unit for the purposes of partitioning and
> +error recovery. A PE may be a single or multi-function IOA (IO Adapter), a
> +function of a multi-function IOA, or multiple IOAs (possibly including switch
> +and bridge structures above the multiple IOAs). PPC64 guests detect PCI errors
> +and recover from them via EEH RTAS services, which works on the basis of
> +additional ioctl commands.
> +
> +So 4 additional ioctls have been added:
>  
>  	VFIO_IOMMU_SPAPR_TCE_GET_INFO - returns the size and the start
>  		of the DMA window on the PCI bus.
> @@ -316,9 +324,12 @@ So 3 additional ioctls have been added:
>  
>  	VFIO_IOMMU_DISABLE - disables the container.
>  
> +	VFIO_EEH_PE_OP - provides an API for EEH setup, error detection and recovery.
>  
>  The code flow from the example above should be slightly changed:
>  
> +	struct vfio_eeh_pe_op pe_op = { .argsz = sizeof(pe_op) };
> +
>  	.....
>  	/* Add the group to the container */
>  	ioctl(group, VFIO_GROUP_SET_CONTAINER, &container);
> @@ -342,9 +353,79 @@ The code flow from the example above should be slightly changed:
>  	dma_map.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE;
>  
>  	/* Check here is .iova/.size are within DMA window from spapr_iommu_info */
> -
>  	ioctl(container, VFIO_IOMMU_MAP_DMA, &dma_map);
> -	.....
> +
> +	/* Get a file descriptor for the device */
> +	device = ioctl(group, VFIO_GROUP_GET_DEVICE_FD, "0000:06:0d.0");
> +
> +	....
> +
> +	/* Gratuitous device reset and go... */
> +	ioctl(device, VFIO_DEVICE_RESET);
> +
> +	/* Make sure EEH is supported */
> +	ioctl(container, VFIO_CHECK_EXTENSION, VFIO_EEH);
> +
> +	/* Enable the EEH functionality on the device */
> +	pe_op.op = VFIO_EEH_PE_ENABLE;
> +	ioctl(container, VFIO_EEH_PE_OP, &pe_op);
> +
> +	/* You're suggested to create additional data struct to represent
> +	 * PE, and put child devices belonging to same IOMMU group to the
> +	 * PE instance for later reference.
> +	 */
> +
> +	/* Check the PE's state and make sure it's in functional state */
> +	pe_op.op = VFIO_EEH_PE_GET_STATE;
> +	ioctl(container, VFIO_EEH_PE_OP, &pe_op);
> +
> +	/* Save device state using pci_save_state().
> +	 * EEH should be enabled on the specified device.
> +	 */
> +
> +	....
> +
> +	/* When 0xFF's returned from reading PCI config space or IO BARs
> +	 * of the PCI device. Check the PE's state to see if that has been
> +	 * frozen.
> +	 */
> +	ioctl(container, VFIO_EEH_PE_OP, &pe_op);
> +
> +	/* Waiting for pending PCI transactions to be completed and don't
> +	 * produce any more PCI traffic from/to the affected PE until
> +	 * recovery is finished.
> +	 */
> +
> +	/* Enable IO for the affected PE and collect logs. Usually, the
> +	 * standard part of PCI config space, AER registers are dumped
> +	 * as logs for further analysis.
> +	 */
> +	pe_op.op = VFIO_EEH_PE_UNFREEZE_IO;
> +	ioctl(container, VFIO_EEH_PE_OP, &pe_op);
> +
> +	/*
> +	 * Issue PE reset: hot or fundamental reset. Usually, hot reset
> +	 * is enough. However, the firmware of some PCI adapters would
> +	 * require fundamental reset.
> +	 */
> +	pe_op.op = VFIO_EEH_PE_RESET_HOT;
> +	ioctl(container, VFIO_EEH_PE_OP, &pe_op);
> +	pe_op.op = VFIO_EEH_PE_RESET_DEACTIVATE;
> +	ioctl(container, VFIO_EEH_PE_OP, &pe_op);
> +
> +	/* Configure the PCI bridges for the affected PE */
> +	pe_op.op = VFIO_EEH_PE_CONFIGURE;
> +	ioctl(container, VFIO_EEH_PE_OP, &pe_op);
> +
> +	/* Restored state we saved at initialization time. pci_restore_state()
> +	 * is good enough as an example.
> +	 */
> +
> +	/* Hopefully, error is recovered successfully. Now, you can resume to
> +	 * start PCI traffic to/from the affected PE.
> +	 */
> +
> +	....
>  
>  -------------------------------------------------------------------------------
>  
> diff --git a/drivers/vfio/Makefile b/drivers/vfio/Makefile
> index 72bfabc..50e30bc 100644
> --- a/drivers/vfio/Makefile
> +++ b/drivers/vfio/Makefile
> @@ -1,4 +1,5 @@
>  obj-$(CONFIG_VFIO) += vfio.o
>  obj-$(CONFIG_VFIO_IOMMU_TYPE1) += vfio_iommu_type1.o
>  obj-$(CONFIG_VFIO_IOMMU_SPAPR_TCE) += vfio_iommu_spapr_tce.o
> +obj-$(CONFIG_EEH) += vfio_spapr_eeh.o
>  obj-$(CONFIG_VFIO_PCI) += pci/
> diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
> index 7ba0424..0122665 100644
> --- a/drivers/vfio/pci/vfio_pci.c
> +++ b/drivers/vfio/pci/vfio_pci.c
> @@ -156,8 +156,10 @@ static void vfio_pci_release(void *device_data)
>  {
>  	struct vfio_pci_device *vdev = device_data;
>  
> -	if (atomic_dec_and_test(&vdev->refcnt))
> +	if (atomic_dec_and_test(&vdev->refcnt)) {
> +		vfio_spapr_pci_eeh_release(vdev->pdev);
>  		vfio_pci_disable(vdev);
> +	}
>  
>  	module_put(THIS_MODULE);
>  }
> @@ -165,19 +167,27 @@ static void vfio_pci_release(void *device_data)
>  static int vfio_pci_open(void *device_data)
>  {
>  	struct vfio_pci_device *vdev = device_data;
> +	int ret;
>  
>  	if (!try_module_get(THIS_MODULE))
>  		return -ENODEV;
>  
>  	if (atomic_inc_return(&vdev->refcnt) == 1) {
> -		int ret = vfio_pci_enable(vdev);
> +		ret = vfio_pci_enable(vdev);
> +		if (ret)
> +			goto error;
> +
> +		ret = vfio_spapr_pci_eeh_open(vdev->pdev);
>  		if (ret) {
> -			module_put(THIS_MODULE);
> -			return ret;
> +			vfio_pci_disable(vdev);
> +			goto error;
>  		}
>  	}
>  
>  	return 0;
> +error:
> +	module_put(THIS_MODULE);
> +	return ret;
>  }
>  
>  static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type)
> diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
> index a84788b..730b4ef 100644
> --- a/drivers/vfio/vfio_iommu_spapr_tce.c
> +++ b/drivers/vfio/vfio_iommu_spapr_tce.c
> @@ -156,7 +156,16 @@ static long tce_iommu_ioctl(void *iommu_data,
>  
>  	switch (cmd) {
>  	case VFIO_CHECK_EXTENSION:
> -		return (arg == VFIO_SPAPR_TCE_IOMMU) ? 1 : 0;
> +		switch (arg) {
> +		case VFIO_SPAPR_TCE_IOMMU:
> +			ret = 1;
> +			break;
> +		default:
> +			ret = vfio_spapr_iommu_eeh_ioctl(NULL, cmd, arg);
> +			break;
> +		}
> +
> +		return (ret < 0) ? 0 : ret;
>  
>  	case VFIO_IOMMU_SPAPR_TCE_GET_INFO: {
>  		struct vfio_iommu_spapr_tce_info info;
> @@ -283,6 +292,12 @@ static long tce_iommu_ioctl(void *iommu_data,
>  		tce_iommu_disable(container);
>  		mutex_unlock(&container->lock);
>  		return 0;
> +	case VFIO_EEH_PE_OP:
> +		if (!container->tbl || !container->tbl->it_group)
> +			return -ENODEV;
> +
> +		return vfio_spapr_iommu_eeh_ioctl(container->tbl->it_group,
> +						  cmd, arg);
>  	}
>  
>  	return -ENOTTY;
> diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
> new file mode 100644
> index 0000000..d438394
> --- /dev/null
> +++ b/drivers/vfio/vfio_spapr_eeh.c
> @@ -0,0 +1,87 @@
> +/*
> + * EEH functionality support for VFIO devices. The feature is only
> + * available on sPAPR compatible platforms.
> + *
> + * Copyright Gavin Shan, IBM Corporation 2014.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/uaccess.h>
> +#include <linux/vfio.h>
> +#include <asm/eeh.h>
> +
> +/* We might build address mapping here for "fast" path later */
> +int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
> +{
> +	return eeh_dev_open(pdev);
> +}
> +
> +void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
> +{
> +	eeh_dev_release(pdev);
> +}
> +
> +long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
> +				unsigned int cmd, unsigned long arg)
> +{
> +	struct eeh_pe *pe;
> +	struct vfio_eeh_pe_op op;
> +	unsigned long minsz;
> +	long ret = -EINVAL;
> +
> +	switch (cmd) {
> +	case VFIO_CHECK_EXTENSION:
> +		if (arg == VFIO_EEH)
> +			ret = eeh_enabled() ? 1 : 0;
> +		else
> +			ret = 0;
> +		break;
> +	case VFIO_EEH_PE_OP:
> +		pe = eeh_iommu_group_to_pe(group);
> +		if (!pe)
> +			return -ENODEV;
> +
> +		minsz = offsetofend(struct vfio_eeh_pe_op, op);
> +		if (copy_from_user(&op, (void __user *)arg, minsz))
> +			return -EFAULT;
> +		if (op.argsz < minsz)
> +			return -EINVAL;

I'm running low on comments, but I found one more.  flags should be
tested as zero here or else we'll run into problems with adding new
functionality later.  The caller could leave it uninitialized and pass
junk which would then break if we start using those flags.  New
userspace on an old kernel could also intentionally pass flag bits that
we ignore and let through here.


How are you expecting this to go in, an ack from me then pushed through
AlexG's tree?  Thanks,

Alex

> +
> +		switch (op.op) {
> +		case VFIO_EEH_PE_DISABLE:
> +			ret = eeh_pe_set_option(pe, EEH_OPT_DISABLE);
> +			break;
> +		case VFIO_EEH_PE_ENABLE:
> +			ret = eeh_pe_set_option(pe, EEH_OPT_ENABLE);
> +			break;
> +		case VFIO_EEH_PE_UNFREEZE_IO:
> +			ret = eeh_pe_set_option(pe, EEH_OPT_THAW_MMIO);
> +			break;
> +		case VFIO_EEH_PE_UNFREEZE_DMA:
> +			ret = eeh_pe_set_option(pe, EEH_OPT_THAW_DMA);
> +			break;
> +		case VFIO_EEH_PE_GET_STATE:
> +			ret = eeh_pe_get_state(pe);
> +			break;
> +		case VFIO_EEH_PE_RESET_DEACTIVATE:
> +			ret = eeh_pe_reset(pe, EEH_RESET_DEACTIVATE);
> +			break;
> +		case VFIO_EEH_PE_RESET_HOT:
> +			ret = eeh_pe_reset(pe, EEH_RESET_HOT);
> +			break;
> +		case VFIO_EEH_PE_RESET_FUNDAMENTAL:
> +			ret = eeh_pe_reset(pe, EEH_RESET_FUNDAMENTAL);
> +			break;
> +		case VFIO_EEH_PE_CONFIGURE:
> +			ret = eeh_pe_configure(pe);
> +			break;
> +		default:
> +			ret = -EINVAL;
> +		}
> +	}
> +
> +	return ret;
> +}
> diff --git a/include/linux/vfio.h b/include/linux/vfio.h
> index 81022a52..0d3bb8f 100644
> --- a/include/linux/vfio.h
> +++ b/include/linux/vfio.h
> @@ -99,4 +99,27 @@ extern int vfio_external_user_iommu_id(struct vfio_group *group);
>  extern long vfio_external_check_extension(struct vfio_group *group,
>  					  unsigned long arg);
>  
> +#ifdef CONFIG_EEH
> +extern int vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
> +extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
> +extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
> +				       unsigned int cmd,
> +				       unsigned long arg);
> +#else
> +static inline int vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
> +{
> +	return 0;
> +}
> +
> +static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
> +{
> +}
> +
> +static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
> +					      unsigned int cmd,
> +					      unsigned long arg)
> +{
> +	return -ENOTTY;
> +}
> +#endif /* CONFIG_EEH */
>  #endif /* VFIO_H */
> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> index cb9023d..6612974 100644
> --- a/include/uapi/linux/vfio.h
> +++ b/include/uapi/linux/vfio.h
> @@ -30,6 +30,9 @@
>   */
>  #define VFIO_DMA_CC_IOMMU		4
>  
> +/* Check if EEH is supported */
> +#define VFIO_EEH			5
> +
>  /*
>   * The IOCTL interface is designed for extensibility by embedding the
>   * structure length (argsz) and flags into structures passed between
> @@ -455,6 +458,37 @@ struct vfio_iommu_spapr_tce_info {
>  
>  #define VFIO_IOMMU_SPAPR_TCE_GET_INFO	_IO(VFIO_TYPE, VFIO_BASE + 12)
>  
> +/*
> + * EEH PE operation struct provides ways to:
> + * - enable/disable EEH functionality;
> + * - unfreeze IO/DMA for frozen PE;
> + * - read PE state;
> + * - reset PE;
> + * - configure PE.
> + */
> +struct vfio_eeh_pe_op {
> +	__u32 argsz;
> +	__u32 flags;
> +	__u32 op;
> +};
> +
> +#define VFIO_EEH_PE_DISABLE		0	/* Disable EEH functionality */
> +#define VFIO_EEH_PE_ENABLE		1	/* Enable EEH functionality  */
> +#define VFIO_EEH_PE_UNFREEZE_IO		2	/* Enable IO for frozen PE   */
> +#define VFIO_EEH_PE_UNFREEZE_DMA	3	/* Enable DMA for frozen PE  */
> +#define VFIO_EEH_PE_GET_STATE		4	/* PE state retrieval        */
> +#define  VFIO_EEH_PE_STATE_NORMAL	0	/* PE in functional state    */
> +#define  VFIO_EEH_PE_STATE_RESET	1	/* PE reset in progress      */
> +#define  VFIO_EEH_PE_STATE_STOPPED	2	/* Stopped DMA and IO        */
> +#define  VFIO_EEH_PE_STATE_STOPPED_DMA	4	/* Stopped DMA only          */
> +#define  VFIO_EEH_PE_STATE_UNAVAIL	5	/* State unavailable         */
> +#define VFIO_EEH_PE_RESET_DEACTIVATE	5	/* Deassert PE reset         */
> +#define VFIO_EEH_PE_RESET_HOT		6	/* Assert hot reset          */
> +#define VFIO_EEH_PE_RESET_FUNDAMENTAL	7	/* Assert fundamental reset  */
> +#define VFIO_EEH_PE_CONFIGURE		8	/* PE configuration          */
> +
> +#define VFIO_EEH_PE_OP			_IO(VFIO_TYPE, VFIO_BASE + 21)
> +
>  /* ***************************************************************** */
>  
>  #endif /* _UAPIVFIO_H */

^ permalink raw reply

* Re: [PATCH] powerpc/powernv: Fix endian issues in memory error handling code
From: Mahesh J Salgaonkar @ 2014-06-06 18:14 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: paulus, linuxppc-dev
In-Reply-To: <20140604144848.459a15e5@kryten>

On 2014-06-04 14:48:48 Wed, Anton Blanchard wrote:
> struct OpalMemoryErrorData is passed to us from firmware, so we
> have to byteswap it.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Tested-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

> ---
> 
> Having enums in a firmware interface concerns me, but that cleanup
> can be in a subsequent patch.
> 
> Mahesh, could you give this a test to see if it works?
> 
> Index: b/arch/powerpc/include/asm/opal.h
> ===================================================================
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -482,7 +482,7 @@ enum OpalMemErr_DynErrType {
>  struct OpalMemoryErrorData {
>  	enum OpalMemErr_Version	version:8;	/* 0x00 */
>  	enum OpalMemErrType	type:8;		/* 0x01 */
> -	uint16_t		flags;		/* 0x02 */
> +	__be16			flags;		/* 0x02 */
>  	uint8_t			reserved_1[4];	/* 0x04 */
> 
>  	union {
> @@ -490,15 +490,15 @@ struct OpalMemoryErrorData {
>  		struct {
>  			enum OpalMemErr_ResilErrType resil_err_type:8;
>  			uint8_t		reserved_1[7];
> -			uint64_t	physical_address_start;
> -			uint64_t	physical_address_end;
> +			__be64		physical_address_start;
> +			__be64		physical_address_end;
>  		} resilience;
>  		/* Dynamic memory deallocation error info */
>  		struct {
>  			enum OpalMemErr_DynErrType dyn_err_type:8;
>  			uint8_t		reserved_1[7];
> -			uint64_t	physical_address_start;
> -			uint64_t	physical_address_end;
> +			__be64		physical_address_start;
> +			__be64		physical_address_end;
>  		} dyn_dealloc;
>  	} u;
>  };
> Index: b/arch/powerpc/platforms/powernv/opal-memory-errors.c
> ===================================================================
> --- a/arch/powerpc/platforms/powernv/opal-memory-errors.c
> +++ b/arch/powerpc/platforms/powernv/opal-memory-errors.c
> @@ -47,12 +47,12 @@ static void handle_memory_error_event(st
>  		  __func__, merr_evt->type);
>  	switch (merr_evt->type) {
>  	case OPAL_MEM_ERR_TYPE_RESILIENCE:
> -		paddr_start = merr_evt->u.resilience.physical_address_start;
> -		paddr_end = merr_evt->u.resilience.physical_address_end;
> +		paddr_start = be64_to_cpu(merr_evt->u.resilience.physical_address_start);
> +		paddr_end = be64_to_cpu(merr_evt->u.resilience.physical_address_end);
>  		break;
>  	case OPAL_MEM_ERR_TYPE_DYN_DALLOC:
> -		paddr_start = merr_evt->u.dyn_dealloc.physical_address_start;
> -		paddr_end = merr_evt->u.dyn_dealloc.physical_address_end;
> +		paddr_start = be64_to_cpu(merr_evt->u.dyn_dealloc.physical_address_start);
> +		paddr_end = be64_to_cpu(merr_evt->u.dyn_dealloc.physical_address_end);
>  		break;
>  	default:
>  		return;
> 

-- 
Mahesh J Salgaonkar

^ permalink raw reply

* [PATCH 05/13] powerpc: Use list_add_(before|after) macros
From: Ken Helias @ 2014-06-06 17:34 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ken Helias, linuxppc-dev, linux-kernel
In-Reply-To: <1402076072-4044-1-git-send-email-kenhelias@web.de>

From: Ken Helias <kenhelias@firemail.de>

Many places in the code uses list_add_tail/list_add to insert an entry
before/after another entry. This confuses the reader because these are usually
used to add an item to a list_head and not an entry. Better use the self
explaining function name.

Signed-off-by: Ken Helias <kenhelias@firemail.de>
Cc: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/lib/rheap.c          | 2 +-
 arch/powerpc/mm/dma-noncoherent.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index a1060a8..d8c5f16 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -486,7 +486,7 @@ unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const ch
 			spblk->start = blk->start;
 			spblk->size = sp_size;
 			/* add before the blk */
-			list_add(&spblk->list, blk->list.prev);
+			list_add_before(&spblk->list, &blk->list);
 		}
 		newblk = get_slot(info);
 		newblk->start = start;
diff --git a/arch/powerpc/mm/dma-noncoherent.c b/arch/powerpc/mm/dma-noncoherent.c
index d85e86a..222ae97 100644
--- a/arch/powerpc/mm/dma-noncoherent.c
+++ b/arch/powerpc/mm/dma-noncoherent.c
@@ -120,7 +120,7 @@ ppc_vm_region_alloc(struct ppc_vm_region *head, size_t size, gfp_t gfp)
 	/*
 	 * Insert this entry _before_ the one we found.
 	 */
-	list_add_tail(&new->vm_list, &c->vm_list);
+	list_add_before(&new->vm_list, &c->vm_list);
 	new->vm_start = addr;
 	new->vm_end = addr + size;
 
-- 
2.0.0

^ permalink raw reply related

* Re: [PATCH 1/4] KVM: PPC: BOOK3S: PR: Emulate virtual timebase register
From: Aneesh Kumar K.V @ 2014-06-06 16:27 UTC (permalink / raw)
  To: Alexander Graf, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc
In-Reply-To: <53919B83.4070308@suse.de>

Alexander Graf <agraf@suse.de> writes:

> On 05.06.14 14:08, Aneesh Kumar K.V wrote:
>> virtual time base register is a per VM, per cpu register that needs
>> to be saved and restored on vm exit and entry. Writing to VTB is not
>> allowed in the privileged mode.
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>
> For some reason BUG() doesn't always trigger the "execution stops here" 
> logic in gcc. So I've squashed this patch into yours.
>
>
> Alex
>
>
> diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
> index 3e7085d..99de6ad 100644
> --- a/arch/powerpc/include/asm/reg.h
> +++ b/arch/powerpc/include/asm/reg.h
> @@ -1206,6 +1206,7 @@ static inline unsigned long mfvtb (void)
>        * capture that.
>        */
>       BUG();
> +    return 0;
>   }
>
>   #ifdef __powerpc64__

you can then drop the include header change. ie, 

#include <asm/bug.h>

-aneesh

^ permalink raw reply

* Re: [PATCH] cpufreq: ppc-corenet-cpu-freq: do_div use quotient
From: Tim Gardner @ 2014-06-06 14:03 UTC (permalink / raw)
  To: Ed Swarthout, scottwood, linuxppc-dev, linux-kernel
In-Reply-To: <1401913973-22536-1-git-send-email-Ed.Swarthout@freescale.com>

On 06/04/2014 02:32 PM, Ed Swarthout wrote:
> 6712d2931933ada259b82f06c03a855b19937074 (cpufreq:
> ppc-corenet-cpufreq: Fix __udivdi3 modpost error) used the remainder
> from do_div instead of the quotient. Fix that and add one to ensure
> minimum is met.
> 
> Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
> ---
>  drivers/cpufreq/ppc-corenet-cpufreq.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c
> index 0af618a..3607070 100644
> --- a/drivers/cpufreq/ppc-corenet-cpufreq.c
> +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c
> @@ -138,7 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	struct cpufreq_frequency_table *table;
>  	struct cpu_data *data;
>  	unsigned int cpu = policy->cpu;
> -	u64 transition_latency_hz;
> +	u64 u64temp;
>  
>  	np = of_get_cpu_node(cpu, NULL);
>  	if (!np)
> @@ -206,9 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	for_each_cpu(i, per_cpu(cpu_mask, cpu))
>  		per_cpu(cpu_data, i) = data;
>  
> -	transition_latency_hz = 12ULL * NSEC_PER_SEC;
> -	policy->cpuinfo.transition_latency =
> -		do_div(transition_latency_hz, fsl_get_sys_freq());
> +	/* Minimum transition latency is 12 platform clocks */
> +	u64temp = 12ULL * NSEC_PER_SEC;
> +	do_div(u64temp, fsl_get_sys_freq());
> +	policy->cpuinfo.transition_latency = u64temp + 1;
>  
>  	of_node_put(np);
>  
> 

Whoops, what was I thinking ? You should also add "Cc:
stable@vger.kernel.org # 3.15+" since this patch will likely miss 3.15
final.

Acked-by: Tim Gardner <tim.gardner@canonical.com>

-- 
Tim Gardner tim.gardner@canonical.com

^ permalink raw reply

* Re: [PATCH] powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode
From: Srivatsa S. Bhat @ 2014-06-06 12:37 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: ego, matt, mahesh, kexec, linux-kernel, suzuki, ebiederm, paulus,
	linuxppc-dev, Vivek Goyal
In-Reply-To: <5391B413.100@linux.vnet.ibm.com>

On 06/06/2014 05:59 PM, Srivatsa S. Bhat wrote:
 
> +bool kexec_cpu_wake(void)
> +{
> +	kexec_smp_down(NULL);
> +
> +	/* NOTREACHED */
> +	return true;
> +}
> +

This function doesn't have to return anything, so we can define it as void.
The bool is a remnant of my previous attempt at making this work. (But these
patches compile fine as they are, though).

Regards,
Srivatsa S. Bhat

^ permalink raw reply

* Re: [PATCH] powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode
From: Srivatsa S. Bhat @ 2014-06-06 12:31 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: ego, matt, mahesh, kexec, linux-kernel, suzuki, ebiederm, paulus,
	linuxppc-dev
In-Reply-To: <20140604134108.GA27557@redhat.com>

On 06/04/2014 07:11 PM, Vivek Goyal wrote:
> On Wed, Jun 04, 2014 at 01:58:40AM +0530, Srivatsa S. Bhat wrote:
>> On 05/28/2014 07:01 PM, Vivek Goyal wrote:
>>> On Tue, May 27, 2014 at 04:25:34PM +0530, Srivatsa S. Bhat wrote:
>>>> If we try to perform a kexec when the machine is in ST (Single-Threaded) mode
>>>> (ppc64_cpu --smt=off), the kexec operation doesn't succeed properly, and we
>>>> get the following messages during boot:
>>>>
[...]
>>>> diff --git a/kernel/kexec.c b/kernel/kexec.c
>>>> index c8380ad..28c5706 100644
>>>> --- a/kernel/kexec.c
>>>> +++ b/kernel/kexec.c
>>>> @@ -1683,6 +1683,14 @@ int kernel_kexec(void)
>>>>  		kexec_in_progress = true;
>>>>  		kernel_restart_prepare(NULL);
>>>>  		migrate_to_reboot_cpu();
>>>> +
>>>> +		/*
>>>> +		 * migrate_to_reboot_cpu() disables CPU hotplug assuming that
>>>> +		 * no further code needs to use CPU hotplug (which is true in
>>>> +		 * the reboot case). However, the kexec path depends on using
>>>> +		 * CPU hotplug again; so re-enable it here.
>>>> +		 */
>>>> +		cpu_hotplug_enable();
>>>>  		printk(KERN_EMERG "Starting new kernel\n");
>>>>  		machine_shutdown();
>>>
>>> After migrate_to_reboot_cpu(), we are calling machine_shutdown() which
>>> calls disable_nonboot_cpus() and which in turn calls _cpu_down().
>>>
>>
>> Hmm? I see only 'arm' calling disable_nonboot_cpus() from machine_shutdown().
>> None of the other architectures call it. Is that a leftover in arm?
> 
> You are right. I did not notice that only arm is doing that. Looks like
> it is calling into some platform code, I am not sure what exactly arm
> does for disabling cpu.
> 
> x86 code calls stop_other_cpus() in machine_shutdown() which sends
> REBOOT_VECTOR to other cpus and calls stop_this_cpu() which in turn
> does.
> 
>         for (;;)
>                 halt();
> 
> IIUC, upon receipt of certain interrupts cpu will come out of halt state.
> Not sure how safe it is from kexec point of view as we will be replacing
> original kernel that means if cpu comes out of halt state it might be
> running some random code.
> 
> Eric/hpa might know better the context here and what safeguards us on x86.
> 
> So one should not make cpu spin on some code as kexec will change that
> code. It should be some other platform specific mechanism which brings
> cpu in to hlt like state. So that way arm seems to be doing right thing.
> 
> I am not sure what powerpc does to stop cpus.
> 

powerpc shepherds all CPUs to a safe state, by making them run kexec_smp_down(),
and eventually those CPUs end up calling kexec_wait() in assembly.

Regards,
Srivatsa S. Bhat

^ permalink raw reply

* Re: [PATCH] powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode
From: Srivatsa S. Bhat @ 2014-06-06 12:30 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: ego, matt, mahesh, kexec, linux-kernel, suzuki, ebiederm, paulus,
	linuxppc-dev
In-Reply-To: <20140604134649.GB27557@redhat.com>

On 06/04/2014 07:16 PM, Vivek Goyal wrote:
> On Wed, Jun 04, 2014 at 08:09:25AM +1000, Benjamin Herrenschmidt wrote:
>> On Wed, 2014-06-04 at 01:58 +0530, Srivatsa S. Bhat wrote:
>>> Yep, that makes sense. But unfortunately I don't have enough insight into
>>> why exactly powerpc has to online the CPUs before doing a kexec. I just
>>> know from the commit log and the comment mentioned above (and from my own
>>> experiments) that the CPUs will get stuck if they were offline. Perhaps
>>> somebody more knowledgeable can explain this in detail and suggest a proper
>>> long-term solution.
>>>
>>> Matt, Ben, any thoughts on this?
>>
>> The problem is with our "soft offline" which we do on some platforms. When we
>> offline we don't actually send the CPUs back to firmware or anything like that.
>>
>> We put them into a very low low power loop inside Linux.
>>
>> The new kernel has no way to extract them from that loop. So we must re-"online"
>> them before we kexec so they can be passed to the new kernel normally (or returned
>> to firmware like we do on powernv).
> 
> Srivatsa,
> 
> Looks like your patch has been merged.
> 
> I don't like the following change in arch independent code.
> 
> /*
>  * migrate_to_reboot_cpu() disables CPU hotplug assuming  that
>  * no further code needs to use CPU hotplug (which is true in
>  * the reboot case). However, the kexec path depends on  using
>  * CPU hotplug again; so re-enable it here. 
>  */
>                cpu_hotplug_enable();
> 
> As it is very powerpc specific requirement, can you enable hotplug in powerpc
> arch dependent code as a short term solution.
> 

I didn't do that because that would mean that the _disable() would be
performed inside kernel/kexec.c and the corresponding _enable() would
be performed in arch/powerpc/kernel/machine_kexec_64.c -- with no apparent
connection between them, which would have made them hard to relate.

> Ideally one needs to fix the requirement of online all cpus in powerpc
> as a long term solution and then get rid of hotplug enable call.
> 

Yes, I agree. I'm trying out a solution at the moment (see the 4
preliminary patches I sent in my reply to Ben). If that works, we won't
need the enable call on powerpc.

Regards,
Srivatsa S. Bhat

^ permalink raw reply

* Re: [PATCH] powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode
From: Srivatsa S. Bhat @ 2014-06-06 12:29 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: ego, matt, mahesh, kexec, linux-kernel, suzuki, ebiederm, paulus,
	linuxppc-dev, Vivek Goyal
In-Reply-To: <1401833365.3247.36.camel@pasglop>

On 06/04/2014 03:39 AM, Benjamin Herrenschmidt wrote:
> On Wed, 2014-06-04 at 01:58 +0530, Srivatsa S. Bhat wrote:
>> Yep, that makes sense. But unfortunately I don't have enough insight into
>> why exactly powerpc has to online the CPUs before doing a kexec. I just
>> know from the commit log and the comment mentioned above (and from my own
>> experiments) that the CPUs will get stuck if they were offline. Perhaps
>> somebody more knowledgeable can explain this in detail and suggest a proper
>> long-term solution.
>>
>> Matt, Ben, any thoughts on this?
> 
> The problem is with our "soft offline" which we do on some platforms. When we
> offline we don't actually send the CPUs back to firmware or anything like that.
> 
> We put them into a very low low power loop inside Linux.
> 
> The new kernel has no way to extract them from that loop. So we must re-"online"
> them before we kexec so they can be passed to the new kernel normally (or returned
> to firmware like we do on powernv).
> 

Thanks a lot for the explanation Ben!

I thought about this and this is what I think: whether the CPU is in the kernel
or in the firmware is a hard-boundary. But once we know it is still in the
kernel, whether it is online or offline is a soft-boundary, something that
ideally shouldn't make any difference to kexec.

Then I looked at what is that special state that kexec expects the online CPUs
to be in, before performing kexec, and I found that that state is entered via
kexec_smp_down().

Which means, if we poke the soft-offline CPUs and make them execute
kexec_smp_down(), we should be able to do a successful kexec without having to
actually online them. After all, the core kexec code doesn't mandate that they
should be online. So if we satisfy powerpc's requirement that all the CPUs are
in a sane state, that should be good enough. (This would be similar to how the
subcore code wakes up offline CPUs to perform the split-core procedure).

I know, this is all theory for now since I haven't tested it yet, but I think
we can make this work.

Below are the 4 preliminary patches I'm have so far, to implement this.


===============================================================================
				Patch 1
===============================================================================

diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index 16d7e33..2a31b52 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -68,6 +68,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
 		ppc_save_regs(newregs);
 }
 
+extern bool kexec_cpu_wake(void);
 extern void kexec_smp_wait(void);	/* get and clear naca physid, wait for
 					  master to copy new code to 0 */
 extern int crashing_cpu;
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index f92b0b5..39f721d 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -255,6 +255,16 @@ struct machdep_calls {
 	void (*machine_shutdown)(void);
 
 #ifdef CONFIG_KEXEC
+#if (defined CONFIG_PPC64) && (defined CONFIG_PPC_BOOK3S)
+
+	/*
+	 * The pseries and powernv book3s platforms have a special requirement
+	 * that soft-offline CPUs have to be woken up before kexec, to avoid
+	 * CPUs getting stuck. This callback prepares the system for the
+	 * impending wakeup of the offline CPUs.
+	 */
+	void (*kexec_wake_prepare)(void);
+#endif
 	void (*kexec_cpu_down)(int crash_shutdown, int secondary);
 
 	/* Called to do what every setup is needed on image and the
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 879b3aa..2ef6c58 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -182,6 +182,14 @@ static void kexec_smp_down(void *arg)
 	/* NOTREACHED */
 }
 
+bool kexec_cpu_wake(void)
+{
+	kexec_smp_down(NULL);
+
+	/* NOTREACHED */
+	return true;
+}
+
 static void kexec_prepare_cpus_wait(int wait_state)
 {
 	int my_cpu, i, notified=-1;
@@ -202,7 +210,7 @@ static void kexec_prepare_cpus_wait(int wait_state)
 	 * these possible-but-not-online-but-should-be CPUs and chaperone them
 	 * into kexec_smp_wait().
 	 */
-	for_each_online_cpu(i) {
+	for_each_present_cpu(i) {
 		if (i == my_cpu)
 			continue;
 
@@ -228,6 +236,8 @@ static void kexec_prepare_cpus_wait(int wait_state)
  * threads as offline -- and again, these CPUs will be stuck.
  *
  * So, we online all CPUs that should be running, including secondary threads.
+ *
+ * TODO: Update this comment
  */
 static void wake_offline_cpus(void)
 {
@@ -237,7 +247,8 @@ static void wake_offline_cpus(void)
 		if (!cpu_online(cpu)) {
 			printk(KERN_INFO "kexec: Waking offline cpu %d.\n",
 			       cpu);
-			WARN_ON(cpu_up(cpu));
+			/* This should work even though the cpu is offline */
+			smp_send_reschedule(cpu);
 		}
 	}
 }



===============================================================================
				Patch 2
===============================================================================

diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
index 75501bf..910081c 100644
--- a/arch/powerpc/platforms/powernv/powernv.h
+++ b/arch/powerpc/platforms/powernv/powernv.h
@@ -27,4 +27,8 @@ extern void pnv_lpc_init(void);
 
 bool cpu_core_split_required(void);
 
+#ifdef CONFIG_KEXEC
+extern void pnv_kexec_wake_prepare(void);
+#endif
+
 #endif /* _POWERNV_H */
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 8c16a5f..8dbccb7 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -331,6 +331,7 @@ define_machine(powernv) {
 	.calibrate_decr		= generic_calibrate_decr,
 	.dma_set_mask		= pnv_dma_set_mask,
 #ifdef CONFIG_KEXEC
+	.kexec_wake_prepare	= pnv_kexec_wake_prepare,
 	.kexec_cpu_down		= pnv_kexec_cpu_down,
 #endif
 #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 0062a43..0b017b0 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -32,6 +32,7 @@
 #include <asm/opal.h>
 #include <asm/runlatch.h>
 #include <asm/code-patching.h>
+#include <asm/kexec.h>
 
 #include "powernv.h"
 
@@ -140,6 +141,15 @@ static int pnv_smp_cpu_disable(void)
 	return 0;
 }
 
+#ifdef CONFIG_KEXEC
+static bool kexec_wake_offline_cpus;
+
+void pnv_kexec_wake_prepare(void)
+{
+	kexec_wake_offline_cpus = true;
+}
+#endif
+
 static void pnv_smp_cpu_kill_self(void)
 {
 	unsigned int cpu;
@@ -170,6 +180,11 @@ static void pnv_smp_cpu_kill_self(void)
 		if (cpu_core_split_required())
 			continue;
 
+#ifdef CONFIG_KEXEC
+		if (kexec_wake_offline_cpus)
+			kexec_cpu_wake(); /* This function won't return! */
+#endif
+
 		if (!generic_check_cpu_restart(cpu))
 			DBG("CPU%d Unexpected exit while offline !\n", cpu);
 	}




===============================================================================
				Patch 3
===============================================================================

diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 20d6297..d026028 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -31,6 +31,7 @@
 #include <asm/vdso_datapage.h>
 #include <asm/xics.h>
 #include <asm/plpar_wrappers.h>
+#include <asm/kexec.h>
 
 #include "offline_states.h"
 
@@ -143,6 +144,13 @@ static void pseries_mach_cpu_die(void)
 			get_lppaca()->donate_dedicated_cpu = 0;
 		get_lppaca()->idle = 0;
 
+#if CONFIG_KEXEC
+		if (get_preferred_offline_state(cpu) == CPU_STATE_KEXEC_WAKE) {
+			/* This function won't return! */
+			kexec_cpu_wake();
+		}
+#endif
+
 		if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
 			unregister_slb_shadow(hwcpu);
 
diff --git a/arch/powerpc/platforms/pseries/kexec.c b/arch/powerpc/platforms/pseries/kexec.c
index 13fa95b3..fc135e6 100644
--- a/arch/powerpc/platforms/pseries/kexec.c
+++ b/arch/powerpc/platforms/pseries/kexec.c
@@ -20,6 +20,17 @@
 #include <asm/plpar_wrappers.h>
 
 #include "pseries.h"
+#include "offline_states.h"
+
+void pseries_kexec_wake_prepare(void)
+{
+	unsigned int cpu;
+
+	for_each_present_cpu(cpu) {
+		if (!cpu_online(cpu))
+			set_preferred_offline_state(cpu, CPU_STATE_KEXEC_WAKE);
+	}
+}
 
 static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
 {
diff --git a/arch/powerpc/platforms/pseries/offline_states.h b/arch/powerpc/platforms/pseries/offline_states.h
index 08672d9..32fe5e8 100644
--- a/arch/powerpc/platforms/pseries/offline_states.h
+++ b/arch/powerpc/platforms/pseries/offline_states.h
@@ -5,6 +5,9 @@
 enum cpu_state_vals {
 	CPU_STATE_OFFLINE,
 	CPU_STATE_INACTIVE,
+#ifdef CONFIG_KEXEC
+	CPU_STATE_KEXEC_WAKE,
+#endif
 	CPU_STATE_ONLINE,
 	CPU_MAX_OFFLINE_STATES
 };
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 361add6..35ecb99 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -38,6 +38,8 @@ static inline void smp_init_pseries_xics(void) { };
 #endif
 
 #ifdef CONFIG_KEXEC
+extern void pseries_kexec_wake_prepare(void);
+
 extern void setup_kexec_cpu_down_xics(void);
 extern void setup_kexec_cpu_down_mpic(void);
 #else
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index adc21a0..c1a0722 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -808,6 +808,7 @@ define_machine(pseries) {
 	.system_reset_exception = pSeries_system_reset_exception,
 	.machine_check_exception = pSeries_machine_check_exception,
 #ifdef CONFIG_KEXEC
+	.kexec_wake_prepare	= pseries_kexec_wake_prepare,
 	.machine_kexec          = pSeries_machine_kexec,
 #endif
 #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE



===============================================================================
				Patch 4
===============================================================================

diff --git a/kernel/kexec.c b/kernel/kexec.c
index 28c5706..55a6350 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1684,13 +1684,6 @@ int kernel_kexec(void)
 		kernel_restart_prepare(NULL);
 		migrate_to_reboot_cpu();
 
-		/*
-		 * migrate_to_reboot_cpu() disables CPU hotplug assuming that
-		 * no further code needs to use CPU hotplug (which is true in
-		 * the reboot case). However, the kexec path depends on using
-		 * CPU hotplug again; so re-enable it here.
-		 */
-		cpu_hotplug_enable();
 		printk(KERN_EMERG "Starting new kernel\n");
 		machine_shutdown();
 	}

^ permalink raw reply related

* Re: [PATCH 1/3 v3] powerpc/fsl-booke: Add support for T2080/T2081 SoC
From: Diana Craciun @ 2014-06-06 12:04 UTC (permalink / raw)
  To: Shengzhou Liu; +Cc: scottwood, linuxppc-dev
In-Reply-To: <1402039105-22590-1-git-send-email-Shengzhou.Liu@freescale.com>

On 06/06/2014 10:18 AM, Shengzhou Liu wrote:
> The T2080 QorIQ multicore processor combines four dual-threaded e6500 Power
> Architecture processor cores with high-performance datapath acceleration
> logic and network and peripheral bus interfaces required for networking,
> telecom/datacom, wireless infrastructure, and mil/aerospace applications.
>
> The T2080 SoC includes the following function and features:
> - Four dual-threaded 64-bit Power architecture e6500 cores, up to 1.8GHz
> - 2MB L2 cache and 512KB CoreNet platform cache (CPC)
> - Hierarchical interconnect fabric
> - One 32-/64-bit DDR3/3L SDRAM memory controllers with ECC and interleaving
> - Data Path Acceleration Architecture (DPAA) incorporating acceleration
> - 16 SerDes lanes up to 10.3125 GHz
> - 8 Ethernet interfaces (multiple 1G/2.5G/10G MACs)
> - High-speed peripheral interfaces
>    - Four PCI Express controllers (two PCIe 2.0 and two PCIe 3.0)
>    - Two Serial RapidIO 2.0 controllers/ports running at up to 5 GHz
> - Additional peripheral interfaces
>    - Two serial ATA (SATA 2.0) controllers
>    - Two high-speed USB 2.0 controllers with integrated PHY
>    - Enhanced secure digital host controller (SD/SDXC/eMMC)
>    - Enhanced serial peripheral interface (eSPI)
>    - Four I2C controllers
>    - Four 2-pin UARTs or two 4-pin UARTs
>    - Integrated Flash Controller supporting NAND and NOR flash
> - Three eight-channel DMA engines
> - Support for hardware virtualization and partitioning enforcement
> - QorIQ Platform's Trust Architecture 2.0
>
> T2081 is a reduced personality of T2080 with following difference:
> Feature               T2080 T2081
> 1G Ethernet numbers:  8     6
> 10G Ethernet numbers: 4     2
> SerDes lanes:         16    8
> Serial RapidIO,RMan:  2     no
> SATA Controller:      2     no
> Aurora:               yes   no
> SoC Package:          896-pins 780-pins
>
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> ---
> v3: added pamu node and updated clockgen.
> v2: updated with some comments.
>
>   arch/powerpc/boot/dts/fsl/t2080si-post.dtsi |  69 +++++
>   arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 434 ++++++++++++++++++++++++++++
>   arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi  |  91 ++++++
>   arch/powerpc/include/asm/mpc85xx.h          |   2 +
>   4 files changed, 596 insertions(+)
>   create mode 100644 arch/powerpc/boot/dts/fsl/t2080si-post.dtsi
>   create mode 100644 arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>   create mode 100644 arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi
>
> diff --git a/arch/powerpc/boot/dts/fsl/t2080si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2080si-post.dtsi
> new file mode 100644
> index 0000000..082ec20
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/fsl/t2080si-post.dtsi
> @@ -0,0 +1,69 @@
> +/*
> + * T2080 Silicon/SoC Device Tree Source (post include)
> + *
> + * Copyright 2013 Freescale Semiconductor Inc.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are met:
> + *     * Redistributions of source code must retain the above copyright
> + *       notice, this list of conditions and the following disclaimer.
> + *     * Redistributions in binary form must reproduce the above copyright
> + *       notice, this list of conditions and the following disclaimer in the
> + *       documentation and/or other materials provided with the distribution.
> + *     * Neither the name of Freescale Semiconductor nor the
> + *       names of its contributors may be used to endorse or promote products
> + *       derived from this software without specific prior written permission.
> + *
> + *
> + * ALTERNATIVELY, this software may be distributed under the terms of the
> + * GNU General Public License ("GPL") as published by the Free Software
> + * Foundation, either version 2 of that License or (at your option) any
> + * later version.
> + *
> + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
> + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
> + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +/include/ "t2081si-post.dtsi"
> +
> +&soc {
> +/include/ "qoriq-sata2-0.dtsi"
> +	sata@220000 {
> +		fsl,iommu-parent = <&pamu1>;
> +		fsl,liodn-reg = <&guts 0x550>; /* SATA1LIODNR */
> +	};
> +
> +/include/ "qoriq-sata2-1.dtsi"
> +	sata@221000 {
> +		fsl,iommu-parent = <&pamu1>;
> +		fsl,liodn-reg = <&guts 0x554>; /* SATA2LIODNR */
> +	};
> +};
> +
> +&rio {
> +	compatible = "fsl,srio";
> +	interrupts = <16 2 1 11>;
> +	#address-cells = <2>;
> +	#size-cells = <2>;
> +	ranges;
> +
> +	port1 {
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		cell-index = <1>;
> +	};
> +
> +	port2 {
> +		#address-cells = <2>;
> +		#size-cells = <2>;
> +		cell-index = <2>;
> +	};
> +};
> diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> new file mode 100644
> index 0000000..c4fb88a
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> @@ -0,0 +1,434 @@
> +/*
> + * T2081 Silicon/SoC Device Tree Source (post include)
> + *
> + * Copyright 2013 Freescale Semiconductor Inc.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are met:
> + *     * Redistributions of source code must retain the above copyright
> + *	 notice, this list of conditions and the following disclaimer.
> + *     * Redistributions in binary form must reproduce the above copyright
> + *	 notice, this list of conditions and the following disclaimer in the
> + *	 documentation and/or other materials provided with the distribution.
> + *     * Neither the name of Freescale Semiconductor nor the
> + *	 names of its contributors may be used to endorse or promote products
> + *	 derived from this software without specific prior written permission.
> + *
> + *
> + * ALTERNATIVELY, this software may be distributed under the terms of the
> + * GNU General Public License ("GPL") as published by the Free Software
> + * Foundation, either version 2 of that License or (at your option) any
> + * later version.
> + *
> + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
> + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
> + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +&ifc {
> +	#address-cells = <2>;
> +	#size-cells = <1>;
> +	compatible = "fsl,ifc", "simple-bus";
> +	interrupts = <25 2 0 0>;
> +};
> +
> +/* controller at 0x240000 */
> +&pci0 {
> +	compatible = "fsl,t2080-pcie", "fsl,qoriq-pcie";
> +	device_type = "pci";
> +	#size-cells = <2>;
> +	#address-cells = <3>;
> +	bus-range = <0x0 0xff>;
> +	interrupts = <20 2 0 0>;
> +	fsl,iommu-parent = <&pamu0>;
> +	pcie@0 {
> +		reg = <0 0 0 0 0>;
> +		#interrupt-cells = <1>;
> +		#size-cells = <2>;
> +		#address-cells = <3>;
> +		device_type = "pci";
> +		interrupts = <20 2 0 0>;
> +		interrupt-map-mask = <0xf800 0 0 7>;
> +		interrupt-map = <
> +			/* IDSEL 0x0 */
> +			0000 0 0 1 &mpic 40 1 0 0
> +			0000 0 0 2 &mpic 1 1 0 0
> +			0000 0 0 3 &mpic 2 1 0 0
> +			0000 0 0 4 &mpic 3 1 0 0
> +		>;
> +	};
> +};
> +
> +/* controller at 0x250000 */
> +&pci1 {
> +	compatible = "fsl,t2080-pcie", "fsl,qoriq-pcie";
> +	device_type = "pci";
> +	#size-cells = <2>;
> +	#address-cells = <3>;
> +	bus-range = <0 0xff>;
> +	interrupts = <21 2 0 0>;
> +	fsl,iommu-parent = <&pamu0>;
> +	pcie@0 {
> +		reg = <0 0 0 0 0>;
> +		#interrupt-cells = <1>;
> +		#size-cells = <2>;
> +		#address-cells = <3>;
> +		device_type = "pci";
> +		interrupts = <21 2 0 0>;
> +		interrupt-map-mask = <0xf800 0 0 7>;
> +		interrupt-map = <
> +			/* IDSEL 0x0 */
> +			0000 0 0 1 &mpic 41 1 0 0
> +			0000 0 0 2 &mpic 5 1 0 0
> +			0000 0 0 3 &mpic 6 1 0 0
> +			0000 0 0 4 &mpic 7 1 0 0
> +		>;
> +	};
> +};
> +
> +/* controller at 0x260000 */
> +&pci2 {
> +	compatible = "fsl,t2080-pcie", "fsl,qoriq-pcie";
> +	device_type = "pci";
> +	#size-cells = <2>;
> +	#address-cells = <3>;
> +	bus-range = <0x0 0xff>;
> +	interrupts = <22 2 0 0>;
> +	fsl,iommu-parent = <&pamu0>;
> +	pcie@0 {
> +		reg = <0 0 0 0 0>;
> +		#interrupt-cells = <1>;
> +		#size-cells = <2>;
> +		#address-cells = <3>;
> +		device_type = "pci";
> +		interrupts = <22 2 0 0>;
> +		interrupt-map-mask = <0xf800 0 0 7>;
> +		interrupt-map = <
> +			/* IDSEL 0x0 */
> +			0000 0 0 1 &mpic 42 1 0 0
> +			0000 0 0 2 &mpic 9 1 0 0
> +			0000 0 0 3 &mpic 10 1 0 0
> +			0000 0 0 4 &mpic 11 1 0 0
> +		>;
> +	};
> +};
> +
> +/* controller at 0x270000 */
> +&pci3 {
> +	compatible = "fsl,t2080-pcie", "fsl,qoriq-pcie";
> +	device_type = "pci";
> +	#size-cells = <2>;
> +	#address-cells = <3>;
> +	bus-range = <0x0 0xff>;
> +	interrupts = <23 2 0 0>;
> +	fsl,iommu-parent = <&pamu0>;
> +	pcie@0 {
> +		reg = <0 0 0 0 0>;
> +		#interrupt-cells = <1>;
> +		#size-cells = <2>;
> +		#address-cells = <3>;
> +		device_type = "pci";
> +		interrupts = <23 2 0 0>;
> +		interrupt-map-mask = <0xf800 0 0 7>;
> +		interrupt-map = <
> +			/* IDSEL 0x0 */
> +			0000 0 0 1 &mpic 43 1 0 0
> +			0000 0 0 2 &mpic 0 1 0 0
> +			0000 0 0 3 &mpic 4 1 0 0
> +			0000 0 0 4 &mpic 8 1 0 0
> +		>;
> +	};
> +};
> +
> +&dcsr {
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +	compatible = "fsl,dcsr", "simple-bus";
> +
> +	dcsr-epu@0 {
> +		compatible = "fsl,t2080-dcsr-epu", "fsl,dcsr-epu";
> +		interrupts = <52 2 0 0
> +			      84 2 0 0
> +			      85 2 0 0
> +			      94 2 0 0
> +			      95 2 0 0>;
> +		reg = <0x0 0x1000>;
> +	};
> +	dcsr-npc {
> +		compatible = "fsl,t2080-dcsr-cnpc", "fsl,dcsr-cnpc";
> +		reg = <0x1000 0x1000 0x1002000 0x10000>;
> +	};
> +	dcsr-nxc@2000 {
> +		compatible = "fsl,dcsr-nxc";
> +		reg = <0x2000 0x1000>;
> +	};
> +	dcsr-corenet {
> +		compatible = "fsl,dcsr-corenet";
> +		reg = <0x8000 0x1000 0x1A000 0x1000>;
> +	};
> +	dcsr-ocn@11000 {
> +		compatible = "fsl,t2080-dcsr-ocn", "fsl,dcsr-ocn";
> +		reg = <0x11000 0x1000>;
> +	};
> +	dcsr-ddr@12000 {
> +		compatible = "fsl,dcsr-ddr";
> +		dev-handle = <&ddr1>;
> +		reg = <0x12000 0x1000>;
> +	};
> +	dcsr-nal@18000 {
> +		compatible = "fsl,t2080-dcsr-nal", "fsl,dcsr-nal";
> +		reg = <0x18000 0x1000>;
> +	};
> +	dcsr-rcpm@22000 {
> +		compatible = "fsl,t2080-dcsr-rcpm", "fsl,dcsr-rcpm";
> +		reg = <0x22000 0x1000>;
> +	};
> +	dcsr-snpc@30000 {
> +		compatible = "fsl,t2080-dcsr-snpc", "fsl,dcsr-snpc";
> +		reg = <0x30000 0x1000 0x1022000 0x10000>;
> +	};
> +	dcsr-snpc@31000 {
> +		compatible = "fsl,t2080-dcsr-snpc", "fsl,dcsr-snpc";
> +		reg = <0x31000 0x1000 0x1042000 0x10000>;
> +	};
> +	dcsr-snpc@32000 {
> +		compatible = "fsl,t2080-dcsr-snpc", "fsl,dcsr-snpc";
> +		reg = <0x32000 0x1000 0x1062000 0x10000>;
> +	};
> +	dcsr-cpu-sb-proxy@100000 {
> +		compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
> +		cpu-handle = <&cpu0>;
> +		reg = <0x100000 0x1000 0x101000 0x1000>;
> +	};
> +	dcsr-cpu-sb-proxy@108000 {
> +		compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
> +		cpu-handle = <&cpu1>;
> +		reg = <0x108000 0x1000 0x109000 0x1000>;
> +	};
> +	dcsr-cpu-sb-proxy@110000 {
> +		compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
> +		cpu-handle = <&cpu2>;
> +		reg = <0x110000 0x1000 0x111000 0x1000>;
> +	};
> +	dcsr-cpu-sb-proxy@118000 {
> +		compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
> +		cpu-handle = <&cpu3>;
> +		reg = <0x118000 0x1000 0x119000 0x1000>;
> +	};
> +};
> +
> +&soc {
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +	device_type = "soc";
> +	compatible = "simple-bus";
> +
> +	soc-sram-error {
> +		compatible = "fsl,soc-sram-error";
> +		interrupts = <16 2 1 29>;
> +	};
> +
> +	corenet-law@0 {
> +		compatible = "fsl,corenet-law";
> +		reg = <0x0 0x1000>;
> +		fsl,num-laws = <32>;
> +	};
> +
> +	ddr1: memory-controller@8000 {
> +		compatible = "fsl,qoriq-memory-controller-v4.7",
> +				"fsl,qoriq-memory-controller";
> +		reg = <0x8000 0x1000>;
> +		interrupts = <16 2 1 23>;
> +	};
> +
> +	cpc: l3-cache-controller@10000 {
> +		compatible = "fsl,t2080-l3-cache-controller", "cache";
> +		reg = <0x10000 0x1000
> +		       0x11000 0x1000
> +		       0x12000 0x1000>;
> +		interrupts = <16 2 1 27
> +			      16 2 1 26
> +			      16 2 1 25>;
> +	};
> +
> +	corenet-cf@18000 {
> +		compatible = "fsl,corenet2-cf", "fsl,corenet-cf";
> +		reg = <0x18000 0x1000>;
> +		interrupts = <16 2 1 31>;
> +		fsl,ccf-num-csdids = <32>;
> +		fsl,ccf-num-snoopids = <32>;
> +	};
> +
> +	iommu@20000 {
> +		compatible = "fsl,pamu-v1.0", "fsl,pamu";
> +		reg = <0x20000 0x3000>;
> +		ranges = <0 0x20000 0x3000>;
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		interrupts = <
> +			24 2 0 0
> +			16 2 1 30>;
> +
> +		pamu0: pamu@0 {
> +			reg = <0 0x1000>;
> +			fsl,primary-cache-geometry = <32 1>;
> +			fsl,secondary-cache-geometry = <128 2>;
> +		};
> +
> +		pamu1: pamu@1000 {
> +			reg = <0x1000 0x1000>;
> +			fsl,primary-cache-geometry = <32 1>;
> +			fsl,secondary-cache-geometry = <128 2>;
> +		};
> +
> +		pamu2: pamu@2000 {
> +			reg = <0x2000 0x1000>;
> +			fsl,primary-cache-geometry = <32 1>;
> +			fsl,secondary-cache-geometry = <128 2>;
> +		};
> +	};

Add also the fsl,portid-mapping to the pamu node. See 
http://patchwork.ozlabs.org/patch/345991/.

> +
> +/include/ "qoriq-mpic4.3.dtsi"
> +
> +	guts: global-utilities@e0000 {
> +		compatible = "fsl,t2080-device-config", "fsl,qoriq-device-config-2.0";
> +		reg = <0xe0000 0xe00>;
> +		fsl,has-rstcr;
> +		fsl,liodn-bits = <12>;
> +	};
> +
> +	clockgen: global-utilities@e1000 {
> +		compatible = "fsl,t2080-clockgen", "fsl,qoriq-clockgen-2.0";
> +		ranges = <0x0 0xe1000 0x1000>;
> +		reg = <0xe1000 0x1000>;
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +
> +		sysclk: sysclk {
> +			#clock-cells = <0>;
> +			compatible = "fsl,qoriq-sysclk-2.0";
> +			clock-output-names = "sysclk", "fixed-clock";
> +		};
> +
> +		pll0: pll0@800 {
> +			#clock-cells = <1>;
> +			reg = <0x800 4>;
> +			compatible = "fsl,qoriq-core-pll-2.0";
> +			clocks = <&sysclk>;
> +			clock-output-names = "pll0", "pll0-div2", "pll0-div4";
> +		};
> +
> +		pll1: pll1@820 {
> +			#clock-cells = <1>;
> +			reg = <0x820 4>;
> +			compatible = "fsl,qoriq-core-pll-2.0";
> +			clocks = <&sysclk>;
> +			clock-output-names = "pll1", "pll1-div2", "pll1-div4";
> +		};
> +
> +		mux0: mux0@0 {
> +			#clock-cells = <0>;
> +			reg = <0x0 4>;
> +			compatible = "fsl,qoriq-core-mux-2.0";
> +			clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>,
> +				 <&pll1 0>, <&pll1 1>, <&pll1 2>;
> +			clock-names = "pll0", "pll0-div2", "pll1-div4",
> +				"pll1", "pll1-div2", "pll1-div4";
> +			clock-output-names = "cmux0";
> +		};
> +
> +		mux1: mux1@20 {
> +			#clock-cells = <0>;
> +			reg = <0x20 4>;
> +			compatible = "fsl,qoriq-core-mux-2.0";
> +			clocks = <&pll0 0>, <&pll0 1>, <&pll0 2>,
> +				 <&pll1 0>, <&pll1 1>, <&pll1 2>;
> +			clock-names = "pll0", "pll0-div2", "pll1-div4",
> +				"pll1", "pll1-div2", "pll1-div4";
> +			clock-output-names = "cmux1";
> +		};
> +	};
> +
> +	rcpm: global-utilities@e2000 {
> +		compatible = "fsl,t2080-rcpm", "fsl,qoriq-rcpm-2.0";
> +		reg = <0xe2000 0x1000>;
> +	};
> +
> +	sfp: sfp@e8000 {
> +		compatible = "fsl,t2080-sfp";
> +		reg = <0xe8000 0x1000>;
> +	};
> +
> +	serdes: serdes@ea000 {
> +		compatible = "fsl,t2080-serdes";
> +		reg = <0xea000 0x4000>;
> +	};
> +
> +/include/ "elo3-dma-0.dtsi"
> +	dma@100300 {
> +		fsl,iommu-parent = <&pamu0>;
> +		fsl,liodn-reg = <&guts 0x580>; /* DMA1LIODNR */
> +	};
> +/include/ "elo3-dma-1.dtsi"
> +	dma@101300 {
> +		fsl,iommu-parent = <&pamu0>;
> +		fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */
> +	};
> +/include/ "elo3-dma-2.dtsi"
> +	dma@102300 {
> +		fsl,iommu-parent = <&pamu0>;
> +		fsl,liodn-reg = <&guts 0x588>; /* DMA3LIODNR */
> +	};
> +
> +/include/ "qoriq-espi-0.dtsi"
> +	spi@110000 {
> +		fsl,espi-num-chipselects = <4>;
> +	};
> +
> +/include/ "qoriq-esdhc-0.dtsi"
> +	sdhc@114000 {
> +		compatible = "fsl,t2080-esdhc", "fsl,esdhc";
> +		fsl,iommu-parent = <&pamu1>;
> +		fsl,liodn-reg = <&guts 0x530>; /* SDMMCLIODNR */
> +		sdhci,auto-cmd12;
> +	};
> +/include/ "qoriq-i2c-0.dtsi"
> +/include/ "qoriq-i2c-1.dtsi"
> +/include/ "qoriq-duart-0.dtsi"
> +/include/ "qoriq-duart-1.dtsi"
> +/include/ "qoriq-gpio-0.dtsi"
> +/include/ "qoriq-gpio-1.dtsi"
> +/include/ "qoriq-gpio-2.dtsi"
> +/include/ "qoriq-gpio-3.dtsi"
> +/include/ "qoriq-usb2-mph-0.dtsi"
> +	usb0: usb@210000 {
> +		compatible = "fsl-usb2-mph-v2.4", "fsl-usb2-mph";
> +		fsl,iommu-parent = <&pamu1>;
> +		fsl,liodn-reg = <&guts 0x520>; /* USB1LIODNR */
> +		phy_type = "utmi";
> +		port0;
> +	};
> +/include/ "qoriq-usb2-dr-0.dtsi"
> +	usb1: usb@211000 {
> +		compatible = "fsl-usb2-dr-v2.4", "fsl-usb2-dr";
> +		fsl,iommu-parent = <&pamu1>;
> +		fsl,liodn-reg = <&guts 0x524>; /* USB1LIODNR */
> +		dr_mode = "host";
> +		phy_type = "utmi";
> +	};
> +/include/ "qoriq-sec5.2-0.dtsi"
> +
> +	L2_1: l2-cache-controller@c20000 {
> +		/* Cluster 0 L2 cache */
> +		compatible = "fsl,t2080-l2-cache-controller";
> +		reg = <0xc20000 0x40000>;
> +		next-level-cache = <&cpc>;
> +	};
> +};
> diff --git a/arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi b/arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi
> new file mode 100644
> index 0000000..d21b100
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/fsl/t208xsi-pre.dtsi
> @@ -0,0 +1,91 @@
> +/*
> + * T2080/T2081 Silicon/SoC Device Tree Source (pre include)
> + *
> + * Copyright 2013 Freescale Semiconductor Inc.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are met:
> + *     * Redistributions of source code must retain the above copyright
> + *	 notice, this list of conditions and the following disclaimer.
> + *     * Redistributions in binary form must reproduce the above copyright
> + *	 notice, this list of conditions and the following disclaimer in the
> + *	 documentation and/or other materials provided with the distribution.
> + *     * Neither the name of Freescale Semiconductor nor the
> + *	 names of its contributors may be used to endorse or promote products
> + *	 derived from this software without specific prior written permission.
> + *
> + *
> + * ALTERNATIVELY, this software may be distributed under the terms of the
> + * GNU General Public License ("GPL") as published by the Free Software
> + * Foundation, either version 2 of that License or (at your option) any
> + * later version.
> + *
> + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
> + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
> + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +/dts-v1/;
> +
> +/include/ "e6500_power_isa.dtsi"
> +
> +/ {
> +	#address-cells = <2>;
> +	#size-cells = <2>;
> +	interrupt-parent = <&mpic>;
> +
> +	aliases {
> +		ccsr = &soc;
> +		dcsr = &dcsr;
> +
> +		serial0 = &serial0;
> +		serial1 = &serial1;
> +		serial2 = &serial2;
> +		serial3 = &serial3;
> +
> +		crypto = &crypto;
> +		pci0 = &pci0;
> +		pci1 = &pci1;
> +		pci2 = &pci2;
> +		pci3 = &pci3;
> +		usb0 = &usb0;
> +		usb1 = &usb1;
> +		dma0 = &dma0;
> +		dma1 = &dma1;
> +		dma2 = &dma2;
> +		sdhc = &sdhc;
> +	};
> +
> +	cpus {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		cpu0: PowerPC,e6500@0 {
> +			device_type = "cpu";
> +			reg = <0 1>;
> +			next-level-cache = <&L2_1>;
> +		};
> +		cpu1: PowerPC,e6500@2 {
> +			device_type = "cpu";
> +			reg = <2 3>;
> +			next-level-cache = <&L2_1>;
> +		};
> +		cpu2: PowerPC,e6500@4 {
> +			device_type = "cpu";
> +			reg = <4 5>;
> +			next-level-cache = <&L2_1>;
> +		};
> +		cpu3: PowerPC,e6500@6 {
> +			device_type = "cpu";
> +			reg = <6 7>;
> +			next-level-cache = <&L2_1>;
> +		};

Add also the fsl,portid-mapping to the cpu nodes. See 
http://patchwork.ozlabs.org/patch/345991/.

> +	};
> +};
> diff --git a/arch/powerpc/include/asm/mpc85xx.h b/arch/powerpc/include/asm/mpc85xx.h
> index 736d4ac..3bef74a 100644
> --- a/arch/powerpc/include/asm/mpc85xx.h
> +++ b/arch/powerpc/include/asm/mpc85xx.h
> @@ -77,6 +77,8 @@
>   #define SVR_T1020	0x852100
>   #define SVR_T1021	0x852101
>   #define SVR_T1022	0x852102
> +#define SVR_T2080	0x853000
> +#define SVR_T2081	0x853100
>   
>   #define SVR_8610	0x80A000
>   #define SVR_8641	0x809000

Diana

^ permalink raw reply

* Re: [PATCH 1/2] powerpc/powernv: include asm/smp.h to handle UP config
From: Benjamin Herrenschmidt @ 2014-06-06 11:03 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: Shreyas B. Prabhu, Paul Mackerras, linuxppc-dev, linux-kernel,
	Geert Uytterhoeven
In-Reply-To: <539152B3.5070702@linux.vnet.ibm.com>

On Fri, 2014-06-06 at 11:03 +0530, Anshuman Khandual wrote:
> On 06/05/2014 08:51 PM, Shreyas B. Prabhu wrote:
> > Build throws following errors when CONFIG_SMP=n
> > arch/powerpc/platforms/powernv/setup.c: In function ‘pnv_kexec_wait_secondaries_down’:
> > arch/powerpc/platforms/powernv/setup.c:179:4: error: implicit declaration of function ‘get_hard_smp_processor_id’
> >     rc = opal_query_cpu_status(get_hard_smp_processor_id(i),
> > 
> > The usage of get_hard_smp_processor_id() needs the declaration from
> > <asm/smp.h>. The file setup.c includes <linux/sched.h>, which in-turn
> > includes <linux/smp.h>. However, <linux/smp.h> includes <asm/smp.h>
> > only on SMP configs and hence UP builds fail.
> > 
> > Fix this by directly including <asm/smp.h> in setup.c unconditionally.
> 
> Can you please clean up the description in the commit message ? and also
> the first line in the commit message should mention that the patch is
> trying to fix a UP specific build failure.

I don't understand your comment ... the description and subject line
are perfectly fine...

Ben.

^ permalink raw reply

* Re: [PATCH 1/4] KVM: PPC: BOOK3S: PR: Emulate virtual timebase register
From: Alexander Graf @ 2014-06-06 10:44 UTC (permalink / raw)
  To: Aneesh Kumar K.V, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc
In-Reply-To: <1401970085-14493-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com>


On 05.06.14 14:08, Aneesh Kumar K.V wrote:
> virtual time base register is a per VM, per cpu register that needs
> to be saved and restored on vm exit and entry. Writing to VTB is not
> allowed in the privileged mode.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

For some reason BUG() doesn't always trigger the "execution stops here" 
logic in gcc. So I've squashed this patch into yours.


Alex


diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 3e7085d..99de6ad 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1206,6 +1206,7 @@ static inline unsigned long mfvtb (void)
       * capture that.
       */
      BUG();
+    return 0;
  }

  #ifdef __powerpc64__

^ permalink raw reply related

* Re: [PATCH v2 2/2] powerpc/powernv : Disable subcore for UP configs
From: Srivatsa S. Bhat @ 2014-06-06 10:28 UTC (permalink / raw)
  To: Shreyas B. Prabhu
  Cc: linux-kernel, Paul Mackerras, linuxppc-dev, Anshuman Khandual
In-Reply-To: <1402050171-18270-1-git-send-email-shreyas@linux.vnet.ibm.com>

On 06/06/2014 03:52 PM, Shreyas B. Prabhu wrote:
> Build throws following errors when CONFIG_SMP=n
> arch/powerpc/platforms/powernv/subcore.c: In function ‘cpu_update_split_mode’:
> arch/powerpc/platforms/powernv/subcore.c:274:15: error: ‘setup_max_cpus’ undeclared (first use in this function)
> arch/powerpc/platforms/powernv/subcore.c:285:5: error: lvalue required as left operand of assignment
> 
> 'setup_max_cpus' variable is relevant only on SMP, so there is no point
> working around it for UP. Furthermore, subcore itself is relevant only
> on SMP and hence the better solution is to exclude subcore.o and
> subcore-asm.o for UP builds.
> 
> Signed-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com>

Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>

Regards,
Srivatsa S. Bhat

> ---
> Changes in v2:
> Excluding subcore-asm.o which is part of the subcore feature for UP configs.
> 
>  arch/powerpc/platforms/powernv/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
> index 4ad0d34..d55891f 100644
> --- a/arch/powerpc/platforms/powernv/Makefile
> +++ b/arch/powerpc/platforms/powernv/Makefile
> @@ -1,9 +1,9 @@
>  obj-y			+= setup.o opal-takeover.o opal-wrappers.o opal.o opal-async.o
>  obj-y			+= opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
>  obj-y			+= rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
> -obj-y			+= opal-msglog.o subcore.o subcore-asm.o
> +obj-y			+= opal-msglog.o
> 
> -obj-$(CONFIG_SMP)	+= smp.o
> +obj-$(CONFIG_SMP)	+= smp.o subcore.o subcore-asm.o
>  obj-$(CONFIG_PCI)	+= pci.o pci-p5ioc2.o pci-ioda.o
>  obj-$(CONFIG_EEH)	+= eeh-ioda.o eeh-powernv.o
>  obj-$(CONFIG_PPC_SCOM)	+= opal-xscom.o
> 

^ permalink raw reply

* Re: KVM: PPC: BOOK3S: PR: P8 Support
From: Alexander Graf @ 2014-06-06 10:24 UTC (permalink / raw)
  To: Aneesh Kumar K.V, benh, paulus; +Cc: linuxppc-dev, kvm, kvm-ppc
In-Reply-To: <1401970085-14493-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>


On 05.06.14 14:08, Aneesh Kumar K.V wrote:
> This patchset adds support for emulating VTB, IC and Doorbell features in P8.
> Doorbell support is dummy since we don't support SMT cores with PR-KVM.

Thanks, applied patches 1 and 4 to kvm-ppc-queue.


Alex

^ permalink raw reply

* [PATCH v2 2/2] powerpc/powernv : Disable subcore for UP configs
From: Shreyas B. Prabhu @ 2014-06-06 10:22 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: Shreyas B. Prabhu, linuxppc-dev, linux-kernel, Srivatsa S. Bhat,
	Anshuman Khandual
In-Reply-To: <1402050065-18007-1-git-send-email-shreyas@linux.vnet.ibm.com>

Build throws following errors when CONFIG_SMP=n
arch/powerpc/platforms/powernv/subcore.c: In function ‘cpu_update_split_mode’:
arch/powerpc/platforms/powernv/subcore.c:274:15: error: ‘setup_max_cpus’ undeclared (first use in this function)
arch/powerpc/platforms/powernv/subcore.c:285:5: error: lvalue required as left operand of assignment

'setup_max_cpus' variable is relevant only on SMP, so there is no point
working around it for UP. Furthermore, subcore itself is relevant only
on SMP and hence the better solution is to exclude subcore.o and
subcore-asm.o for UP builds.

Signed-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com>
---
Changes in v2:
Excluding subcore-asm.o which is part of the subcore feature for UP configs.

 arch/powerpc/platforms/powernv/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
index 4ad0d34..d55891f 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -1,9 +1,9 @@
 obj-y			+= setup.o opal-takeover.o opal-wrappers.o opal.o opal-async.o
 obj-y			+= opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
 obj-y			+= rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
-obj-y			+= opal-msglog.o subcore.o subcore-asm.o
+obj-y			+= opal-msglog.o
 
-obj-$(CONFIG_SMP)	+= smp.o
+obj-$(CONFIG_SMP)	+= smp.o subcore.o subcore-asm.o
 obj-$(CONFIG_PCI)	+= pci.o pci-p5ioc2.o pci-ioda.o
 obj-$(CONFIG_EEH)	+= eeh-ioda.o eeh-powernv.o
 obj-$(CONFIG_PPC_SCOM)	+= opal-xscom.o
-- 
1.9.0

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox