- 13 12月, 2022 40 次提交
-
-
由 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>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.17-rc1 commit 73bc0dbb 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=73bc0dbb591baea322a7319c735e5f6c7dba9cfb ---------------------------------------------------------------------- Add wrappers to get/set status and protect these operations with cf_mutex to serialize these operations with respect to get/set config operations. Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220105114646.577224-4-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 a64917bc 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=a64917bc2e9b1e0aa716b783c4ec879fdd280300 ---------------------------------------------------------------------- Provide an interface to read the negotiated features. This is needed when building the netlink message in vdpa_dev_net_config_fill(). Also fix the implementation of vdpa_dev_net_config_fill() to use the negotiated features instead of the device features. To make APIs clearer, make the following name changes to struct vdpa_config_ops so they better describe their operations: get_features -> get_device_features set_features -> set_driver_features Finally, add get_driver_features to return the negotiated features and add implementation to all the upstream drivers. Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NEli Cohen <elic@nvidia.com> Link: https://lore.kernel.org/r/20220105114646.577224-2-elic@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eugenio Pérez 提交于
mainline inclusion from mainline-v5.17-rc1 commit 28cc408b 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=28cc408be72cebb0f3fcc37bc74ab3196d4de726 ---------------------------------------------------------------------- Since vhost_vdpa_mmap checks for its existence before calling it. Signed-off-by: NEugenio Pérez <eperezma@redhat.com> Link: https://lore.kernel.org/r/20211104195248.2088904-1-eperezma@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eugenio Pérez 提交于
mainline inclusion from mainline-v5.17-rc1 commit 23118b09 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=23118b09e6e11a03cb40a86875d5d342257ae1ec ---------------------------------------------------------------------- It has no sense to call get_status twice, since we already have a variable for that. Signed-off-by: NEugenio Pérez <eperezma@redhat.com> Link: https://lore.kernel.org/r/20211104195833.2089796-1-eperezma@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Stefano Garzarella 提交于
mainline inclusion from mainline-v5.17-rc1 commit 9c25cdeb 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=9c25cdeb5f3ca9ef0d683ee8c29b7cb61a174165 ---------------------------------------------------------------------- Add missing documentation of sysfs ABI for vDPA bus in the new Documentation/ABI/testing/sysfs-bus-vdpa file. Signed-off-by: NStefano Garzarella <sgarzare@redhat.com> Link: https://lore.kernel.org/r/20211126164753.181829-2-sgarzare@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Wu Zongyong 提交于
mainline inclusion from mainline-v5.16-rc3 commit ea8f17e4 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=ea8f17e44fa7d54fae287ccbe30ce269afb5ee42 ---------------------------------------------------------------------- Vdpa devices should be reset after unseting irqs of virtqueues, or we will get errors when killing qemu process: >> pi_update_irte: failed to update PI IRTE >> irq bypass consumer (token 0000000065102a43) unregistration fails: -22 Signed-off-by: NWu Zongyong <wuzongyong@linux.alibaba.com> Link: https://lore.kernel.org/r/a2cb60cf73be9da5c4e6399242117d8818f975ae.1636946171.git.wuzongyong@linux.alibaba.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Parav Pandit 提交于
mainline inclusion from mainline-v5.16-rc1 commit d8ca2fa5 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=d8ca2fa5be1bdb9d08cfe1f831cddb622a01dfd4 ---------------------------------------------------------------------- $ vdpa dev add name bar mgmtdev vdpasim_net mac 00:11:22:33:44:55 mtu 9000 $ vdpa dev config show bar: mac 00:11:22:33:44:55 link up link_announce false mtu 9000 $ vdpa dev config show -jp { "config": { "bar": { "mac": "00:11:22:33:44:55", "link ": "up", "link_announce ": false, "mtu": 9000, } } } Signed-off-by: NParav Pandit <parav@nvidia.com> Reviewed-by: NEli Cohen <elic@nvidia.com> Acked-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20211026175519.87795-5-parav@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Parav Pandit 提交于
mainline inclusion from mainline-v5.16-rc1 commit 960deb33 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=960deb33be3d08e55a39e40e0286a51c7448e053 ---------------------------------------------------------------------- As subsequent patch adds new structure field with comment, move the structure comment to follow kernel coding style. Signed-off-by: NParav Pandit <parav@nvidia.com> Reviewed-by: NEli Cohen <elic@nvidia.com> Acked-by: NJason Wang <jasowang@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Link: https://lore.kernel.org/r/20211026175519.87795-4-parav@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Parav Pandit 提交于
mainline inclusion from mainline-v5.16-rc1 commit ad69dd0b 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=ad69dd0bf26b88ec6ab26f8bbe5cd74fbed7672a ---------------------------------------------------------------------- Introduce a command to query a device config layout. An example query of network vdpa device: $ vdpa dev add name bar mgmtdev vdpasim_net $ vdpa dev config show bar: mac 00:35:09:19:48:05 link up link_announce false mtu 1500 $ vdpa dev config show -jp { "config": { "bar": { "mac": "00:35:09:19:48:05", "link ": "up", "link_announce ": false, "mtu": 1500, } } } Signed-off-by: NParav Pandit <parav@nvidia.com> Signed-off-by: NEli Cohen <elic@nvidia.com> Acked-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20211026175519.87795-3-parav@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Parav Pandit 提交于
mainline inclusion from mainline-v5.16-rc1 commit 6dbb1f16 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=6dbb1f1687a2ccdfc5b84b0a35bbc6dfefc4de3b ---------------------------------------------------------------------- Subsequent patches enable get and set configuration either via management device or via vdpa device' config ops. This requires synchronization between multiple callers to get and set config callbacks. Features setting also influence the layout of the configuration fields endianness. To avoid exposing synchronization primitives to callers, introduce helper for setting the configuration and use it. Signed-off-by: NParav Pandit <parav@nvidia.com> Reviewed-by: NEli Cohen <elic@nvidia.com> Acked-by: NJason Wang <jasowang@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Link: https://lore.kernel.org/r/20211026175519.87795-2-parav@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Wu Zongyong 提交于
mainline inclusion from mainline-v5.16-rc1 commit e47be840 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=e47be840e87ea15677bca2043ee7b696ccacf56a ---------------------------------------------------------------------- This attribute advertises the min value of virtqueue size. The value is 1 by default. Signed-off-by: NWu Zongyong <wuzongyong@linux.alibaba.com> Link: https://lore.kernel.org/r/2bbc417355c4d22298050b1ba887cecfbde3e85d.1635493219.git.wuzongyong@linux.alibaba.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Wu Zongyong 提交于
mainline inclusion from mainline-v5.16-rc1 commit 30a03dfc 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=30a03dfcbbdac22ade72a38b953e0709fbf35baa ---------------------------------------------------------------------- For the devices which implement the get_vq_num_min callback, the driver should not negotiate with virtqueue size with the backend vdpa device if the value returned by get_vq_num_min equals to the value returned by get_vq_num_max. This is useful for vdpa devices based on legacy virtio specfication. Signed-off-by: NWu Zongyong <wuzongyong@linux.alibaba.com> Link: https://lore.kernel.org/r/bc0551cec6c3f3dd9424b678b7c22d882aebab3a.1635493219.git.wuzongyong@linux.alibaba.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Wu Zongyong 提交于
mainline inclusion from mainline-v5.16-rc1 commit c53e5d1b 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=c53e5d1b5ea46cfd6acb4a51c324b2ec03e89e76 ---------------------------------------------------------------------- Just failed to probe the vdpa device if the min virtqueue num returned by get_vq_num_min is greater than the max virtqueue num returned by get_vq_num_max. Signed-off-by: NWu Zongyong <wuzongyong@linux.alibaba.com> Acked-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/21199b62cc10b2a9f2cf90eeb63ad080645d881f.1635493219.git.wuzongyong@linux.alibaba.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Wu Zongyong 提交于
mainline inclusion from mainline-v5.16-rc1 commit 3b970a58 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=3b970a5842c9114c82e60744c84a7d06ee51b6f9 ---------------------------------------------------------------------- This callback is optional. For vdpa devices that not support to change virtqueue size, get_vq_num_min and get_vq_num_max will return the same value, so that users can choose a correct value for that device. Suggested-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NWu Zongyong <wuzongyong@linux.alibaba.com> Acked-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/f4af5b0abd660d9a29ab6b2f67bd6df10284a230.1635493219.git.wuzongyong@linux.alibaba.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Wu Zongyong 提交于
mainline inclusion from mainline-v5.15-rc6 commit 97f854be 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=97f854be203883b61d24f230445bd533bbdf770c ---------------------------------------------------------------------- Currently we unset vq irq after freeing irq and that will result in error messages: pi_update_irte: failed to update PI IRTE irq bypass consumer (token 000000005a07a12b) unregistration fails: -22 This patch solves this. Signed-off-by: NWu Zongyong <wuzongyong@linux.alibaba.com> Link: https://lore.kernel.org/r/02637d38dcf4e4b836c5b3a65055fe92bf812b3b.1631687872.git.wuzongyong@linux.alibaba.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Dan Carpenter 提交于
mainline inclusion from mainline-v5.15-rc4 commit be9c6bad 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=be9c6bad9b46451ba5bb8d366c51e2475f374981 ---------------------------------------------------------------------- The concern here is that "ret" can be uninitialized if we hit the "goto next" condition on every iteration through the loop. Fixes: 41ba1b5f9d4b ("vdpa: Support transferring virtual addressing during DMA mapping") Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20210907073253.GB18254@kiliSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Reviewed-by: NXie Yongji <xieyongji@bytedance.com> Acked-by: NJason Wang <jasowang@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Xie Yongji 提交于
mainline inclusion from mainline-v5.15-rc1 commit 59dfe4f1 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=59dfe4f1e810b5820443c84f9863b04b033143e8 ---------------------------------------------------------------------- Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NXie Yongji <xieyongji@bytedance.com> Acked-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210831103634.33-8-xieyongji@bytedance.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Xie Yongji 提交于
mainline inclusion from mainline-v5.15-rc1 commit d8945ec4 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=d8945ec411209272bcd4ae9e75ea1b078257e492 ---------------------------------------------------------------------- This patch introduces an attribute for vDPA device to indicate whether virtual address can be used. If vDPA device driver set it, vhost-vdpa bus driver will not pin user page and transfer userspace virtual address instead of physical address during DMA mapping. And corresponding vma->vm_file and offset will be also passed as an opaque pointer. Suggested-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NXie Yongji <xieyongji@bytedance.com> Acked-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210831103634.33-11-xieyongji@bytedance.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Xie Yongji 提交于
mainline inclusion from mainline-v5.15-rc1 commit 22af48cf 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=22af48cf91aae5f2fd32fe811d9be1c52d7a801b ---------------------------------------------------------------------- The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NXie Yongji <xieyongji@bytedance.com> Acked-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210831103634.33-10-xieyongji@bytedance.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Xie Yongji 提交于
mainline inclusion from mainline-v5.15-rc1 commit c10fb945 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=c10fb9454adc80c062151c6a436047e1fa59e99f ---------------------------------------------------------------------- Add an opaque pointer for DMA mapping. Suggested-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NXie Yongji <xieyongji@bytedance.com> Acked-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210831103634.33-9-xieyongji@bytedance.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Xie Yongji 提交于
mainline inclusion from mainline-v5.15-rc1 commit 7f05630d 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=7f05630dc65d62df5d55ad3e1038ffbe5e2ce9c3 ---------------------------------------------------------------------- The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: NXie Yongji <xieyongji@bytedance.com> Acked-by: NJason Wang <jasowang@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Link: https://lore.kernel.org/r/20210831103634.33-7-xieyongji@bytedance.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Xie Yongji 提交于
mainline inclusion from mainline-v5.15-rc1 commit 86e17a51 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=86e17a51c1a5a299009f8b1645e3e9da0d59faae ---------------------------------------------------------------------- Fix some code indent issues and following checkpatch warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' 371: FILE: include/linux/vdpa.h:371: +static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset, Signed-off-by: NXie Yongji <xieyongji@bytedance.com> Acked-by: NJason Wang <jasowang@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Link: https://lore.kernel.org/r/20210831103634.33-5-xieyongji@bytedance.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Cai Huoqing 提交于
mainline inclusion from mainline-v5.15-rc1 commit 729ce5a5 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=729ce5a5bd6fda5eb2322a39db2287f1f26f92f3 ---------------------------------------------------------------------- it's a nice refactor to make use of PFN_PHYS/PFN_UP/PFN_DOWN helper macro Signed-off-by: NCai Huoqing <caihuoqing@baidu.com> Link: https://lore.kernel.org/r/20210802013717.851-1-caihuoqing@baidu.comAcked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NMichael S. Tsirkin <mst@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Xie Yongji 提交于
mainline inclusion from mainline-v5.14-rc7 commit c8d182bd 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=c8d182bd387a09a8b95303c8086238e8bf61fcfc ---------------------------------------------------------------------- The return value of vdpa_alloc_device() macro is not very clear, so that most of callers did the wrong check. Let's add some comments to better document it. Signed-off-by: NXie Yongji <xieyongji@bytedance.com> Link: https://lore.kernel.org/r/20210715080026.242-4-xieyongji@bytedance.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Reviewed-by: NStefano Garzarella <sgarzare@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Eli Cohen 提交于
mainline inclusion from mainline-v5.14-rc1 commit efa08cb4 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=efa08cb468cdd67855f63f341eac5f5f9ac93370 ---------------------------------------------------------------------- Clear the available index as part of the initialization process to clear and values that might be left from previous usage of the device. For example, if the device was previously used by vhost_vdpa and now probed by vhost_vdpa, you want to start with indices. Fixes: c043b4a8 ("virtio: introduce a vDPA based transport") Signed-off-by: NEli Cohen <elic@nvidia.com> Signed-off-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210602021536.39525-5-jasowang@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Reviewed-by: NEli Cohen <elic@nvidia.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Jason Wang 提交于
mainline inclusion from mainline-v5.14-rc1 commit 94e48d6a 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=94e48d6aafef23143f92eadd010c505c49487576 ---------------------------------------------------------------------- We forget to assign a error value when we fail to map the notification during prove. This patch fixes it. Reported-by: Nkernel test robot <lkp@intel.com> Reported-by: NDan Carpenter <dan.carpenter@oracle.com> Fixes: 11d8ffed ("vp_vdpa: switch to use vp_modern_map_vq_notify()") Signed-off-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210624035939.26618-1-jasowang@redhat.comReviewed-by: NStefano Garzarella <sgarzare@redhat.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.13-rc1 commit fd466b36 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=fd466b36940b22a506265edf12714bd0cf9ed836 ---------------------------------------------------------------------- No user now and the capability should not be setup externally. Instead, every access to the capability should be done via virtio_pci_modern_device. Signed-off-by: NJason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/r/20210415073147.19331-6-jasowang@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Reviewed-by: NEli Cohen <elic@nvidia.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-
由 Xie Yongji 提交于
mainline inclusion from mainline-v5.13-rc1 commit 9d6d97bf 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=9d6d97bff7909910af537fd3903d05338adaaefa ---------------------------------------------------------------------- Since the config checks are done by the vDPA drivers, we can remove the virtio-net restriction and we should be able to support all kinds of virtio devices. <linux/virtio_net.h> is not needed anymore, but we need to include <linux/slab.h> to avoid compilation failures. Signed-off-by: NXie Yongji <xieyongji@bytedance.com> Signed-off-by: NStefano Garzarella <sgarzare@redhat.com> Link: https://lore.kernel.org/r/20210315163450.254396-11-sgarzare@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com> Acked-by: NJason Wang <jasowang@redhat.com> Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
-