Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3538946ybl; Mon, 12 Aug 2019 02:07:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlTZzHvuhf33R9RO/e1EQgI+3MqkMJkfCsOKLDJl0+xuAc3TDBoV06xciQNMFvSzPyZbmc X-Received: by 2002:a17:902:b582:: with SMTP id a2mr6281571pls.199.1565600862787; Mon, 12 Aug 2019 02:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565600862; cv=none; d=google.com; s=arc-20160816; b=O8zjVJba1Et/OXGkhMGAlneMBocbFBSsDR+wSnGbquBdWrANT7o0L60EswfpLvMX/h BepXqSEV1X5Ev+QPvkQXAGN0rsbJ8O5zE5nH5XTdi2+rrmrs+3QtyaHIQBxwrZLWq4jN JdTdebcxMQ2vqjVZLVr2tg9Gef1ARym/OdgFezCmxywWYtJMKD5feurdPxFNDV9EUHvy Z+uPUm7B0CfutzfxKQzs1Uo2fY47EyBusm6qcGIb/wk8vBomYvRNxLjEnLZjM7nRve6f t26pALlIzpS7hHxVEHa1ktGO9IJAsfIJ7Mr/WOy/15Z38w2sbt/H/fxoFPjg4jLPKq8i 9NbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9oJGnJx4rYnjPWca80rP8eP6aMLTyFpnlq+TKHxmWyU=; b=aXVll55hIreOIcSP5BPCBBuI+V6m93fvazAKiC4uGJnE/kKcdMu88emsTkeq8/Qilz 1CgYMCkgIQT6brUme7UlY2reNIydnsrYoOQsYAMPuNFWh8hI1XWONczE+pv5O8srpnkM KZ7PvPcgmZzEPePicjQ4wbUxZ8vtuyFRzCO+rN+b7w8Gi1WLwVs8uV7+b3XyfpHYB2zc NbhhyV4MV6IbqilkVVIDktLwPAxelbnO+Zx8FOMBt2mWOeLtg0I/5pVrnCQiUGGy26r/ jqmNmtahFW7q2ravUReN2YYUiwI33OX0qHPhqQkWN02Np081SOeOoSPTi0fV7X6YO8cs 4W5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si47136092pgr.555.2019.08.12.02.07.27; Mon, 12 Aug 2019 02:07:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727416AbfHLJGn (ORCPT + 99 others); Mon, 12 Aug 2019 05:06:43 -0400 Received: from foss.arm.com ([217.140.110.172]:46194 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727233AbfHLJGn (ORCPT ); Mon, 12 Aug 2019 05:06:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6039915A2; Mon, 12 Aug 2019 02:06:42 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ACD743F718; Mon, 12 Aug 2019 02:06:41 -0700 (PDT) Date: Mon, 12 Aug 2019 10:06:40 +0100 From: Andrew Murray To: Denis Efremov Cc: Bjorn Helgaas , Sebastian Ott , Gerald Schaefer , "H. Peter Anvin" , Giuseppe Cavallaro , Alexandre Torgue , Matt Porter , Alexandre Bounine , Peter Jones , Bartlomiej Zolnierkiewicz , Cornelia Huck , Alex Williamson , kvm@vger.kernel.org, linux-fbdev@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, linux-s390@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/7] Add definition for the number of standard PCI BARs Message-ID: <20190812090639.GX56241@e119886-lin.cambridge.arm.com> References: <20190811150802.2418-1-efremov@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190811150802.2418-1-efremov@linux.com> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 11, 2019 at 06:07:55PM +0300, Denis Efremov wrote: > Code that iterates over all standard PCI BARs typically uses > PCI_STD_RESOURCE_END, but this is error-prone because it requires > "i <= PCI_STD_RESOURCE_END" rather than something like > "i < PCI_STD_NUM_BARS". We could add such a definition and use it the same > way PCI_SRIOV_NUM_BARS is used. There is already the definition > PCI_BAR_COUNT for s390 only. Thus, this patchset introduces it globally. > > The patch is splitted into 7 parts for different drivers/subsystems for > easy readability. > > Denis Efremov (7): > PCI: Add define for the number of standard PCI BARs > s390/pci: Replace PCI_BAR_COUNT with PCI_STD_NUM_BARS > x86/PCI: Use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END > PCI/net: Use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END > rapidio/tsi721: use PCI_STD_NUM_BARS in loops instead of > PCI_STD_RESOURCE_END > efifb: Use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END > vfio_pci: Use PCI_STD_NUM_BARS in loops instead of > PCI_STD_RESOURCE_END > > arch/s390/include/asm/pci.h | 5 +---- > arch/s390/include/asm/pci_clp.h | 6 +++--- > arch/s390/pci/pci.c | 16 ++++++++-------- > arch/s390/pci/pci_clp.c | 6 +++--- > arch/x86/pci/common.c | 2 +- > drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 4 ++-- > drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c | 2 +- > drivers/pci/quirks.c | 2 +- > drivers/rapidio/devices/tsi721.c | 2 +- > drivers/vfio/pci/vfio_pci.c | 4 ++-- > drivers/vfio/pci/vfio_pci_config.c | 2 +- > drivers/vfio/pci/vfio_pci_private.h | 4 ++-- > drivers/video/fbdev/efifb.c | 2 +- > include/linux/pci.h | 2 +- > include/uapi/linux/pci_regs.h | 1 + Hi Denis, You could also fix up a few cases where the number of BARs is hard coded in loops, e.g. drivers/pci/controller/pci-hyperv.c - look for uses of probed_bar in loops drivers/pci/pci.c - pci_release_selected_regions and __pci_request_selected_regions drivers/pci/quirks.c - quirk_alder_ioapic Thanks, Andrew Murray > 15 files changed, 29 insertions(+), 31 deletions(-) > > -- > 2.21.0 >