Add xenpic_dynirq_disable_intr and set it as the .pic_disable_intr method

for xenpic_dynirq_template.  This fixes a panic when a virtual disk is
removed, since that results in an interrupt channel being disabled and
NULL isn't very good function for disabling interrupts.

We should probably have a xenpic_pirq_disable_intr as well; I'm not adding
that here because (a) I'm not sure what uses pirqs so I don't have a test
case, and (b) the xenpic_pirq_enable_intr code is significantly more
complex than the xenpic_dynirq_enable_intr code, so I'm not sure what
should go into a xenpic_pirq_disable_intr routine.

PR:		kern/153511
MFC after:	3 days
This commit is contained in:
Colin Percival 2010-12-30 01:28:56 +00:00
parent 2eaf566f2a
commit 19e99e964e

View File

@ -628,6 +628,7 @@ static void xenpic_dynirq_enable_source(struct intsrc *isrc);
static void xenpic_dynirq_disable_source(struct intsrc *isrc, int);
static void xenpic_dynirq_eoi_source(struct intsrc *isrc);
static void xenpic_dynirq_enable_intr(struct intsrc *isrc);
static void xenpic_dynirq_disable_intr(struct intsrc *isrc);
static void xenpic_pirq_enable_source(struct intsrc *isrc);
static void xenpic_pirq_disable_source(struct intsrc *isrc, int);
@ -647,6 +648,7 @@ struct pic xenpic_dynirq_template = {
.pic_disable_source = xenpic_dynirq_disable_source,
.pic_eoi_source = xenpic_dynirq_eoi_source,
.pic_enable_intr = xenpic_dynirq_enable_intr,
.pic_disable_intr = xenpic_dynirq_disable_intr,
.pic_vector = xenpic_vector,
.pic_source_pending = xenpic_source_pending,
.pic_suspend = xenpic_suspend,
@ -715,6 +717,20 @@ xenpic_dynirq_enable_intr(struct intsrc *isrc)
mtx_unlock_spin(&irq_mapping_update_lock);
}
static void
xenpic_dynirq_disable_intr(struct intsrc *isrc)
{
unsigned int irq;
struct xenpic_intsrc *xp;
xp = (struct xenpic_intsrc *)isrc;
mtx_lock_spin(&irq_mapping_update_lock);
irq = xenpic_vector(isrc);
mask_evtchn(evtchn_from_irq(irq));
xp->xp_masked = 1;
mtx_unlock_spin(&irq_mapping_update_lock);
}
static void
xenpic_dynirq_eoi_source(struct intsrc *isrc)
{