From: Ian Campbell Subject: Re: pv_ops dom0 kernel failure with ata_piix / irq problems Date: Fri, 30 Jan 2009 18:12:56 +0000 Message-ID: <1233339176.9970.44.camel@zakaz.uk.xensource.com> References: <495BE5E1.40602@goop.org> <20090102064444.GN15052@edu.joroinen.fi> <20090109174006.GR15052@edu.joroinen.fi> <20090122194645.GJ15052@edu.joroinen.fi> <4978D5BE.8090601@goop.org> <20090124140930.GP15052@edu.joroinen.fi> <20090124145844.GQ15052@edu.joroinen.fi> <497B64B8.5040709@goop.org> <20090124201702.GR15052@edu.joroinen.fi> <20090124234920.GS15052@edu.joroinen.fi> <497BB984.9080803@goop.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <497BB984.9080803@goop.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jeremy Fitzhardinge Cc: Todd Deshane , Andrew Lyon , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Sat, 2009-01-24 at 16:59 -0800, Jeremy Fitzhardinge wrote: > Pasi K=C3=A4rkk=C3=A4inen wrote: > > rc =3D devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), irq_handler, IRQF= _SHARED, drv_name, host); > > if (rc) > > goto out; > > > > and ports names never get assigned because that "goto out;" is execut= ed. > > > > So.. Any ideas why devm_request_irq() fails?=20 >=20 >=20 > Good question. Will need to pick through >=20 > Hm, wonder if its something to do with the handling of the legacy irqs: >=20 > ata_pci_sff_activate_host: pci_read_config_byte() > ata_pci_sff_activate_host: if (!devres_open_group(dev, NULL, GFP_KERNEL= )) > ata_pci_sff_activate_host: if (!legacy_mode && pdev->irq) > ata_pci_sff_activate_host: legacy_mode > ata_pci_sff_activate_host: port 0 not dummy: devm_request_irq() > ata_pci_sff_activate_host: non-legacy-mode irq: 30 > ata_pci_sff_activate_host: requesting ATA_PRIMARY_IRQ(pdev) irq: 14 > ata_pci_sff_activate_host: devm_request_irq() returned !=3D 0, goto out I see a similar failure to allocate IRQ 14 although in my case some other driver comes along and makes it work so I hadn't noticed until just now. In my case request_irq() was being called direct rather than via devm_request_irq and the return was -ENOSYS (it'd be interesting to know what !=3D 0 value was seen here). I followed this down to __setup_irq() which has: if (desc->chip =3D=3D &no_irq_chip) return -ENOSYS; So it looks like something expects there to already be a chip present for the legacy IRQ. For non-legacy IRQs I think we setup the chip through xen_pci_pirq_enable() -> xen_register_gsi() -> xen_allocate_pirq() -> set_irq_chip_and_handler_name(). Perhaps legacy IRQs do not (always) get explicitly enabled? This little hack made things work for me. Possibly the correct fix might be to use xen_register_gsi() here instead of xen_allocate_pirq() and get rid of the special case for IRQ 14 and 15 in xen_pci_pirq_enable(). Maybe only 14 and 15 need this special treatment. --- a/arch/x86/xen/pci.c Fri Jan 30 17:39:54 2009 +0000 +++ b/arch/x86/xen/pci.c Fri Jan 30 18:08:36 2009 +0000 @@ -133,4 +133,7 @@ /* Blerk. */ acpi_gbl_FADT.sci_interrupt =3D irq; #endif + + for (irq =3D 0 ; irq < 16 ; irq ++) + xen_allocate_pirq(irq); }