aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-03 19:41:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-03 19:41:38 -0400
commitff474e8ca8547d09cb82ebab56d4c96f9eea01ce (patch)
treec004122f04a405eddb7929cd0297ccdce016f1b8 /arch/powerpc/kernel
parent4c92b5bb14226faa16d29a1df5752baf1ff22b53 (diff)
parent390fd5929f52bdfb9dfcc03820041ba556780f4a (diff)
Merge tag 'powerpc-4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman: - support "hybrid" iommu/direct DMA ops for coherent_mask < dma_mask from Benjamin Herrenschmidt - EEH fixes for SRIOV from Gavin - introduce rtas_get_sensor_fast() for IRQ handlers from Thomas Huth - use hardware RNG for arch_get_random_seed_* not arch_get_random_* from Paul Mackerras - seccomp filter support from Michael Ellerman - opal_cec_reboot2() handling for HMIs & machine checks from Mahesh Salgaonkar - add powerpc timebase as a trace clock source from Naveen N. Rao - misc cleanups in the xmon, signal & SLB code from Anshuman Khandual - add an inline function to update POWER8 HID0 from Gautham R. Shenoy - fix pte_pagesize_index() crash on 4K w/64K hash from Michael Ellerman - drop support for 64K local store on 4K kernels from Michael Ellerman - move dma_get_required_mask() from pnv_phb to pci_controller_ops from Andrew Donnellan - initialize distance lookup table from drconf path from Nikunj A Dadhania - enable RTC class support from Vaibhav Jain - disable automatically blocked PCI config from Gavin Shan - add LEDs driver for PowerNV platform from Vasant Hegde - fix endianness issues in the HVSI driver from Laurent Dufour - kexec endian fixes from Samuel Mendoza-Jonas - fix corrupted pdn list from Gavin Shan - fix fenced PHB caused by eeh_slot_error_detail() from Gavin Shan - Freescale updates from Scott: Highlights include 32-bit memcpy/memset optimizations, checksum optimizations, 85xx config fragments and updates, device tree updates, e6500 fixes for non-SMP, and misc cleanup and minor fixes. - a ton of cxl updates & fixes: - add explicit precision specifiers from Rasmus Villemoes - use more common format specifier from Rasmus Villemoes - destroy cxl_adapter_idr on module_exit from Johannes Thumshirn - destroy afu->contexts_idr on release of an afu from Johannes Thumshirn - compile with -Werror from Daniel Axtens - EEH support from Daniel Axtens - plug irq_bitmap getting leaked in cxl_context from Vaibhav Jain - add alternate MMIO error handling from Ian Munsie - allow release of contexts which have been OPENED but not STARTED from Andrew Donnellan - remove use of macro DEFINE_PCI_DEVICE_TABLE from Vaishali Thakkar - release irqs if memory allocation fails from Vaibhav Jain - remove racy attempt to force EEH invocation in reset from Daniel Axtens - fix + cleanup error paths in cxl_dev_context_init from Ian Munsie - fix force unmapping mmaps of contexts allocated through the kernel api from Ian Munsie - set up and enable PSL Timebase from Philippe Bergheaud * tag 'powerpc-4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (140 commits) cxl: Set up and enable PSL Timebase cxl: Fix force unmapping mmaps of contexts allocated through the kernel api cxl: Fix + cleanup error paths in cxl_dev_context_init powerpc/eeh: Fix fenced PHB caused by eeh_slot_error_detail() powerpc/pseries: Cleanup on pci_dn_reconfig_notifier() powerpc/pseries: Fix corrupted pdn list powerpc/powernv: Enable LEDS support powerpc/iommu: Set default DMA offset in dma_dev_setup cxl: Remove racy attempt to force EEH invocation in reset cxl: Release irqs if memory allocation fails cxl: Remove use of macro DEFINE_PCI_DEVICE_TABLE powerpc/powernv: Fix mis-merge of OPAL support for LEDS driver powerpc/powernv: Reset HILE before kexec_sequence() powerpc/kexec: Reset secondary cpu endianness before kexec powerpc/hvsi: Fix endianness issues in the HVSI driver leds/powernv: Add driver for PowerNV platform powerpc/powernv: Create LED platform device powerpc/powernv: Add OPAL interfaces for accessing and modifying system LED states powerpc/powernv: Fix the log message when disabling VF cxl: Allow release of contexts which have been OPENED but not STARTED ...
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/dma-iommu.c2
-rw-r--r--arch/powerpc/kernel/dma-swiotlb.c4
-rw-r--r--arch/powerpc/kernel/dma.c118
-rw-r--r--arch/powerpc/kernel/eeh.c31
-rw-r--r--arch/powerpc/kernel/eeh_pe.c22
-rw-r--r--arch/powerpc/kernel/entry_32.S7
-rw-r--r--arch/powerpc/kernel/entry_64.S28
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S13
-rw-r--r--arch/powerpc/kernel/fsl_booke_entry_mapping.S15
-rw-r--r--arch/powerpc/kernel/kvm.c1
-rw-r--r--arch/powerpc/kernel/misc_64.S13
-rw-r--r--arch/powerpc/kernel/nvram_64.c10
-rw-r--r--arch/powerpc/kernel/pci-common.c72
-rw-r--r--arch/powerpc/kernel/process.c14
-rw-r--r--arch/powerpc/kernel/prom.c25
-rw-r--r--arch/powerpc/kernel/prom_init.c25
-rw-r--r--arch/powerpc/kernel/ptrace.c89
-rw-r--r--arch/powerpc/kernel/rtas.c25
-rw-r--r--arch/powerpc/kernel/signal_32.c5
-rw-r--r--arch/powerpc/kernel/signal_64.c21
-rw-r--r--arch/powerpc/kernel/trace_clock.c15
23 files changed, 396 insertions, 161 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 12868b1c4e05..ba336930d448 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -118,6 +118,7 @@ obj-$(CONFIG_PPC_IO_WORKAROUNDS) += io-workarounds.o
118obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 118obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
119obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 119obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
120obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o 120obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
121obj-$(CONFIG_TRACING) += trace_clock.o
121 122
122ifneq ($(CONFIG_PPC_INDIRECT_PIO),y) 123ifneq ($(CONFIG_PPC_INDIRECT_PIO),y)
123obj-y += iomap.o 124obj-y += iomap.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 98230579d99c..810f433731dc 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -213,7 +213,6 @@ int main(void)
213 offsetof(struct tlb_core_data, esel_max)); 213 offsetof(struct tlb_core_data, esel_max));
214 DEFINE(TCD_ESEL_FIRST, 214 DEFINE(TCD_ESEL_FIRST,
215 offsetof(struct tlb_core_data, esel_first)); 215 offsetof(struct tlb_core_data, esel_first));
216 DEFINE(TCD_LOCK, offsetof(struct tlb_core_data, lock));
217#endif /* CONFIG_PPC_BOOK3E */ 216#endif /* CONFIG_PPC_BOOK3E */
218 217
219#ifdef CONFIG_PPC_STD_MMU_64 218#ifdef CONFIG_PPC_STD_MMU_64
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 4c68bfe4108a..41a7d9d49a5a 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -73,7 +73,7 @@ static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
73} 73}
74 74
75/* We support DMA to/from any memory page via the iommu */ 75/* We support DMA to/from any memory page via the iommu */
76static int dma_iommu_dma_supported(struct device *dev, u64 mask) 76int dma_iommu_dma_supported(struct device *dev, u64 mask)
77{ 77{
78 struct iommu_table *tbl = get_iommu_table_base(dev); 78 struct iommu_table *tbl = get_iommu_table_base(dev);
79 79
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index 6e8d764ce47b..c6689f658b50 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -47,8 +47,8 @@ static u64 swiotlb_powerpc_get_required(struct device *dev)
47 * for everything else. 47 * for everything else.
48 */ 48 */
49struct dma_map_ops swiotlb_dma_ops = { 49struct dma_map_ops swiotlb_dma_ops = {
50 .alloc = dma_direct_alloc_coherent, 50 .alloc = __dma_direct_alloc_coherent,
51 .free = dma_direct_free_coherent, 51 .free = __dma_direct_free_coherent,
52 .mmap = dma_direct_mmap_coherent, 52 .mmap = dma_direct_mmap_coherent,
53 .map_sg = swiotlb_map_sg_attrs, 53 .map_sg = swiotlb_map_sg_attrs,
54 .unmap_sg = swiotlb_unmap_sg_attrs, 54 .unmap_sg = swiotlb_unmap_sg_attrs,
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 35e4dcc5dce3..59503ed98e5f 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -16,6 +16,7 @@
16#include <asm/bug.h> 16#include <asm/bug.h>
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/swiotlb.h> 18#include <asm/swiotlb.h>
19#include <asm/iommu.h>
19 20
20/* 21/*
21 * Generic direct DMA implementation 22 * Generic direct DMA implementation
@@ -39,9 +40,31 @@ static u64 __maybe_unused get_pfn_limit(struct device *dev)
39 return pfn; 40 return pfn;
40} 41}
41 42
42void *dma_direct_alloc_coherent(struct device *dev, size_t size, 43static int dma_direct_dma_supported(struct device *dev, u64 mask)
43 dma_addr_t *dma_handle, gfp_t flag, 44{
44 struct dma_attrs *attrs) 45#ifdef CONFIG_PPC64
46 u64 limit = get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
47
48 /* Limit fits in the mask, we are good */
49 if (mask >= limit)
50 return 1;
51
52#ifdef CONFIG_FSL_SOC
53 /* Freescale gets another chance via ZONE_DMA/ZONE_DMA32, however
54 * that will have to be refined if/when they support iommus
55 */
56 return 1;
57#endif
58 /* Sorry ... */
59 return 0;
60#else
61 return 1;
62#endif
63}
64
65void *__dma_direct_alloc_coherent(struct device *dev, size_t size,
66 dma_addr_t *dma_handle, gfp_t flag,
67 struct dma_attrs *attrs)
45{ 68{
46 void *ret; 69 void *ret;
47#ifdef CONFIG_NOT_COHERENT_CACHE 70#ifdef CONFIG_NOT_COHERENT_CACHE
@@ -96,9 +119,9 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
96#endif 119#endif
97} 120}
98 121
99void dma_direct_free_coherent(struct device *dev, size_t size, 122void __dma_direct_free_coherent(struct device *dev, size_t size,
100 void *vaddr, dma_addr_t dma_handle, 123 void *vaddr, dma_addr_t dma_handle,
101 struct dma_attrs *attrs) 124 struct dma_attrs *attrs)
102{ 125{
103#ifdef CONFIG_NOT_COHERENT_CACHE 126#ifdef CONFIG_NOT_COHERENT_CACHE
104 __dma_free_coherent(size, vaddr); 127 __dma_free_coherent(size, vaddr);
@@ -107,6 +130,51 @@ void dma_direct_free_coherent(struct device *dev, size_t size,
107#endif 130#endif
108} 131}
109 132
133static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
134 dma_addr_t *dma_handle, gfp_t flag,
135 struct dma_attrs *attrs)
136{
137 struct iommu_table *iommu;
138
139 /* The coherent mask may be smaller than the real mask, check if
140 * we can really use the direct ops
141 */
142 if (dma_direct_dma_supported(dev, dev->coherent_dma_mask))
143 return __dma_direct_alloc_coherent(dev, size, dma_handle,
144 flag, attrs);
145
146 /* Ok we can't ... do we have an iommu ? If not, fail */
147 iommu = get_iommu_table_base(dev);
148 if (!iommu)
149 return NULL;
150
151 /* Try to use the iommu */
152 return iommu_alloc_coherent(dev, iommu, size, dma_handle,
153 dev->coherent_dma_mask, flag,
154 dev_to_node(dev));
155}
156
157static void dma_direct_free_coherent(struct device *dev, size_t size,
158 void *vaddr, dma_addr_t dma_handle,
159 struct dma_attrs *attrs)
160{
161 struct iommu_table *iommu;
162
163 /* See comments in dma_direct_alloc_coherent() */
164 if (dma_direct_dma_supported(dev, dev->coherent_dma_mask))
165 return __dma_direct_free_coherent(dev, size, vaddr, dma_handle,
166 attrs);
167 /* Maybe we used an iommu ... */
168 iommu = get_iommu_table_base(dev);
169
170 /* If we hit that we should have never allocated in the first
171 * place so how come we are freeing ?
172 */
173 if (WARN_ON(!iommu))
174 return;
175 iommu_free_coherent(iommu, size, vaddr, dma_handle);
176}
177
110int dma_direct_mmap_coherent(struct device *dev, struct vm_area_struct *vma, 178int dma_direct_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
111 void *cpu_addr, dma_addr_t handle, size_t size, 179 void *cpu_addr, dma_addr_t handle, size_t size,
112 struct dma_attrs *attrs) 180 struct dma_attrs *attrs)
@@ -147,18 +215,6 @@ static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
147{ 215{
148} 216}
149 217
150static int dma_direct_dma_supported(struct device *dev, u64 mask)
151{
152#ifdef CONFIG_PPC64
153 /* Could be improved so platforms can set the limit in case
154 * they have limited DMA windows
155 */
156 return mask >= get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
157#else
158 return 1;
159#endif
160}
161
162static u64 dma_direct_get_required_mask(struct device *dev) 218static u64 dma_direct_get_required_mask(struct device *dev)
163{ 219{
164 u64 end, mask; 220 u64 end, mask;
@@ -230,6 +286,25 @@ struct dma_map_ops dma_direct_ops = {
230}; 286};
231EXPORT_SYMBOL(dma_direct_ops); 287EXPORT_SYMBOL(dma_direct_ops);
232 288
289int dma_set_coherent_mask(struct device *dev, u64 mask)
290{
291 if (!dma_supported(dev, mask)) {
292 /*
293 * We need to special case the direct DMA ops which can
294 * support a fallback for coherent allocations. There
295 * is no dma_op->set_coherent_mask() so we have to do
296 * things the hard way:
297 */
298 if (get_dma_ops(dev) != &dma_direct_ops ||
299 get_iommu_table_base(dev) == NULL ||
300 !dma_iommu_dma_supported(dev, mask))
301 return -EIO;
302 }
303 dev->coherent_dma_mask = mask;
304 return 0;
305}
306EXPORT_SYMBOL_GPL(dma_set_coherent_mask);
307
233#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) 308#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
234 309
235int __dma_set_mask(struct device *dev, u64 dma_mask) 310int __dma_set_mask(struct device *dev, u64 dma_mask)
@@ -278,6 +353,13 @@ u64 dma_get_required_mask(struct device *dev)
278 if (ppc_md.dma_get_required_mask) 353 if (ppc_md.dma_get_required_mask)
279 return ppc_md.dma_get_required_mask(dev); 354 return ppc_md.dma_get_required_mask(dev);
280 355
356 if (dev_is_pci(dev)) {
357 struct pci_dev *pdev = to_pci_dev(dev);
358 struct pci_controller *phb = pci_bus_to_host(pdev->bus);
359 if (phb->controller_ops.dma_get_required_mask)
360 return phb->controller_ops.dma_get_required_mask(pdev);
361 }
362
281 return __dma_get_required_mask(dev); 363 return __dma_get_required_mask(dev);
282} 364}
283EXPORT_SYMBOL_GPL(dma_get_required_mask); 365EXPORT_SYMBOL_GPL(dma_get_required_mask);
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index af9b597b10af..e968533e3e05 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -308,11 +308,26 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
308 if (!(pe->type & EEH_PE_PHB)) { 308 if (!(pe->type & EEH_PE_PHB)) {
309 if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG)) 309 if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG))
310 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); 310 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
311
312 /*
313 * The config space of some PCI devices can't be accessed
314 * when their PEs are in frozen state. Otherwise, fenced
315 * PHB might be seen. Those PEs are identified with flag
316 * EEH_PE_CFG_RESTRICTED, indicating EEH_PE_CFG_BLOCKED
317 * is set automatically when the PE is put to EEH_PE_ISOLATED.
318 *
319 * Restoring BARs possibly triggers PCI config access in
320 * (OPAL) firmware and then causes fenced PHB. If the
321 * PCI config is blocked with flag EEH_PE_CFG_BLOCKED, it's
322 * pointless to restore BARs and dump config space.
323 */
311 eeh_ops->configure_bridge(pe); 324 eeh_ops->configure_bridge(pe);
312 eeh_pe_restore_bars(pe); 325 if (!(pe->state & EEH_PE_CFG_BLOCKED)) {
326 eeh_pe_restore_bars(pe);
313 327
314 pci_regs_buf[0] = 0; 328 pci_regs_buf[0] = 0;
315 eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen); 329 eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen);
330 }
316 } 331 }
317 332
318 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen); 333 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen);
@@ -750,14 +765,14 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
750 eeh_pe_state_clear(pe, EEH_PE_ISOLATED); 765 eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
751 break; 766 break;
752 case pcie_hot_reset: 767 case pcie_hot_reset:
753 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 768 eeh_pe_state_mark_with_cfg(pe, EEH_PE_ISOLATED);
754 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); 769 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE);
755 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev); 770 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev);
756 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED); 771 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED);
757 eeh_ops->reset(pe, EEH_RESET_HOT); 772 eeh_ops->reset(pe, EEH_RESET_HOT);
758 break; 773 break;
759 case pcie_warm_reset: 774 case pcie_warm_reset:
760 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 775 eeh_pe_state_mark_with_cfg(pe, EEH_PE_ISOLATED);
761 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); 776 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE);
762 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev); 777 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev);
763 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED); 778 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED);
@@ -1116,9 +1131,6 @@ void eeh_add_device_late(struct pci_dev *dev)
1116 return; 1131 return;
1117 } 1132 }
1118 1133
1119 if (eeh_has_flag(EEH_PROBE_MODE_DEV))
1120 eeh_ops->probe(pdn, NULL);
1121
1122 /* 1134 /*
1123 * The EEH cache might not be removed correctly because of 1135 * The EEH cache might not be removed correctly because of
1124 * unbalanced kref to the device during unplug time, which 1136 * unbalanced kref to the device during unplug time, which
@@ -1142,6 +1154,9 @@ void eeh_add_device_late(struct pci_dev *dev)
1142 dev->dev.archdata.edev = NULL; 1154 dev->dev.archdata.edev = NULL;
1143 } 1155 }
1144 1156
1157 if (eeh_has_flag(EEH_PROBE_MODE_DEV))
1158 eeh_ops->probe(pdn, NULL);
1159
1145 edev->pdev = dev; 1160 edev->pdev = dev;
1146 dev->dev.archdata.edev = edev; 1161 dev->dev.archdata.edev = edev;
1147 1162
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index 35f0b62259bb..8654cb166c19 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -657,6 +657,28 @@ void eeh_pe_state_clear(struct eeh_pe *pe, int state)
657 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state); 657 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state);
658} 658}
659 659
660/**
661 * eeh_pe_state_mark_with_cfg - Mark PE state with unblocked config space
662 * @pe: PE
663 * @state: PE state to be set
664 *
665 * Set specified flag to PE and its child PEs. The PCI config space
666 * of some PEs is blocked automatically when EEH_PE_ISOLATED is set,
667 * which isn't needed in some situations. The function allows to set
668 * the specified flag to indicated PEs without blocking their PCI
669 * config space.
670 */
671void eeh_pe_state_mark_with_cfg(struct eeh_pe *pe, int state)
672{
673 eeh_pe_traverse(pe, __eeh_pe_state_mark, &state);
674 if (!(state & EEH_PE_ISOLATED))
675 return;
676
677 /* Clear EEH_PE_CFG_BLOCKED, which might be set just now */
678 state = EEH_PE_CFG_BLOCKED;
679 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state);
680}
681
660/* 682/*
661 * Some PCI bridges (e.g. PLX bridges) have primary/secondary 683 * Some PCI bridges (e.g. PLX bridges) have primary/secondary
662 * buses assigned explicitly by firmware, and we probably have 684 * buses assigned explicitly by firmware, and we probably have
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 46fc0f4d8982..2405631e91a2 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/err.h>
23#include <linux/sys.h> 24#include <linux/sys.h>
24#include <linux/threads.h> 25#include <linux/threads.h>
25#include <asm/reg.h> 26#include <asm/reg.h>
@@ -354,7 +355,7 @@ ret_from_syscall:
354 SYNC 355 SYNC
355 MTMSRD(r10) 356 MTMSRD(r10)
356 lwz r9,TI_FLAGS(r12) 357 lwz r9,TI_FLAGS(r12)
357 li r8,-_LAST_ERRNO 358 li r8,-MAX_ERRNO
358 andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) 359 andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
359 bne- syscall_exit_work 360 bne- syscall_exit_work
360 cmplw 0,r3,r8 361 cmplw 0,r3,r8
@@ -457,6 +458,10 @@ syscall_dotrace:
457 lwz r7,GPR7(r1) 458 lwz r7,GPR7(r1)
458 lwz r8,GPR8(r1) 459 lwz r8,GPR8(r1)
459 REST_NVGPRS(r1) 460 REST_NVGPRS(r1)
461
462 cmplwi r0,NR_syscalls
463 /* Return code is already in r3 thanks to do_syscall_trace_enter() */
464 bge- ret_from_syscall
460 b syscall_dotrace_cont 465 b syscall_dotrace_cont
461 466
462syscall_exit_work: 467syscall_exit_work:
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 579e0f9a2d57..a94f155db78e 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/err.h>
22#include <asm/unistd.h> 23#include <asm/unistd.h>
23#include <asm/processor.h> 24#include <asm/processor.h>
24#include <asm/page.h> 25#include <asm/page.h>
@@ -150,8 +151,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
150 CURRENT_THREAD_INFO(r11, r1) 151 CURRENT_THREAD_INFO(r11, r1)
151 ld r10,TI_FLAGS(r11) 152 ld r10,TI_FLAGS(r11)
152 andi. r11,r10,_TIF_SYSCALL_DOTRACE 153 andi. r11,r10,_TIF_SYSCALL_DOTRACE
153 bne syscall_dotrace 154 bne syscall_dotrace /* does not return */
154.Lsyscall_dotrace_cont:
155 cmpldi 0,r0,NR_syscalls 155 cmpldi 0,r0,NR_syscalls
156 bge- syscall_enosys 156 bge- syscall_enosys
157 157
@@ -207,7 +207,7 @@ system_call: /* label this so stack traces look sane */
207#endif /* CONFIG_PPC_BOOK3E */ 207#endif /* CONFIG_PPC_BOOK3E */
208 208
209 ld r9,TI_FLAGS(r12) 209 ld r9,TI_FLAGS(r12)
210 li r11,-_LAST_ERRNO 210 li r11,-MAX_ERRNO
211 andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) 211 andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
212 bne- syscall_exit_work 212 bne- syscall_exit_work
213 cmpld r3,r11 213 cmpld r3,r11
@@ -245,22 +245,34 @@ syscall_dotrace:
245 bl save_nvgprs 245 bl save_nvgprs
246 addi r3,r1,STACK_FRAME_OVERHEAD 246 addi r3,r1,STACK_FRAME_OVERHEAD
247 bl do_syscall_trace_enter 247 bl do_syscall_trace_enter
248
248 /* 249 /*
249 * Restore argument registers possibly just changed. 250 * We use the return value of do_syscall_trace_enter() as the syscall
250 * We use the return value of do_syscall_trace_enter 251 * number. If the syscall was rejected for any reason do_syscall_trace_enter()
251 * for the call number to look up in the table (r0). 252 * returns an invalid syscall number and the test below against
253 * NR_syscalls will fail.
252 */ 254 */
253 mr r0,r3 255 mr r0,r3
256
257 /* Restore argument registers just clobbered and/or possibly changed. */
254 ld r3,GPR3(r1) 258 ld r3,GPR3(r1)
255 ld r4,GPR4(r1) 259 ld r4,GPR4(r1)
256 ld r5,GPR5(r1) 260 ld r5,GPR5(r1)
257 ld r6,GPR6(r1) 261 ld r6,GPR6(r1)
258 ld r7,GPR7(r1) 262 ld r7,GPR7(r1)
259 ld r8,GPR8(r1) 263 ld r8,GPR8(r1)
264
265 /* Repopulate r9 and r10 for the system_call path */
260 addi r9,r1,STACK_FRAME_OVERHEAD 266 addi r9,r1,STACK_FRAME_OVERHEAD
261 CURRENT_THREAD_INFO(r10, r1) 267 CURRENT_THREAD_INFO(r10, r1)
262 ld r10,TI_FLAGS(r10) 268 ld r10,TI_FLAGS(r10)
263 b .Lsyscall_dotrace_cont 269
270 cmpldi r0,NR_syscalls
271 blt+ system_call
272
273 /* Return code is already in r3 thanks to do_syscall_trace_enter() */
274 b .Lsyscall_exit
275
264 276
265syscall_enosys: 277syscall_enosys:
266 li r3,-ENOSYS 278 li r3,-ENOSYS
@@ -277,7 +289,7 @@ syscall_exit_work:
277 beq+ 0f 289 beq+ 0f
278 REST_NVGPRS(r1) 290 REST_NVGPRS(r1)
279 b 2f 291 b 2f
2800: cmpld r3,r11 /* r10 is -LAST_ERRNO */ 2920: cmpld r3,r11 /* r11 is -MAX_ERRNO */
281 blt+ 1f 293 blt+ 1f
282 andi. r0,r9,_TIF_NOERROR 294 andi. r0,r9,_TIF_NOERROR
283 bne- 1f 295 bne- 1f
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 3e68d1c69718..f3bd5e747ed8 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -1313,11 +1313,14 @@ skpinv: addi r6,r6,1 /* Increment */
1313 sync 1313 sync
1314 isync 1314 isync
1315 1315
1316/* The mapping only needs to be cache-coherent on SMP */ 1316/*
1317#ifdef CONFIG_SMP 1317 * The mapping only needs to be cache-coherent on SMP, except on
1318#define M_IF_SMP MAS2_M 1318 * Freescale e500mc derivatives where it's also needed for coherent DMA.
1319 */
1320#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
1321#define M_IF_NEEDED MAS2_M
1319#else 1322#else
1320#define M_IF_SMP 0 1323#define M_IF_NEEDED 0
1321#endif 1324#endif
1322 1325
1323/* 6. Setup KERNELBASE mapping in TLB[0] 1326/* 6. Setup KERNELBASE mapping in TLB[0]
@@ -1332,7 +1335,7 @@ skpinv: addi r6,r6,1 /* Increment */
1332 ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_1GB))@l 1335 ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_1GB))@l
1333 mtspr SPRN_MAS1,r6 1336 mtspr SPRN_MAS1,r6
1334 1337
1335 LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET | M_IF_SMP) 1338 LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET | M_IF_NEEDED)
1336 mtspr SPRN_MAS2,r6 1339 mtspr SPRN_MAS2,r6
1337 1340
1338 rlwinm r5,r5,0,0,25 1341 rlwinm r5,r5,0,0,25
diff --git a/arch/powerpc/kernel/fsl_booke_entry_mapping.S b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
index f22e7e44fbf3..83dd0f6776b3 100644
--- a/arch/powerpc/kernel/fsl_booke_entry_mapping.S
+++ b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
@@ -152,11 +152,14 @@ skpinv: addi r6,r6,1 /* Increment */
152 tlbivax 0,r9 152 tlbivax 0,r9
153 TLBSYNC 153 TLBSYNC
154 154
155/* The mapping only needs to be cache-coherent on SMP */ 155/*
156#ifdef CONFIG_SMP 156 * The mapping only needs to be cache-coherent on SMP, except on
157#define M_IF_SMP MAS2_M 157 * Freescale e500mc derivatives where it's also needed for coherent DMA.
158 */
159#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
160#define M_IF_NEEDED MAS2_M
158#else 161#else
159#define M_IF_SMP 0 162#define M_IF_NEEDED 0
160#endif 163#endif
161 164
162#if defined(ENTRY_MAPPING_BOOT_SETUP) 165#if defined(ENTRY_MAPPING_BOOT_SETUP)
@@ -167,8 +170,8 @@ skpinv: addi r6,r6,1 /* Increment */
167 lis r6,(MAS1_VALID|MAS1_IPROT)@h 170 lis r6,(MAS1_VALID|MAS1_IPROT)@h
168 ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_64M))@l 171 ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_64M))@l
169 mtspr SPRN_MAS1,r6 172 mtspr SPRN_MAS1,r6
170 lis r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_SMP)@h 173 lis r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_NEEDED)@h
171 ori r6,r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_SMP)@l 174 ori r6,r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_NEEDED)@l
172 mtspr SPRN_MAS2,r6 175 mtspr SPRN_MAS2,r6
173 mtspr SPRN_MAS3,r8 176 mtspr SPRN_MAS3,r8
174 tlbwe 177 tlbwe
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 33aa4ddf597d..9ad37f827a97 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -649,7 +649,6 @@ static void kvm_check_ins(u32 *inst, u32 features)
649 kvm_patch_ins_mtsrin(inst, inst_rt, inst_rb); 649 kvm_patch_ins_mtsrin(inst, inst_rt, inst_rb);
650 } 650 }
651 break; 651 break;
652 break;
653#endif 652#endif
654 } 653 }
655 654
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 4e314b90c75d..6e4168cf4698 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -475,9 +475,18 @@ _GLOBAL(kexec_wait)
475#ifdef CONFIG_KEXEC /* use no memory without kexec */ 475#ifdef CONFIG_KEXEC /* use no memory without kexec */
476 lwz r4,0(r5) 476 lwz r4,0(r5)
477 cmpwi 0,r4,0 477 cmpwi 0,r4,0
478 bnea 0x60 478 beq 99b
479#ifdef CONFIG_PPC_BOOK3S_64
480 li r10,0x60
481 mfmsr r11
482 clrrdi r11,r11,1 /* Clear MSR_LE */
483 mtsrr0 r10
484 mtsrr1 r11
485 rfid
486#else
487 ba 0x60
488#endif
479#endif 489#endif
480 b 99b
481 490
482/* this can be in text because we won't change it until we are 491/* this can be in text because we won't change it until we are
483 * running in real anyways 492 * running in real anyways
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 1e703f8ebad4..98ba106a59ef 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -541,10 +541,9 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
541 time->tv_sec = be64_to_cpu(oops_hdr->timestamp); 541 time->tv_sec = be64_to_cpu(oops_hdr->timestamp);
542 time->tv_nsec = 0; 542 time->tv_nsec = 0;
543 } 543 }
544 *buf = kmalloc(length, GFP_KERNEL); 544 *buf = kmemdup(buff + hdr_size, length, GFP_KERNEL);
545 if (*buf == NULL) 545 if (*buf == NULL)
546 return -ENOMEM; 546 return -ENOMEM;
547 memcpy(*buf, buff + hdr_size, length);
548 kfree(buff); 547 kfree(buff);
549 548
550 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) 549 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ)
@@ -582,9 +581,10 @@ static int nvram_pstore_init(void)
582 spin_lock_init(&nvram_pstore_info.buf_lock); 581 spin_lock_init(&nvram_pstore_info.buf_lock);
583 582
584 rc = pstore_register(&nvram_pstore_info); 583 rc = pstore_register(&nvram_pstore_info);
585 if (rc != 0) 584 if (rc && (rc != -EPERM))
586 pr_err("nvram: pstore_register() failed, defaults to " 585 /* Print error only when pstore.backend == nvram */
587 "kmsg_dump; returned %d\n", rc); 586 pr_err("nvram: pstore_register() failed, returned %d. "
587 "Defaults to kmsg_dump\n", rc);
588 588
589 return rc; 589 return rc;
590} 590}
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 02c1d5dcee4d..a1d0632d97c6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -823,23 +823,15 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
823 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { 823 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
824 /* Only print message if not re-assigning */ 824 /* Only print message if not re-assigning */
825 if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) 825 if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC))
826 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] " 826 pr_debug("PCI:%s Resource %d %pR is unassigned\n",
827 "is unassigned\n", 827 pci_name(dev), i, res);
828 pci_name(dev), i,
829 (unsigned long long)res->start,
830 (unsigned long long)res->end,
831 (unsigned int)res->flags);
832 res->end -= res->start; 828 res->end -= res->start;
833 res->start = 0; 829 res->start = 0;
834 res->flags |= IORESOURCE_UNSET; 830 res->flags |= IORESOURCE_UNSET;
835 continue; 831 continue;
836 } 832 }
837 833
838 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]\n", 834 pr_debug("PCI:%s Resource %d %pR\n", pci_name(dev), i, res);
839 pci_name(dev), i,
840 (unsigned long long)res->start,\
841 (unsigned long long)res->end,
842 (unsigned int)res->flags);
843 } 835 }
844 836
845 /* Call machine specific resource fixup */ 837 /* Call machine specific resource fixup */
@@ -943,11 +935,7 @@ static void pcibios_fixup_bridge(struct pci_bus *bus)
943 continue; 935 continue;
944 } 936 }
945 937
946 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x]\n", 938 pr_debug("PCI:%s Bus rsrc %d %pR\n", pci_name(dev), i, res);
947 pci_name(dev), i,
948 (unsigned long long)res->start,\
949 (unsigned long long)res->end,
950 (unsigned int)res->flags);
951 939
952 /* Try to detect uninitialized P2P bridge resources, 940 /* Try to detect uninitialized P2P bridge resources,
953 * and clear them out so they get re-assigned later 941 * and clear them out so they get re-assigned later
@@ -1126,10 +1114,8 @@ static int reparent_resources(struct resource *parent,
1126 *pp = NULL; 1114 *pp = NULL;
1127 for (p = res->child; p != NULL; p = p->sibling) { 1115 for (p = res->child; p != NULL; p = p->sibling) {
1128 p->parent = res; 1116 p->parent = res;
1129 pr_debug("PCI: Reparented %s [%llx..%llx] under %s\n", 1117 pr_debug("PCI: Reparented %s %pR under %s\n",
1130 p->name, 1118 p->name, p, res->name);
1131 (unsigned long long)p->start,
1132 (unsigned long long)p->end, res->name);
1133 } 1119 }
1134 return 0; 1120 return 0;
1135} 1121}
@@ -1198,14 +1184,9 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1198 } 1184 }
1199 } 1185 }
1200 1186
1201 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx " 1187 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %pR, parent %p (%s)\n",
1202 "[0x%x], parent %p (%s)\n", 1188 bus->self ? pci_name(bus->self) : "PHB", bus->number,
1203 bus->self ? pci_name(bus->self) : "PHB", 1189 i, res, pr, (pr && pr->name) ? pr->name : "nil");
1204 bus->number, i,
1205 (unsigned long long)res->start,
1206 (unsigned long long)res->end,
1207 (unsigned int)res->flags,
1208 pr, (pr && pr->name) ? pr->name : "nil");
1209 1190
1210 if (pr && !(pr->flags & IORESOURCE_UNSET)) { 1191 if (pr && !(pr->flags & IORESOURCE_UNSET)) {
1211 struct pci_dev *dev = bus->self; 1192 struct pci_dev *dev = bus->self;
@@ -1247,11 +1228,8 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
1247{ 1228{
1248 struct resource *pr, *r = &dev->resource[idx]; 1229 struct resource *pr, *r = &dev->resource[idx];
1249 1230
1250 pr_debug("PCI: Allocating %s: Resource %d: %016llx..%016llx [%x]\n", 1231 pr_debug("PCI: Allocating %s: Resource %d: %pR\n",
1251 pci_name(dev), idx, 1232 pci_name(dev), idx, r);
1252 (unsigned long long)r->start,
1253 (unsigned long long)r->end,
1254 (unsigned int)r->flags);
1255 1233
1256 pr = pci_find_parent_resource(dev, r); 1234 pr = pci_find_parent_resource(dev, r);
1257 if (!pr || (pr->flags & IORESOURCE_UNSET) || 1235 if (!pr || (pr->flags & IORESOURCE_UNSET) ||
@@ -1259,11 +1237,7 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
1259 printk(KERN_WARNING "PCI: Cannot allocate resource region %d" 1237 printk(KERN_WARNING "PCI: Cannot allocate resource region %d"
1260 " of device %s, will remap\n", idx, pci_name(dev)); 1238 " of device %s, will remap\n", idx, pci_name(dev));
1261 if (pr) 1239 if (pr)
1262 pr_debug("PCI: parent is %p: %016llx-%016llx [%x]\n", 1240 pr_debug("PCI: parent is %p: %pR\n", pr, pr);
1263 pr,
1264 (unsigned long long)pr->start,
1265 (unsigned long long)pr->end,
1266 (unsigned int)pr->flags);
1267 /* We'll assign a new address later */ 1241 /* We'll assign a new address later */
1268 r->flags |= IORESOURCE_UNSET; 1242 r->flags |= IORESOURCE_UNSET;
1269 r->end -= r->start; 1243 r->end -= r->start;
@@ -1425,12 +1399,8 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
1425 if (r->parent || !r->start || !r->flags) 1399 if (r->parent || !r->start || !r->flags)
1426 continue; 1400 continue;
1427 1401
1428 pr_debug("PCI: Claiming %s: " 1402 pr_debug("PCI: Claiming %s: Resource %d: %pR\n",
1429 "Resource %d: %016llx..%016llx [%x]\n", 1403 pci_name(dev), i, r);
1430 pci_name(dev), i,
1431 (unsigned long long)r->start,
1432 (unsigned long long)r->end,
1433 (unsigned int)r->flags);
1434 1404
1435 if (pci_claim_resource(dev, i) == 0) 1405 if (pci_claim_resource(dev, i) == 0)
1436 continue; 1406 continue;
@@ -1514,11 +1484,8 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
1514 } else { 1484 } else {
1515 offset = pcibios_io_space_offset(hose); 1485 offset = pcibios_io_space_offset(hose);
1516 1486
1517 pr_debug("PCI: PHB IO resource = %08llx-%08llx [%lx] off 0x%08llx\n", 1487 pr_debug("PCI: PHB IO resource = %pR off 0x%08llx\n",
1518 (unsigned long long)res->start, 1488 res, (unsigned long long)offset);
1519 (unsigned long long)res->end,
1520 (unsigned long)res->flags,
1521 (unsigned long long)offset);
1522 pci_add_resource_offset(resources, res, offset); 1489 pci_add_resource_offset(resources, res, offset);
1523 } 1490 }
1524 1491
@@ -1535,11 +1502,8 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
1535 offset = hose->mem_offset[i]; 1502 offset = hose->mem_offset[i];
1536 1503
1537 1504
1538 pr_debug("PCI: PHB MEM resource %d = %08llx-%08llx [%lx] off 0x%08llx\n", i, 1505 pr_debug("PCI: PHB MEM resource %d = %pR off 0x%08llx\n", i,
1539 (unsigned long long)res->start, 1506 res, (unsigned long long)offset);
1540 (unsigned long long)res->end,
1541 (unsigned long)res->flags,
1542 (unsigned long long)offset);
1543 1507
1544 pci_add_resource_offset(resources, res, offset); 1508 pci_add_resource_offset(resources, res, offset);
1545 } 1509 }
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 64e6e9d9e656..75b6676c1a0b 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -86,7 +86,7 @@ void giveup_fpu_maybe_transactional(struct task_struct *tsk)
86 if (tsk == current && tsk->thread.regs && 86 if (tsk == current && tsk->thread.regs &&
87 MSR_TM_ACTIVE(tsk->thread.regs->msr) && 87 MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
88 !test_thread_flag(TIF_RESTORE_TM)) { 88 !test_thread_flag(TIF_RESTORE_TM)) {
89 tsk->thread.tm_orig_msr = tsk->thread.regs->msr; 89 tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr;
90 set_thread_flag(TIF_RESTORE_TM); 90 set_thread_flag(TIF_RESTORE_TM);
91 } 91 }
92 92
@@ -104,7 +104,7 @@ void giveup_altivec_maybe_transactional(struct task_struct *tsk)
104 if (tsk == current && tsk->thread.regs && 104 if (tsk == current && tsk->thread.regs &&
105 MSR_TM_ACTIVE(tsk->thread.regs->msr) && 105 MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
106 !test_thread_flag(TIF_RESTORE_TM)) { 106 !test_thread_flag(TIF_RESTORE_TM)) {
107 tsk->thread.tm_orig_msr = tsk->thread.regs->msr; 107 tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr;
108 set_thread_flag(TIF_RESTORE_TM); 108 set_thread_flag(TIF_RESTORE_TM);
109 } 109 }
110 110
@@ -540,7 +540,7 @@ static void tm_reclaim_thread(struct thread_struct *thr,
540 * the thread will no longer be transactional. 540 * the thread will no longer be transactional.
541 */ 541 */
542 if (test_ti_thread_flag(ti, TIF_RESTORE_TM)) { 542 if (test_ti_thread_flag(ti, TIF_RESTORE_TM)) {
543 msr_diff = thr->tm_orig_msr & ~thr->regs->msr; 543 msr_diff = thr->ckpt_regs.msr & ~thr->regs->msr;
544 if (msr_diff & MSR_FP) 544 if (msr_diff & MSR_FP)
545 memcpy(&thr->transact_fp, &thr->fp_state, 545 memcpy(&thr->transact_fp, &thr->fp_state,
546 sizeof(struct thread_fp_state)); 546 sizeof(struct thread_fp_state));
@@ -591,10 +591,10 @@ static inline void tm_reclaim_task(struct task_struct *tsk)
591 /* Stash the original thread MSR, as giveup_fpu et al will 591 /* Stash the original thread MSR, as giveup_fpu et al will
592 * modify it. We hold onto it to see whether the task used 592 * modify it. We hold onto it to see whether the task used
593 * FP & vector regs. If the TIF_RESTORE_TM flag is set, 593 * FP & vector regs. If the TIF_RESTORE_TM flag is set,
594 * tm_orig_msr is already set. 594 * ckpt_regs.msr is already set.
595 */ 595 */
596 if (!test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_TM)) 596 if (!test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_TM))
597 thr->tm_orig_msr = thr->regs->msr; 597 thr->ckpt_regs.msr = thr->regs->msr;
598 598
599 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, " 599 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, "
600 "ccr=%lx, msr=%lx, trap=%lx)\n", 600 "ccr=%lx, msr=%lx, trap=%lx)\n",
@@ -663,7 +663,7 @@ static inline void tm_recheckpoint_new_task(struct task_struct *new)
663 tm_restore_sprs(&new->thread); 663 tm_restore_sprs(&new->thread);
664 return; 664 return;
665 } 665 }
666 msr = new->thread.tm_orig_msr; 666 msr = new->thread.ckpt_regs.msr;
667 /* Recheckpoint to restore original checkpointed register state. */ 667 /* Recheckpoint to restore original checkpointed register state. */
668 TM_DEBUG("*** tm_recheckpoint of pid %d " 668 TM_DEBUG("*** tm_recheckpoint of pid %d "
669 "(new->msr 0x%lx, new->origmsr 0x%lx)\n", 669 "(new->msr 0x%lx, new->origmsr 0x%lx)\n",
@@ -723,7 +723,7 @@ void restore_tm_state(struct pt_regs *regs)
723 if (!MSR_TM_ACTIVE(regs->msr)) 723 if (!MSR_TM_ACTIVE(regs->msr))
724 return; 724 return;
725 725
726 msr_diff = current->thread.tm_orig_msr & ~regs->msr; 726 msr_diff = current->thread.ckpt_regs.msr & ~regs->msr;
727 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX; 727 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX;
728 if (msr_diff & MSR_FP) { 728 if (msr_diff & MSR_FP) {
729 fp_enable(); 729 fp_enable();
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 8b888b12a475..bef76c5033e4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -218,22 +218,18 @@ static void __init check_cpu_pa_features(unsigned long node)
218} 218}
219 219
220#ifdef CONFIG_PPC_STD_MMU_64 220#ifdef CONFIG_PPC_STD_MMU_64
221static void __init check_cpu_slb_size(unsigned long node) 221static void __init init_mmu_slb_size(unsigned long node)
222{ 222{
223 const __be32 *slb_size_ptr; 223 const __be32 *slb_size_ptr;
224 224
225 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL); 225 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL) ? :
226 if (slb_size_ptr != NULL) { 226 of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
227 mmu_slb_size = be32_to_cpup(slb_size_ptr); 227
228 return; 228 if (slb_size_ptr)
229 }
230 slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
231 if (slb_size_ptr != NULL) {
232 mmu_slb_size = be32_to_cpup(slb_size_ptr); 229 mmu_slb_size = be32_to_cpup(slb_size_ptr);
233 }
234} 230}
235#else 231#else
236#define check_cpu_slb_size(node) do { } while(0) 232#define init_mmu_slb_size(node) do { } while(0)
237#endif 233#endif
238 234
239static struct feature_property { 235static struct feature_property {
@@ -380,7 +376,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
380 376
381 check_cpu_feature_properties(node); 377 check_cpu_feature_properties(node);
382 check_cpu_pa_features(node); 378 check_cpu_pa_features(node);
383 check_cpu_slb_size(node); 379 init_mmu_slb_size(node);
384 380
385#ifdef CONFIG_PPC64 381#ifdef CONFIG_PPC64
386 if (nthreads > 1) 382 if (nthreads > 1)
@@ -476,9 +472,10 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
476 flags = of_read_number(&dm[3], 1); 472 flags = of_read_number(&dm[3], 1);
477 /* skip DRC index, pad, assoc. list index, flags */ 473 /* skip DRC index, pad, assoc. list index, flags */
478 dm += 4; 474 dm += 4;
479 /* skip this block if the reserved bit is set in flags (0x80) 475 /* skip this block if the reserved bit is set in flags
480 or if the block is not assigned to this partition (0x8) */ 476 or if the block is not assigned to this partition */
481 if ((flags & 0x80) || !(flags & 0x8)) 477 if ((flags & DRCONF_MEM_RESERVED) ||
478 !(flags & DRCONF_MEM_ASSIGNED))
482 continue; 479 continue;
483 size = memblock_size; 480 size = memblock_size;
484 rngs = 1; 481 rngs = 1;
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index fcca8077e6a2..15099c41622e 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -641,6 +641,15 @@ static void __init early_cmdline_parse(void)
641#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ 641#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \
642 ((x) >> 8) & 0xff, (x) & 0xff 642 ((x) >> 8) & 0xff, (x) & 0xff
643 643
644/* Firmware expects the value to be n - 1, where n is the # of vectors */
645#define NUM_VECTORS(n) ((n) - 1)
646
647/*
648 * Firmware expects 1 + n - 2, where n is the length of the option vector in
649 * bytes. The 1 accounts for the length byte itself, the - 2 .. ?
650 */
651#define VECTOR_LENGTH(n) (1 + (n) - 2)
652
644unsigned char ibm_architecture_vec[] = { 653unsigned char ibm_architecture_vec[] = {
645 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */ 654 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */
646 W(0xffff0000), W(0x003e0000), /* POWER6 */ 655 W(0xffff0000), W(0x003e0000), /* POWER6 */
@@ -651,16 +660,16 @@ unsigned char ibm_architecture_vec[] = {
651 W(0xffffffff), W(0x0f000003), /* all 2.06-compliant */ 660 W(0xffffffff), W(0x0f000003), /* all 2.06-compliant */
652 W(0xffffffff), W(0x0f000002), /* all 2.05-compliant */ 661 W(0xffffffff), W(0x0f000002), /* all 2.05-compliant */
653 W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */ 662 W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */
654 6 - 1, /* 6 option vectors */ 663 NUM_VECTORS(6), /* 6 option vectors */
655 664
656 /* option vector 1: processor architectures supported */ 665 /* option vector 1: processor architectures supported */
657 3 - 2, /* length */ 666 VECTOR_LENGTH(2), /* length */
658 0, /* don't ignore, don't halt */ 667 0, /* don't ignore, don't halt */
659 OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 | 668 OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |
660 OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07, 669 OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07,
661 670
662 /* option vector 2: Open Firmware options supported */ 671 /* option vector 2: Open Firmware options supported */
663 34 - 2, /* length */ 672 VECTOR_LENGTH(33), /* length */
664 OV2_REAL_MODE, 673 OV2_REAL_MODE,
665 0, 0, 674 0, 0,
666 W(0xffffffff), /* real_base */ 675 W(0xffffffff), /* real_base */
@@ -674,17 +683,17 @@ unsigned char ibm_architecture_vec[] = {
674 48, /* max log_2(hash table size) */ 683 48, /* max log_2(hash table size) */
675 684
676 /* option vector 3: processor options supported */ 685 /* option vector 3: processor options supported */
677 3 - 2, /* length */ 686 VECTOR_LENGTH(2), /* length */
678 0, /* don't ignore, don't halt */ 687 0, /* don't ignore, don't halt */
679 OV3_FP | OV3_VMX | OV3_DFP, 688 OV3_FP | OV3_VMX | OV3_DFP,
680 689
681 /* option vector 4: IBM PAPR implementation */ 690 /* option vector 4: IBM PAPR implementation */
682 3 - 2, /* length */ 691 VECTOR_LENGTH(2), /* length */
683 0, /* don't halt */ 692 0, /* don't halt */
684 OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */ 693 OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */
685 694
686 /* option vector 5: PAPR/OF options */ 695 /* option vector 5: PAPR/OF options */
687 19 - 2, /* length */ 696 VECTOR_LENGTH(18), /* length */
688 0, /* don't ignore, don't halt */ 697 0, /* don't ignore, don't halt */
689 OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) | 698 OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) |
690 OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) | 699 OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) |
@@ -717,12 +726,12 @@ unsigned char ibm_architecture_vec[] = {
717 OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) | 726 OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) |
718 OV5_FEAT(OV5_PFO_HW_842), 727 OV5_FEAT(OV5_PFO_HW_842),
719 OV5_FEAT(OV5_SUB_PROCESSORS), 728 OV5_FEAT(OV5_SUB_PROCESSORS),
729
720 /* option vector 6: IBM PAPR hints */ 730 /* option vector 6: IBM PAPR hints */
721 4 - 2, /* length */ 731 VECTOR_LENGTH(3), /* length */
722 0, 732 0,
723 0, 733 0,
724 OV6_LINUX, 734 OV6_LINUX,
725
726}; 735};
727 736
728/* Old method - ELF header with PT_NOTE sections only works on BE */ 737/* Old method - ELF header with PT_NOTE sections only works on BE */
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index f21897b42057..737c0d0b53ac 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1762,26 +1762,81 @@ long arch_ptrace(struct task_struct *child, long request,
1762 return ret; 1762 return ret;
1763} 1763}
1764 1764
1765/* 1765#ifdef CONFIG_SECCOMP
1766 * We must return the syscall number to actually look up in the table. 1766static int do_seccomp(struct pt_regs *regs)
1767 * This can be -1L to skip running any syscall at all. 1767{
1768 if (!test_thread_flag(TIF_SECCOMP))
1769 return 0;
1770
1771 /*
1772 * The ABI we present to seccomp tracers is that r3 contains
1773 * the syscall return value and orig_gpr3 contains the first
1774 * syscall parameter. This is different to the ptrace ABI where
1775 * both r3 and orig_gpr3 contain the first syscall parameter.
1776 */
1777 regs->gpr[3] = -ENOSYS;
1778
1779 /*
1780 * We use the __ version here because we have already checked
1781 * TIF_SECCOMP. If this fails, there is nothing left to do, we
1782 * have already loaded -ENOSYS into r3, or seccomp has put
1783 * something else in r3 (via SECCOMP_RET_ERRNO/TRACE).
1784 */
1785 if (__secure_computing())
1786 return -1;
1787
1788 /*
1789 * The syscall was allowed by seccomp, restore the register
1790 * state to what ptrace and audit expect.
1791 * Note that we use orig_gpr3, which means a seccomp tracer can
1792 * modify the first syscall parameter (in orig_gpr3) and also
1793 * allow the syscall to proceed.
1794 */
1795 regs->gpr[3] = regs->orig_gpr3;
1796
1797 return 0;
1798}
1799#else
1800static inline int do_seccomp(struct pt_regs *regs) { return 0; }
1801#endif /* CONFIG_SECCOMP */
1802
1803/**
1804 * do_syscall_trace_enter() - Do syscall tracing on kernel entry.
1805 * @regs: the pt_regs of the task to trace (current)
1806 *
1807 * Performs various types of tracing on syscall entry. This includes seccomp,
1808 * ptrace, syscall tracepoints and audit.
1809 *
1810 * The pt_regs are potentially visible to userspace via ptrace, so their
1811 * contents is ABI.
1812 *
1813 * One or more of the tracers may modify the contents of pt_regs, in particular
1814 * to modify arguments or even the syscall number itself.
1815 *
1816 * It's also possible that a tracer can choose to reject the system call. In
1817 * that case this function will return an illegal syscall number, and will put
1818 * an appropriate return value in regs->r3.
1819 *
1820 * Return: the (possibly changed) syscall number.
1768 */ 1821 */
1769long do_syscall_trace_enter(struct pt_regs *regs) 1822long do_syscall_trace_enter(struct pt_regs *regs)
1770{ 1823{
1771 long ret = 0; 1824 bool abort = false;
1772 1825
1773 user_exit(); 1826 user_exit();
1774 1827
1775 secure_computing_strict(regs->gpr[0]); 1828 if (do_seccomp(regs))
1829 return -1;
1776 1830
1777 if (test_thread_flag(TIF_SYSCALL_TRACE) && 1831 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
1778 tracehook_report_syscall_entry(regs))
1779 /* 1832 /*
1780 * Tracing decided this syscall should not happen. 1833 * The tracer may decide to abort the syscall, if so tracehook
1781 * We'll return a bogus call number to get an ENOSYS 1834 * will return !0. Note that the tracer may also just change
1782 * error, but leave the original number in regs->gpr[0]. 1835 * regs->gpr[0] to an invalid syscall number, that is handled
1836 * below on the exit path.
1783 */ 1837 */
1784 ret = -1L; 1838 abort = tracehook_report_syscall_entry(regs) != 0;
1839 }
1785 1840
1786 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1841 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1787 trace_sys_enter(regs, regs->gpr[0]); 1842 trace_sys_enter(regs, regs->gpr[0]);
@@ -1798,7 +1853,17 @@ long do_syscall_trace_enter(struct pt_regs *regs)
1798 regs->gpr[5] & 0xffffffff, 1853 regs->gpr[5] & 0xffffffff,
1799 regs->gpr[6] & 0xffffffff); 1854 regs->gpr[6] & 0xffffffff);
1800 1855
1801 return ret ?: regs->gpr[0]; 1856 if (abort || regs->gpr[0] >= NR_syscalls) {
1857 /*
1858 * If we are aborting explicitly, or if the syscall number is
1859 * now invalid, set the return value to -ENOSYS.
1860 */
1861 regs->gpr[3] = -ENOSYS;
1862 return -1;
1863 }
1864
1865 /* Return the possibly modified but valid syscall number */
1866 return regs->gpr[0];
1802} 1867}
1803 1868
1804void do_syscall_trace_leave(struct pt_regs *regs) 1869void do_syscall_trace_leave(struct pt_regs *regs)
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 7a488c108410..84bf934cf748 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -478,8 +478,9 @@ unsigned int rtas_busy_delay_time(int status)
478 478
479 if (status == RTAS_BUSY) { 479 if (status == RTAS_BUSY) {
480 ms = 1; 480 ms = 1;
481 } else if (status >= 9900 && status <= 9905) { 481 } else if (status >= RTAS_EXTENDED_DELAY_MIN &&
482 order = status - 9900; 482 status <= RTAS_EXTENDED_DELAY_MAX) {
483 order = status - RTAS_EXTENDED_DELAY_MIN;
483 for (ms = 1; order > 0; order--) 484 for (ms = 1; order > 0; order--)
484 ms *= 10; 485 ms *= 10;
485 } 486 }
@@ -584,6 +585,23 @@ int rtas_get_sensor(int sensor, int index, int *state)
584} 585}
585EXPORT_SYMBOL(rtas_get_sensor); 586EXPORT_SYMBOL(rtas_get_sensor);
586 587
588int rtas_get_sensor_fast(int sensor, int index, int *state)
589{
590 int token = rtas_token("get-sensor-state");
591 int rc;
592
593 if (token == RTAS_UNKNOWN_SERVICE)
594 return -ENOENT;
595
596 rc = rtas_call(token, 2, 2, state, sensor, index);
597 WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
598 rc <= RTAS_EXTENDED_DELAY_MAX));
599
600 if (rc < 0)
601 return rtas_error_rc(rc);
602 return rc;
603}
604
587bool rtas_indicator_present(int token, int *maxindex) 605bool rtas_indicator_present(int token, int *maxindex)
588{ 606{
589 int proplen, count, i; 607 int proplen, count, i;
@@ -641,7 +659,8 @@ int rtas_set_indicator_fast(int indicator, int index, int new_value)
641 659
642 rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value); 660 rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
643 661
644 WARN_ON(rc == -2 || (rc >= 9900 && rc <= 9905)); 662 WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
663 rc <= RTAS_EXTENDED_DELAY_MAX));
645 664
646 if (rc < 0) 665 if (rc < 0)
647 return rtas_error_rc(rc); 666 return rtas_error_rc(rc);
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index da50e0c9c57e..0dbee465af7a 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -949,6 +949,11 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, const siginfo_t *s)
949 err |= __put_user(s->si_overrun, &d->si_overrun); 949 err |= __put_user(s->si_overrun, &d->si_overrun);
950 err |= __put_user(s->si_int, &d->si_int); 950 err |= __put_user(s->si_int, &d->si_int);
951 break; 951 break;
952 case __SI_SYS >> 16:
953 err |= __put_user(ptr_to_compat(s->si_call_addr), &d->si_call_addr);
954 err |= __put_user(s->si_syscall, &d->si_syscall);
955 err |= __put_user(s->si_arch, &d->si_arch);
956 break;
952 case __SI_RT >> 16: /* This is not generated by the kernel as of now. */ 957 case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
953 case __SI_MESGQ >> 16: 958 case __SI_MESGQ >> 16:
954 err |= __put_user(s->si_int, &d->si_int); 959 err |= __put_user(s->si_int, &d->si_int);
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index c7c24d2e2bdb..20756dfb9f34 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -74,6 +74,19 @@ static const char fmt64[] = KERN_INFO \
74 "%s[%d]: bad frame in %s: %016lx nip %016lx lr %016lx\n"; 74 "%s[%d]: bad frame in %s: %016lx nip %016lx lr %016lx\n";
75 75
76/* 76/*
77 * This computes a quad word aligned pointer inside the vmx_reserve array
78 * element. For historical reasons sigcontext might not be quad word aligned,
79 * but the location we write the VMX regs to must be. See the comment in
80 * sigcontext for more detail.
81 */
82#ifdef CONFIG_ALTIVEC
83static elf_vrreg_t __user *sigcontext_vmx_regs(struct sigcontext __user *sc)
84{
85 return (elf_vrreg_t __user *) (((unsigned long)sc->vmx_reserve + 15) & ~0xful);
86}
87#endif
88
89/*
77 * Set up the sigcontext for the signal frame. 90 * Set up the sigcontext for the signal frame.
78 */ 91 */
79 92
@@ -90,7 +103,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
90 * v_regs pointer or not 103 * v_regs pointer or not
91 */ 104 */
92#ifdef CONFIG_ALTIVEC 105#ifdef CONFIG_ALTIVEC
93 elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *)(((unsigned long)sc->vmx_reserve + 15) & ~0xful); 106 elf_vrreg_t __user *v_regs = sigcontext_vmx_regs(sc);
94#endif 107#endif
95 unsigned long msr = regs->msr; 108 unsigned long msr = regs->msr;
96 long err = 0; 109 long err = 0;
@@ -181,10 +194,8 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc,
181 * v_regs pointer or not. 194 * v_regs pointer or not.
182 */ 195 */
183#ifdef CONFIG_ALTIVEC 196#ifdef CONFIG_ALTIVEC
184 elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *) 197 elf_vrreg_t __user *v_regs = sigcontext_vmx_regs(sc);
185 (((unsigned long)sc->vmx_reserve + 15) & ~0xful); 198 elf_vrreg_t __user *tm_v_regs = sigcontext_vmx_regs(tm_sc);
186 elf_vrreg_t __user *tm_v_regs = (elf_vrreg_t __user *)
187 (((unsigned long)tm_sc->vmx_reserve + 15) & ~0xful);
188#endif 199#endif
189 unsigned long msr = regs->msr; 200 unsigned long msr = regs->msr;
190 long err = 0; 201 long err = 0;
diff --git a/arch/powerpc/kernel/trace_clock.c b/arch/powerpc/kernel/trace_clock.c
new file mode 100644
index 000000000000..49170690946d
--- /dev/null
+++ b/arch/powerpc/kernel/trace_clock.c
@@ -0,0 +1,15 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
7 */
8
9#include <asm/trace_clock.h>
10#include <asm/time.h>
11
12u64 notrace trace_clock_ppc_tb(void)
13{
14 return get_tb();
15}