summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-kvm' into nextBenjamin Herrenschmidt2013-10-1127-384/+442
|\ | | | | | | | | | | | | | | | | Topic branch for commits that the KVM tree might want to pull in separately. Hand merged a few files due to conflicts with the LE stuff Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| * powerpc: Provide for giveup_fpu/altivec to save state in alternate locationPaul Mackerras2013-10-116-3/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provides a facility which is intended for use by KVM, where the contents of the FP/VSX and VMX (Altivec) registers can be saved away to somewhere other than the thread_struct when kernel code wants to use floating point or VMX instructions. This is done by providing a pointer in the thread_struct to indicate where the state should be saved to. The giveup_fpu() and giveup_altivec() functions test these pointers and save state to the indicated location if they are non-NULL. Note that the MSR_FP/VEC bits in task->thread.regs->msr are still used to indicate whether the CPU register state is live, even when an alternate save location is being used. This also provides load_fp_state() and load_vr_state() functions, which load up FP/VSX and VMX state from memory into the CPU registers, and corresponding store_fp_state() and store_vr_state() functions, which store FP/VSX and VMX state into memory from the CPU registers. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| * powerpc: Put FP/VSX and VR state into structuresPaul Mackerras2013-10-1117-358/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This creates new 'thread_fp_state' and 'thread_vr_state' structures to store FP/VSX state (including FPSCR) and Altivec/VSX state (including VSCR), and uses them in the thread_struct. In the thread_fp_state, the FPRs and VSRs are represented as u64 rather than double, since we rarely perform floating-point computations on the values, and this will enable the structures to be used in KVM code as well. Similarly FPSCR is now a u64 rather than a structure of two 32-bit values. This takes the offsets out of the macros such as SAVE_32FPRS, REST_32FPRS, etc. This enables the same macros to be used for normal and transactional state, enabling us to delete the transactional versions of the macros. This also removes the unused do_load_up_fpu and do_load_up_altivec, which were in fact buggy since they didn't create large enough stack frames to account for the fact that load_up_fpu and load_up_altivec are not designed to be called from C and assume that their caller's stack frame is an interrupt frame. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| * powerpc: add real mode support for dma operations on powernvAlexey Kardashevskiy2013-10-114-19/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing TCE machine calls (tce_build and tce_free) only support virtual mode as they call __raw_writeq for TCE invalidation what fails in real mode. This introduces tce_build_rm and tce_free_rm real mode versions which do mostly the same but use "Store Doubleword Caching Inhibited Indexed" instruction for TCE invalidation. This new feature is going to be utilized by real mode support of VFIO. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| * powerpc: Prepare to support kernel handling of IOMMU map/unmapAlexey Kardashevskiy2013-10-114-2/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current VFIO-on-POWER implementation supports only user mode driven mapping, i.e. QEMU is sending requests to map/unmap pages. However this approach is really slow, so we want to move that to KVM. Since H_PUT_TCE can be extremely performance sensitive (especially with network adapters where each packet needs to be mapped/unmapped) we chose to implement that as a "fast" hypercall directly in "real mode" (processor still in the guest context but MMU off). To be able to do that, we need to provide some facilities to access the struct page count within that real mode environment as things like the sparsemem vmemmap mappings aren't accessible. This adds an API function realmode_pfn_to_page() to get page struct when MMU is off. This adds to MM a new function put_page_unless_one() which drops a page if counter is bigger than 1. It is going to be used when MMU is off (for example, real mode on PPC64) and we want to make sure that page release will not happen in real mode as it may crash the kernel in a horrible way. CONFIG_SPARSEMEM_VMEMMAP and CONFIG_FLATMEM are supported. Cc: linux-mm@kvack.org Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| * hashtable: add hash_for_each_possible_rcu_notrace()Alexey Kardashevskiy2013-10-111-0/+15
| | | | | | | | | | | | | | | | | | This adds hash_for_each_possible_rcu_notrace() which is basically a notrace clone of hash_for_each_possible_rcu() which cannot be used in real mode due to its tracing/debugging capability. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/eeh: Reorder output messagesGavin Shan2013-10-111-3/+3
| | | | | | | | | | | | | | | | | | | | We already had some output messages from EEH core. Occasionally, we can see the output messages from EEH core before the stack dump. That's not what we expected. The patch fixes that and shows the stack dump prior to output messages from EEH core. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/eeh: Output PHB3 diag-dataGavin Shan2013-10-112-0/+135
| | | | | | | | | | | | | | | | | | The patch adds function ioda_eeh_phb3_phb_diag() to dump PHB3 PHB diag-data. That's called while detecting informative errors or frozen PE on the specific PHB. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Double size of log blobGavin Shan2013-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | Each PHB instance (struct pnv_phb) has its corresponding log blob, which is used to hold the retrieved error log from firmware. The current size of that (4096) isn't enough for PHB3 case and the patch makes that double to 8192. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/eeh: Output error numberGavin Shan2013-10-111-2/+2
| | | | | | | | | | | | | | | | The patch prints the error number while failing to retrieve error log from firmware. It's helpful for debugging. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Support inbound error injectionGavin Shan2013-10-111-9/+50
| | | | | | | | | | | | | | | | | | For now, we only support outbound error injection. Actually, the hardware supports injecting inbound errors as well. The patch enables to inject inbound errors. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Enable EEH for PHB3Gavin Shan2013-10-112-19/+12
| | | | | | | | | | | | | | The EEH isn't enabled for PHB3 and the patch intends to enable it. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/scom: Use "devspec" rather than "path" in debugfs entriesBenjamin Herrenschmidt2013-10-111-1/+1
| | | | | | | | | | | | | | This is the traditional name for device-tree path, used in sysfs, do the same for the XSCOM debugfs files. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/scom: CONFIG_SCOM_DEBUGFS should depend on CONFIG_DEBUG_FSBenjamin Herrenschmidt2013-10-111-1/+1
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Add scom support under OPALv3Benjamin Herrenschmidt2013-10-113-0/+107
| | | | | | | | | | | | | | OPAL v3 provides interfaces to access the chips XSCOM, expose this via the existing scom infrastructure. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/scom: Create debugfs files using ibm,chip-id if availableBenjamin Herrenschmidt2013-10-111-2/+7
| | | | | | | | | | | | | | When creating the debugfs scom files, use "ibm,chip-id" as the scom%d index rather than a simple made up number when possible. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/scom: Add support for "reg" propertyBenjamin Herrenschmidt2013-10-111-5/+17
| | | | | | | | | | | | | | | | | | | | When devices are direct children of a scom controller node, they should be able to use the normal "reg" property instead of "scom-reg". In that case, they also use #address-cells rather than #scom-cells to indicate the size of an entry. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/scom: Change scom_read() and scom_write() to return errorsBenjamin Herrenschmidt2013-10-115-23/+46
| | | | | | | | | | | | | | scom_read() now returns the read value via a pointer argument and both functions return an int error code Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Enable /dev/port when isa_io_special is setBenjamin Herrenschmidt2013-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | isa_io_special is set when the platform provides a "special" implementation of inX/outX via some FW interface for example. Such a platform doesn't need an ISA bridge on PCI, and so /dev/port should be made available even if one isn't present. This makes the LPC bus IOs accessible via /dev/port on PowerNV Power8 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Make ftrace endian-safe.Eugene Surovegin2013-10-111-0/+4
| | | | | | | | | | Signed-off-by: Eugene Surovegin <surovegin@google.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Make kernel module helper endian-safe.Eugene Surovegin2013-10-111-0/+16
| | | | | | | | | | Signed-off-by: Eugene Surovegin <surovegin@google.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: prom_init exception when updating core valueLaurent Dufour2013-10-111-6/+22
| | | | | | | | | | | | | | | | | | Since the CPU is generating an exception when accessing unaligned word, and as this exception is not yet handled when running prom_init, data should be copied from the architecture vector byte per byte. Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/booke64: Check napping in performance monitor interruptKevin Hao2013-10-111-0/+1
| | | | | | | | | | | | | | | | | | The performance monitor interrupt is asynchronous, so we should check if the current processor is in napping status in the handler of this interrupt. Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/kernel: Fix endian issue in rtas_pciCedric Le Goater2013-10-111-3/+3
| | | | | | | | | | Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/pseries: Implement arch_get_random_long() based on H_RANDOMMichael Ellerman2013-10-112-1/+45
| | | | | | | | | | | | | | | | | | Add support for the arch_get_random_long() hook based on the H_RANDOM hypervisor call. We trust the hypervisor to provide us with random data, ie. we don't whiten it in anyway. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | hwrng: Add a driver for the hwrng found in power7+ systemsMichael Ellerman2013-10-113-0/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a driver for the hwrng found in power7+ systems, based on the existing code for the arch_get_random_long() hook. We only register a single instance of the driver, not one per device, because we use the existing per_cpu array of devices in the arch code. This means we always read from the "closest" device, avoiding inter-chip memory traffic. Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Implement arch_get_random_long/int() for powernvMichael Ellerman2013-10-116-1/+163
| | | | | | | | | | | | | | | | | | | | | | | | Add the plumbing to implement arch_get_random_long/int(). It didn't seem worth adding an extra ppc_md hook for int, so we reuse the one for long. Add an implementation for powernv based on the hwrng found in power7+ systems. We whiten the output of the hwrng, and the result passes all the dieharder tests. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | hwrng: Return errors to upper levels in pseries-rng.cMichael Ellerman2013-10-111-3/+11
| | | | | | | | | | | | | | | | | | We don't expect to get errors from the hypervisor when reading the rng, but if we do we should pass the error up to the hwrng driver. Otherwise the hwrng driver will continue calling us forever. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Added __cmpdi2 for signed 64bit comparisionBharat Bhushan2013-10-112-0/+16
| | | | | | | | | | | | | | | | | | This was missing on powerpc and I am getting compilation error drivers/vfio/pci/vfio_pci_rdwr.c:193: undefined reference to `__cmpdi2' drivers/vfio/pci/vfio_pci_rdwr.c:193: undefined reference to `__cmpdi2' Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Fix section mismatch warning in free_lppacasVladimir Murzin2013-10-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While cross-building for PPC64 I've got bunch of WARNING: arch/powerpc/kernel/built-in.o(.text.unlikely+0x2d2): Section mismatch in reference from the function .free_lppacas() to the variable .init.data:lppaca_size The function .free_lppacas() references the variable __initdata lppaca_size. This is often because .free_lppacas lacks a __initdata annotation or the annotation of lppaca_size is wrong. Fix it by using proper annotation for free_lppacas. Additionally, annotate {allocate,new}_llpcas properly. Signed-off-by: Vladimir Murzin <murzin.v@gmail.com> Acked-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/ppc64: Remove the unneeded load of ti_flags in resume_kernelKevin Hao2013-10-111-3/+1
| | | | | | | | | | | | | | | | | | We already got the value of current_thread_info and ti_flags and store them into r9 and r4 respectively before jumping to resume_kernel. So there is no reason to reload them again. Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/8xx/tqm8xx: Fix incorrect placement of __initdata tagBartlomiej Zolnierkiewicz2013-10-111-2/+2
| | | | | | | | | | | | | | | | | | __initdata tag should be placed between the variable name and equal sign for the variable to be placed in the intended .init.data section. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/legacy_serial: Fix incorrect placement of __initdata tagBartlomiej Zolnierkiewicz2013-10-111-1/+1
| | | | | | | | | | | | | | | | | | __initdata tag should be placed between the variable name and equal sign for the variable to be placed in the intended .init.data section. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/mpic: Disable preemption when calling mpic_processor_id()Scott Wood2013-10-111-1/+7
| | | | | | | | | | | | | | | | | | | | Otherwise, we get a debug traceback due to the use of smp_processor_id() (or get_paca()) inside hard_smp_processor_id(). mpic_host_map() is just looking for a default CPU, so it doesn't matter if we migrate after getting the CPU ID. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Work around little endian gcc bugAnton Blanchard2013-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | Temporarily work around an ICE we are seeing while building in little endian mode: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57134 Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Don't set HAVE_EFFICIENT_UNALIGNED_ACCESS on little endian buildsAnton Blanchard2013-10-111-1/+1
| | | | | | | | | | | | | | | | | | POWER7 takes alignment exceptions on some unaligned addresses, so disable HAVE_EFFICIENT_UNALIGNED_ACCESS. This fixes an early boot issue in the printk code. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Add ability to build little endian kernelsIan Munsie2013-10-114-4/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows the kbuild system to successfully compile a kernel for the little endian PowerPC64 architecture. A subsequent patch will add the CONFIG_CPU_LITTLE_ENDIAN kernel config option which must be set to build such a kernel. If cross compiling, CROSS_COMPILE must point to a suitable toolchain (compiled for the powerpc64le-linux and powerpcle-linux targets). Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | KVM: PPC: Disable KVM on little endian buildsAnton Blanchard2013-10-111-0/+1
| | | | | | | | | | | | | | | | | | | | There are a number of KVM issues with little endian builds. We are working on fixing them, but in the meantime disable it. Signed-off-by: Anton Blanchard <anton@samba.org> Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | tty/hvc_opal: powerpc: Make OPAL HVC device tree accesses endian safeBenjamin Herrenschmidt2013-10-111-2/+2
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/hvsi: Fix endian issues in HVSI driverBenjamin Herrenschmidt2013-10-112-21/+20
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Fix some PCI sparse errors and one LE bugAnton Blanchard2013-10-115-19/+19
| | | | | | | | | | | | | | | | pnv_pci_setup_bml_iommu was missing a byteswap of a device tree property. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: More little endian issues in OPAL RTC driverAnton Blanchard2013-10-112-11/+12
| | | | | | | | | | | | | | | | Sparse caught an issue where opal_set_rtc_time was incorrectly byteswapping. Also fix a number of sparse warnings. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Don't register exception handlers in little endian modeBenjamin Herrenschmidt2013-10-111-0/+2
| | | | | | | | | | | | | | The powernv exception handlers are not ready to take exceptions in little endian mode, so disable them. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Fix OPAL entry and exit in little endian modeBenjamin Herrenschmidt2013-10-111-1/+8
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Fix endian issues in OPAL console and udbg backendBenjamin Herrenschmidt2013-10-112-16/+20
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Fix endian issues in powernv PCI codeBenjamin Herrenschmidt2013-10-112-28/+30
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Make OPAL NVRAM device tree accesses endian safeBenjamin Herrenschmidt2013-10-111-2/+2
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Fix endian issues in OPAL ICS backendBenjamin Herrenschmidt2013-10-111-8/+9
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc/powernv: Fix endian issues in OPAL RTC driverBenjamin Herrenschmidt2013-10-111-0/+7
| | | | | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* | powerpc: Little endian sparse clean up for ↵Alistair Popple2013-10-111-2/+2
| | | | | | | | | | | | | | arch/powerpc/platforms/powernv/pci-ioda.c Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>