aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc
AgeCommit message (Collapse)AuthorFilesLines
2013-08-14powerpc: More little endian fixes for setup-common.cAlistair Popple1-2/+5
Signed-off-by: Alistair Popple <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Make logical to real cpu mapping code endian safeAnton Blanchard1-3/+3
Signed-off-by: Anton Blanchard <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Make RTAS calls endian safeAnton Blanchard2-23/+23
RTAS expects arguments in the call buffer to be big endian so we need to byteswap on little endian builds Signed-off-by: Anton Blanchard <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Make cache info device tree accesses endian safeAnton Blanchard1-5/+5
Signed-off-by: Anton Blanchard <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Make RTAS device tree accesses endian safeAnton Blanchard1-14/+14
Signed-off-by: Anton Blanchard <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: More little endian fixes for prom.cAlistair Popple1-2/+2
Signed-off-by: Alistair Popple <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Make prom.c device tree accesses endian safeIan Munsie1-29/+31
On PowerPC the device tree is always big endian, but the CPU could be either, so add be32_to_cpu where appropriate and change the types of device tree data to __be32 etc to allow sparse to locate endian issues. Signed-off-by: Ian Munsie <[email protected]> Acked-by: Grant Likely <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Avoid link stack corruption for MMU on exceptionsMichael Neuling2-19/+20
When we have MMU on exceptions (POWER8) and a relocatable kernel, we need to branch from the initial exception vectors at 0x0 to up high where the kernel might be located. Currently we do this using the link register. Unfortunately this corrupts the link stack and instead we should use the count register. We did this for the syscall entry path in: 6a40480 powerpc: Avoid link stack corruption in MMU on syscall entry path but I stupidly forgot to do the same for other exceptions. This patch changes the initial exception vectors to use the count register instead of the link register when we need to branch up to the relocated kernel. I have a dodgy userspace test which loops calling a function that reads the PVR (mfpvr in userspace will be emulated by the kernel via the program check exception). On POWER8 and with CONFIG_RELOCATABLE=y, I get a ~10% performance improvement with my userspace test with this patch. Signed-off-by: Michael Neuling <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Make chip-id information available to userspaceVasant Hegde3-0/+17
So far "/sys/devices/system/cpu/cpuX/topology/physical_package_id" was always default (-1) on ppc64 architecture. Now, some systems have an ibm,chip-id property in the cpu nodes in the device tree. On these systems, we now use this information to display physical_package_id. Signed-off-by: Vasant Hegde <[email protected]> Signed-off-by: Shivaprasad G Bhat <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/eeh: powerpc/eeh: Fix undefined variableMike Qiu1-14/+8
changes for V4: - changes the type of frozen_pe_no from %d to %llu in pr_devel() 'pe_no' hasn't been defined, it should be an typo error, it should be 'frozen_pe_no'. Also '__func__' has missed in IODA_EEH_DBG(), For safety reasons, use pr_devel() directly, instead of use IODA_EEH_DBG() Signed-off-by: Mike Qiu <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14Revert "powerpc/e500: Update compilation flags with core specific options"Benjamin Herrenschmidt1-16/+2
This reverts commit c8db32c8669f7de05b820ee4934926405af52188. The commit breaks the build of all my 64-bit embedded configs. It looks like gcc-4.7.3 doesn't know about e5500. Additionally it incorrectly does -mcpu=e5500 on a config that has both e5500 and A2 support enabled. Signed-off-by: Benjamin Herrenschmidt <[email protected]> ---
2013-08-14powerpc: Use ibm, chip-id property to compute cpu_core_mask if availablePaul Mackerras1-3/+45
Some systems have an ibm,chip-id property in the cpu nodes in the device tree. On these systems, we now use that to compute the cpu_core_mask (i.e. the set of core siblings) rather than looking at cache properties. Signed-off-by: Paul Mackerras <[email protected]> Tested-by: Vasant Hegde <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Pull out cpu_core_mask updates into a separate functionPaul Mackerras1-28/+28
This factors out the details of updating cpu_core_mask into a separate function, to make it easier to change how the mask is calculated later. This makes no functional change. Signed-off-by: Paul Mackerras <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Fix denormalized exception handlerPaul Mackerras1-5/+6
The denormalized exception handler (denorm_exception_hv) has a couple of bugs. If the CONFIG_PPC_DENORMALISATION option is not selected, or the HSRR1_DENORM bit is not set in HSRR1, we don't test whether the interrupt occurred within a KVM guest. On the other hand, if the HSRR1_DENORM bit is set and CONFIG_PPC_DENORMALISATION is enabled, we corrupt the CFAR and PPR. To correct these problems, this replaces the open-coded version of EXCEPTION_PROLOG_1 that is there currently, and that is missing the saving of PPR and CFAR values to the PACA, with an instance of EXCEPTION_PROLOG_1. This adds an explicit KVMTEST after testing whether the exception is one we can handle, and adds code to restore the CFAR on exit. Signed-off-by: Paul Mackerras <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Ignore zImage.epaprMark Brown1-0/+1
This is another file we can generate so add it to the list. Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/math-emu: Fix load/store indexed emulationJames Yang1-10/+5
Load/store indexed instructions where the index register RA=R0, such as "lfdx f1,0,r3", are not illegal. Load/store indexed with update instructions where the index register RA=R0, such as "lfdux f1,0,r3", are invalid, and, to be consistent with existing math-emu behavior for other invalid instruction forms, will signal as illegal. Signed-off-by: James Yang <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Remove the empty giveup_fpu() function on 32bit kernelKevin Hao6-33/+4
Instead of implementing an empty giveup_fpu() function for each 32bit processor type, replace them with an unique empty inline function. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Make flush_fp_to_thread() nop when CONFIG_PPC_FPU is disabledKevin Hao3-3/+9
In the current kernel, the function flush_fp_to_thread() is not dependent on CONFIG_PPC_FPU. So most invocations of this function is not wrapped by CONFIG_PPC_FPU. Even through we don't really save the FPRs to the thread struct if CONFIG_PPC_FPU is not enabled, but there does have some runtime overhead such as the check for tsk->thread.regs and preempt disable and enable. It really make no sense to do that. So make it a nop when CONFIG_PPC_FPU is disabled. Also remove the wrapped #ifdef CONFIG_PPC_FPU when invoking this function. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Remove the redundant flush_fp_to_thread() in setup_sigcontext()Kevin Hao1-2/+0
In commit c6e6771b(powerpc: Introduce VSX thread_struct and CONFIG_VSX) we add a invocation of flush_fp_to_thread() before copying the FPR or VSR to users. But we already invoke the flush_fp_to_thread() in this function. So remove one of them. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/mpc85xx: Only emulate the unimplemented FP instructions on corenet64Kevin Hao1-0/+1
We have split the math emulation into two parts. This makes it possible to just emulate the unimplemented floating point instructions on these boards. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: remove the unused function disable_kernel_fp()Kevin Hao2-14/+0
The only using of function disable_kernel_fp() was already dropped in the commit 5daf9071 (powerpc: merge align.c). Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: split She math emulation into two partsKevin Hao3-18/+46
For some SoC (such as the FSL BookE) even though there does have a hardware FPU, but not all floating point instructions are implemented. Unfortunately some versions of gcc do use these unimplemented instructions. Then we have to enable the math emulation to workaround this issue. It seems a little redundant to have the support to emulate all the floating point instructions in this case. So split the math emulation into two parts. One is for the SoC which doesn't have FPU at all and the other for the SoC which does have the hardware FPU and only need some special floating point instructions to be emulated. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Introduce function emulate_math()Kevin Hao1-45/+34
There are two invocations of do_mathemu() in traps.c. And the codes in these two places are almost the same. Introduce a locale function to eliminate the duplication. With this change we can also make sure that in program_check_exception() the PPC_WARN_EMULATED is invoked for the correctly emulated math instructions. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/math-emu: Move the flush FPU state function into do_mathemuKevin Hao2-9/+9
By doing this we can make sure that the FPU state is only flushed to the thread struct when it is really needed. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/85xx: Enable the math emulation for the corenet64_smp_defconfigKevin Hao1-0/+1
I got the following error on my t4240qds board. ntpd[2713]: unhandled signal 4 at 0fd5b448 nip 0fd5b448 lr 0fd5b424 code 30001 The root cause is that the float point instruction 'fsqrt' is used. But this instruction is not implemented on e6500 core. Even this does seem a gcc bug, I would like to enable the math emulation in the kernel to workaround this kind of issue. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/8xx: Remove last traces of 8XX_MINIMAL_FPEMUPaul Bolle3-203/+0
The Kconfig symbol 8XX_MINIMAL_FPEMU was removed in commit 968219fa33 ("powerpc/8xx: Remove 8xx specific "minimal FPU emulation""). But that commit didn't remove all code depending on that symbol. Do so now. Signed-off-by: Paul Bolle <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/math-emu: Remove the unneeded check for CONFIG_MATH_EMULATION in math.cKevin Hao1-4/+0
The math.c is only built when CONFIG_MATH_EMULATION is enabled. So the #ifdef check for CONFIG_MATH_EMULATION in it seems redundant. Drop all of them. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/math-emu: Remove the dead code in math.cKevin Hao1-42/+0
The math.c is only built when CONFIG_MATH_EMULATION is enabled. So we would never get into the case that CONFIG_MATH_EMULATION is not defined in this file. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Enable detection of legacy UARTsBenjamin Herrenschmidt1-0/+1
Legacy UARTs can exist on PowerNV, memory-mapped ones on PCI or IO based ones on the LPC bus. Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Don't crash if there are no OPAL consolesBenjamin Herrenschmidt1-7/+9
Some machines might provide the console via a different mechanism such as direct access to a UART from Linux, in which case OPAL might not expose any console. In that case, the code would cause a NULL dereference. Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Check "status" property before adding legacy ISA serial portsBenjamin Herrenschmidt1-3/+5
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Cleanup udbg_16550 and add support for LPC PIO-only UARTsBenjamin Herrenschmidt3-193/+206
The udbg_16550 code, which we use for our early consoles and debug backends was fairly messy. Especially for the debug consoles, it would re-implement the "high level" getc/putc/poll functions for each access method. It also had code to configure the UART but only for the straight MMIO method. This changes it to instead abstract at the register accessor level, and have the various functions and configuration routines use these. The result is simpler and slightly smaller code, and free support for non-MMIO mapped PIO UARTs, which such as the ones that can be present on a POWER 8 LPC bus. Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Add PIO accessors for Power8 LPC busBenjamin Herrenschmidt8-1/+226
This uses the hooks provided by CONFIG_PPC_INDIRECT_PIO to implement a set of hooks for IO port access to use the LPC bus via OPAL calls for the first 64K of IO space Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Add helper to get ibm,chip-id of a nodeBenjamin Herrenschmidt2-0/+28
This includes walking the parent nodes if necessary. Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Update opal.h to add new LPC and XSCOM functionsBenjamin Herrenschmidt2-0/+27
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Better split CONFIG_PPC_INDIRECT_PIO and CONFIG_PPC_INDIRECT_MMIOBenjamin Herrenschmidt5-21/+37
Remove the generic PPC_INDIRECT_IO and ensure we only add overhead to the right accessors. IE. If only CONFIG_PPC_INDIRECT_PIO is set, we don't add overhead to all MMIO accessors. Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/ppc64: Rename SOFT_DISABLE_INTS with RECONCILE_IRQ_STATETiejun Chen4-8/+9
The SOFT_DISABLE_INTS seems an odd name for something that updates the software state to be consistent with interrupts being hard disabled, so rename SOFT_DISABLE_INTS with RECONCILE_IRQ_STATE to avoid this confusion. Signed-off-by: Tiejun Chen <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/pmac: Early debug output on screen on 64-bit macsBenjamin Herrenschmidt6-117/+202
We have a bunch of CONFIG_PPC_EARLY_DEBUG_* options that are intended for bringup/debug only. They hard wire a machine specific udbg backend very early on (before we even probe the platform), and use whatever tricks are available on each machine/cpu to be able to get some kind of output out there early on. So far, on powermac with no serial ports, we have CONFIG_PPC_EARLY_DEBUG_BOOTX to use the low-level btext engine on the screen, but it doesn't do much, at least on 64-bit. It only really gets enabled after the platform has been probed and the MMU enabled. This adds a way to enable it much earlier. From prom_init.c (while still running with Open Firmware), we grab the screen details and set things up using the physical address of the frame buffer. Then btext itself uses the "rm_ci" feature of the 970 processor (Real Mode Cache Inhibited) to access it while in real mode. We need to do a little bit of reorg of the btext code to inline things better, in order to limit how much we touch memory while in this mode as the consequences might be ... interesting. This successfully allowed me to debug problems early on with the G5 (related to gold being broken vs. ppc64 kernels). Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/pci: Remove duplicate check in pcibios_fixup_bus()Gavin Shan1-2/+1
pci_read_bridge_bases() already checks if the PCI bus is root bus or not, so we needn't do same check in pcibios_fixup_bus() and just remove it. Signed-off-by: Gavin Shan <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Needn't IO segment map for PHB3Gavin Shan1-6/+7
PHB3 doesn't support IO ports and we needn't IO segment map for that. Signed-off-by: Gavin Shan <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Check primary PHB through IDGavin Shan1-3/+1
The index of one specific PCI controller (struct pci_controller:: global_number) can tell that it's primary one or not. So we needn't additional variable for that and just remove it. Signed-off-by: Gavin Shan <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Fetch PHB bus range from dev-treeGavin Shan1-3/+10
The patch enables fetching bus range from device-tree for the specific PHB. If we can't get that from device-tree, the default range [0 255] will be used. Signed-off-by: Gavin Shan <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc/powernv: Free PHB instance upon errorGavin Shan1-6/+11
We don't free PHB instance (struct pnv_phb) on error to creating the associated PCI controler (struct pci_controller). The patch fixes that. Also, the output messages have been cleaned for a bit so that they looks unified for IODA_1/2 cases. Signed-off-by: Gavin Shan <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Fix VRSAVE handlingPaul Mackerras3-2/+19
Since 2002, the kernel has not saved VRSAVE on exception entry and restored it on exit; rather, VRSAVE gets context-switched in _switch. This means that when executing in process context in the kernel, the userspace VRSAVE value is live in the VRSAVE register. However, the signal code assumes that current->thread.vrsave holds the current VRSAVE value, which is incorrect. Therefore, this commit changes it to use the actual VRSAVE register instead. (It still uses current->thread.vrsave as a temporary location to store it in, as __get_user and __put_user can only transfer to/from a variable, not an SPR.) This also modifies the transactional memory code to save and restore VRSAVE regardless of whether VMX is enabled in the MSR. This is because accesses to VRSAVE are not controlled by the MSR.VEC bit, but can happen at any time. Signed-off-by: Paul Mackerras <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Implement __get_user_pages_fast()Paul Mackerras1-16/+21
Other architectures have a __get_user_pages_fast(), in addition to the regular get_user_pages_fast(), which doesn't call get_user_pages() on failure, and thus doesn't attempt to fault pages in or COW them. The generic KVM code uses __get_user_pages_fast() to detect whether a page for which we have only requested read access is actually writable. This provides an implementation of __get_user_pages_fast() by splitting the existing get_user_pages_fast() in two. With this, the generic KVM code will get the right answer instead of always considering such pages non-writable. Signed-off-by: Paul Mackerras <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Convert platforms to smp_generic_cpu_bootableAndy Fleming5-49/+4
T4, Cell, powernv, and pseries had the same implementation, so switch them to use a generic version. A2 apparently had a version, but removed it at some point, so we remove the declaration, too. Signed-off-by: Andy Fleming <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Add smp_generic_cpu_bootableAndy Fleming2-0/+24
Cell and PSeries both implemented their own versions of a cpu_bootable smp_op which do the same thing (well, the PSeries one has support for more than 2 threads). Copy the PSeries one to generic code, and rename it smp_generic_cpu_bootable. Signed-off-by: Andy Fleming <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Remove the symbol __flush_icache_rangeKevin Hao4-9/+3
And now the function flush_icache_range() is just a wrapper which only invoke the function __flush_icache_range() directly. So we don't have reason to keep it anymore. Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Move the testing of CPU_FTR_COHERENT_ICACHE into __flush_icache_rangeKevin Hao3-3/+5
In function flush_icache_range(), we use cpu_has_feature() to test the feature bit of CPU_FTR_COHERENT_ICACHE. But this seems not optimal for two reasons: a) For ppc32, the function __flush_icache_range() already do this check with the macro END_FTR_SECTION_IFSET. b) Compare with the cpu_has_feature(), the method of using macro END_FTR_SECTION_IFSET will not introduce any runtime overhead. [And while at it, add the missing required isync] -- BenH Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
2013-08-14powerpc: Stop using non-architected shared_proc field in lppacaAnton Blanchard7-12/+23
Although the shared_proc field in the lppaca works today, it is not architected. A shared processor partition will always have a non zero yield_count so use that instead. Create a wrapper so users don't have to know about the details. In order for older kernels to continue to work on KVM we need to set the shared_proc bit. While here, remove the ugly bitfield. Signed-off-by: Anton Blanchard <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>