diff mbox

pci/intr_remapping: allocate irq_iommu on node -v2

Message ID 4A80E2E2.5000208@kernel.org (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Yinghai Lu Aug. 11, 2009, 3:17 a.m. UTC
make it use node from irq_desc.

also need to make sure legacy irq node is right, when there is no ram on node 0

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 drivers/pci/intr_remapping.c |   10 +++++++++-
 kernel/irq/handle.c          |    5 ++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Ingo Molnar Aug. 11, 2009, 7:34 a.m. UTC | #1
* Yinghai Lu <yinghai@kernel.org> wrote:

>  static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
>  {
> -	return irq_2_iommu_alloc_node(irq, cpu_to_node(boot_cpu_id));
> +	int node;
> +
> +#ifdef CONFIG_SMP
> +	node = irq_to_desc(irq)->node;
> +#else
> +	node = cpu_to_node(boot_cpu_id);
> +#endif
> +
> +	return irq_2_iommu_alloc_node(irq, node);
>  }

To avoid the ifdef, shouldnt there be an new irq_node(irq) primitive 
that maps to desc->node on SMP and does the right thing on UP?

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: linux-2.6/drivers/pci/intr_remapping.c
===================================================================
--- linux-2.6.orig/drivers/pci/intr_remapping.c
+++ linux-2.6/drivers/pci/intr_remapping.c
@@ -79,7 +79,15 @@  static struct irq_2_iommu *irq_2_iommu_a
 
 static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq)
 {
-	return irq_2_iommu_alloc_node(irq, cpu_to_node(boot_cpu_id));
+	int node;
+
+#ifdef CONFIG_SMP
+	node = irq_to_desc(irq)->node;
+#else
+	node = cpu_to_node(boot_cpu_id);
+#endif
+
+	return irq_2_iommu_alloc_node(irq, node);
 }
 
 #else /* !CONFIG_SPARSE_IRQ */
Index: linux-2.6/kernel/irq/handle.c
===================================================================
--- linux-2.6.orig/kernel/irq/handle.c
+++ linux-2.6/kernel/irq/handle.c
@@ -161,7 +161,7 @@  int __init early_irq_init(void)
 
 	desc = irq_desc_legacy;
 	legacy_count = ARRAY_SIZE(irq_desc_legacy);
- 	node = first_online_node;
+	node = first_online_node;
 
 	/* allocate irq_desc_ptrs array based on nr_irqs */
 	irq_desc_ptrs = kcalloc(nr_irqs, sizeof(void *), GFP_NOWAIT);
@@ -172,6 +172,9 @@  int __init early_irq_init(void)
 
 	for (i = 0; i < legacy_count; i++) {
 		desc[i].irq = i;
+#ifdef CONFIG_SMP
+		desc[i].node = node;
+#endif
 		desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids;
 		lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
 		alloc_desc_masks(&desc[i], node, true);