Re: [PATCH] Allow system to allocate IRQ 0 to ATA devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

On 25.10.2018 8:50, Chaohong guo wrote:

Interrupt vector 0 can be used on some platform. In libata, the routine
ata_host_activate() doesn't consider irq=0 as invalid.

   Hm, actually it does...

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. This
is perfectly legal. Moreover most ATA drivers will check if irq < 0 or
irq == -1.

Signed-off-by: Chaohong guo <chaohong.guo@xxxxxxxxx>
---
 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(-)

[...]
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)

Ugh, this code was buggy. Thanks for fixing! Perhaps worth a separate patch though...

 		irq_handler = arasan_cf_interrupt;
 	else
 		quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA;
[...]
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)

   Was buggy as well...

 		irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);

 	/* Setup expansion bus chip selects */

MBR, Sergei




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux