This is a note to let you know that I've just added the patch titled vDPA/ifcvf: decouple config space ops from the adapter to the 6.2-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: vdpa-ifcvf-decouple-config-space-ops-from-the-adapter.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From af8eb69a62b73a2ce5f91575453534ac07f06eb4 Mon Sep 17 00:00:00 2001 From: Zhu Lingshan <lingshan.zhu@xxxxxxxxx> Date: Fri, 25 Nov 2022 22:57:14 +0800 Subject: vDPA/ifcvf: decouple config space ops from the adapter From: Zhu Lingshan <lingshan.zhu@xxxxxxxxx> commit af8eb69a62b73a2ce5f91575453534ac07f06eb4 upstream. This commit decopules the config space ops from the adapter layer, so these functions can be invoked once the device is probed. Signed-off-by: Zhu Lingshan <lingshan.zhu@xxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Message-Id: <20221125145724.1129962-3-lingshan.zhu@xxxxxxxxx> Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/vdpa/ifcvf/ifcvf_base.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) --- a/drivers/vdpa/ifcvf/ifcvf_base.c +++ b/drivers/vdpa/ifcvf/ifcvf_base.c @@ -10,11 +10,6 @@ #include "ifcvf_base.h" -struct ifcvf_adapter *vf_to_adapter(struct ifcvf_hw *hw) -{ - return container_of(hw, struct ifcvf_adapter, vf); -} - u16 ifcvf_set_vq_vector(struct ifcvf_hw *hw, u16 qid, int vector) { struct virtio_pci_common_cfg __iomem *cfg = hw->common_cfg; @@ -37,8 +32,6 @@ u16 ifcvf_set_config_vector(struct ifcvf static void __iomem *get_cap_addr(struct ifcvf_hw *hw, struct virtio_pci_cap *cap) { - struct ifcvf_adapter *ifcvf; - struct pci_dev *pdev; u32 length, offset; u8 bar; @@ -46,17 +39,14 @@ static void __iomem *get_cap_addr(struct offset = le32_to_cpu(cap->offset); bar = cap->bar; - ifcvf= vf_to_adapter(hw); - pdev = ifcvf->pdev; - if (bar >= IFCVF_PCI_MAX_RESOURCE) { - IFCVF_DBG(pdev, + IFCVF_DBG(hw->pdev, "Invalid bar number %u to get capabilities\n", bar); return NULL; } - if (offset + length > pci_resource_len(pdev, bar)) { - IFCVF_DBG(pdev, + if (offset + length > pci_resource_len(hw->pdev, bar)) { + IFCVF_DBG(hw->pdev, "offset(%u) + len(%u) overflows bar%u's capability\n", offset, length, bar); return NULL; @@ -92,6 +82,7 @@ int ifcvf_init_hw(struct ifcvf_hw *hw, s IFCVF_ERR(pdev, "Failed to read PCI capability list\n"); return -EIO; } + hw->pdev = pdev; while (pos) { ret = ifcvf_read_config_range(pdev, (u32 *)&cap, @@ -230,13 +221,11 @@ int ifcvf_verify_min_features(struct ifc u32 ifcvf_get_config_size(struct ifcvf_hw *hw) { - struct ifcvf_adapter *adapter; u32 net_config_size = sizeof(struct virtio_net_config); u32 blk_config_size = sizeof(struct virtio_blk_config); u32 cap_size = hw->cap_dev_config_size; u32 config_size; - adapter = vf_to_adapter(hw); /* If the onboard device config space size is greater than * the size of struct virtio_net/blk_config, only the spec * implementing contents size is returned, this is very @@ -251,7 +240,7 @@ u32 ifcvf_get_config_size(struct ifcvf_h break; default: config_size = 0; - IFCVF_ERR(adapter->pdev, "VIRTIO ID %u not supported\n", hw->dev_type); + IFCVF_ERR(hw->pdev, "VIRTIO ID %u not supported\n", hw->dev_type); } return config_size; Patches currently in stable-queue which might be from lingshan.zhu@xxxxxxxxx are queue-6.2/vdpa-ifcvf-allocate-the-adapter-in-dev_add.patch queue-6.2/vdpa-ifcvf-decouple-vq-irq-releasers-from-the-adapter.patch queue-6.2/vdpa-ifcvf-decouple-vq-irq-requester-from-the-adapter.patch queue-6.2/vdpa-ifcvf-ifcvf_request_irq-works-on-ifcvf_hw.patch queue-6.2/vdpa-ifcvf-decouple-config-space-ops-from-the-adapter.patch queue-6.2/vdpa-ifcvf-decouple-config-irq-releaser-from-the-adapter.patch queue-6.2/vdpa-ifcvf-alloc-the-mgmt_dev-before-the-adapter.patch queue-6.2/vdpa-ifcvf-manage-ifcvf_hw-in-the-mgmt_dev.patch queue-6.2/vdpa-ifcvf-decouple-hw-features-manipulators-from-the-adapter.patch queue-6.2/vdpa-ifcvf-decouple-config-dev-irq-requester-and-vectors-allocator-from-the-adapter.patch