Gao Shiyuan
55fa4be6f7
virtio-pci: fix memory_region_find for VirtIOPCIRegion's MR
...
As shown below, if a virtio PCI device is attached under a pci-bridge, the MR
of VirtIOPCIRegion does not belong to any address space. So memory_region_find
cannot be used to search for this MR.
Introduce the virtio-pci and pci_bridge address spaces to solve this problem.
Before:
memory-region: pci_bridge_pci
0000000000000000-ffffffffffffffff (prio 0, i/o): pci_bridge_pci
00000000fe840000-00000000fe840fff (prio 1, i/o): virtio-net-pci-msix
00000000fe840000-00000000fe84003f (prio 0, i/o): msix-table
00000000fe840800-00000000fe840807 (prio 0, i/o): msix-pba
0000380000000000-0000380000003fff (prio 1, i/o): virtio-pci
0000380000000000-0000380000000fff (prio 0, i/o): virtio-pci-common-virtio-net
0000380000001000-0000380000001fff (prio 0, i/o): virtio-pci-isr-virtio-net
0000380000002000-0000380000002fff (prio 0, i/o): virtio-pci-device-virtio-net
0000380000003000-0000380000003fff (prio 0, i/o): virtio-pci-notify-virtio-net
After:
address-space: virtio-pci-cfg-mem-as
0000380000000000-0000380000003fff (prio 1, i/o): virtio-pci
0000380000000000-0000380000000fff (prio 0, i/o): virtio-pci-common-virtio-net
0000380000001000-0000380000001fff (prio 0, i/o): virtio-pci-isr-virtio-net
0000380000002000-0000380000002fff (prio 0, i/o): virtio-pci-device-virtio-net
0000380000003000-0000380000003fff (prio 0, i/o): virtio-pci-notify-virtio-net
address-space: pci_bridge_pci_mem
0000000000000000-ffffffffffffffff (prio 0, i/o): pci_bridge_pci
00000000fe840000-00000000fe840fff (prio 1, i/o): virtio-net-pci-msix
00000000fe840000-00000000fe84003f (prio 0, i/o): msix-table
00000000fe840800-00000000fe840807 (prio 0, i/o): msix-pba
0000380000000000-0000380000003fff (prio 1, i/o): virtio-pci
0000380000000000-0000380000000fff (prio 0, i/o): virtio-pci-common-virtio-net
0000380000001000-0000380000001fff (prio 0, i/o): virtio-pci-isr-virtio-net
0000380000002000-0000380000002fff (prio 0, i/o): virtio-pci-device-virtio-net
0000380000003000-0000380000003fff (prio 0, i/o): virtio-pci-notify-virtio-net
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2576
Fixes: ffa8a3e3b2
("virtio-pci: Add lookup subregion of VirtIOPCIRegion MR")
Co-developed-by: Zuo Boqun <zuoboqun@baidu.com >
Signed-off-by: Zuo Boqun <zuoboqun@baidu.com >
Co-developed-by: Wang Liang <wangliang44@baidu.com >
Signed-off-by: Wang Liang <wangliang44@baidu.com >
Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com >
Message-Id: <20241030131324.34144-1-gaoshiyuan@baidu.com >
Tested-by: Daniel P. Berrangé <berrange@redhat.com >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2024-11-04 16:03:24 -05:00
Michael S. Tsirkin
67f5b279fc
Revert "virtio-pci: Implement SR-IOV PF"
...
This reverts commit 3f868ffb0b
.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2024-08-01 04:32:00 -04:00
Akihiko Odaki
3f868ffb0b
virtio-pci: Implement SR-IOV PF
...
Allow user to attach SR-IOV VF to a virtio-pci PF.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com >
Message-Id: <20240715-sriov-v5-6-3f5539093ffc@daynix.com >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2024-07-22 20:15:41 -04:00
Jiqian Chen
5d98e18823
virtio-pci: implement No_Soft_Reset bit
...
In current code, when guest does S3, virtio-gpu are reset due to the
bit No_Soft_Reset is not set. After resetting, the display resources
of virtio-gpu are destroyed, then the display can't come back and only
show blank after resuming.
Implement No_Soft_Reset bit of PCI_PM_CTRL register, then guest can check
this bit, if this bit is set, the devices resetting will not be done, and
then the display can work after resuming.
No_Soft_Reset bit is implemented for all virtio devices, and was tested
only on virtio-gpu device. Set it false by default for safety.
Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com >
Message-Id: <20240606102205.114671-3-Jiqian.Chen@amd.com >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2024-07-01 17:16:05 -04:00
Michael S. Tsirkin
4034159c1a
Revert "hw/virtio: Add support for VDPA network simulation devices"
...
This reverts commit cd341fd1ff
.
The patch adds non-upstream code in
include/standard-headers/linux/virtio_pci.h
which would make maintainance harder.
Revert for now.
Suggested-by: Jason Wang <jasowang@redhat.com >
Message-Id: <df6b6b465753e754a19459e8cd61416548f89a42.1712569644.git.mst@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2024-04-09 02:30:18 -04:00
Hao Chen
cd341fd1ff
hw/virtio: Add support for VDPA network simulation devices
...
This patch adds support for VDPA network simulation devices.
The device is developed based on virtio-net and tap backend,
and supports hardware live migration function.
For more details, please refer to "docs/system/devices/vdpa-net.rst"
Signed-off-by: Hao Chen <chenh@yusur.tech >
Message-Id: <20240221073802.2888022-1-chenh@yusur.tech >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2024-03-12 17:56:55 -04:00
Philippe Mathieu-Daudé
837053a7f4
hw/virtio: Add VirtioPCIDeviceTypeInfo::instance_finalize field
...
The VirtioPCIDeviceTypeInfo structure, added in commit a4ee4c8baa
("virtio: Helper for registering virtio device types") got extended
in commit 8ea90ee690
("virtio: add class_size") with the @class_size
field. Do similarly with the @instance_finalize field.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-id: 20231121174051.63038-2-philmd@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Peter Maydell <peter.maydell@linaro.org >
2023-11-27 15:27:39 +00:00
Dr. David Alan Gilbert
605a16a762
virtio: Add shared memory capability
...
Define a new capability type 'VIRTIO_PCI_CAP_SHARED_MEMORY_CFG' to allow
defining shared memory regions with sizes and offsets of 2^32 and more.
Multiple instances of the capability are allowed and distinguished
by a device-specific 'id'.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com >
Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com >
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org >
Tested-by: Alyssa Ross <hi@alyssa.is >
Tested-by: Huang Rui <ray.huang@amd.com >
Tested-by: Akihiko Odaki <akihiko.odaki@daynix.com >
Acked-by: Huang Rui <ray.huang@amd.com >
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org >
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com >
2023-10-16 11:29:56 +04:00
Cindy Lu
1680542862
virtio-pci: add support for configure interrupt
...
Add process to handle the configure interrupt, The function's
logic is the same with vq interrupt.Add extra process to check
the configure interrupt
Signed-off-by: Cindy Lu <lulu@redhat.com >
Message-Id: <20221222070451.936503-11-lulu@redhat.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2023-01-08 01:54:22 -05:00
Longpeng
2273324540
virtio: get class_id and pci device id by the virtio id
...
Add helpers to get the "Transitional PCI Device ID" and "class_id"
of the device specified by the "Virtio Device ID".
These helpers will be used to build the generic vDPA device later.
Acked-by: Jason Wang <jasowang@redhat.com >
Signed-off-by: Longpeng <longpeng2@huawei.com >
Message-Id: <20221215134944.2809-2-longpeng2@huawei.com >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2022-12-21 06:35:28 -05:00
Xuan Zhuo
805d782d28
virtio-pci: support queue reset
...
PCI devices support vq reset.
Based on this function, the driver can adjust the size of the ring, and
quickly recycle the buffer in the ring.
The migration of the virtio devices will not happen during a reset
operation. This is becuase the global iothread lock is held. Migration
thread also needs the lock. As a result, when migration of virtio
devices starts, the 'reset' status of VirtIOPCIQueue will always be 0.
Thus, we do not need to add it in vmstate_virtio_pci_modern_queue_state.
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com >
Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com >
Acked-by: Jason Wang <jasowang@redhat.com >
Message-Id: <20221017092558.111082-6-xuanzhuo@linux.alibaba.com >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2022-11-07 13:12:20 -05:00
Alex Bennée
e1b1f5341a
hw/virtio: move virtio-pci.h into shared include space
...
This allows other device classes that will be exposed via PCI to be
able to do so in the appropriate hw/ directory. I resisted the
temptation to re-order headers to be more aesthetically pleasing.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org >
Message-Id: <20200925125147.26943-4-alex.bennee@linaro.org >
Message-Id: <20220321153037.3622127-2-alex.bennee@linaro.org >
Reviewed-by: Michael S. Tsirkin <mst@redhat.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2022-05-16 04:38:40 -04:00