linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] x86/irq related fix
@ 2012-01-27  7:25 Yinghai Lu
  2012-01-27  7:25 ` [PATCH 1/7] x86, irq: Modify irq chip one time when irq remapping is enabled Yinghai Lu
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Yinghai Lu @ 2012-01-27  7:25 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: linux-kernel, Yinghai Lu

small cleanup with io_apic.c

e807126: x86, irq: kill create_irq()
6a4e909: iommu, irq: alloc irq_desc for dmar_msi with local node
5e6f66d: ia64, irq: add dummy create_irq_nr()
cbe7558: x86, irq: Make dmar_msi/hpet_msi irq_chip name consistent
b567f4c: x86, irq: Let msi-x to shown as MSI-X in /proc/interrupt
303205f: x86, irq: more clear about msix printout
c102aca: x86, irq: Modify irq chip one time when irq remapping is enabled

 arch/ia64/kernel/irq_ia64.c    |   10 +++++++
 arch/x86/include/asm/io_apic.h |    2 +
 arch/x86/kernel/apic/apic.c    |    9 +++++-
 arch/x86/kernel/apic/io_apic.c |   59 +++++++++++++++++++++++-----------------
 drivers/iommu/dmar.c           |    2 +-
 5 files changed, 55 insertions(+), 27 deletions(-)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] x86, irq: Modify irq chip one time when irq remapping is enabled
  2012-01-27  7:25 [PATCH 0/7] x86/irq related fix Yinghai Lu
@ 2012-01-27  7:25 ` Yinghai Lu
  2012-01-27  7:25 ` [PATCH 2/7] x86, irq: more clear about msix printout Yinghai Lu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2012-01-27  7:25 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: linux-kernel, Yinghai Lu, Suresh Siddha

So we don't need change irq chip during every irq setup.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
---
 arch/x86/include/asm/io_apic.h |    2 ++
 arch/x86/kernel/apic/apic.c    |    9 ++++++++-
 arch/x86/kernel/apic/io_apic.c |   23 +++++++++++++++++------
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 690d1cc..142a6b9 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -176,6 +176,8 @@ extern void mp_save_irq(struct mpc_intsrc *m);
 
 extern void disable_ioapic_support(void);
 
+void irq_remap_modify_chips(void);
+
 #else  /* !CONFIG_X86_IO_APIC */
 
 #define io_apic_assign_pci_irqs 0
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 2eec05b..87aa884 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1512,6 +1512,8 @@ void enable_x2apic(void)
 int __init enable_IR(void)
 {
 #ifdef CONFIG_IRQ_REMAP
+	int ret;
+
 	if (!intr_remapping_supported()) {
 		pr_debug("intr-remapping not supported\n");
 		return -1;
@@ -1523,7 +1525,12 @@ int __init enable_IR(void)
 		return -1;
 	}
 
-	return enable_intr_remapping();
+	ret = enable_intr_remapping();
+
+	if (ret >= 0)
+		irq_remap_modify_chips();
+
+	return ret;
 #endif
 	return -1;
 }
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index fb07275..e4ee9bc 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1313,7 +1313,6 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg,
 
 	if (irq_remapped(cfg)) {
 		irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
-		irq_remap_modify_chip_defaults(chip);
 		fasteoi = trigger != 0;
 	}
 
@@ -2634,6 +2633,8 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
 
 static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
 {
+	apic_printk(APIC_DEBUG, KERN_DEBUG "irq_chip: %s ==> IR-%s",
+			 chip->name, chip->name);
 	chip->irq_print_chip = ir_print_prefix;
 	chip->irq_ack = ir_ack_apic_edge;
 	chip->irq_eoi = ir_ack_apic_level;
@@ -3268,10 +3269,8 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
 	irq_set_msi_desc(irq, msidesc);
 	write_msi_msg(irq, &msg);
 
-	if (irq_remapped(irq_get_chip_data(irq))) {
+	if (irq_remapped(irq_get_chip_data(irq)))
 		irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
-		irq_remap_modify_chip_defaults(chip);
-	}
 
 	irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
 
@@ -3459,8 +3458,6 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
 
 	hpet_msi_write(irq_get_handler_data(irq), &msg);
 	irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
-	if (irq_remapped(irq_get_chip_data(irq)))
-		irq_remap_modify_chip_defaults(chip);
 
 	irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
 	return 0;
@@ -3468,6 +3465,20 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
 #endif
 
 #endif /* CONFIG_PCI_MSI */
+
+void irq_remap_modify_chips(void)
+{
+#ifdef CONFIG_IRQ_REMAP
+	irq_remap_modify_chip_defaults(&ioapic_chip);
+# ifdef CONFIG_PCI_MSI
+	irq_remap_modify_chip_defaults(&msi_chip);
+#  ifdef CONFIG_HPET_TIMER
+	irq_remap_modify_chip_defaults(&hpet_msi_type);
+#  endif
+# endif
+#endif
+}
+
 /*
  * Hypertransport interrupt support
  */
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] x86, irq: more clear about msix printout
  2012-01-27  7:25 [PATCH 0/7] x86/irq related fix Yinghai Lu
  2012-01-27  7:25 ` [PATCH 1/7] x86, irq: Modify irq chip one time when irq remapping is enabled Yinghai Lu
@ 2012-01-27  7:25 ` Yinghai Lu
  2012-01-27  7:25 ` [PATCH 3/7] x86, irq: Let msi-x to shown as MSI-X in /proc/interrupt Yinghai Lu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2012-01-27  7:25 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: linux-kernel, Yinghai Lu, Suresh Siddha

Print out exact MSI or MSI-X instead of MSI/MSI-X

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
---
 arch/x86/kernel/apic/io_apic.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index e4ee9bc..f5c77ff 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3274,7 +3274,8 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
 
 	irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
 
-	dev_printk(KERN_DEBUG, &dev->dev, "irq %d for MSI/MSI-X\n", irq);
+	dev_printk(KERN_DEBUG, &dev->dev, "irq %d for MSI%s\n", irq,
+			 msidesc->msi_attrib.is_msix ? "-X" : "");
 
 	return 0;
 }
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] x86, irq: Let msi-x to shown as MSI-X in /proc/interrupt
  2012-01-27  7:25 [PATCH 0/7] x86/irq related fix Yinghai Lu
  2012-01-27  7:25 ` [PATCH 1/7] x86, irq: Modify irq chip one time when irq remapping is enabled Yinghai Lu
  2012-01-27  7:25 ` [PATCH 2/7] x86, irq: more clear about msix printout Yinghai Lu
@ 2012-01-27  7:25 ` Yinghai Lu
  2012-01-27  7:25 ` [PATCH 4/7] x86, irq: Make dmar_msi/hpet_msi irq_chip name consistent Yinghai Lu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2012-01-27  7:25 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: linux-kernel, Yinghai Lu, Suresh Siddha

Use new added irq_print_chip() to append -X after MSI for msi-x.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
---
 arch/x86/kernel/apic/io_apic.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index f5c77ff..52618ad 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2628,7 +2628,10 @@ static void ir_ack_apic_level(struct irq_data *data)
 
 static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
 {
-	seq_printf(p, " IR-%s", data->chip->name);
+	seq_printf(p, " IR-%s%s", data->chip->name,
+			data->msi_desc ?
+			 (data->msi_desc->msi_attrib.is_msix ? "-X" : "")
+			 : "");
 }
 
 static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
@@ -3214,6 +3217,14 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)
 }
 #endif /* CONFIG_SMP */
 
