diff mbox series

[libata,v2] Allow system to allocate IRQ 0 to ATA devices

Message ID 20181102014608.21823-1-chaohong.guo@intel.com
State Not Applicable
Delegated to: David Miller
Headers show
Series [libata,v2] Allow system to allocate IRQ 0 to ATA devices | expand

Commit Message

Guo, Chaohong Nov. 2, 2018, 1:46 a.m. UTC
Interrupt vector 0 can be used on some platform. In libata, the routine
ata_host_activate() considers irq=0 as invalid. As a result, when running
linux in non-root cell of Jailhouse,  if we allocate just one PCI ATA
device to the guest, the device will get an IRQ of value 0. Although IRQ0
is perfectly legal, ATA device will fail to start up. Besides, some ATA
drivers have the same bug and consider irq0 as invalid, So, we fix them as
well.

Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
 drivers/ata/libata-core.c    | 2 +-
 drivers/ata/pata_arasan_cf.c | 4 ++--
 drivers/ata/pata_falcon.c    | 2 +-
 drivers/ata/pata_ixp4xx_cf.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

Comments

Sergei Shtylyov Nov. 4, 2018, 4:39 p.m. UTC | #1
Hello!

On 11/2/2018 4:46 AM, Chaohong guo wrote:

> Interrupt vector 0 can be used on some platform. In libata, the routine
> ata_host_activate() considers irq=0 as invalid. As a result, when running
> linux in non-root cell of Jailhouse,  if we allocate just one PCI ATA
> device to the guest, the device will get an IRQ of value 0. Although IRQ0
> is perfectly legal, ATA device will fail to start up. Besides, some ATA
> drivers have the same bug and consider irq0 as invalid, So, we fix them as
> well.
> 
> Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
> Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

    I haven't explicitly given you my Reviewed-by: tag, you can't add it
just because I commented to your patch.

MBR, Sergei
Guo, Chaohong Nov. 6, 2018, 2:29 a.m. UTC | #2
Sorry for putting u into the reviewed-by before getting your ack.   I will split this patch and re-send it. 

-chaohong 

> -----Original Message-----
> From: Sergei Shtylyov [mailto:sergei.shtylyov@cogentembedded.com]
> Sent: Monday, November 5, 2018 12:40 AM
> To: Guo, Chaohong <chaohong.guo@intel.com>; linux-ide@vger.kernel.org
> Subject: Re: [PATCH libata v2] Allow system to allocate IRQ 0 to ATA devices
> 
> Hello!
> 
> On 11/2/2018 4:46 AM, Chaohong guo wrote:
> 
> > Interrupt vector 0 can be used on some platform. In libata, the
> > routine
> > ata_host_activate() considers irq=0 as invalid. As a result, when
> > running linux in non-root cell of Jailhouse,  if we allocate just one
> > PCI ATA device to the guest, the device will get an IRQ of value 0.
> > Although IRQ0 is perfectly legal, ATA device will fail to start up.
> > Besides, some ATA drivers have the same bug and consider irq0 as
> > invalid, So, we fix them as well.
> >
> > Signed-off-by: Chaohong guo <chaohong.guo@intel.com>
> > Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
>     I haven't explicitly given you my Reviewed-by: tag, you can't add it just
> because I commented to your patch.
> 
> MBR, Sergei
diff mbox series

Patch

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index a9dd4ea7467d..d83ba91c5051 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6628,7 +6628,7 @@  int ata_host_activate(struct ata_host *host, int irq,
 		return rc;
 
 	/* Special case for polling mode */
-	if (!irq) {
+	if (irq < 0) {
 		WARN_ON(irq_handler);
 		return ata_host_register(host, sht);
 	}
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index ebecab8c3f36..133c7466a875 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -817,9 +817,9 @@  static int arasan_cf_probe(struct platform_device *pdev)
 	else
 		quirk = CF_BROKEN_UDMA; /* as it is on spear1340 */
 
-	/* if irq is 0, support only PIO */
+	/* if irq < 0, support only PIO */
 	acdev->irq = platform_get_irq(pdev, 0);
-	if (acdev->irq)
+	if (acdev->irq >= 0)
 		irq_handler = arasan_cf_interrupt;
 	else
 		quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA;
diff --git a/drivers/ata/pata_falcon.c b/drivers/ata/pata_falcon.c
index 41e0d6a6cd05..94407e3e2a70 100644
--- a/drivers/ata/pata_falcon.c
+++ b/drivers/ata/pata_falcon.c
@@ -171,7 +171,7 @@  static int pata_falcon_init_one(void)
 		      (unsigned long)base + ATA_HD_CONTROL);
 
 	/* activate */
-	return ata_host_activate(host, 0, NULL, 0, &pata_falcon_sht);
+	return ata_host_activate(host, -1 , NULL, 0, &pata_falcon_sht);
 }
 
 module_init(pata_falcon_init_one);
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index 0b0d93065f5a..303337d1c1f7 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -169,7 +169,7 @@  static int ixp4xx_pata_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq)
+	if (irq >= 0)
 		irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
 
 	/* Setup expansion bus chip selects */