|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] VT-d: bind IRQs to CPUs local to the node the IOMMU is on
# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1323772737 -3600
# Node ID eea4fdb356bedf410e2e7dbe4428dbf5c4efc6f6
# Parent 63a79abb84e030559536d5868e611a0805d01c51
VT-d: bind IRQs to CPUs local to the node the IOMMU is on
This extends create_irq() to take a node parameter, allowing the
resulting IRQ to have its destination set to a CPU on that node right
away, which is more natural than having to post-adjust this (and
get e.g. a new IRQ vector assigned despite a fresh one was just
obtained).
All other callers of create_irq() pass NUMA_NO_NODE for the time being.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---
diff -r 63a79abb84e0 -r eea4fdb356be xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c Tue Dec 13 11:36:35 2011 +0100
+++ b/xen/arch/x86/hpet.c Tue Dec 13 11:38:57 2011 +0100
@@ -11,6 +11,7 @@
#include <xen/smp.h>
#include <xen/softirq.h>
#include <xen/irq.h>
+#include <xen/numa.h>
#include <asm/fixmap.h>
#include <asm/div64.h>
#include <asm/hpet.h>
@@ -334,7 +335,7 @@
{
int irq;
- if ( (irq = create_irq()) < 0 )
+ if ( (irq = create_irq(NUMA_NO_NODE)) < 0 )
return irq;
if ( hpet_setup_msi_irq(irq, hpet_events + idx) )
diff -r 63a79abb84e0 -r eea4fdb356be xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c Tue Dec 13 11:36:35 2011 +0100
+++ b/xen/arch/x86/io_apic.c Tue Dec 13 11:38:57 2011 +0100
@@ -995,7 +995,7 @@
continue;
if (IO_APIC_IRQ(irq)) {
- vector = assign_irq_vector(irq);
+ vector = assign_irq_vector(irq, NULL);
BUG_ON(vector < 0);
entry.vector = vector;
ioapic_register_intr(irq, IOAPIC_AUTO);
@@ -2188,7 +2188,7 @@
if (!platform_legacy_irq(irq))
add_pin_to_irq(irq, ioapic, pin);
- vector = assign_irq_vector(irq);
+ vector = assign_irq_vector(irq, NULL);
if (vector < 0)
return vector;
entry.vector = vector;
@@ -2340,7 +2340,7 @@
if ( desc->arch.vector <= 0 || desc->arch.vector > LAST_DYNAMIC_VECTOR ) {
add_pin_to_irq(irq, apic, pin);
- vector = assign_irq_vector(irq);
+ vector = assign_irq_vector(irq, NULL);
if ( vector < 0 )
return vector;
diff -r 63a79abb84e0 -r eea4fdb356be xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c Tue Dec 13 11:36:35 2011 +0100
+++ b/xen/arch/x86/irq.c Tue Dec 13 11:38:57 2011 +0100
@@ -151,7 +151,7 @@
/*
* Dynamic irq allocate and deallocation for MSI
*/
-int create_irq(void)
+int create_irq(int node)
{
int irq, ret;
struct irq_desc *desc;
@@ -168,7 +168,17 @@
ret = init_one_irq_desc(desc);
if (!ret)
- ret = assign_irq_vector(irq);
+ {
+ cpumask_t *mask = NULL;
+
+ if (node != NUMA_NO_NODE && node >= 0)
+ {
+ mask = &node_to_cpumask(node);
+ if (cpumask_empty(mask))
+ mask = NULL;
+ }
+ ret = assign_irq_vector(irq, mask);
+ }
if (ret < 0)
{
desc->arch.used = IRQ_UNUSED;
@@ -514,7 +524,7 @@
return err;
}
-int assign_irq_vector(int irq)
+int assign_irq_vector(int irq, const cpumask_t *mask)
{
int ret;
unsigned long flags;
@@ -523,7 +533,7 @@
BUG_ON(irq >= nr_irqs || irq <0);
spin_lock_irqsave(&vector_lock, flags);
- ret = __assign_irq_vector(irq, desc, TARGET_CPUS);
+ ret = __assign_irq_vector(irq, desc, mask ?: TARGET_CPUS);
if (!ret) {
ret = desc->arch.vector;
cpumask_copy(desc->affinity, desc->arch.cpu_mask);
diff -r 63a79abb84e0 -r eea4fdb356be xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c Tue Dec 13 11:36:35 2011 +0100
+++ b/xen/arch/x86/physdev.c Tue Dec 13 11:38:57 2011 +0100
@@ -132,7 +132,7 @@
case MAP_PIRQ_TYPE_MSI:
irq = *index;
if ( irq == -1 )
- irq = create_irq();
+ irq = create_irq(NUMA_NO_NODE);
if ( irq < 0 || irq >= nr_irqs )
{
diff -r 63a79abb84e0 -r eea4fdb356be xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c Tue Dec 13 11:36:35 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c Tue Dec 13 11:38:57 2011 +0100
@@ -551,7 +551,7 @@
{
int irq, ret;
- irq = create_irq();
+ irq = create_irq(NUMA_NO_NODE);
if ( irq <= 0 )
{
dprintk(XENLOG_ERR, "IOMMU: no irqs\n");
diff -r 63a79abb84e0 -r eea4fdb356be xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c Tue Dec 13 11:36:35 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c Tue Dec 13 11:38:57 2011 +0100
@@ -1096,11 +1096,13 @@
.set_affinity = dma_msi_set_affinity,
};
-static int __init iommu_set_interrupt(struct iommu *iommu)
+static int __init iommu_set_interrupt(struct acpi_drhd_unit *drhd)
{
int irq, ret;
+ struct acpi_rhsa_unit *rhsa = drhd_to_rhsa(drhd);
- irq = create_irq();
+ irq = create_irq(rhsa ? pxm_to_node(rhsa->proximity_domain)
+ : NUMA_NO_NODE);
if ( irq <= 0 )
{
dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no irq available!\n");
@@ -1109,9 +1111,9 @@
irq_desc[irq].handler = &dma_msi_type;
#ifdef CONFIG_X86
- ret = request_irq(irq, iommu_page_fault, 0, "dmar", iommu);
+ ret = request_irq(irq, iommu_page_fault, 0, "dmar", drhd->iommu);
#else
- ret = request_irq_vector(irq, iommu_page_fault, 0, "dmar", iommu);
+ ret = request_irq_vector(irq, iommu_page_fault, 0, "dmar", drhd->iommu);
#endif
if ( ret )
{
@@ -2133,7 +2135,7 @@
if ( !vtd_ept_page_compatible(iommu) )
iommu_hap_pt_share = 0;
- ret = iommu_set_interrupt(iommu);
+ ret = iommu_set_interrupt(drhd);
if ( ret < 0 )
{
dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: interrupt setup failed\n");
diff -r 63a79abb84e0 -r eea4fdb356be xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h Tue Dec 13 11:36:35 2011 +0100
+++ b/xen/include/asm-x86/io_apic.h Tue Dec 13 11:38:57 2011 +0100
@@ -213,9 +213,6 @@
static inline void ioapic_resume(void) {}
#endif
-extern int assign_irq_vector(int irq);
-extern int free_irq_vector(int vector);
-
unsigned highest_gsi(void);
int ioapic_guest_read( unsigned long physbase, unsigned int reg, u32 *pval);
diff -r 63a79abb84e0 -r eea4fdb356be xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h Tue Dec 13 11:36:35 2011 +0100
+++ b/xen/include/asm-x86/irq.h Tue Dec 13 11:38:57 2011 +0100
@@ -155,8 +155,9 @@
void clear_irq_vector(int irq);
int irq_to_vector(int irq);
-int create_irq(void);
+int create_irq(int node);
void destroy_irq(unsigned int irq);
+int assign_irq_vector(int irq, const cpumask_t *);
extern void irq_complete_move(struct irq_desc *);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |