diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-11 20:34:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-11 20:34:00 -0400 |
commit | fd9879b9bb3258ebc27a4cc6d2d29f528f71901f (patch) | |
tree | 48b68994f5e8083aafe116533e8143cb2bf30c85 /arch/powerpc/sysdev | |
parent | 81ae31d78239318610d7c2acb3e2610d622a5aa4 (diff) | |
parent | d53ba6b3bba33432cc37b7101a86f8f3392c46e7 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux
Pull powerpc updates from Michael Ellerman:
"Here's a first pull request for powerpc updates for 3.18.
The bulk of the additions are for the "cxl" driver, for IBM's Coherent
Accelerator Processor Interface (CAPI). Most of it's in drivers/misc,
which Greg & Arnd maintain, Greg said he was happy for us to take it
through our tree.
There's the usual minor cleanups and fixes, including a bit of noise
in drivers from some of those. A bunch of updates to our EEH code,
which has been getting more testing. Several nice speedups from
Anton, including 20% in clear_page().
And a bunch of updates for freescale from Scott"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux: (130 commits)
cxl: Fix afu_read() not doing finish_wait() on signal or non-blocking
cxl: Add documentation for userspace APIs
cxl: Add driver to Kbuild and Makefiles
cxl: Add userspace header file
cxl: Driver code for powernv PCIe based cards for userspace access
cxl: Add base builtin support
powerpc/mm: Add hooks for cxl
powerpc/opal: Add PHB to cxl mode call
powerpc/mm: Add new hash_page_mm()
powerpc/powerpc: Add new PCIe functions for allocating cxl interrupts
cxl: Add new header for call backs and structs
powerpc/powernv: Split out set MSI IRQ chip code
powerpc/mm: Export mmu_kernel_ssize and mmu_linear_psize
powerpc/msi: Improve IRQ bitmap allocator
powerpc/cell: Make spu_flush_all_slbs() generic
powerpc/cell: Move data segment faulting code out of cell platform
powerpc/cell: Move spu_handle_mm_fault() out of cell platform
powerpc/pseries: Use new defines when calling H_SET_MODE
powerpc: Update contact info in Documentation files
powerpc/perf/hv-24x7: Simplify catalog_read()
...
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/axonram.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/dcr.c | 1 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_msi.c | 95 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_msi.h | 4 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 3 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/msi_bitmap.c | 42 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mv64x60_dev.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/pmi.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/xics/icp-native.c | 25 | ||||
-rw-r--r-- | arch/powerpc/sysdev/xilinx_intc.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/xilinx_pci.c | 2 |
13 files changed, 116 insertions, 68 deletions
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c index 47b6b9f81d43..ad56edc39919 100644 --- a/arch/powerpc/sysdev/axonram.c +++ b/arch/powerpc/sysdev/axonram.c | |||
@@ -314,7 +314,7 @@ axon_ram_remove(struct platform_device *device) | |||
314 | return 0; | 314 | return 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | static struct of_device_id axon_ram_device_id[] = { | 317 | static const struct of_device_id axon_ram_device_id[] = { |
318 | { | 318 | { |
319 | .type = "dma-memory" | 319 | .type = "dma-memory" |
320 | }, | 320 | }, |
diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c index e9056e438575..2d8a101b6b9e 100644 --- a/arch/powerpc/sysdev/dcr.c +++ b/arch/powerpc/sysdev/dcr.c | |||
@@ -230,5 +230,6 @@ EXPORT_SYMBOL_GPL(dcr_unmap_mmio); | |||
230 | 230 | ||
231 | #ifdef CONFIG_PPC_DCR_NATIVE | 231 | #ifdef CONFIG_PPC_DCR_NATIVE |
232 | DEFINE_SPINLOCK(dcr_ind_lock); | 232 | DEFINE_SPINLOCK(dcr_ind_lock); |
233 | EXPORT_SYMBOL_GPL(dcr_ind_lock); | ||
233 | #endif /* defined(CONFIG_PPC_DCR_NATIVE) */ | 234 | #endif /* defined(CONFIG_PPC_DCR_NATIVE) */ |
234 | 235 | ||
diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c index afc2dbf37011..90545ad1626e 100644 --- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c +++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | |||
@@ -171,7 +171,7 @@ static int mpc85xx_l2ctlr_of_remove(struct platform_device *dev) | |||
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | static struct of_device_id mpc85xx_l2ctlr_of_match[] = { | 174 | static const struct of_device_id mpc85xx_l2ctlr_of_match[] = { |
175 | { | 175 | { |
176 | .compatible = "fsl,p2020-l2-cache-controller", | 176 | .compatible = "fsl,p2020-l2-cache-controller", |
177 | }, | 177 | }, |
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index b32e79dbef4f..de40b48b460e 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/of_platform.h> | 20 | #include <linux/of_platform.h> |
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/seq_file.h> | ||
21 | #include <sysdev/fsl_soc.h> | 23 | #include <sysdev/fsl_soc.h> |
22 | #include <asm/prom.h> | 24 | #include <asm/prom.h> |
23 | #include <asm/hw_irq.h> | 25 | #include <asm/hw_irq.h> |
@@ -50,6 +52,7 @@ struct fsl_msi_feature { | |||
50 | struct fsl_msi_cascade_data { | 52 | struct fsl_msi_cascade_data { |
51 | struct fsl_msi *msi_data; | 53 | struct fsl_msi *msi_data; |
52 | int index; | 54 | int index; |
55 | int virq; | ||
53 | }; | 56 | }; |
54 | 57 | ||
55 | static inline u32 fsl_msi_read(u32 __iomem *base, unsigned int reg) | 58 | static inline u32 fsl_msi_read(u32 __iomem *base, unsigned int reg) |
@@ -65,11 +68,24 @@ static void fsl_msi_end_irq(struct irq_data *d) | |||
65 | { | 68 | { |
66 | } | 69 | } |
67 | 70 | ||
71 | static void fsl_msi_print_chip(struct irq_data *irqd, struct seq_file *p) | ||
72 | { | ||
73 | struct fsl_msi *msi_data = irqd->domain->host_data; | ||
74 | irq_hw_number_t hwirq = irqd_to_hwirq(irqd); | ||
75 | int cascade_virq, srs; | ||
76 | |||
77 | srs = (hwirq >> msi_data->srs_shift) & MSI_SRS_MASK; | ||
78 | cascade_virq = msi_data->cascade_array[srs]->virq; | ||
79 | |||
80 | seq_printf(p, " fsl-msi-%d", cascade_virq); | ||
81 | } | ||
82 | |||
83 | |||
68 | static struct irq_chip fsl_msi_chip = { | 84 | static struct irq_chip fsl_msi_chip = { |
69 | .irq_mask = mask_msi_irq, | 85 | .irq_mask = mask_msi_irq, |
70 | .irq_unmask = unmask_msi_irq, | 86 | .irq_unmask = unmask_msi_irq, |
71 | .irq_ack = fsl_msi_end_irq, | 87 | .irq_ack = fsl_msi_end_irq, |
72 | .name = "FSL-MSI", | 88 | .irq_print_chip = fsl_msi_print_chip, |
73 | }; | 89 | }; |
74 | 90 | ||
75 | static int fsl_msi_host_map(struct irq_domain *h, unsigned int virq, | 91 | static int fsl_msi_host_map(struct irq_domain *h, unsigned int virq, |
@@ -175,7 +191,8 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
175 | np = of_parse_phandle(hose->dn, "fsl,msi", 0); | 191 | np = of_parse_phandle(hose->dn, "fsl,msi", 0); |
176 | if (np) { | 192 | if (np) { |
177 | if (of_device_is_compatible(np, "fsl,mpic-msi") || | 193 | if (of_device_is_compatible(np, "fsl,mpic-msi") || |
178 | of_device_is_compatible(np, "fsl,vmpic-msi")) | 194 | of_device_is_compatible(np, "fsl,vmpic-msi") || |
195 | of_device_is_compatible(np, "fsl,vmpic-msi-v4.3")) | ||
179 | phandle = np->phandle; | 196 | phandle = np->phandle; |
180 | else { | 197 | else { |
181 | dev_err(&pdev->dev, | 198 | dev_err(&pdev->dev, |
@@ -234,40 +251,24 @@ out_free: | |||
234 | return rc; | 251 | return rc; |
235 | } | 252 | } |
236 | 253 | ||
237 | static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc) | 254 | static irqreturn_t fsl_msi_cascade(int irq, void *data) |
238 | { | 255 | { |
239 | struct irq_chip *chip = irq_desc_get_chip(desc); | ||
240 | struct irq_data *idata = irq_desc_get_irq_data(desc); | ||
241 | unsigned int cascade_irq; | 256 | unsigned int cascade_irq; |
242 | struct fsl_msi *msi_data; | 257 | struct fsl_msi *msi_data; |
243 | int msir_index = -1; | 258 | int msir_index = -1; |
244 | u32 msir_value = 0; | 259 | u32 msir_value = 0; |
245 | u32 intr_index; | 260 | u32 intr_index; |
246 | u32 have_shift = 0; | 261 | u32 have_shift = 0; |
247 | struct fsl_msi_cascade_data *cascade_data; | 262 | struct fsl_msi_cascade_data *cascade_data = data; |
263 | irqreturn_t ret = IRQ_NONE; | ||
248 | 264 | ||
249 | cascade_data = irq_get_handler_data(irq); | ||
250 | msi_data = cascade_data->msi_data; | 265 | msi_data = cascade_data->msi_data; |
251 | 266 | ||
252 | raw_spin_lock(&desc->lock); | ||
253 | if ((msi_data->feature & FSL_PIC_IP_MASK) == FSL_PIC_IP_IPIC) { | ||
254 | if (chip->irq_mask_ack) | ||
255 | chip->irq_mask_ack(idata); | ||
256 | else { | ||
257 | chip->irq_mask(idata); | ||
258 | chip->irq_ack(idata); | ||
259 | } | ||
260 | } | ||
261 | |||
262 | if (unlikely(irqd_irq_inprogress(idata))) | ||
263 | goto unlock; | ||
264 | |||
265 | msir_index = cascade_data->index; | 267 | msir_index = cascade_data->index; |
266 | 268 | ||
267 | if (msir_index >= NR_MSI_REG_MAX) | 269 | if (msir_index >= NR_MSI_REG_MAX) |
268 | cascade_irq = NO_IRQ; | 270 | cascade_irq = NO_IRQ; |
269 | 271 | ||
270 | irqd_set_chained_irq_inprogress(idata); | ||
271 | switch (msi_data->feature & FSL_PIC_IP_MASK) { | 272 | switch (msi_data->feature & FSL_PIC_IP_MASK) { |
272 | case FSL_PIC_IP_MPIC: | 273 | case FSL_PIC_IP_MPIC: |
273 | msir_value = fsl_msi_read(msi_data->msi_regs, | 274 | msir_value = fsl_msi_read(msi_data->msi_regs, |
@@ -296,40 +297,32 @@ static void fsl_msi_cascade(unsigned int irq, struct irq_desc *desc) | |||
296 | cascade_irq = irq_linear_revmap(msi_data->irqhost, | 297 | cascade_irq = irq_linear_revmap(msi_data->irqhost, |
297 | msi_hwirq(msi_data, msir_index, | 298 | msi_hwirq(msi_data, msir_index, |
298 | intr_index + have_shift)); | 299 | intr_index + have_shift)); |
299 | if (cascade_irq != NO_IRQ) | 300 | if (cascade_irq != NO_IRQ) { |
300 | generic_handle_irq(cascade_irq); | 301 | generic_handle_irq(cascade_irq); |
302 | ret = IRQ_HANDLED; | ||
303 | } | ||
301 | have_shift += intr_index + 1; | 304 | have_shift += intr_index + 1; |
302 | msir_value = msir_value >> (intr_index + 1); | 305 | msir_value = msir_value >> (intr_index + 1); |
303 | } | 306 | } |
304 | irqd_clr_chained_irq_inprogress(idata); | ||
305 | 307 | ||
306 | switch (msi_data->feature & FSL_PIC_IP_MASK) { | 308 | return ret; |
307 | case FSL_PIC_IP_MPIC: | ||
308 | case FSL_PIC_IP_VMPIC: | ||
309 | chip->irq_eoi(idata); | ||
310 | break; | ||
311 | case FSL_PIC_IP_IPIC: | ||
312 | if (!irqd_irq_disabled(idata) && chip->irq_unmask) | ||
313 | chip->irq_unmask(idata); | ||
314 | break; | ||
315 | } | ||
316 | unlock: | ||
317 | raw_spin_unlock(&desc->lock); | ||
318 | } | 309 | } |
319 | 310 | ||
320 | static int fsl_of_msi_remove(struct platform_device *ofdev) | 311 | static int fsl_of_msi_remove(struct platform_device *ofdev) |
321 | { | 312 | { |
322 | struct fsl_msi *msi = platform_get_drvdata(ofdev); | 313 | struct fsl_msi *msi = platform_get_drvdata(ofdev); |
323 | int virq, i; | 314 | int virq, i; |
324 | struct fsl_msi_cascade_data *cascade_data; | ||
325 | 315 | ||
326 | if (msi->list.prev != NULL) | 316 | if (msi->list.prev != NULL) |
327 | list_del(&msi->list); | 317 | list_del(&msi->list); |
328 | for (i = 0; i < NR_MSI_REG_MAX; i++) { | 318 | for (i = 0; i < NR_MSI_REG_MAX; i++) { |
329 | virq = msi->msi_virqs[i]; | 319 | if (msi->cascade_array[i]) { |
330 | if (virq != NO_IRQ) { | 320 | virq = msi->cascade_array[i]->virq; |
331 | cascade_data = irq_get_handler_data(virq); | 321 | |
332 | kfree(cascade_data); | 322 | BUG_ON(virq == NO_IRQ); |
323 | |||
324 | free_irq(virq, msi->cascade_array[i]); | ||
325 | kfree(msi->cascade_array[i]); | ||
333 | irq_dispose_mapping(virq); | 326 | irq_dispose_mapping(virq); |
334 | } | 327 | } |
335 | } | 328 | } |
@@ -348,7 +341,7 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, | |||
348 | int offset, int irq_index) | 341 | int offset, int irq_index) |
349 | { | 342 | { |
350 | struct fsl_msi_cascade_data *cascade_data = NULL; | 343 | struct fsl_msi_cascade_data *cascade_data = NULL; |
351 | int virt_msir, i; | 344 | int virt_msir, i, ret; |
352 | 345 | ||
353 | virt_msir = irq_of_parse_and_map(dev->dev.of_node, irq_index); | 346 | virt_msir = irq_of_parse_and_map(dev->dev.of_node, irq_index); |
354 | if (virt_msir == NO_IRQ) { | 347 | if (virt_msir == NO_IRQ) { |
@@ -363,11 +356,18 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, | |||
363 | return -ENOMEM; | 356 | return -ENOMEM; |
364 | } | 357 | } |
365 | irq_set_lockdep_class(virt_msir, &fsl_msi_irq_class); | 358 | irq_set_lockdep_class(virt_msir, &fsl_msi_irq_class); |
366 | msi->msi_virqs[irq_index] = virt_msir; | ||
367 | cascade_data->index = offset; | 359 | cascade_data->index = offset; |
368 | cascade_data->msi_data = msi; | 360 | cascade_data->msi_data = msi; |
369 | irq_set_handler_data(virt_msir, cascade_data); | 361 | cascade_data->virq = virt_msir; |
370 | irq_set_chained_handler(virt_msir, fsl_msi_cascade); | 362 | msi->cascade_array[irq_index] = cascade_data; |
363 | |||
364 | ret = request_irq(virt_msir, fsl_msi_cascade, 0, | ||
365 | "fsl-msi-cascade", cascade_data); | ||
366 | if (ret) { | ||
367 | dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n", | ||
368 | virt_msir, ret); | ||
369 | return ret; | ||
370 | } | ||
371 | 371 | ||
372 | /* Release the hwirqs corresponding to this MSI register */ | 372 | /* Release the hwirqs corresponding to this MSI register */ |
373 | for (i = 0; i < IRQS_PER_MSI_REG; i++) | 373 | for (i = 0; i < IRQS_PER_MSI_REG; i++) |
@@ -461,7 +461,8 @@ static int fsl_of_msi_probe(struct platform_device *dev) | |||
461 | 461 | ||
462 | p = of_get_property(dev->dev.of_node, "msi-available-ranges", &len); | 462 | p = of_get_property(dev->dev.of_node, "msi-available-ranges", &len); |
463 | 463 | ||
464 | if (of_device_is_compatible(dev->dev.of_node, "fsl,mpic-msi-v4.3")) { | 464 | if (of_device_is_compatible(dev->dev.of_node, "fsl,mpic-msi-v4.3") || |
465 | of_device_is_compatible(dev->dev.of_node, "fsl,vmpic-msi-v4.3")) { | ||
465 | msi->srs_shift = MSIIR1_SRS_SHIFT; | 466 | msi->srs_shift = MSIIR1_SRS_SHIFT; |
466 | msi->ibs_shift = MSIIR1_IBS_SHIFT; | 467 | msi->ibs_shift = MSIIR1_IBS_SHIFT; |
467 | if (p) | 468 | if (p) |
@@ -566,6 +567,10 @@ static const struct of_device_id fsl_of_msi_ids[] = { | |||
566 | .compatible = "fsl,vmpic-msi", | 567 | .compatible = "fsl,vmpic-msi", |
567 | .data = &vmpic_msi_feature, | 568 | .data = &vmpic_msi_feature, |
568 | }, | 569 | }, |
570 | { | ||
571 | .compatible = "fsl,vmpic-msi-v4.3", | ||
572 | .data = &vmpic_msi_feature, | ||
573 | }, | ||
569 | #endif | 574 | #endif |
570 | {} | 575 | {} |
571 | }; | 576 | }; |
diff --git a/arch/powerpc/sysdev/fsl_msi.h b/arch/powerpc/sysdev/fsl_msi.h index df9aa9fe0933..420cfcbdac01 100644 --- a/arch/powerpc/sysdev/fsl_msi.h +++ b/arch/powerpc/sysdev/fsl_msi.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #define FSL_PIC_IP_IPIC 0x00000002 | 27 | #define FSL_PIC_IP_IPIC 0x00000002 |
28 | #define FSL_PIC_IP_VMPIC 0x00000003 | 28 | #define FSL_PIC_IP_VMPIC 0x00000003 |
29 | 29 | ||
30 | struct fsl_msi_cascade_data; | ||
31 | |||
30 | struct fsl_msi { | 32 | struct fsl_msi { |
31 | struct irq_domain *irqhost; | 33 | struct irq_domain *irqhost; |
32 | 34 | ||
@@ -37,7 +39,7 @@ struct fsl_msi { | |||
37 | u32 srs_shift; /* Shift of the shared interrupt register select */ | 39 | u32 srs_shift; /* Shift of the shared interrupt register select */ |
38 | void __iomem *msi_regs; | 40 | void __iomem *msi_regs; |
39 | u32 feature; | 41 | u32 feature; |
40 | int msi_virqs[NR_MSI_REG_MAX]; | 42 | struct fsl_msi_cascade_data *cascade_array[NR_MSI_REG_MAX]; |
41 | 43 | ||
42 | struct msi_bitmap bitmap; | 44 | struct msi_bitmap bitmap; |
43 | 45 | ||
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index c5077673bd94..65d2ed4549e6 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -522,7 +522,8 @@ int fsl_add_bridge(struct platform_device *pdev, int is_primary) | |||
522 | } else { | 522 | } else { |
523 | /* For PCI read PROG to identify controller mode */ | 523 | /* For PCI read PROG to identify controller mode */ |
524 | early_read_config_byte(hose, 0, 0, PCI_CLASS_PROG, &progif); | 524 | early_read_config_byte(hose, 0, 0, PCI_CLASS_PROG, &progif); |
525 | if ((progif & 1) == 1) | 525 | if ((progif & 1) && |
526 | !of_property_read_bool(dev, "fsl,pci-agent-force-enum")) | ||
526 | goto no_bridge; | 527 | goto no_bridge; |
527 | } | 528 | } |
528 | 529 | ||
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index be33c9768ea1..89cec0ed6a58 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -960,7 +960,7 @@ void mpic_set_vector(unsigned int virq, unsigned int vector) | |||
960 | mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), vecpri); | 960 | mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), vecpri); |
961 | } | 961 | } |
962 | 962 | ||
963 | void mpic_set_destination(unsigned int virq, unsigned int cpuid) | 963 | static void mpic_set_destination(unsigned int virq, unsigned int cpuid) |
964 | { | 964 | { |
965 | struct mpic *mpic = mpic_from_irq(virq); | 965 | struct mpic *mpic = mpic_from_irq(virq); |
966 | unsigned int src = virq_to_hw(virq); | 966 | unsigned int src = virq_to_hw(virq); |
diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c index 2ff630267e9e..0c75214b6f92 100644 --- a/arch/powerpc/sysdev/msi_bitmap.c +++ b/arch/powerpc/sysdev/msi_bitmap.c | |||
@@ -20,32 +20,37 @@ int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num) | |||
20 | int offset, order = get_count_order(num); | 20 | int offset, order = get_count_order(num); |
21 | 21 | ||
22 | spin_lock_irqsave(&bmp->lock, flags); | 22 | spin_lock_irqsave(&bmp->lock, flags); |
23 | /* | 23 | |
24 | * This is fast, but stricter than we need. We might want to add | 24 | offset = bitmap_find_next_zero_area(bmp->bitmap, bmp->irq_count, 0, |
25 | * a fallback routine which does a linear search with no alignment. | 25 | num, (1 << order) - 1); |
26 | */ | 26 | if (offset > bmp->irq_count) |
27 | offset = bitmap_find_free_region(bmp->bitmap, bmp->irq_count, order); | 27 | goto err; |
28 | |||
29 | bitmap_set(bmp->bitmap, offset, num); | ||
28 | spin_unlock_irqrestore(&bmp->lock, flags); | 30 | spin_unlock_irqrestore(&bmp->lock, flags); |
29 | 31 | ||
30 | pr_debug("msi_bitmap: allocated 0x%x (2^%d) at offset 0x%x\n", | 32 | pr_debug("msi_bitmap: allocated 0x%x at offset 0x%x\n", num, offset); |
31 | num, order, offset); | ||
32 | 33 | ||
33 | return offset; | 34 | return offset; |
35 | err: | ||
36 | spin_unlock_irqrestore(&bmp->lock, flags); | ||
37 | return -ENOMEM; | ||
34 | } | 38 | } |
39 | EXPORT_SYMBOL(msi_bitmap_alloc_hwirqs); | ||
35 | 40 | ||
36 | void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset, | 41 | void msi_bitmap_free_hwirqs(struct msi_bitmap *bmp, unsigned int offset, |
37 | unsigned int num) | 42 | unsigned int num) |
38 | { | 43 | { |
39 | unsigned long flags; | 44 | unsigned long flags; |
40 | int order = get_count_order(num); | ||
41 | 45 | ||
42 | pr_debug("msi_bitmap: freeing 0x%x (2^%d) at offset 0x%x\n", | 46 | pr_debug("msi_bitmap: freeing 0x%x at offset 0x%x\n", |
43 | num, order, offset); | 47 | num, offset); |
44 | 48 | ||
45 | spin_lock_irqsave(&bmp->lock, flags); | 49 | spin_lock_irqsave(&bmp->lock, flags); |
46 | bitmap_release_region(bmp->bitmap, offset, order); | 50 | bitmap_clear(bmp->bitmap, offset, num); |
47 | spin_unlock_irqrestore(&bmp->lock, flags); | 51 | spin_unlock_irqrestore(&bmp->lock, flags); |
48 | } | 52 | } |
53 | EXPORT_SYMBOL(msi_bitmap_free_hwirqs); | ||
49 | 54 | ||
50 | void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq) | 55 | void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq) |
51 | { | 56 | { |
@@ -143,7 +148,7 @@ void msi_bitmap_free(struct msi_bitmap *bmp) | |||
143 | #define check(x) \ | 148 | #define check(x) \ |
144 | if (!(x)) printk("msi_bitmap: test failed at line %d\n", __LINE__); | 149 | if (!(x)) printk("msi_bitmap: test failed at line %d\n", __LINE__); |
145 | 150 | ||
146 | void __init test_basics(void) | 151 | static void __init test_basics(void) |
147 | { | 152 | { |
148 | struct msi_bitmap bmp; | 153 | struct msi_bitmap bmp; |
149 | int i, size = 512; | 154 | int i, size = 512; |
@@ -180,6 +185,15 @@ void __init test_basics(void) | |||
180 | msi_bitmap_free_hwirqs(&bmp, size / 2, 1); | 185 | msi_bitmap_free_hwirqs(&bmp, size / 2, 1); |
181 | check(msi_bitmap_alloc_hwirqs(&bmp, 1) == size / 2); | 186 | check(msi_bitmap_alloc_hwirqs(&bmp, 1) == size / 2); |
182 | 187 | ||
188 | /* Check we get a naturally aligned offset */ | ||
189 | check(msi_bitmap_alloc_hwirqs(&bmp, 2) % 2 == 0); | ||
190 | check(msi_bitmap_alloc_hwirqs(&bmp, 4) % 4 == 0); | ||
191 | check(msi_bitmap_alloc_hwirqs(&bmp, 8) % 8 == 0); | ||
192 | check(msi_bitmap_alloc_hwirqs(&bmp, 9) % 16 == 0); | ||
193 | check(msi_bitmap_alloc_hwirqs(&bmp, 3) % 4 == 0); | ||
194 | check(msi_bitmap_alloc_hwirqs(&bmp, 7) % 8 == 0); | ||
195 | check(msi_bitmap_alloc_hwirqs(&bmp, 121) % 128 == 0); | ||
196 | |||
183 | msi_bitmap_free(&bmp); | 197 | msi_bitmap_free(&bmp); |
184 | 198 | ||
185 | /* Clients may check bitmap == NULL for "not-allocated" */ | 199 | /* Clients may check bitmap == NULL for "not-allocated" */ |
@@ -188,7 +202,7 @@ void __init test_basics(void) | |||
188 | kfree(bmp.bitmap); | 202 | kfree(bmp.bitmap); |
189 | } | 203 | } |
190 | 204 | ||
191 | void __init test_of_node(void) | 205 | static void __init test_of_node(void) |
192 | { | 206 | { |
193 | u32 prop_data[] = { 10, 10, 25, 3, 40, 1, 100, 100, 200, 20 }; | 207 | u32 prop_data[] = { 10, 10, 25, 3, 40, 1, 100, 100, 200, 20 }; |
194 | const char *expected_str = "0-9,20-24,28-39,41-99,220-255"; | 208 | const char *expected_str = "0-9,20-24,28-39,41-99,220-255"; |
@@ -236,7 +250,7 @@ void __init test_of_node(void) | |||
236 | kfree(bmp.bitmap); | 250 | kfree(bmp.bitmap); |
237 | } | 251 | } |
238 | 252 | ||
239 | int __init msi_bitmap_selftest(void) | 253 | static int __init msi_bitmap_selftest(void) |
240 | { | 254 | { |
241 | printk(KERN_DEBUG "Running MSI bitmap self-tests ...\n"); | 255 | printk(KERN_DEBUG "Running MSI bitmap self-tests ...\n"); |
242 | 256 | ||
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c index c2dba7db71ad..026bbc3b2c47 100644 --- a/arch/powerpc/sysdev/mv64x60_dev.c +++ b/arch/powerpc/sysdev/mv64x60_dev.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | /* These functions provide the necessary setup for the mv64x60 drivers. */ | 24 | /* These functions provide the necessary setup for the mv64x60 drivers. */ |
25 | 25 | ||
26 | static struct of_device_id __initdata of_mv64x60_devices[] = { | 26 | static const struct of_device_id of_mv64x60_devices[] __initconst = { |
27 | { .compatible = "marvell,mv64306-devctrl", }, | 27 | { .compatible = "marvell,mv64306-devctrl", }, |
28 | {} | 28 | {} |
29 | }; | 29 | }; |
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c index 5aaf86c03893..13e67d93a7c1 100644 --- a/arch/powerpc/sysdev/pmi.c +++ b/arch/powerpc/sysdev/pmi.c | |||
@@ -101,7 +101,7 @@ out: | |||
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | static struct of_device_id pmi_match[] = { | 104 | static const struct of_device_id pmi_match[] = { |
105 | { .type = "ibm,pmi", .name = "ibm,pmi" }, | 105 | { .type = "ibm,pmi", .name = "ibm,pmi" }, |
106 | { .type = "ibm,pmi" }, | 106 | { .type = "ibm,pmi" }, |
107 | {}, | 107 | {}, |
diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerpc/sysdev/xics/icp-native.c index de8d9483bbe8..2fc4cf1b7557 100644 --- a/arch/powerpc/sysdev/xics/icp-native.c +++ b/arch/powerpc/sysdev/xics/icp-native.c | |||
@@ -155,6 +155,31 @@ static void icp_native_cause_ipi(int cpu, unsigned long data) | |||
155 | icp_native_set_qirr(cpu, IPI_PRIORITY); | 155 | icp_native_set_qirr(cpu, IPI_PRIORITY); |
156 | } | 156 | } |
157 | 157 | ||
158 | /* | ||
159 | * Called when an interrupt is received on an off-line CPU to | ||
160 | * clear the interrupt, so that the CPU can go back to nap mode. | ||
161 | */ | ||
162 | void icp_native_flush_interrupt(void) | ||
163 | { | ||
164 | unsigned int xirr = icp_native_get_xirr(); | ||
165 | unsigned int vec = xirr & 0x00ffffff; | ||
166 | |||
167 | if (vec == XICS_IRQ_SPURIOUS) | ||
168 | return; | ||
169 | if (vec == XICS_IPI) { | ||
170 | /* Clear pending IPI */ | ||
171 | int cpu = smp_processor_id(); | ||
172 | kvmppc_set_host_ipi(cpu, 0); | ||
173 | icp_native_set_qirr(cpu, 0xff); | ||
174 | } else { | ||
175 | pr_err("XICS: hw interrupt 0x%x to offline cpu, disabling\n", | ||
176 | vec); | ||
177 | xics_mask_unknown_vec(vec); | ||
178 | } | ||
179 | /* EOI the interrupt */ | ||
180 | icp_native_set_xirr(xirr); | ||
181 | } | ||
182 | |||
158 | void xics_wake_cpu(int cpu) | 183 | void xics_wake_cpu(int cpu) |
159 | { | 184 | { |
160 | icp_native_set_qirr(cpu, IPI_PRIORITY); | 185 | icp_native_set_qirr(cpu, IPI_PRIORITY); |
diff --git a/arch/powerpc/sysdev/xilinx_intc.c b/arch/powerpc/sysdev/xilinx_intc.c index 83f943a8e0db..56f0524e47a6 100644 --- a/arch/powerpc/sysdev/xilinx_intc.c +++ b/arch/powerpc/sysdev/xilinx_intc.c | |||
@@ -265,7 +265,7 @@ static void __init xilinx_i8259_setup_cascade(void) | |||
265 | static inline void xilinx_i8259_setup_cascade(void) { return; } | 265 | static inline void xilinx_i8259_setup_cascade(void) { return; } |
266 | #endif /* defined(CONFIG_PPC_I8259) */ | 266 | #endif /* defined(CONFIG_PPC_I8259) */ |
267 | 267 | ||
268 | static struct of_device_id xilinx_intc_match[] __initconst = { | 268 | static const struct of_device_id xilinx_intc_match[] __initconst = { |
269 | { .compatible = "xlnx,opb-intc-1.00.c", }, | 269 | { .compatible = "xlnx,opb-intc-1.00.c", }, |
270 | { .compatible = "xlnx,xps-intc-1.00.a", }, | 270 | { .compatible = "xlnx,xps-intc-1.00.a", }, |
271 | {} | 271 | {} |
diff --git a/arch/powerpc/sysdev/xilinx_pci.c b/arch/powerpc/sysdev/xilinx_pci.c index 1453b0eed220..fea5667699ed 100644 --- a/arch/powerpc/sysdev/xilinx_pci.c +++ b/arch/powerpc/sysdev/xilinx_pci.c | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #define PCI_HOST_ENABLE_CMD PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | 28 | #define PCI_HOST_ENABLE_CMD PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY |
29 | 29 | ||
30 | static struct of_device_id xilinx_pci_match[] = { | 30 | static const struct of_device_id xilinx_pci_match[] = { |
31 | { .compatible = "xlnx,plbv46-pci-1.03.a", }, | 31 | { .compatible = "xlnx,plbv46-pci-1.03.a", }, |
32 | {} | 32 | {} |
33 | }; | 33 | }; |