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=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 A0082C433DB for ; Fri, 26 Mar 2021 12:22:49 +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 1F20561879 for ; Fri, 26 Mar 2021 12:22:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F20561879 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk 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:Date:Message-Id:MIME-Version:Subject:Cc:To:From: References:In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HfolMpg7IwY7ug76SclQi9dwePlPJFVLomo7FDA9OmI=; b=qCHwuaqvU94/NULzDrvxTDZKr 25rh9GkMembPasGrIgEFcj5qh7NIoxyMwcXav0h7XxA5stUJN4PolnST1JbJFBlwUYps/USRPGiUM H9R3v7RuZruKsJx89fs/cX1+RVj4ZnkoVYwymp9EHtm1gR2bkZJBjmY/GrN1akyiawyfGoH1zLV57 cmeqdIbtHMrOcmTTFdKgoTpmGFp0MW81VtIXthQBHDMOggXNB2WLMC4TW+o/ELS0hUe1c5FImSxH8 xmuZ+7nEZxK87yOdOTFCprGZdqTp+qnID/JgFjdSnCOscyOt13xmMEmi+WyzIR0i7k+Aa++Abjfpv snBRiIuIQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lPlSn-003VPT-3S; Fri, 26 Mar 2021 12:21:17 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lPlSh-003V05-QA for linux-arm-kernel@lists.infradead.org; Fri, 26 Mar 2021 12:21:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eND/uAB6KuszhTbWyaSBgY8WmnwEJAGF7E8w7aEI+vg=; b=vCWD/zn70l30eMgPo6o2FpLMnd Xffo/bZf0javUGM8C/cdUQQVb4Gxwa8sNJN7sM7koCqTAXuXZZCzN2kfH1T3vlPzAHveNFCeg5GIk HBURd5AQIGXtjy/49W6NrmMoMx7m/qazlQOjeuJMSC4xFTj1vAwi5QsI9hDi5INAFkS3mecO002Ui nOLspXF6Ya1vmZv3y8ETKWYn+iVDi2IrHKIP7dqUz4m7mlgXHcTqs7CTKhSI+DJfGGksnN7Jh4DTG e/9HPcar6HUHZx02TiswggrtkxWOf2wK7v5iLqhTUewOSY2QmThnxdvOUndDuADkpkQKIjxL7edQs qyGtJHwQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:41126 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lPlPk-0005do-9p; Fri, 26 Mar 2021 12:18:08 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lPlPk-0007oG-2X; Fri, 26 Mar 2021 12:18:08 +0000 In-Reply-To: <20210326121735.GQ1463@shell.armlinux.org.uk> References: <20210326121735.GQ1463@shell.armlinux.org.uk> From: Russell King To: linux-arm-kernel@lists.infradead.org Cc: Rob Herring ,Arnd Bergmann Subject: [PATCH 1/3] ARM: pci: make bus I/O resources optional MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 26 Mar 2021 12:18:08 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210326_122111_975610_55752522 X-CRM114-Status: GOOD ( 17.20 ) 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 Adding a bus I/O resource that extends from pcibios_min_io to the top of PCI space breaks Footbridge based platforms, which may have ISA southbridges and IDE controllers that are in legacy mode. The PCI I/O space on these machines really does cover port addresses from zero upwards, even when pcibios_min_io is non-zero. Fix this by making Rob's changes optional - Rob's change is probably based on a misunderstanding of what pcibios_min_io is - it is the minimum IO port address that we wish to start allocating bus resources which may not be the same as the minimum IO port address for the bus. Fixes: 3c5d1699887b ("ARM: move PCI i/o resource setup into common code") Signed-off-by: Russell King --- arch/arm/include/asm/mach/pci.h | 1 + arch/arm/kernel/bios32.c | 37 ++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h index 83d340702680..0f96c2462ee5 100644 --- a/arch/arm/include/asm/mach/pci.h +++ b/arch/arm/include/asm/mach/pci.h @@ -21,6 +21,7 @@ struct hw_pci { struct pci_ops *ops; int nr_controllers; unsigned int io_optional:1; + unsigned int no_bus_ioport_resource:1; void **private_data; int (*setup)(int nr, struct pci_sys_data *); int (*scan)(int nr, struct pci_host_bridge *); diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index ed46ca69813d..c48476193687 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -412,10 +412,11 @@ static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) } static int pcibios_init_resource(int busnr, struct pci_sys_data *sys, - int io_optional) + int io_optional, int bus_ioport_resource) { - int ret; struct resource_entry *window; + struct resource *res; + int ret; if (list_empty(&sys->resources)) { pci_add_resource_offset(&sys->resources, @@ -434,19 +435,25 @@ static int pcibios_init_resource(int busnr, struct pci_sys_data *sys, if (resource_type(window->res) == IORESOURCE_IO) return 0; - sys->io_res.start = (busnr * SZ_64K) ? : pcibios_min_io; - sys->io_res.end = (busnr + 1) * SZ_64K - 1; - sys->io_res.flags = IORESOURCE_IO; - sys->io_res.name = sys->io_res_name; - sprintf(sys->io_res_name, "PCI%d I/O", busnr); + if (bus_ioport_resource) { + sys->io_res.start = (busnr * SZ_64K) ? : pcibios_min_io; + sys->io_res.end = (busnr + 1) * SZ_64K - 1; + sys->io_res.flags = IORESOURCE_IO; + sys->io_res.name = sys->io_res_name; + sprintf(sys->io_res_name, "PCI%d I/O", busnr); + + ret = request_resource(&ioport_resource, &sys->io_res); + if (ret) { + pr_err("PCI: unable to allocate I/O port region (%d)\n", ret); + return ret; + } - ret = request_resource(&ioport_resource, &sys->io_res); - if (ret) { - pr_err("PCI: unable to allocate I/O port region (%d)\n", ret); - return ret; + res = &sys->io_res; + } else { + res = &ioport_resource; } - pci_add_resource_offset(&sys->resources, &sys->io_res, - sys->io_offset); + + pci_add_resource_offset(&sys->resources, res, sys->io_offset); return 0; } @@ -478,8 +485,8 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, ret = hw->setup(nr, sys); if (ret > 0) { - - ret = pcibios_init_resource(nr, sys, hw->io_optional); + ret = pcibios_init_resource(nr, sys, hw->io_optional, + !hw->no_bus_ioport_resource); if (ret) { pci_free_host_bridge(bridge); break; -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel