linux-stable/drivers/vdpa
Dragos Tatulea abb0dcf993 vdpa/mlx5: Fix firmware error on creation of 1k VQs
A firmware error is triggered when configuring a 9k MTU on the PF after
switching to switchdev mode and then using a vdpa device with larger
(1k) rings:
mlx5_cmd_out_err: CREATE_GENERAL_OBJECT(0xa00) op_mod(0xd) failed, status bad resource(0x5), syndrome (0xf6db90), err(-22)

This is due to the fact that the hw VQ size parameters are computed
based on the umem_1/2/3_buffer_param_a/b capabilities and all
device capabilities are read only when the driver is moved to switchdev mode.

The problematic configuration flow looks like this:
1) Create VF
2) Unbind VF
3) Switch PF to switchdev mode.
4) Bind VF
5) Set PF MTU to 9k
6) create vDPA device
7) Start VM with vDPA device and 1K queue size

Note that setting the MTU before step 3) doesn't trigger this issue.

This patch reads the forementioned umem parameters at the latest point
possible before the VQs of the device are created.

v2:
- Allocate output with kmalloc to reduce stack frame size.
- Removed stable from cc.

Fixes: 1a86b377aa ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Message-Id: <20230831155702.1080754-1-dtatulea@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
2023-10-18 11:29:41 -04:00
..
alibaba vdpa: multiple address spaces support 2022-05-31 12:44:27 -04:00
ifcvf vDPA/ifcvf: implement new accessors for vq_state 2023-07-03 12:15:12 -04:00
mlx5 vdpa/mlx5: Fix firmware error on creation of 1k VQs 2023-10-18 11:29:41 -04:00
pds pds_vdpa: fix up debugfs feature bit printing 2023-08-10 15:51:46 -04:00
solidrun vdpa/snet: implement the resume vDPA callback 2023-06-27 10:47:08 -04:00
vdpa_sim vdpa_sim_blk: Fix the potential leak of mgmt_dev 2023-10-18 11:28:47 -04:00
vdpa_user vduse: Use proper spinlock for IRQ injection 2023-08-10 15:24:28 -04:00
virtio_pci vp_vdpa: fix the crash in hot unplug with vp_vdpa 2023-03-10 03:48:27 -05:00
Kconfig pds_vdpa: pds_vdps.rst and Kconfig 2023-06-27 10:47:09 -04:00
Makefile pds_vdpa: Add new vDPA driver for AMD/Pensando DSC 2023-06-27 10:47:08 -04:00
vdpa.c vdpa: Enable strict validation for netlinks ops 2023-08-10 15:24:28 -04:00