Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

interrupt cleanup #2



Hi Everyone,

As promised, here is the first of a few patches to rework
interrupts. This is slightly reworked from the one in 
"Subject: interrupt cleanup #1"

I'd like it to be tried on machines with as many devices as possible -
the more and diverse the better.

Just to be clear, what you need to do is:

i) Apply the patch to -current
ii) build XEN3_DOM0 kernel, and boot it.
iii) stress test it a bit with i/o of all sorts.

Please let me know.

PS: I'm not sure if this patch is relevant for configs where pci is
passed through in domUs.

More patches coming soon.

Many thanks.

-- 
~cherry

# HG changeset patch
# User Cherry G. Mathew <cherry%NetBSD.org@localhost>
# Date 1535365493 0
#      Mon Aug 27 10:24:53 2018 +0000
# Branch cherry-xen
# Node ID 6ae998799191511838071e5c522750d2643bf622
# Parent  e8efcad62fc75cb00dd537bd7044ba0d16eac22f
[mq]: 0001-clean-isa_intr_establish_xname-of-XEN

diff -r e8efcad62fc7 -r 6ae998799191 sys/arch/x86/isa/isa_machdep.c
--- a/sys/arch/x86/isa/isa_machdep.c	Wed Aug 22 14:12:30 2018 +0000
+++ b/sys/arch/x86/isa/isa_machdep.c	Mon Aug 27 10:24:53 2018 +0000
@@ -237,31 +237,8 @@
 			printf("isa_intr_establish: no MP mapping found\n");
 	}
 #endif
-#if defined(XEN)
-	KASSERT(APIC_IRQ_ISLEGACY(irq));
-
-	int evtch;
-	const char *intrstr;
-	char intrstr_buf[INTRIDBUF];
-
-	mpih |= APIC_IRQ_LEGACY_IRQ(irq);
-
-	evtch = xen_pirq_alloc(&mpih, type); /* XXX: legacy - xen just tosses irq back at us */
-	if (evtch == -1)
-		return NULL;
-
-	intrstr = intr_create_intrid(irq, pic, pin, intrstr_buf,
-	    sizeof(intrstr_buf));
-
-	aprint_debug("irq: %d requested on pic: %s.\n", irq, pic->pic_name);
-
-	return (void *)pirq_establish(irq, evtch, ih_fun, ih_arg, level,
-	    intrstr, xname);
-#else /* defined(XEN) */
 	return intr_establish_xname(irq, pic, pin, type, level, ih_fun, ih_arg,
 	    false, xname);
-#endif
-
 }
 
 /* Deregister an interrupt handler. */
diff -r e8efcad62fc7 -r 6ae998799191 sys/arch/x86/x86/intr.c
--- a/sys/arch/x86/x86/intr.c	Wed Aug 22 14:12:30 2018 +0000
+++ b/sys/arch/x86/x86/intr.c	Mon Aug 27 10:24:53 2018 +0000
@@ -1266,15 +1266,18 @@
 	intr_handle_t irq;
 	int evtchn;
 
-	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < 16),
+	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < 256),
 	    "bad legacy IRQ value: %d", legacy_irq);
 	KASSERTMSG(!(legacy_irq == -1 && pic == &i8259_pic),
 	    "non-legacy IRQon i8259 ");
 
 	if (pic->pic_type != PIC_I8259) {
 #if NIOAPIC > 0
+		/* Are we passing mp tranmogrified/cascaded irqs ? */
+		irq = (legacy_irq == -1) ? 0 : legacy_irq;
+
 		/* will do interrupts via I/O APIC */
-		irq = APIC_INT_VIA_APIC;
+		irq |= APIC_INT_VIA_APIC;
 		irq |= pic->pic_apicid << APIC_INT_APIC_SHIFT;
 		irq |= pin << APIC_INT_PIN_SHIFT;
 #else /* NIOAPIC */


Home | Main Index | Thread Index | Old Index