- 13 12月, 2022 40 次提交
-
-
由 Xuan Zhuo 提交于
mainline inclusion from mainline-v6.0-rc1 commit 56bdc061 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=56bdc06139404b3b06ed75ec99b93445d7e0b8c3 ---------------------------------------------------------------------- Introduce vp_active_vq() to configure vring to backend after vq attach vring. And configure vq vector if necessary. Signed-off-by: NXuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: NJason Wang <jasowang@redhat.com> Message-Id: <20220801063902.129329-32-xuanzhuo@linux.alibaba.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eugenio Pérez 提交于
mainline inclusion from mainline-v6.0-rc1 commit f345a014 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f345a0143b4dd1cfc850009c6979a3801b86a06f ---------------------------------------------------------------------- The ioctl adds support for suspending the device from userspace. This is a must before getting virtqueue indexes (base) for live migration, since the device could modify them after userland gets them. There are individual ways to perform that action for some devices (VHOST_NET_SET_BACKEND, VHOST_VSOCK_SET_RUNNING, ...) but there was no way to perform it for any vhost device (and, in particular, vhost-vdpa). After a successful return of the ioctl call the device must not process more virtqueue descriptors. The device can answer to read or writes of config fields as if it were not suspended. In particular, writing to "queue_enable" with a value of 1 will not make the device start processing buffers of the virtqueue. Signed-off-by: NEugenio Pérez <eperezma@redhat.com> Message-Id: <20220810171512.2343333-4-eperezma@redhat.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eugenio Pérez 提交于
mainline inclusion from mainline-v6.0-rc1 commit 0723f1df category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0723f1df5c3ec8a1112d150dab98e149361ef488 ---------------------------------------------------------------------- Userland knows if it can suspend the device or not by checking this feature bit. It's only offered if the vdpa driver backend implements the suspend() operation callback, and to offer it or userland to ack it if the backend does not offer that callback is an error. Signed-off-by: NEugenio Pérez <eperezma@redhat.com> Message-Id: <20220810171512.2343333-3-eperezma@redhat.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eugenio Pérez 提交于
mainline inclusion from mainline-v6.0-rc1 commit 848ecea1 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=848ecea184e1253758423b37cbfc1ed732ccf5b4 ---------------------------------------------------------------------- This operation is optional: It it's not implemented, backend feature bit will not be exposed. Signed-off-by: NEugenio Pérez <eperezma@redhat.com> Message-Id: <20220810171512.2343333-2-eperezma@redhat.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Bo Liu 提交于
mainline inclusion from mainline-v6.0-rc1 commit ebe6a354 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ebe6a354fa7e0a7d5b581da31ad031b19d8693f9 ---------------------------------------------------------------------- In function vhost_vdpa_probe(), when code execution fails, we should call ida_simple_remove() to free ida. Signed-off-by: NBo Liu <liubo03@inspur.com> Message-Id: <20220805091254.20026-1-liubo03@inspur.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Zhu Lingshan 提交于
mainline inclusion from mainline-v6.0-rc1 commit 79e0034c category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=79e0034cb3485e64622ec0aabf8a6f4f8143f47b ---------------------------------------------------------------------- This commit fixes spars warnings: cast to restricted __le16 in function vdpa_dev_net_config_fill() and vdpa_fill_stats_rec() Signed-off-by: NZhu Lingshan <lingshan.zhu@intel.com> Reviewed-by: NParav Pandit <parav@nvidia.com> Message-Id: <20220722115309.82746-7-lingshan.zhu@intel.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Zhu Lingshan 提交于
mainline inclusion from mainline-v6.0-rc1 commit a34bed37 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a34bed37fc9d3da319bb75dfbf02a7d3e95e12de ---------------------------------------------------------------------- Users may want to query the config space of a vDPA device, to choose a appropriate one for a certain guest. This means the users need to read the config space before FEATURES_OK, and the existence of config space contents does not depend on FEATURES_OK. The spec says: The device MUST allow reading of any device-specific configuration field before FEATURES_OK is set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device. Signed-off-by: NZhu Lingshan <lingshan.zhu@intel.com> Message-Id: <20220722115309.82746-5-lingshan.zhu@intel.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Jason Wang 提交于
mainline inclusion from mainline-v5.19-rc2 commit 00d1f546 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=00d1f546470d89e072dd3cda12b5c794341e7268 ---------------------------------------------------------------------- This patch makes get_vq_group and set_group_asid optional. This is needed to unbreak the vDPA parent that doesn't support multiple address spaces. Cc: Gautam Dawar <gautam.dawar@xilinx.com> Fixes: aaca8373 ("vhost-vdpa: support ASID based IOTLB API") Signed-off-by: NJason Wang <jasowang@redhat.com> Message-Id: <20220609041901.2029-1-jasowang@redhat.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Dan Carpenter 提交于
mainline inclusion from mainline-v5.19-rc1 commit f4a8686e category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f4a8686ec7a34f940d36784872036fbacb1b4623 ---------------------------------------------------------------------- The copy_to_user() function returns the number of bytes remaining to be copied. However, we need to return a negative error code, -EFAULT, to the user. Fixes: 87f4c217413a ("vhost-vdpa: introduce uAPI to get the number of virtqueue groups") Fixes: e96ef636f154 ("vhost-vdpa: introduce uAPI to get the number of address spaces") Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Message-Id: <YotG1vXKXXSayr63@kili> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Cindy Lu 提交于
mainline inclusion from mainline-v5.19-rc1 commit ffbda8e9 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffbda8e9df10d1784d5427ec199e7d8308e3763f ---------------------------------------------------------------------- this patch is to add the support for vdpa tool in vp_vdpa here is the example steps modprobe vp_vdpa modprobe vhost_vdpa echo 0000:00:06.0>/sys/bus/pci/drivers/virtio-pci/unbind echo 1af4 1041 > /sys/bus/pci/drivers/vp-vdpa/new_id vdpa dev add name vdpa1 mgmtdev pci/0000:00:06.0 Signed-off-by: NCindy Lu <lulu@redhat.com> Message-Id: <20220429091030.547434-1-lulu@redhat.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit aaca8373 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aaca8373c4b1e010b8d748fc99d929de1bf860b8 ---------------------------------------------------------------------- This patch extends the vhost-vdpa to support ASID based IOTLB API. The vhost-vdpa device will allocated multiple IOTLBs for vDPA device that supports multiple address spaces. The IOTLBs and vDPA device memory mappings is determined and maintained through ASID. Note that we still don't support vDPA device with more than one address spaces that depends on platform IOMMU. This work will be done by moving the IOMMU logic from vhost-vDPA to vDPA device driver. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-16-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Includes fixup: vhost-vdpa: Fix some error handling path in vhost_vdpa_process_iotlb_msg() In the error paths introduced by the original patch, a mutex may be left locked. Add the correct goto instead of a direct return. Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr> Message-Id: <89ef0ae4c26ac3cfa440c71e97e392dcb328ac1b.1653227924.git.christophe.jaillet@wanadoo.fr> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 84d7c8fd category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=84d7c8fd3aade2fe79313003ed06ede431ec2a6d ---------------------------------------------------------------------- Follows the vDPA support for associating ASID to a specific virtqueue group. This patch adds a uAPI to support setting them from userspace. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-15-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 2d1fcb77 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2d1fcb7758e49fd9caf150f3c70804b95b2ce80c ---------------------------------------------------------------------- Follows the support for virtqueue group in vDPA. This patches introduces uAPI to get the virtqueue group ID for a specific virtqueue in vhost-vdpa. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-14-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit a0c95f20 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a0c95f201170bd559737d3cdc8a950aea62f29c6 ---------------------------------------------------------------------- This patch introduces the uAPI for getting the number of address spaces supported by this vDPA device. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-13-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 3ace88bd category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3ace88bd37436abc84906312146fe5158a469142 ---------------------------------------------------------------------- Follows the vDPA support for multiple address spaces, this patch introduce uAPI for the userspace to know the number of virtqueue groups supported by the vDPA device. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-12-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 3d569879 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3d5698793897a2b9c0060d899881d1a0591630d5 ---------------------------------------------------------------------- This patch converts the vhost-vDPA device to support multiple IOTLBs tagged via ASID via hlist. This will be used for supporting multiple address spaces in the following patches. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-11-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 91233ad7 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=91233ad711866f4e375742d84ef3ed6aab9daa96 ---------------------------------------------------------------------- This patches allows userspace to send ASID based IOTLB message to vhost. This idea is to use the reserved u32 field in the existing V2 IOTLB message. Vhost device should advertise this capability via VHOST_BACKEND_F_IOTLB_ASID backend feature. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-10-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 1cb10899 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cb108994c6830cc6a6e066ad7d9a22ef59fa167 ---------------------------------------------------------------------- This patch splits out IOTLB initialization to make sure it could be reused by external modules. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-9-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 46d554b1 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=46d554b1bcd19133401d2d5c0728b85e7bfd1358 ---------------------------------------------------------------------- This patch introduces a new bus operation to allow the vDPA bus driver to associate an ASID to a virtqueue group. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-8-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit db9adcbf category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=db9adcbf4286ad1c1fca091a870db6e49bb0df07 ---------------------------------------------------------------------- This patches introduces the multiple address spaces support for vDPA device. This idea is to identify a specific address space via an dedicated identifier - ASID. During vDPA device allocation, vDPA device driver needs to report the number of address spaces supported by the device then the DMA mapping ops of the vDPA device needs to be extended to support ASID. This helps to isolate the environments for the virtqueue that will not be assigned directly. E.g in the case of virtio-net, the control virtqueue will not be assigned directly to guest. As a start, simply claim 1 virtqueue groups and 1 address spaces for all vDPA devices. And vhost-vDPA will simply reject the device with more than 1 virtqueue groups or address spaces. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-7-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit d4821902 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d4821902e43453b85b31329441a9f6ac071228a8 ---------------------------------------------------------------------- This patch introduces virtqueue groups to vDPA device. The virtqueue group is the minimal set of virtqueues that must share an address space. And the address space identifier could only be attached to a specific virtqueue group. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-6-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> [Changes to ifcvf and mlx5 are not included.] Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 0b7ee47c category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b7ee47c5f36634926def0142a515eafedc8a779 ---------------------------------------------------------------------- To ease the implementation of per group ASID support for vDPA device. This patch switches to use a vhost-vdpa specific IOTLB to avoid the unnecessary refactoring of the vhost core. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-5-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit ae967246 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ae967246d0997a684093ffc06a14999292ad9276 ---------------------------------------------------------------------- To prepare for the ASID support for vhost-vdpa, try to pass IOTLB object to dma helpers. No functional changes, it's just a preparation for support multiple IOTLBs. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-4-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit ea239a67 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ea239a67461a34839e2172ead3043295a9173389 ---------------------------------------------------------------------- There's no need for setting callbacks for the driver that doesn't care about that. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-3-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Gautam Dawar 提交于
mainline inclusion from mainline-v5.19-rc1 commit 175d493c category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=175d493c3c3e09a3abaa843068fae0f0ad42c47e ---------------------------------------------------------------------- We should store feature bits in vhost_types.h as what has been done for e.g VHOST_F_LOG_ALL. Signed-off-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NGautam Dawar <gdawar@xilinx.com> Message-Id: <20220330180436.24644-2-gdawar@xilinx.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.19-rc1 commit a6a51adc category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a6a51adc6e8aafebfe0c4beb80e99694ea562b40 ---------------------------------------------------------------------- Replace cf_mutex with rw_semaphore to reflect the fact that some calls could be called concurrently but can suffice with read lock. Suggested-by: NSi-Wei Liu <si-wei.liu@oracle.com> Signed-off-by: NEli Cohen <elic@nvidia.com> Message-Id: <20220518133804.1075129-5-elic@nvidia.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.19-rc1 commit 0078ad90 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0078ad905dc8eada34461312a0060b0904c57e2d ---------------------------------------------------------------------- Use rw_semaphore instead of mutex to control access to vdpa devices. This can be especially beneficial in case processes poll on statistics information. Suggested-by: NSi-Wei Liu <si-wei.liu@oracle.com> Reviewed-by: NSi-Wei Liu <si-wei.liu@oracle.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NEli Cohen <elic@nvidia.com> Message-Id: <20220518133804.1075129-4-elic@nvidia.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.19-rc1 commit 13b00b13 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=13b00b135665c92065a27c0c39dd97e0f380bd4f ---------------------------------------------------------------------- Allows to read vendor statistics of a vdpa device. The specific statistics data are received from the upstream driver in the form of an (attribute name, attribute value) pairs. An example of statistics for mlx5_vdpa device are: received_desc - number of descriptors received by the virtqueue completed_desc - number of descriptors completed by the virtqueue A descriptor using indirect buffers is still counted as 1. In addition, N chained descriptors are counted correctly N times as one would expect. A new callback was added to vdpa_config_ops which provides the means for the vdpa driver to return statistics results. The interface allows for reading all the supported virtqueues, including the control virtqueue if it exists. Below are some examples taken from mlx5_vdpa which are introduced in the following patch: 1. Read statistics for the virtqueue at index 1 $ vdpa dev vstats show vdpa-a qidx 1 vdpa-a: queue_type tx queue_index 1 received_desc 3844836 completed_desc 3844836 2. Read statistics for the virtqueue at index 32 $ vdpa dev vstats show vdpa-a qidx 32 vdpa-a: queue_type control_vq queue_index 32 received_desc 62 completed_desc 62 3. Read statisitics for the virtqueue at index 0 with json output $ vdpa -j dev vstats show vdpa-a qidx 0 {"vstats":{"vdpa-a":{ "queue_type":"rx","queue_index":0,"name":"received_desc","value":417776,\ "name":"completed_desc","value":417548}}} 4. Read statistics for the virtqueue at index 0 with preety json output $ vdpa -jp dev vstats show vdpa-a qidx 0 { "vstats": { "vdpa-a": { "queue_type": "rx", "queue_index": 0, "name": "received_desc", "value": 417776, "name": "completed_desc", "value": 417548 } } } Signed-off-by: NEli Cohen <elic@nvidia.com> Message-Id: <20220518133804.1075129-3-elic@nvidia.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.19-rc1 commit 7a6691f1 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7a6691f1f89784f775fa0c54be57533445726068 ---------------------------------------------------------------------- In vdpa_nl_cmd_dev_get_doit(), if the call to genlmsg_reply() fails we must not call nlmsg_free() since this is done inside genlmsg_reply(). Fix it. Fixes: bc0d90ee ("vdpa: Enable user to query vdpa device info") Reviewed-by: NSi-Wei Liu <si-wei.liu@oracle.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NEli Cohen <elic@nvidia.com> Message-Id: <20220518133804.1075129-2-elic@nvidia.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Anirudh Rayabharam 提交于
mainline inclusion from mainline-v5.18-rc1 commit 03a91c9a category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=03a91c9af2c42ae14afafb829a4b7e6589ab5892 ---------------------------------------------------------------------- vhost_iotlb_add_range_ctx() handles the range [0, ULONG_MAX] by splitting it into two ranges and adding them separately. The return value of adding the first range to the iotlb is currently ignored. Check the return value and bail out in case of an error. Signed-off-by: NAnirudh Rayabharam <mail@anirudhrb.com> Link: https://lore.kernel.org/r/20220312141121.4981-1-mail@anirudhrb.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Fixes: e2ae38cf ("vhost: fix hung thread due to erroneous iotlb entries") Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Longpeng 提交于
mainline inclusion from mainline-v5.18-rc1 commit 81d46d69 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=81d46d693173a5c86a9b0c648eca1817ad5c0ae5 ---------------------------------------------------------------------- Change vdpa_device.nvqs and vhost_vdpa.nvqs to use u32 Signed-off-by: NLongpeng <longpeng2@huawei.com> Link: https://lore.kernel.org/r/20220315032553.455-3-longpeng2@huawei.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: Longpeng <<a href="mailto:longpeng2@huawei.com" target="_blank">longpeng2@huawei.com</a>><br></blockquote><div><br></div><div>Acked-by: Jason Wang <<a href="mailto:jasowang@redhat.com">jasowang@redhat.com</a>></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Anirudh Rayabharam 提交于
mainline inclusion from mainline-v5.17-rc8 commit e2ae38cf category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e2ae38cf3d91837a493cb2093c87700ff3cbe667 ---------------------------------------------------------------------- In vhost_iotlb_add_range_ctx(), range size can overflow to 0 when start is 0 and last is ULONG_MAX. One instance where it can happen is when userspace sends an IOTLB message with iova=size=uaddr=0 (vhost_process_iotlb_msg). So, an entry with size = 0, start = 0, last = ULONG_MAX ends up in the iotlb. Next time a packet is sent, iotlb_access_ok() loops indefinitely due to that erroneous entry. Call Trace: <TASK> iotlb_access_ok+0x21b/0x3e0 drivers/vhost/vhost.c:1340 vq_meta_prefetch+0xbc/0x280 drivers/vhost/vhost.c:1366 vhost_transport_do_send_pkt+0xe0/0xfd0 drivers/vhost/vsock.c:104 vhost_worker+0x23d/0x3d0 drivers/vhost/vhost.c:372 kthread+0x2e9/0x3a0 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 </TASK> Reported by syzbot at: https://syzkaller.appspot.com/bug?extid=0abd373e2e50d704db87 To fix this, do two things: 1. Return -EINVAL in vhost_chr_write_iter() when userspace asks to map a range with size 0. 2. Fix vhost_iotlb_add_range_ctx() to handle the range [0, ULONG_MAX] by splitting it into two entries. Fixes: 0bbe3066 ("vhost: factor out IOTLB") Reported-by: syzbot+0abd373e2e50d704db87@syzkaller.appspotmail.com Tested-by: syzbot+0abd373e2e50d704db87@syzkaller.appspotmail.com Signed-off-by: NAnirudh Rayabharam <mail@anirudhrb.com> Link: https://lore.kernel.org/r/20220305095525.5145-1-mail@anirudhrb.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Si-Wei Liu 提交于
mainline inclusion from mainline-v5.17-rc8 commit e0077cc1 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e0077cc13b831f8fad5557442f73bf7728683713 ---------------------------------------------------------------------- No functional change introduced. vdpa bus driver such as virtio_vdpa or vhost_vdpa is not supposed to take care of the locking for core by its own. The locked API vdpa_set_features should suffice the bus driver's need. Signed-off-by: NSi-Wei Liu <si-wei.liu@oracle.com> Reviewed-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/1642206481-30721-2-git-send-email-si-wei.liu@oracle.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.17-rc1 commit 680ab9d6 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=680ab9d69a04cfd9f3f5fedaacbc1974b2959121 ---------------------------------------------------------------------- Call reset using the wrapper function vdpa_reset() to make sure the operation is serialized with cf_mutex. This comes to protect from the following possible scenario: vhost_vdpa_set_status() could call the reset op. Since the call is not protected by cf_mutex, a netlink thread calling vdpa_dev_config_fill could get passed the VIRTIO_CONFIG_S_FEATURES_OK check in vdpa_dev_config_fill() and end up reporting wrong features. Fixes: 5f6e85953d8f ("vdpa: Read device configuration only if FEATURES_OK") Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220111183400.38418-3-elic@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Reviewed-by: Si-Wei Liu<si-wei.liu@oracle.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.17-rc1 commit f6d955d8 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f6d955d80830b6e6f6a170be68cc3628f36365dd ---------------------------------------------------------------------- Avoid the wrapper holding cf_mutex since it is not protecting anything. To avoid confusion and unnecessary overhead incurred by it, remove. Fixes: f489f27bc0ab ("vdpa: Sync calls set/get config/status with cf_mutex") Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220111183400.38418-2-elic@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Reviewed-by: Si-Wei Liu<si-wei.liu@oracle.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.17-rc1 commit 47a1401a category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=47a1401ac95f95936148b813843ee51d516921ea ---------------------------------------------------------------------- All masks in this file are 64 bits. Change BIT to BIT_ULL. Other occurences use (1 << val) which yields a 32 bit value. Change them to use BIT_ULL too. Reviewed-by: NSi-Wei Liu <si-wei.liu@oracle.com> Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220105114646.577224-14-elic@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.17-rc1 commit cd2629f6 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cd2629f6df1cab5b3df34705ae7f3bde6147fce3 ---------------------------------------------------------------------- Add max_supported_vqs and supported_features fields to struct vdpa_mgmt_dev. Upstream drivers need to feel these values according to the device capabilities. These values are reported back in a netlink message when showing management devices. Examples: $ auxiliary/mlx5_core.sf.1: supported_classes net max_supported_vqs 257 dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ \ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM $ vdpa -j mgmtdev show {"mgmtdev":{"auxiliary/mlx5_core.sf.1":{"supported_classes":["net"], \ "max_supported_vqs":257,"dev_features":["CSUM","GUEST_CSUM","MTU", \ "HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR", \ "VERSION_1","ACCESS_PLATFORM"]}}} $ vdpa -jp mgmtdev show { "mgmtdev": { "auxiliary/mlx5_core.sf.1": { "supported_classes": [ "net" ], "max_supported_vqs": 257, "dev_features": ["CSUM","GUEST_CSUM","MTU","HOST_TSO4", \ "HOST_TSO6","STATUS","CTRL_VQ","MQ", \ "CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM"] } } } Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220105114646.577224-11-elic@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Reviewed-by: Si-Wei Liu<si-wei.liu@oracle.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.17-rc1 commit 612f330e category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=612f330ec56f12c0d099286c45f82d835845f136 ---------------------------------------------------------------------- Add netlink attribute to store the negotiated features. This can be used by userspace to get the current state of the vdpa instance. Examples: $ vdpa dev config show vdpa-a vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 16 mtu 1500 negotiated_features CSUM GUEST_CSUM MTU MAC HOST_TSO4 HOST_TSO6 STATUS \ CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM $ vdpa -j dev config show vdpa-a {"config":{"vdpa-a":{"mac":"00:00:00:00:88:88","link ":"up","link_announce":false, \ "max_vq_pairs":16,"mtu":1500,"negotiated_features":["CSUM","GUEST_CSUM","MTU","MAC", \ "HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR","VERSION_1", \ "ACCESS_PLATFORM"]}}} $ vdpa -jp dev config show vdpa-a { "config": { "vdpa-a": { "mac": "00:00:00:00:88:88", "link ": "up", "link_announce ": false, "max_vq_pairs": 16, "mtu": 1500, "negotiated_features": [ "CSUM","GUEST_CSUM","MTU","MAC","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ", \ "CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM" ] } } } Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220105114646.577224-9-elic@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.17-rc1 commit aba21aff category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aba21aff772b8622e08f07219069be793429a48f ---------------------------------------------------------------------- Add netlink support to configure the max virtqueue pairs for a device. At least one pair is required. The maximum is dictated by the device. Example: $ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 4 Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220105114646.577224-6-elic@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.17-rc1 commit 30ef7a8a category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=30ef7a8ac8a07046b9ac9206d3a732a9f76b2e60 ---------------------------------------------------------------------- Avoid reading device configuration during feature negotiation. Read device status and verify that VIRTIO_CONFIG_S_FEATURES_OK is set. Protect the entire operation, including configuration read with cf_mutex to ensure integrity of the results. Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220105114646.577224-5-elic@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-