Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62598
b: refs/heads/master
c: 7fd7218
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed Jul 22, 2007
1 parent b6cb258 commit 60c0db2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34f329db54e8154cf7faf0e7c45e7c16facfbbfe
refs/heads/master: 7fd7218610600b16f6f0af3f9d9353ba0265c09f
32 changes: 32 additions & 0 deletions trunk/arch/powerpc/sysdev/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,8 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,

if (hw == mpic->spurious_vec)
return -EINVAL;
if (mpic->protected && test_bit(hw, mpic->protected))
return -EINVAL;

#ifdef CONFIG_SMP
else if (hw >= mpic->ipi_vecs[0]) {
Expand Down Expand Up @@ -1034,6 +1036,25 @@ struct mpic * __init mpic_alloc(struct device_node *node,
if (node && of_get_property(node, "big-endian", NULL) != NULL)
mpic->flags |= MPIC_BIG_ENDIAN;

/* Look for protected sources */
if (node) {
unsigned int psize, bits, mapsize;
const u32 *psrc =
of_get_property(node, "protected-sources", &psize);
if (psrc) {
psize /= 4;
bits = intvec_top + 1;
mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long);
mpic->protected = alloc_bootmem(mapsize);
BUG_ON(mpic->protected == NULL);
memset(mpic->protected, 0, mapsize);
for (i = 0; i < psize; i++) {
if (psrc[i] > intvec_top)
continue;
__set_bit(psrc[i], mpic->protected);
}
}
}

#ifdef CONFIG_MPIC_WEIRD
mpic->hw_set = mpic_infos[MPIC_GET_REGSET(flags)];
Expand Down Expand Up @@ -1213,6 +1234,9 @@ void __init mpic_init(struct mpic *mpic)
u32 vecpri = MPIC_VECPRI_MASK | i |
(8 << MPIC_VECPRI_PRIORITY_SHIFT);

/* check if protected */
if (mpic->protected && test_bit(i, mpic->protected))
continue;
/* init hw */
mpic_irq_write(i, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION),
Expand Down Expand Up @@ -1407,6 +1431,14 @@ unsigned int mpic_get_one_irq(struct mpic *mpic)
mpic_eoi(mpic);
return NO_IRQ;
}
if (unlikely(mpic->protected && test_bit(src, mpic->protected))) {
if (printk_ratelimit())
printk(KERN_WARNING "%s: Got protected source %d !\n",
mpic->name, (int)src);
mpic_eoi(mpic);
return NO_IRQ;
}

return irq_linear_revmap(mpic->irqhost, src);
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/include/asm-powerpc/mpic.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ struct mpic
unsigned int dcr_base;
#endif

/* Protected sources */
unsigned long *protected;

#ifdef CONFIG_MPIC_WEIRD
/* Pointer to HW info array */
u32 *hw_set;
Expand Down

0 comments on commit 60c0db2

Please sign in to comment.