On 8/28/22 19:49, Xiang W wrote:
Please try my patch and let me know the test results

diff --git a/drivers/virtio/virtio_pci_modern.c 
b/drivers/virtio/virtio_pci_modern.c
index 880a12cc28..cfde4007f5 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -466,7 +466,7 @@ static void __iomem *virtio_pci_map_capability(struct 
udevice *udev,
         unsigned long mask =
                         PCI_REGION_TYPE | PCI_REGION_SYS_MEMORY | 
PCI_REGION_RO;
         unsigned long flags = PCI_REGION_MEM;
-       u8 *p = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0 + cap->bar, cap->offset,
+       u8 *p = dm_pci_map_bar(udev, PCI_BASE_ADDRESS_0 + 4 * cap->bar, 
cap->offset,
                                cap->length, mask, flags);
return (void __iomem *)p;

It fixes the problem for me. Tested on U-Boot master with both mmode and smode, also with the original libvirt use case.

Thanks!

--
Regards,
Felix Yan

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to