From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig Date: Mon, 22 Mar 2021 16:33:14 +0100 Message-ID: <20210322153314.GA3440@lst.de> References: <20210318045706.200458-1-hch@lst.de> <20210318045706.200458-3-hch@lst.de> <20210319170753.GV1463@shell.armlinux.org.uk> <20210319175311.GW1463@shell.armlinux.org.uk> <20210322145403.GA30942@lst.de> <20210322151503.GX1463@shell.armlinux.org.uk> <20210322151823.GA2764@lst.de> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <20210322151823.GA2764@lst.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane-mx.org@lists.ozlabs.org Sender: "Linuxppc-dev" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Russell King - ARM Linux admin Cc: Jens Axboe , Thomas Bogendoerfer , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , linux-ide@vger.kernel.org, linux-m68k@lists.linux-m68k.org, Ivan Kokshaysky , linux-alpha@vger.kernel.org, Geert Uytterhoeven , Matt Turner , linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Christoph Hellwig , linux-arm-kernel@lists.infradead.org, Richard Henderson On Mon, Mar 22, 2021 at 04:18:23PM +0100, Christoph Hellwig wrote: > On Mon, Mar 22, 2021 at 03:15:03PM +0000, Russell King - ARM Linux admin wrote: > > It gets worse than that though - due to a change to remove > > pcibios_min_io from the generic code, moving it into the ARM > > architecture code, this has caused a regression that prevents the > > legacy resources being registered against the bus resource. So even > > if they are there, they cause probe failures. I haven't found a > > reasonable way to solve this yet, but until there is, there is no > > way that the PATA driver can be used as the "legacy mode" support > > is effectively done via the PCI code assigning virtual IO port > > resources. > > > > I'm quite surprised that the CY82C693 even works on Alpha - I've > > asked for a lspci for that last week but nothing has yet been > > forthcoming from whoever responded to your patch for Alpha - so I > > can't compare what I'm seeing with what's happening with Alpha. > > That sounds like something we could fix with a quirk for function 2 > in the PCI resource assignment code. Can you show what vendor and > device ID function 2 has so that I could try to come up with one? Something like this: diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 953f15abc850ac..851918206c4f2d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1855,7 +1855,7 @@ int pci_setup_device(struct pci_dev *dev) * addresses. These are not always echoed in BAR0-3, and * BAR0-3 in a few cases contain junk! */ - if (class == PCI_CLASS_STORAGE_IDE) { + if (class == PCI_CLASS_STORAGE_IDE && !dev->no_legacy_ide_bars) { u8 progif; pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); if ((progif & 1) == 0) { diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3ba9ef1..c661462d894a5b 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -5612,3 +5612,16 @@ static void apex_pci_fixup_class(struct pci_dev *pdev) } DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a, PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); + +/* + * CY82C693 splits the primary and secondar IDE channels over 2 functions, which + * causes the PCI resource assignment algorithm to assign the legacy IDE I/O + * regions to both of them. Disable that assignment for function 2 here. + */ +static void quirk_cy82c693_legacy_resources(struct pci_dev *pdev) +{ + if (PCI_FUNC(pdev->devfn) == 2) + pdev->no_legacy_ide_bars = 1; +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, + quirk_cy82c693_legacy_resources); diff --git a/include/linux/pci.h b/include/linux/pci.h index 86c799c97b7796..7ca3f5ebbfade7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -453,6 +453,7 @@ struct pci_dev { unsigned int link_active_reporting:1;/* Device capable of reporting link active */ unsigned int no_vf_scan:1; /* Don't scan for VFs after IOV enablement */ unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */ + unsigned int no_legacy_ide_bars:1; /* do not assign legacy IDE BARs */ pci_dev_flags_t dev_flags; atomic_t enable_cnt; /* pci_enable_device has been called */ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 080BBC433E1 for ; Mon, 22 Mar 2021 15:34:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CDCCB6192E for ; Mon, 22 Mar 2021 15:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbhCVPdc (ORCPT ); Mon, 22 Mar 2021 11:33:32 -0400 Received: from verein.lst.de ([213.95.11.211]:56320 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbhCVPdW (ORCPT ); Mon, 22 Mar 2021 11:33:22 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 69F4568BEB; Mon, 22 Mar 2021 16:33:15 +0100 (CET) Date: Mon, 22 Mar 2021 16:33:14 +0100 From: Christoph Hellwig To: Russell King - ARM Linux admin Cc: Christoph Hellwig , "David S. Miller" , Jens Axboe , Geert Uytterhoeven , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , Michael Ellerman , linux-ide@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig Message-ID: <20210322153314.GA3440@lst.de> References: <20210318045706.200458-1-hch@lst.de> <20210318045706.200458-3-hch@lst.de> <20210319170753.GV1463@shell.armlinux.org.uk> <20210319175311.GW1463@shell.armlinux.org.uk> <20210322145403.GA30942@lst.de> <20210322151503.GX1463@shell.armlinux.org.uk> <20210322151823.GA2764@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322151823.GA2764@lst.de> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Mon, Mar 22, 2021 at 04:18:23PM +0100, Christoph Hellwig wrote: > On Mon, Mar 22, 2021 at 03:15:03PM +0000, Russell King - ARM Linux admin wrote: > > It gets worse than that though - due to a change to remove > > pcibios_min_io from the generic code, moving it into the ARM > > architecture code, this has caused a regression that prevents the > > legacy resources being registered against the bus resource. So even > > if they are there, they cause probe failures. I haven't found a > > reasonable way to solve this yet, but until there is, there is no > > way that the PATA driver can be used as the "legacy mode" support > > is effectively done via the PCI code assigning virtual IO port > > resources. > > > > I'm quite surprised that the CY82C693 even works on Alpha - I've > > asked for a lspci for that last week but nothing has yet been > > forthcoming from whoever responded to your patch for Alpha - so I > > can't compare what I'm seeing with what's happening with Alpha. > > That sounds like something we could fix with a quirk for function 2 > in the PCI resource assignment code. Can you show what vendor and > device ID function 2 has so that I could try to come up with one? Something like this: diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 953f15abc850ac..851918206c4f2d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1855,7 +1855,7 @@ int pci_setup_device(struct pci_dev *dev) * addresses. These are not always echoed in BAR0-3, and * BAR0-3 in a few cases contain junk! */ - if (class == PCI_CLASS_STORAGE_IDE) { + if (class == PCI_CLASS_STORAGE_IDE && !dev->no_legacy_ide_bars) { u8 progif; pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); if ((progif & 1) == 0) { diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3ba9ef1..c661462d894a5b 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -5612,3 +5612,16 @@ static void apex_pci_fixup_class(struct pci_dev *pdev) } DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a, PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); + +/* + * CY82C693 splits the primary and secondar IDE channels over 2 functions, which + * causes the PCI resource assignment algorithm to assign the legacy IDE I/O + * regions to both of them. Disable that assignment for function 2 here. + */ +static void quirk_cy82c693_legacy_resources(struct pci_dev *pdev) +{ + if (PCI_FUNC(pdev->devfn) == 2) + pdev->no_legacy_ide_bars = 1; +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, + quirk_cy82c693_legacy_resources); diff --git a/include/linux/pci.h b/include/linux/pci.h index 86c799c97b7796..7ca3f5ebbfade7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -453,6 +453,7 @@ struct pci_dev { unsigned int link_active_reporting:1;/* Device capable of reporting link active */ unsigned int no_vf_scan:1; /* Don't scan for VFs after IOV enablement */ unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */ + unsigned int no_legacy_ide_bars:1; /* do not assign legacy IDE BARs */ pci_dev_flags_t dev_flags; atomic_t enable_cnt; /* pci_enable_device has been called */ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD77BC433DB for ; Mon, 22 Mar 2021 15:35:28 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 484AE6192E for ; Mon, 22 Mar 2021 15:35:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 484AE6192E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YDFo1OQFdTLKV6co5LA80wGrpw0Oy0adKLgQmkWdSEY=; b=jTAHwdCjqncouc7V22zIEIDcv 1HpWZErSYFUZ8iZbEDZoR1wJtZksc4dHwzvakBTuF2B4XDxI4kzKkJDMqvSh3RQrVf1rGXh4Lvnfl xOHbhtz1KU+M6swJVuQoysUZzFBkZi5TJUp9t7R9SUkrHTiFoeGGQy75F6TQkWa/hSI1yaqGZcTYB yHbAt/Mncj/qB9n8T/NClGRSptyFMKf2mhqj2bDheunWWKJAYFBddpRA9golnxkT2c/9mN3OWdlm5 aDrNTQ0jFlYhIcCCTagQMJVt1Fp4UDdLTPyKukJI7OkGGwOZP2Dj8ike6ap4JfhBzXLdRXgxhhxBj OgJVtOiKQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOMYW-00Bu8U-EU; Mon, 22 Mar 2021 15:33:24 +0000 Received: from verein.lst.de ([213.95.11.211]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOMYS-00Bu7r-2X for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 15:33:21 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id 69F4568BEB; Mon, 22 Mar 2021 16:33:15 +0100 (CET) Date: Mon, 22 Mar 2021 16:33:14 +0100 From: Christoph Hellwig To: Russell King - ARM Linux admin Cc: Christoph Hellwig , "David S. Miller" , Jens Axboe , Geert Uytterhoeven , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , Michael Ellerman , linux-ide@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 02/10] ARM: disable CONFIG_IDE in footbridge_defconfig Message-ID: <20210322153314.GA3440@lst.de> References: <20210318045706.200458-1-hch@lst.de> <20210318045706.200458-3-hch@lst.de> <20210319170753.GV1463@shell.armlinux.org.uk> <20210319175311.GW1463@shell.armlinux.org.uk> <20210322145403.GA30942@lst.de> <20210322151503.GX1463@shell.armlinux.org.uk> <20210322151823.GA2764@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210322151823.GA2764@lst.de> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_153320_272539_BAB20013 X-CRM114-Status: GOOD ( 34.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Mar 22, 2021 at 04:18:23PM +0100, Christoph Hellwig wrote: > On Mon, Mar 22, 2021 at 03:15:03PM +0000, Russell King - ARM Linux admin wrote: > > It gets worse than that though - due to a change to remove > > pcibios_min_io from the generic code, moving it into the ARM > > architecture code, this has caused a regression that prevents the > > legacy resources being registered against the bus resource. So even > > if they are there, they cause probe failures. I haven't found a > > reasonable way to solve this yet, but until there is, there is no > > way that the PATA driver can be used as the "legacy mode" support > > is effectively done via the PCI code assigning virtual IO port > > resources. > > > > I'm quite surprised that the CY82C693 even works on Alpha - I've > > asked for a lspci for that last week but nothing has yet been > > forthcoming from whoever responded to your patch for Alpha - so I > > can't compare what I'm seeing with what's happening with Alpha. > > That sounds like something we could fix with a quirk for function 2 > in the PCI resource assignment code. Can you show what vendor and > device ID function 2 has so that I could try to come up with one? Something like this: diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 953f15abc850ac..851918206c4f2d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1855,7 +1855,7 @@ int pci_setup_device(struct pci_dev *dev) * addresses. These are not always echoed in BAR0-3, and * BAR0-3 in a few cases contain junk! */ - if (class == PCI_CLASS_STORAGE_IDE) { + if (class == PCI_CLASS_STORAGE_IDE && !dev->no_legacy_ide_bars) { u8 progif; pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); if ((progif & 1) == 0) { diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3ba9ef1..c661462d894a5b 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -5612,3 +5612,16 @@ static void apex_pci_fixup_class(struct pci_dev *pdev) } DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a, PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); + +/* + * CY82C693 splits the primary and secondar IDE channels over 2 functions, which + * causes the PCI resource assignment algorithm to assign the legacy IDE I/O + * regions to both of them. Disable that assignment for function 2 here. + */ +static void quirk_cy82c693_legacy_resources(struct pci_dev *pdev) +{ + if (PCI_FUNC(pdev->devfn) == 2) + pdev->no_legacy_ide_bars = 1; +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, + quirk_cy82c693_legacy_resources); diff --git a/include/linux/pci.h b/include/linux/pci.h index 86c799c97b7796..7ca3f5ebbfade7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -453,6 +453,7 @@ struct pci_dev { unsigned int link_active_reporting:1;/* Device capable of reporting link active */ unsigned int no_vf_scan:1; /* Don't scan for VFs after IOV enablement */ unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */ + unsigned int no_legacy_ide_bars:1; /* do not assign legacy IDE BARs */ pci_dev_flags_t dev_flags; atomic_t enable_cnt; /* pci_enable_device has been called */ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel