This patch propose to solve a driver incompatibility issue due to the current starting IO address for PCI addressing on RISCV arch.
PATCH 1/1 This patch propose to solve a driver incompatibility issue due to the current starting IO address for PCI addressing on RISCV arch.
The issue was observed when virtio drivers failed to load for a Virtio network PCI device (1af4:1000).
The current implementation of virtio does not permit to have a PCI resource block starting at the address 0.
This can be observed in function pci_iomap_range, at line 28 of file ./lib/pci_iomap.c:
37 if (len <= offset || !start)
38 return NULL;
Because start variable value corresponds to the PCI resource start address:
33 resource_size_t start = pci_resource_start(dev, bar);
In function virtio_pci_legacy_probe (line 212), in file ./drivers/virtio/virtio_pci_legacy.c, the returned NULL value results in returning the ENOMEM error:
246 rc = -ENOMEM;
247 vp_dev->ioaddr = pci_iomap(pci_dev, 0, 0);
248 if (!vp_dev->ioaddr)
249 goto err_iomap;
As it is already the case for other architectures (like ARM64), I suggest to add an offset the PCIBIOS_MIN_IO constant, it forces IO resource address to be non zero.
Not enough knowledge on PCI to evaluate possible issues resulting from PCIBIOS_MIN_IO value change.
---arch/riscv/include/asm/pci.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/include/asm/pci.h +0 -0
@@ -12,7 +12,7 @@
#include <asm/io.h>
-#define PCIBIOS_MIN_IO 0
+#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0
/* RISC-V shim does not initialize PCI bus */
--
2.32.0
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv