Bastian Blank
2010-Mar-24 11:54 UTC
[Xen-devel] [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. Signed-off-by: Bastian Blank <waldi@debian.org> --- arch/x86/include/asm/xen/pci.h | 1 + arch/x86/xen/pci.c | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h index d68637f..6286bbb 100644 --- a/arch/x86/include/asm/xen/pci.h +++ b/arch/x86/include/asm/xen/pci.h @@ -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); diff --git a/arch/x86/xen/pci.c b/arch/x86/xen/pci.c index eabb512..3e95f76 100644 --- a/arch/x86/xen/pci.c +++ b/arch/x86/xen/pci.c @@ -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(); -- 1.7.0 -- Sometimes a feeling is all we humans have to go on. -- Kirk, "A Taste of Armageddon", stardate 3193.9 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jeremy Fitzhardinge
2010-Mar-24 17:54 UTC
Re: [Xen-devel] [PATCH 3/3] xen: Don''t register GSI in pre-setup
On 03/24/2010 04:54 AM, Bastian Blank wrote:> 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> Signed-off-by: Bastian Blank<waldi@debian.org> > --- > arch/x86/include/asm/xen/pci.h | 1 + > arch/x86/xen/pci.c | 31 ++++++++++++++++++++++--------- > 2 files changed, 23 insertions(+), 9 deletions(-) > > diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h > index d68637f..6286bbb 100644 > --- a/arch/x86/include/asm/xen/pci.h > +++ b/arch/x86/include/asm/xen/pci.h > @@ -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); > diff --git a/arch/x86/xen/pci.c b/arch/x86/xen/pci.c > index eabb512..3e95f76 100644 > --- a/arch/x86/xen/pci.c > +++ b/arch/x86/xen/pci.c > @@ -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(); >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Bastian Blank
2010-Mar-24 22:54 UTC
Re: [Xen-devel] [PATCH 3/3] xen: Don''t register GSI in pre-setup
On Wed, Mar 24, 2010 at 10:54:27AM -0700, Jeremy Fitzhardinge wrote:> On 03/24/2010 04:54 AM, Bastian Blank wrote: >> 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.> 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 -- A Vulcan can no sooner be disloyal than he can exist without breathing. -- Kirk, "The Menagerie", stardate 3012.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel