Re: [PATCH] powerpc: Optimize __arch_swab32 and __arch_swab16

2011-09-10 Thread Benjamin Herrenschmidt
On Fri, 2011-09-09 at 14:10 +0200, Joakim Tjernlund wrote: > PPC __arch_swab32 and __arch_swab16 generates non optimal code. > They do not schedule very well, need to copy its input register > and swab16 needs an extra insn to clear its upper bits. > Fix this with better inline ASM. > > Signed-off

[PATCH 01/21] powerpc/udbg: Fix Kconfig entry for avoiding 44x early debug with KVM

2011-09-10 Thread Benjamin Herrenschmidt
It was preventing the global early debug selection whenever KVM was enabled instead of only preventing the 440 specific one. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/Kconfig.debug |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/Kconfig.de

[PATCH 02/21] powerpc/smp: More generic support for "soft hotplug"

2011-09-10 Thread Benjamin Herrenschmidt
This adds more generic support for doing CPU hotplug with a simple idle loop and no actual reset of the processors. The generic smp_generic_kick_cpu() does the hotplug bringup trick if the PACA shows that the CPU has already been started at boot and we provide an accessor for the CPU state. Signed

[PATCH 03/21] powerpc/pci: Call pcie_bus_configure_settings()

2011-09-10 Thread Benjamin Herrenschmidt
This new function is used to properly setup the PCI Express Max Payload Size (and in some circumstances Max Read Request Size). Some systems will not operate properly if these aren't set correctly and the firmware doesn't always do it. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/kern

[PATCH 04/21] tty/hvc/hvsi_lib: Updates for running under OPAL v2

2011-09-10 Thread Benjamin Herrenschmidt
Experience shows that our hvsi negotiation timeouts were too short under OPAL v2. This patch bumps them from 200ms to 500ms. To limit the impact when the console is repeatedly opened/closed, we also avoid re-negotiating an already opened & established connection which typically happens when runnin

[PATCH 05/21] powerpc/powernv: Don't clobber r9 in relative_toc()

2011-09-10 Thread Benjamin Herrenschmidt
With OPAL, r8 and r9 will be used to pass the OPAL base and entry for debugging purposes (those informations are also in the device-tree). We don't want to clobber those registers that early. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/head_64.S |6 +++--- 1 files changed,

[PATCH 06/21] powerpc: Add skeleton PowerNV platform

2011-09-10 Thread Benjamin Herrenschmidt
This adds a skeletton for the new Power "Non Virtualized" platform which will be used by machines supporting running without an hypervisor, for example in order to run KVM. These machines will be using a new firmware called OPAL for which the support will be provided by later patches. The PowerNV

[PATCH 07/21] of: Change logic to overwrite cmd_line with CONFIG_CMDLINE

2011-09-10 Thread Benjamin Herrenschmidt
We used to overwrite with CONFIG_CMDLINE if we found a chosen node but failed to get bootargs out of it or they were empty, unless CONFIG_CMDLINE_FORCE is set. Instead change that to overwrite if cmd_line is non empty after the bootargs check. It allows arch code to have other mechanisms to retrie

[PATCH 08/21] powerpc/powernv: Add CPU hotplug support

2011-09-10 Thread Benjamin Herrenschmidt
Unplugged CPU go into NAP mode in a loop until woken up Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/Kconfig |2 +- arch/powerpc/platforms/powernv/smp.c | 78 +- 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/arch/p

[PATCH 09/21] powerpc/powernv: Add OPAL takeover from PowerVM

2011-09-10 Thread Benjamin Herrenschmidt
On machines supporting the OPAL firmware version 1, the system is initially booted under pHyp. We then use a special hypercall to verify if OPAL is available and if it is, we then trigger a "takeover" which disables pHyp and loads the OPAL runtime firmware, giving control to the kernel in hyperviso

[PATCH 12/21] powerpc/powernv: Add support for instanciating OPAL v2 from Open Firmware

2011-09-10 Thread Benjamin Herrenschmidt
OPAL v2 is instantiated in a way similar to RTAS using Open Firmware client interface calls, and the resulting address and entry point are put in the device-tree Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/prom_init.c | 136 +-- 1 files chan

