This is a note to let you know that I've just added the patch titled [PATCH v2 for-4.9 12/40] PCI: Remove pci_resource_bar() and pci_iov_resource_bar() to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pci-remove-pci_resource_bar-and-pci_iov_resource_bar.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Mon Mar 20 11:41:01 CET 2017 From: alexander.levin@xxxxxxxxxxx Date: Fri, 17 Mar 2017 00:48:23 +0000 Subject: [PATCH v2 for-4.9 12/40] PCI: Remove pci_resource_bar() and pci_iov_resource_bar() To: "gregkh@xxxxxxxxxxxxxxxxxxx" <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: "stable@xxxxxxxxxxxxxxx" <stable@xxxxxxxxxxxxxxx> Message-ID: <20170317004812.26960-12-alexander.levin@xxxxxxxxxxx> From: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> [ Upstream commit 286c2378aaccc7343ebf17ec6cd86567659caf70 ] pci_std_update_resource() only deals with standard BARs, so we don't have to worry about the complications of VF BARs in an SR-IOV capability. Compute the BAR address inline and remove pci_resource_bar(). That makes pci_iov_resource_bar() unused, so remove that as well. Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> Reviewed-by: Gavin Shan <gwshan@xxxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/pci/iov.c | 18 ------------------ drivers/pci/pci.c | 30 ------------------------------ drivers/pci/pci.h | 6 ------ drivers/pci/setup-res.c | 13 +++++++------ 4 files changed, 7 insertions(+), 60 deletions(-) --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -554,24 +554,6 @@ void pci_iov_release(struct pci_dev *dev } /** - * pci_iov_resource_bar - get position of the SR-IOV BAR - * @dev: the PCI device - * @resno: the resource number - * - * Returns position of the BAR encapsulated in the SR-IOV capability. - */ -int pci_iov_resource_bar(struct pci_dev *dev, int resno) -{ - if (resno < PCI_IOV_RESOURCES || resno > PCI_IOV_RESOURCE_END) - return 0; - - BUG_ON(!dev->is_physfn); - - return dev->sriov->pos + PCI_SRIOV_BAR + - 4 * (resno - PCI_IOV_RESOURCES); -} - -/** * pci_iov_update_resource - update a VF BAR * @dev: the PCI device * @resno: the resource number --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4835,36 +4835,6 @@ int pci_select_bars(struct pci_dev *dev, } EXPORT_SYMBOL(pci_select_bars); -/** - * pci_resource_bar - get position of the BAR associated with a resource - * @dev: the PCI device - * @resno: the resource number - * @type: the BAR type to be filled in - * - * Returns BAR position in config space, or 0 if the BAR is invalid. - */ -int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type) -{ - int reg; - - if (resno < PCI_ROM_RESOURCE) { - *type = pci_bar_unknown; - return PCI_BASE_ADDRESS_0 + 4 * resno; - } else if (resno == PCI_ROM_RESOURCE) { - *type = pci_bar_mem32; - return dev->rom_base_reg; - } else if (resno < PCI_BRIDGE_RESOURCES) { - /* device specific resource */ - *type = pci_bar_unknown; - reg = pci_iov_resource_bar(dev, resno); - if (reg) - return reg; - } - - dev_err(&dev->dev, "BAR %d: invalid resource\n", resno); - return 0; -} - /* Some architectures require additional programming to enable VGA */ static arch_set_vga_state_t arch_set_vga_state; --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -245,7 +245,6 @@ bool pci_bus_read_dev_vendor_id(struct p int pci_setup_device(struct pci_dev *dev); int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, struct resource *res, unsigned int reg); -int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type); void pci_configure_ari(struct pci_dev *dev); void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head); @@ -289,7 +288,6 @@ static inline void pci_restore_ats_state #ifdef CONFIG_PCI_IOV int pci_iov_init(struct pci_dev *dev); void pci_iov_release(struct pci_dev *dev); -int pci_iov_resource_bar(struct pci_dev *dev, int resno); void pci_iov_update_resource(struct pci_dev *dev, int resno); resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno); void pci_restore_iov_state(struct pci_dev *dev); @@ -304,10 +302,6 @@ static inline void pci_iov_release(struc { } -static inline int pci_iov_resource_bar(struct pci_dev *dev, int resno) -{ - return 0; -} static inline void pci_restore_iov_state(struct pci_dev *dev) { } --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -32,7 +32,6 @@ static void pci_std_update_resource(stru u16 cmd; u32 new, check, mask; int reg; - enum pci_bar_type type; struct resource *res = dev->resource + resno; if (dev->is_virtfn) { @@ -66,14 +65,16 @@ static void pci_std_update_resource(stru else mask = (u32)PCI_BASE_ADDRESS_MEM_MASK; - reg = pci_resource_bar(dev, resno, &type); - if (!reg) - return; - if (type != pci_bar_unknown) { + if (resno < PCI_ROM_RESOURCE) { + reg = PCI_BASE_ADDRESS_0 + 4 * resno; + } else if (resno == PCI_ROM_RESOURCE) { if (!(res->flags & IORESOURCE_ROM_ENABLE)) return; + + reg = dev->rom_base_reg; new |= PCI_ROM_ADDRESS_ENABLE; - } + } else + return; /* * We can't update a 64-bit BAR atomically, so when possible, Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-4.9/pci-add-comments-about-rom-bar-updating.patch queue-4.9/acpi-blacklist-make-dell-latitude-3350-ethernet-work.patch queue-4.9/s390-zcrypt-introduce-cex6-toleration.patch queue-4.9/dccp-tcp-fix-routing-redirect-race.patch queue-4.9/vrf-fix-use-after-free-in-vrf_xmit.patch queue-4.9/tcp-fix-various-issues-for-sockets-morphing-to-listen-state.patch queue-4.9/block-allow-write_same-commands-with-the-sg_io-ioctl.patch queue-4.9/strparser-destroy-workqueue-on-module-exit.patch queue-4.9/powerpc-mm-fix-build-break-when-cma-n-spapr_tce_iommu-y.patch queue-4.9/vfio-spapr-postpone-default-window-creation.patch queue-4.9/vfio-spapr-add-a-helper-to-create-default-dma-window.patch queue-4.9/pci-do-any-vf-bar-updates-before-enabling-the-bars.patch queue-4.9/usb-gadget-udc-atmel-remove-memory-leak.patch queue-4.9/x86-hyperv-handle-unknown-nmis-on-one-cpu-when-unknown_nmi_panic.patch queue-4.9/net-tunnel-set-inner-protocol-in-network-gro-hooks.patch queue-4.9/serial-8250_pci-detach-low-level-driver-during-pci-error-recovery.patch queue-4.9/powerpc-iommu-stop-using-current-in-mm_iommu_xxx.patch queue-4.9/tun-fix-premature-pollout-notification-on-tun-devices.patch queue-4.9/vxlan-correctly-validate-vxlan-id-against-vxlan_n_vid.patch queue-4.9/bpf-fix-regression-on-verifier-pruning-wrt-map-lookups.patch queue-4.9/tcp-dccp-block-bh-for-syn-processing.patch queue-4.9/net-sched-act_skbmod-remove-unneeded-rcu_read_unlock-in-tcf_skbmod_dump.patch queue-4.9/dccp-fix-memory-leak-during-tear-down-of-unsuccessful-connection-request.patch queue-4.9/xen-do-not-re-use-pirq-number-cached-in-pci-device-msi-msg-data.patch queue-4.9/vxlan-lock-rcu-on-tx-path.patch queue-4.9/mlxsw-spectrum_router-avoid-potential-packets-loss.patch queue-4.9/mpls-do-not-decrement-alive-counter-for-unregister-events.patch queue-4.9/net-phy-avoid-deadlock-during-phy_error.patch queue-4.9/uapi-fix-linux-packet_diag.h-userspace-compilation-error.patch queue-4.9/pci-separate-vf-bar-updates-from-standard-bar-updates.patch queue-4.9/pci-ignore-bar-updates-on-virtual-functions.patch queue-4.9/geneve-lock-rcu-on-tx-path.patch queue-4.9/dccp-fix-use-after-free-in-dccp_feat_activate_values.patch queue-4.9/l2tp-avoid-use-after-free-caused-by-l2tp_ip_backlog_recv.patch queue-4.9/powerpc-mm-iommu-vfio-spapr-put-pages-on-vfio-container-shutdown.patch queue-4.9/bpf-fix-state-equivalence.patch queue-4.9/scsi-ibmvscsis-clean-up-properly-if-target_submit_cmd-tmr-fails.patch queue-4.9/drm-nouveau-disp-gp102-fix-cursor-overlay-immediate-channel-indices.patch queue-4.9/pci-update-bars-using-property-bits-appropriate-for-type.patch queue-4.9/scsi-ibmvscsis-synchronize-cmds-at-remove-time.patch queue-4.9/vfio-spapr-postpone-allocation-of-userspace-version-of-tce-table.patch queue-4.9/ibmveth-calculate-gso_segs-for-large-packets.patch queue-4.9/net-mlx5e-do-not-reduce-lro-wqe-size-when-not-using-build_skb.patch queue-4.9/net-sched-actions-decrement-module-reference-count-after-table-flush.patch queue-4.9/pci-don-t-update-vf-bars-while-vf-memory-space-is-enabled.patch queue-4.9/ipv4-mask-tos-for-input-route.patch queue-4.9/net-fix-socket-refcounting-in-skb_complete_tx_timestamp.patch queue-4.9/net-bridge-allow-ipv6-when-multicast-flood-is-disabled.patch queue-4.9/net-mlx5e-fix-wrong-cqe-decompression.patch queue-4.9/net-net_enable_timestamp-can-be-called-from-irq-contexts.patch queue-4.9/igb-workaround-for-igb-i210-firmware-issue.patch queue-4.9/drivers-hv-ring_buffer-count-on-wrap-around-mappings-in-get_next_pkt_raw-v2.patch queue-4.9/drm-nouveau-disp-nv50-specify-ctrl-user-separately-when-constructing-classes.patch queue-4.9/ipv6-make-ecmp-route-replacement-less-greedy.patch queue-4.9/ipv6-avoid-write-to-a-possibly-cloned-skb.patch queue-4.9/pci-remove-pci_resource_bar-and-pci_iov_resource_bar.patch queue-4.9/mpls-send-route-delete-notifications-when-router-module-is-unloaded.patch queue-4.9/dmaengine-iota-ioat_alloc_chan_resources-should-not-perform-sleeping-allocations.patch queue-4.9/scsi-ibmvscsis-return-correct-partition-name-to-client.patch queue-4.9/vti6-return-gre_key-for-vti6.patch queue-4.9/vfio-spapr-reference-mm-in-tce_container.patch queue-4.9/scsi-ibmvscsis-rearrange-functions-for-future-patches.patch queue-4.9/dccp-unlock-sock-before-calling-sk_free.patch queue-4.9/bpf-fix-mark_reg_unknown_value-for-spilled-regs-on-map-value-marking.patch queue-4.9/powerpc-iommu-pass-mm_struct-to-init-cleanup-helpers.patch queue-4.9/slub-move-synchronize_sched-out-of-slab_mutex-on-shrink.patch queue-4.9/net-mlx5e-register-unregister-vport-representors-on-interface-attach-detach.patch queue-4.9/pci-decouple-ioresource_rom_enable-and-pci_rom_address_enable.patch queue-4.9/net-don-t-call-strlen-on-the-user-buffer-in-packet_bind_spkt.patch queue-4.9/bpf-detect-identical-ptr_to_map_value_or_null-registers.patch queue-4.9/scsi-ibmvscsis-issues-from-dan-carpenter-smatch.patch queue-4.9/vxlan-don-t-allow-overwrite-of-config-src-addr.patch queue-4.9/acpi-blacklist-add-_rev-quirks-for-dell-precision-5520-and-3520.patch queue-4.9/bridge-drop-netfilter-fake-rtable-unconditionally.patch queue-4.9/igb-add-i211-to-i210-phy-workaround.patch queue-4.9/drm-nouveau-disp-nv50-split-chid-into-chid.ctrl-and-chid.user.patch queue-4.9/net-fix-socket-refcounting-in-skb_complete_wifi_ack.patch queue-4.9/scsi-ibmvscsis-synchronize-cmds-at-tpg_enable_store-time.patch queue-4.9/ipv6-orphan-skbs-in-reassembly-unit.patch queue-4.9/act_connmark-avoid-crashing-on-malformed-nlattrs-with-null-parms.patch queue-4.9/uvcvideo-uvc_scan_fallback-for-webcams-with-broken-chain.patch