Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp693472ybl; Fri, 16 Aug 2019 02:27:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxL0TgJ+YyIL5MDJ6I2ySBNHhyCf7BPEgo3ZilzMbk7fL/bSBVgX45wg8lCzypB8HE8wBvR X-Received: by 2002:a17:90a:974c:: with SMTP id i12mr6398807pjw.12.1565947646606; Fri, 16 Aug 2019 02:27:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565947646; cv=none; d=google.com; s=arc-20160816; b=W5cYhcES6oPSn1rohMfk96OJaT9fPQzPXFoTqMjQVtqlh/ifUXIzXU/JJmPvYoOORA bIzdPHfgK2NdX09gffKJbDrNDFvc71eKBXqPmtRSpeWfNkWDQYDDxwTpgT/1uerIv5fW r1tNHMkjbt6+bPzIHWOp7sxLORD8kvmbwqRhd4cFdpiA6TAlWDE1xB3sI8J5H0jF3asW PxkSbfQb1tZbGRUVjHnDiLz3O32klxip0fpbDqMzP5qa2Qx8HjvYbAlJQXwOCF8LkTPr WPDMQ65duephRcDD2yb6d7rIzKBMCTuib2HacVt3GYFewSxrgxJicTPSO/pGrBpuOlI3 BApA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=/VxpV6HL/eaLGj7FsELgy9XZqdi/XB/wlgbntskeVnQ=; b=u6wGaZ3BX+sy224EysHB4llWZpOi42629ViST2lA/fuLtZyId/hhXHUsZhqK2jNsY/ w7XW2H01689HOSMss4mktYnTTAGFqHPz0bVXe6P9T95k0/zzgNkbgvMtjeTDNRyAY248 3R3QbgWn7WAW2gr+QYuFHSlJbm2LoU5TOqlGaPVGK4Nw4dY/l8LhheCuyNGsCOAylLb/ rQRKEL8J41pK1dEff7A21nftlnz6mRC1lY04H6HNGCT06wHhQLTLa8HrVymo1hfmjZlD N685ZtvOiM/Vh1dzPeQeIGXE0qnwiAWgCexD7ED/zin0LlQ6e9QUUrfpu7ND6ffWKdSN 5DgQ== 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 l70si3446246pge.446.2019.08.16.02.27.09; Fri, 16 Aug 2019 02:27:26 -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 S1727092AbfHPJY5 (ORCPT + 99 others); Fri, 16 Aug 2019 05:24:57 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41642 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726879AbfHPJY5 (ORCPT ); Fri, 16 Aug 2019 05:24:57 -0400 Received: by mail-wr1-f66.google.com with SMTP id j16so890377wrr.8; Fri, 16 Aug 2019 02:24:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/VxpV6HL/eaLGj7FsELgy9XZqdi/XB/wlgbntskeVnQ=; b=IbAKXSF5R1mr1Ot5O0SVLwAG2d11xlP91LdIq3kT56OXCfcZQpdGKIylwQP3f1bF5V cj+htenCqB1qBD1rvN+lyZF9nXCUCaeeJ0rSyIw3uuCrFgH7rGaf1+QIgKbEuGRdOjzh criNKo5Du8irVDnbTXz7vicG14NNNWilRuwW0LUjrPCMYxazCc+DczVaDj5GXf3r3Miu q5Hf+xL4WVFY9W+0XERsk+zkFtddPw2URZewd5zzvDjPcOdYRCqdjVfl4K1Zw9Op4zpR 0zwzM3zhWiRRFZ+i2PxOn4fn2725rRu/cwlHN0nttr8XcJiQT4Xn1pfhzkRJyFCVYVRK yhWg== X-Gm-Message-State: APjAAAVtDI8tsSHPbZTPV4bguM28TsQVTUXOL7oqYePXixGMBsnPLfdz qUdpugQy7H7Kp+Jc0NjAzU0= X-Received: by 2002:adf:eac3:: with SMTP id o3mr8886853wrn.264.1565947494195; Fri, 16 Aug 2019 02:24:54 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id q20sm16521138wrc.79.2019.08.16.02.24.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:24:53 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Sebastian Ott , Gerald Schaefer , "H. Peter Anvin" , Giuseppe Cavallaro , Alexandre Torgue , Matt Porter , Alexandre Bounine , Peter Jones , Bartlomiej Zolnierkiewicz , Cornelia Huck , Alex Williamson , Andrew Murray , Jose Abreu , kvm@vger.kernel.org, linux-fbdev@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, linux-s390@vger.kernel.org Subject: [PATCH v2 00/10] Add definition for the number of standard PCI BARs Date: Fri, 16 Aug 2019 12:24:27 +0300 Message-Id: <20190816092437.31846-1-efremov@linux.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Changes in v2: - Reverse checks in pci_iomap_range,pci_iomap_wc_range. - Refactor loops in vfio_pci to keep PCI_STD_RESOURCES. - Add 2 new patches to replace the magic constant with new define. - Split net patch in v1 to separate stmmac and dwc-xlgmac patches. Denis Efremov (10): PCI: Add define for the number of standard PCI BARs s390/pci: Loop using PCI_STD_NUM_BARS x86/PCI: Loop using PCI_STD_NUM_BARS stmmac: pci: Loop using PCI_STD_NUM_BARS net: dwc-xlgmac: Loop using PCI_STD_NUM_BARS rapidio/tsi721: Loop using PCI_STD_NUM_BARS efifb: Loop using PCI_STD_NUM_BARS vfio_pci: Loop using PCI_STD_NUM_BARS PCI: hv: Use PCI_STD_NUM_BARS PCI: Use PCI_STD_NUM_BARS 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/controller/pci-hyperv.c | 10 +++++----- drivers/pci/pci.c | 11 ++++++----- drivers/pci/quirks.c | 4 ++-- drivers/rapidio/devices/tsi721.c | 2 +- drivers/vfio/pci/vfio_pci.c | 11 +++++++---- drivers/vfio/pci/vfio_pci_config.c | 10 ++++++---- 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 + 17 files changed, 51 insertions(+), 47 deletions(-) -- 2.21.0