[PATCH 10/21] powerpc/powernv: Get kernel command line accross OPAL takeover

2011-09-10 Thread Benjamin Herrenschmidt
We stash it in boot_command_line which isn't in BSS and so won't be overwritten. We then use that as a default cmd_line before we walk the device-tree. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/prom.c |7 +++ arch/powerpc/kernel/prom_init.c|4 +

[PATCH 11/21] powerpc/powernv: Basic support for OPAL

2011-09-10 Thread Benjamin Herrenschmidt
Add definition of OPAL interfaces along with the wrappers to call into OPAL runtime and the early device-tree parsing hook to locate the OPAL runtime firmware. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/include/asm/firmware.h| 10 + arch/powerpc/include/asm/opal.h

[PATCH 13/21] powerpc/powernv: Support for OPAL console

2011-09-10 Thread Benjamin Herrenschmidt
This adds a udbg and an hvc console backend for supporting a console using the OPAL console interfaces. On OPAL v1 we have hvc0 mapped to whatever console the system was configured for (network or hvsi serial port) via the service processor. On OPAL v2 we have hvcN mapped to the Nth console provi

[PATCH 14/21] powerpc/powernv: Hookup reboot and poweroff functions

2011-09-10 Thread Benjamin Herrenschmidt
This calls the respective HAL functions, and spin on hal_poll_event() to ensure the HAL has a chance to communicate with the FSP to trigger the reboot or shutdown operation Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/platforms/powernv/setup.c | 32 ++-- 1

[PATCH 15/21] powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks

2011-09-10 Thread Benjamin Herrenschmidt
Implements OPAL RTC and NVRAM support and wire all that up to the powernv platform. We use RTAS for RTC as a fallback if available. Using RTAS for nvram is not supported yet, pending some rework/cleanup and generalization of the pSeries & CHRP code. We also use RTAS fallbacks for power off and reb

[PATCH 18/21] powerpc/powernv: Machine check and other system interrupts

2011-09-10 Thread Benjamin Herrenschmidt
OPAL can handle various interrupt for us such as Machine Checks (it performs all sorts of recovery tasks and passes back control to us with informations about the error), Hardware Management Interrupts and Softpatch interrupts. This wires up the mechanisms and prints out specific informations retu

[PATCH 19/21] powerpc/powernv: Add support for p5ioc2 PCI-X and PCIe

2011-09-10 Thread Benjamin Herrenschmidt
This adds support for PCI-X and PCIe on the p5ioc2 IO hub using OPAL. This includes allocating & setting up TCE tables and config space access routines. This also supports fallbacks via RTAS when OPAL is absent, using legacy TCE format pre-allocated via the device-tree (BML style) Signed-off-by:

[PATCH 20/21] powerpc/powernv: Implement MSI support for p5ioc2 PCIe

2011-09-10 Thread Benjamin Herrenschmidt
This implements support for MSIs on p5ioc2 PHBs. We only support MSIs on the PCIe PHBs, not the PCI-X ones as the later hasn't been properly verified in HW. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/platforms/powernv/pci-p5ioc2.c | 49 arch/powerpc/platforms/powernv/p

[PATCH 21/21] powerpc/powernv: Handle PCI-X/PCIe reset delay

2011-09-10 Thread Benjamin Herrenschmidt
The firmware doesn't wait after lifting the PCI reset. However it does timestamp it in the device tree. We use that to ensure we wait long enough (3s is our current arbitrary setting) from that timestamp to actually probing the bus. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/platform

[PATCH 16/21] powerpc/powernv: Add OPAL ICS backend

2011-09-10 Thread Benjamin Herrenschmidt
OPAL handles HW access to the various ICS or equivalent chips for us (with the exception of p5ioc2 based HEA which uses a different backend) similarily to what RTAS does on pSeries. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/include/asm/xics.h| 19 +++ arch/powerpc/sysdev/x

[PATCH 17/21] powerpc/powernv: Register and handle OPAL interrupts

2011-09-10 Thread Benjamin Herrenschmidt
We do the minimum which is to "pass" interrupts to HAL, which makes the console smoother and will allow us to implement interrupt based completion and console. Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/platforms/powernv/opal.c | 31 +++ 1 files changed,