Skip to contentSkip to conversation

xen: Don't register GSI in pre-setup

PATCH In review Bastian Blank 2 participants 3 messages Mar 24, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 xen: Don't register GSI in pre-setup

Xen behaves the same way that native Linux, it only allows any IO-APIC pin to be setup once. Therefor we must not set it up in the initial run over all legacy interrupts.

---
 arch/x86/include/asm/xen/pci.h |    1 +
 arch/x86/xen/pci.c             |   31 ++++++++++++++++++++++---------
 2 files changed, 23 insertions(+), 9 deletions(-)
arch/x86/include/asm/xen/pci.h +1 -0
index d68637f..6286bbb 100644
@@ -64,6 +64,7 @@ static inline int xen_pci_setup_msi_irqs(struct pci_dev *dev, int nvec, int type
 #endif /* CONFIG_PCI_MSI */
 
 #ifdef CONFIG_XEN_DOM0_PCI
+int xen_register_pirq(u32 gsi, int triggering);
 int xen_register_gsi(u32 gsi, int triggering, int polarity);
 int xen_find_device_domain_owner(struct pci_dev *dev);
 int xen_register_device_domain_owner(struct pci_dev *dev, uint16_t domain);
arch/x86/xen/pci.c +22 -9
index eabb512..3e95f76 100644
@@ -16,10 +16,9 @@
 
 #include "xen-ops.h"
 
-int xen_register_gsi(u32 gsi, int triggering, int polarity)
+int xen_register_pirq(u32 gsi, int triggering)
 {
 	int rc, irq;
-	struct physdev_setup_gsi setup_gsi;
 	struct physdev_map_pirq map_irq;
 	int shareable = 0;
 	char *name;
@@ -27,9 +26,6 @@ int xen_register_gsi(u32 gsi, int triggering, int polarity)
 	if (!xen_domain())
 		return -1;
 
-	printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
-			gsi, triggering, polarity);
-
 	if (triggering == ACPI_EDGE_SENSITIVE) {
 		shareable = 0;
 		name = "ioapic-edge";
@@ -56,6 +52,25 @@ int xen_register_gsi(u32 gsi, int triggering, int polarity)
 		return -1;
 	}
 
+	return irq;
+}
+
+int xen_register_gsi(u32 gsi, int triggering, int polarity)
+{
+	int rc, irq;
+	struct physdev_setup_gsi setup_gsi;
+	struct physdev_map_pirq map_irq;
+	int shareable = 0;
+	char *name;
+
+	if (!xen_domain())
+		return -1;
+
+	printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
+			gsi, triggering, polarity);
+
+	irq = xen_register_pirq(gsi, triggering);
+
 	setup_gsi.gsi = gsi;
 	setup_gsi.triggering = (triggering == ACPI_EDGE_SENSITIVE ?
 			0 : 1);
@@ -67,7 +82,6 @@ int xen_register_gsi(u32 gsi, int triggering, int polarity)
 	else if (rc) {
 		printk(KERN_ERR "Failed to setup GSI :%d, err_code:%d\n",
 				gsi, rc);
-		BUG();
 	}
 
 	return irq;
@@ -181,9 +195,8 @@ void __init xen_setup_pirqs(void)
 		if (acpi_get_override_irq(irq, &trigger, &polarity) == -1)
 			continue;
 
-		xen_register_gsi(irq,
-			trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE,
-			polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH);
+		xen_register_pirq(irq,
+			trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE);
 	}
 
 	xen_setup_acpi_sci();
Signature · 6 lines
1.7.0


-- 
Sometimes a feeling is all we humans have to go on.
		-- Kirk, "A Taste of Armageddon", stardate 3193.9
#1 lore raw
Quoted 4 lines · Bastian Blank

Xen behaves the same way that native Linux, it only allows any IO-APIC pin to be setup once. Therefor we must not set it up in the initial run over all legacy interrupts.

Do you need both this patch and the Xen one to solve your problem, or is one or the other sufficient?

Is there any dependency between the Linux and Xen patches? (Doesn't look like it to me, but I just want to be sure.)

Thanks,
J

Quoted 91 lines
---
  arch/x86/include/asm/xen/pci.h |    1 +
  arch/x86/xen/pci.c             |   31 ++++++++++++++++++++++---------
  2 files changed, 23 insertions(+), 9 deletions(-)
arch/x86/include/asm/xen/pci.h +1 -0
index d68637f..6286bbb 100644
@@ -64,6 +64,7 @@ static inline int xen_pci_setup_msi_irqs(struct pci_dev *dev, int nvec, int type
  #endif /* CONFIG_PCI_MSI */
 
  #ifdef CONFIG_XEN_DOM0_PCI
+int xen_register_pirq(u32 gsi, int triggering);
  int xen_register_gsi(u32 gsi, int triggering, int polarity);
  int xen_find_device_domain_owner(struct pci_dev *dev);
  int xen_register_device_domain_owner(struct pci_dev *dev, uint16_t domain);
arch/x86/xen/pci.c +22 -9
index eabb512..3e95f76 100644
@@ -16,10 +16,9 @@
 
  #include "xen-ops.h"
 
-int xen_register_gsi(u32 gsi, int triggering, int polarity)
+int xen_register_pirq(u32 gsi, int triggering)
  {
  	int rc, irq;
-	struct physdev_setup_gsi setup_gsi;
  	struct physdev_map_pirq map_irq;
  	int shareable = 0;
  	char *name;
@@ -27,9 +26,6 @@ int xen_register_gsi(u32 gsi, int triggering, int polarity)
  	if (!xen_domain())
  		return -1;
 
-	printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
-			gsi, triggering, polarity);
-
  	if (triggering == ACPI_EDGE_SENSITIVE) {
  		shareable = 0;
  		name = "ioapic-edge";
@@ -56,6 +52,25 @@ int xen_register_gsi(u32 gsi, int triggering, int polarity)
  		return -1;
  	}
 
+	return irq;
+}
+
+int xen_register_gsi(u32 gsi, int triggering, int polarity)
+{
+	int rc, irq;
+	struct physdev_setup_gsi setup_gsi;
+	struct physdev_map_pirq map_irq;
+	int shareable = 0;
+	char *name;
+
+	if (!xen_domain())
+		return -1;
+
+	printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
+			gsi, triggering, polarity);
+
+	irq = xen_register_pirq(gsi, triggering);
+
  	setup_gsi.gsi = gsi;
  	setup_gsi.triggering = (triggering == ACPI_EDGE_SENSITIVE ?
  			0 : 1);
@@ -67,7 +82,6 @@ int xen_register_gsi(u32 gsi, int triggering, int polarity)
  	else if (rc) {
  		printk(KERN_ERR "Failed to setup GSI :%d, err_code:%d\n",
  				gsi, rc);
-		BUG();
  	}
 
  	return irq;
@@ -181,9 +195,8 @@ void __init xen_setup_pirqs(void)
  		if (acpi_get_override_irq(irq,&trigger,&polarity) == -1)
  			continue;
 
-		xen_register_gsi(irq,
-			trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE,
-			polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH);
+		xen_register_pirq(irq,
+			trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE);
  	}
 
  	xen_setup_acpi_sci();
#2 lore raw
Quoted 6 lines · Jeremy Fitzhardinge
Quoted 3 lines · Bastian Blank

Xen behaves the same way that native Linux, it only allows any IO-APIC pin to be setup once. Therefor we must not set it up in the initial run over all legacy interrupts.

Do you need both this patch and the Xen one to solve your problem, or is one or the other sufficient?

Both are needed.

Quoted 2 lines

Is there any dependency between the Linux and Xen patches? (Doesn't look like it to me, but I just want to be sure.)

Nope. Thats why the hypervisor patch returns EEXISTS instead of EBUSY. The later causes a BUG in current kernels, which is emited before the real console is setup and breaks the system.

Bastian

Signature · 2 lines
A Vulcan can no sooner be disloyal than he can exist without breathing.
		-- Kirk, "The Menagerie", stardate 3012.4