+static void msi_irq_print_chip(struct irq_data *data, struct seq_file *p)
+{
+	seq_printf(p, " %s%s", data->chip->name,
+			data->msi_desc ?
+			 (data->msi_desc->msi_attrib.is_msix ? "-X" : "")
+			 : "");
+}
+
 /*
  * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices,
  * which implement the MSI or MSI-X Capability Structure.
@@ -3227,6 +3238,7 @@ static struct irq_chip msi_chip = {
 	.irq_set_affinity	= msi_set_affinity,
 #endif
 	.irq_retrigger		= ioapic_retrigger_irq,
+	.irq_print_chip		= msi_irq_print_chip,
 };
 
 /*
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] x86, irq: Make dmar_msi/hpet_msi irq_chip name consistent
  2012-01-27  7:25 [PATCH 0/7] x86/irq related fix Yinghai Lu
                   ` (2 preceding siblings ...)
  2012-01-27  7:25 ` [PATCH 3/7] x86, irq: Let msi-x to shown as MSI-X in /proc/interrupt Yinghai Lu
@ 2012-01-27  7:25 ` Yinghai Lu
  2012-01-27  7:25 ` [PATCH 5/7] ia64, irq: add dummy create_irq_nr() Yinghai Lu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2012-01-27  7:25 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: linux-kernel, Yinghai Lu, Suresh Siddha

all others are using - instead _.

Change those to use - too.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
---
 arch/x86/kernel/apic/io_apic.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 52618ad..cb8c43d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3384,7 +3384,7 @@ dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
 #endif /* CONFIG_SMP */
 
 static struct irq_chip dmar_msi_type = {
-	.name			= "DMAR_MSI",
+	.name			= "DMAR-MSI",
 	.irq_unmask		= dmar_msi_unmask,
 	.irq_mask		= dmar_msi_mask,
 	.irq_ack		= ack_apic_edge,
@@ -3437,7 +3437,7 @@ static int hpet_msi_set_affinity(struct irq_data *data,
 #endif /* CONFIG_SMP */
 
 static struct irq_chip hpet_msi_type = {
-	.name = "HPET_MSI",
+	.name = "HPET-MSI",
 	.irq_unmask = hpet_msi_unmask,
 	.irq_mask = hpet_msi_mask,
 	.irq_ack = ack_apic_edge,
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] ia64, irq: add dummy create_irq_nr()
  2012-01-27  7:25 [PATCH 0/7] x86/irq related fix Yinghai Lu
                   ` (3 preceding siblings ...)
  2012-01-27  7:25 ` [PATCH 4/7] x86, irq: Make dmar_msi/hpet_msi irq_chip name consistent Yinghai Lu
@ 2012-01-27  7:25 ` Yinghai Lu
  2012-01-27  7:25 ` [PATCH 6/7] iommu, irq: alloc irq_desc for dmar_msi with local node Yinghai Lu
  2012-01-27  7:25 ` [PATCH 7/7] x86, irq: kill create_irq() Yinghai Lu
  6 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2012-01-27  7:25 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: linux-kernel, Yinghai Lu, Tony Luck, Fenghua Yu, linux-ia64

create_irq() will return -1 when fail to allocate.
create_irq_nr() will return 0 when fail to allocate.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
---
 arch/ia64/kernel/irq_ia64.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 782c3a35..07fcbdc 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -431,6 +431,16 @@ int create_irq(void)
 	return irq;
 }
 
+unsigned int create_irq_nr(unsigned int from, int node)
+{
+	int irq = create_irq();
+
+	if (irq < 0)
+		irq = 0;
+
+	return irq;
+}
+
 void destroy_irq(unsigned int irq)
 {
 	dynamic_irq_cleanup(irq);
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] iommu, irq: alloc irq_desc for dmar_msi with local node
  2012-01-27  7:25 [PATCH 0/7] x86/irq related fix Yinghai Lu
                   ` (4 preceding siblings ...)
  2012-01-27  7:25 ` [PATCH 5/7] ia64, irq: add dummy create_irq_nr() Yinghai Lu
@ 2012-01-27  7:25 ` Yinghai Lu
  2012-01-27  7:25 ` [PATCH 7/7] x86, irq: kill create_irq() Yinghai Lu
  6 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2012-01-27  7:25 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: linux-kernel, Yinghai Lu

Also fix the return value checking problem.

create_irq() will return -1 when fail to allocate.
create_irq_nr() will return 0 when fail to allocate.

here only check !irq, so need to change it to create_irq_nr.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 drivers/iommu/dmar.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 35c1e17..c6e9b1a 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1221,7 +1221,7 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
 	if (iommu->irq)
 		return 0;
 
-	irq = create_irq();
+	irq = create_irq_nr(0, iommu->node);
 	if (!irq) {
 		printk(KERN_ERR "IOMMU: no free vectors\n");
 		return -EINVAL;
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] x86, irq: kill create_irq()
  2012-01-27  7:25 [PATCH 0/7] x86/irq related fix Yinghai Lu
                   ` (5 preceding siblings ...)
  2012-01-27  7:25 ` [PATCH 6/7] iommu, irq: alloc irq_desc for dmar_msi with local node Yinghai Lu
@ 2012-01-27  7:25 ` Yinghai Lu
  6 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2012-01-27  7:25 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: linux-kernel, Yinghai Lu, Suresh Siddha

create_irq() will return -1 when fail to allocate.
create_irq_nr() will return 0 when fail to allocate.

it only causes confusing.

And now we don't have user for create_irq().

So remove create_irq() for x86.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
---
 arch/x86/kernel/apic/io_apic.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index cb8c43d..4bda08d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3090,21 +3090,6 @@ unsigned int create_irq_nr(unsigned int from, int node)
 	return ret;
 }
 
-int create_irq(void)
-{
-	int node = cpu_to_node(0);
-	unsigned int irq_want;
-	int irq;
-
-	irq_want = nr_irqs_gsi;
-	irq = create_irq_nr(irq_want, node);
-
-	if (irq == 0)
-		irq = -1;
-
-	return irq;
-}
-
 void destroy_irq(unsigned int irq)
 {
 	struct irq_cfg *cfg = irq_get_chip_data(irq);
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-27  7:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27  7:25 [PATCH 0/7] x86/irq related fix Yinghai Lu
2012-01-27  7:25 ` [PATCH 1/7] x86, irq: Modify irq chip one time when irq remapping is enabled Yinghai Lu
2012-01-27  7:25 ` [PATCH 2/7] x86, irq: more clear about msix printout Yinghai Lu
2012-01-27  7:25 ` [PATCH 3/7] x86, irq: Let msi-x to shown as MSI-X in /proc/interrupt Yinghai Lu
2012-01-27  7:25 ` [PATCH 4/7] x86, irq: Make dmar_msi/hpet_msi irq_chip name consistent Yinghai Lu
2012-01-27  7:25 ` [PATCH 5/7] ia64, irq: add dummy create_irq_nr() Yinghai Lu
2012-01-27  7:25 ` [PATCH 6/7] iommu, irq: alloc irq_desc for dmar_msi with local node Yinghai Lu
2012-01-27  7:25 ` [PATCH 7/7] x86, irq: kill create_irq() Yinghai Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).