From patchwork Thu Oct 25 05:50:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Chaohong" X-Patchwork-Id: 988903 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42gbnM6XRVz9sBk for ; Thu, 25 Oct 2018 16:50:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726865AbeJYOVX (ORCPT ); Thu, 25 Oct 2018 10:21:23 -0400 Received: from mga03.intel.com ([134.134.136.65]:17484 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726633AbeJYOVX (ORCPT ); Thu, 25 Oct 2018 10:21:23 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 22:50:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,423,1534834800"; d="scan'208";a="83997420" Received: from minskey-desktop.bj.intel.com ([10.238.144.127]) by orsmga007.jf.intel.com with ESMTP; 24 Oct 2018 22:50:11 -0700 From: Chaohong guo To: linux-ide@vger.kernel.org Cc: b.zolnierkie@samsung.com, jan.kiszka@siemens.com, vireshk@kernel.org, axboe@kernel.dk Subject: [PATCH] Allow system to allocate IRQ 0 to ATA devices Date: Thu, 25 Oct 2018 13:50:10 +0800 Message-Id: <20181025055010.13355-1-chaohong.guo@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Interrupt vector 0 can be used on some platform. In libata, the routine ata_host_activate() doesn't consider 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. This is perfectly legal. Moreover most ATA drivers will check if irq < 0 or irq == -1. Signed-off-by: Chaohong guo --- 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/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 */