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=-9.0 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 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 94246C433DB for ; Fri, 26 Mar 2021 13:35:18 +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 01F6C61879 for ; Fri, 26 Mar 2021 13:35:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01F6C61879 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.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:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MBL3AHFHUihVFJ1oIXJxOZ5rPAWqNxC8lI3zrfTNnSA=; b=jNwRz8nPzkJeAfpOScShTqCIx R6JebP/NArs4CN81gtKY9d8h2ztKKBSgKIGlnDvqC7C1RmLjVNUxMQr69EmbwGZbNMa41hwqvzQMF JmoDS14INA52Dv6fg0rfRBmFXyQQCy/EkoYkIlWLwLra7tm4k5DlBnptb8WO+zUGXLHYDeuKXwj+E RDgxqmnKIra9/fwKGc1z82i2DiDIymPB3cCzGGT4JjnC/lvglvpJxx9UnzZ1xxIIwkn4GiZnNAKwg R1cjbl7ozQrf/L79q2K0mdbuTefmtQalILe6guQvbAp4hnsEVzNIsaiydy74qS/DSImPR1V10FHg/ bibCytiXQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lPmap-003bcK-I6; Fri, 26 Mar 2021 13:33:39 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lPmal-003bbH-LB for linux-arm-kernel@lists.infradead.org; Fri, 26 Mar 2021 13:33:37 +0000 Received: from mail-oi1-f170.google.com ([209.85.167.170]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1Mdvua-1lyIKQ02EQ-00aziY for ; Fri, 26 Mar 2021 14:33:32 +0100 Received: by mail-oi1-f170.google.com with SMTP id i3so5698846oik.7 for ; Fri, 26 Mar 2021 06:33:31 -0700 (PDT) X-Gm-Message-State: AOAM531Bswk9gMRnd445/kXWlnAjk6rstof8B5/QDlZYCWRiZOQ/J3NI I60oCCNSELrHcl4vh3hhbPSR4NHAqnlTiuAwyvk= X-Google-Smtp-Source: ABdhPJw7kVl3SbFJbH2Y/p1yB0X/c2bkJeFc5rjNgNNS5JhoesKLCMmsZmh2LtGN46UbUV4VrpRILiURd0E2Y+0pLcs= X-Received: by 2002:a05:6808:313:: with SMTP id i19mr9595568oie.67.1616765610791; Fri, 26 Mar 2021 06:33:30 -0700 (PDT) MIME-Version: 1.0 References: <20210326121735.GQ1463@shell.armlinux.org.uk> In-Reply-To: From: Arnd Bergmann Date: Fri, 26 Mar 2021 14:33:15 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] ARM: pci: make bus I/O resources optional To: Russell King Cc: Linux ARM , Rob Herring X-Provags-ID: V03:K1:YMD5JnoAg4ItQO1kqWsJVhIySJUQU0vr1F008OxGX3XvjwI/k7C qSyaMbXwBJK4WwTpRWcflFihhFvba/S1bdqfJvS+D5Ph1UKNJeGhzEcS7+BmG6n5h1gFWcQ 6znOdyseXS5y2AI2SV4ddT4XmktRYmyFiw5U4GfM4Ec5z9w0S1ZgBN3reX55ltfVXUlw7pf i82VWgn2ax/+vrDcgoSDQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:z/Pgah1t1lE=:WPLGQ0L8hi2aJ5Kcm9II43 ypvlgWDcu+MFJrhRJ9lw8/lMoC2p7ZPQawmDuRHrSQE2XVQo3vFeMr/o3d26u0araIakvtZJ1 FSAwhFuHeb2d6yNdMd2i78fyBAa917r0W45GGGz9rGYw3cFaEBQa4+05SpGqkfzhKg9UkO2fL h5F2LgWuEzFzgfY3SIaS8WpHOtn7+a/7ovJnJktfBWIsR1+8YSnt/QgIoZTVRUYNtaUhzjyA3 4FaV4pPiGlnbqUjQWolKtZyvSY2lGgZNLlf6edZocB7cKVpRAYLApW7nPgHurf2J5FaJ95zov xV32g8A/XS78KLM21MBoiTu6xUJl+HmYeKm2r6xfvLx/CDR4YNkH0KeJdw/S5V7MlE56Bc4lq Z3XDLM03m0C1VhSG9XnjdWEb4lXg08CRP+9ZX6ExxHCwsTrs1I8TuplNBHFoT3+Me1UQIolOT TxTQxgym3xBkxunjivMEXhFQMTzB1G0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210326_133335_889296_CB018A7E X-CRM114-Status: GOOD ( 22.75 ) 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 Fri, Mar 26, 2021 at 1:18 PM Russell King wrote: > > 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. I think Rob's original change is needed for platforms with multiple PCI root bridges, since they need non-overlapping I/O resources, and each if they can't all be the root ioport_resource, they have to be children of that. Leaving out the lower 0x1000 port numbers in turn is required so legacy ISA drivers acquire the ports with request_region(). The reason it broke on your machine was apparently that pci_claim_resource() failed to assign the low port numbers to the PCI bus after that has explicitly set the minimum. Using ioport_resource as the PCI host bridge resource as you do is the easiest way to make it work for both ISA drivers and PCI drivers using low I/O ports. > @@ -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; After rereading this function, I see that the function already provides a way to do what you want here: If the hw->setup() function inserts ioport_resource into sys->resources along with the memory resources, it will skip the extra one, and you get the same effect. This is what ixp4xx and sa1100/nanoengine apparently do. I see that cns3xxx also adds an I/O resource, but this one seems to get it wrong (it refers to the physical address of the I/O window, not the port numbers), which would be an unrelated bug. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel