* [PATCH] This patch propose to solve a driver incompatibility issue due to the current starting IO address for PCI addressing on RISCV arch.
@ 2021-08-13 15:35 Nicolas Peslerbe
0 siblings, 0 replies; only message in thread
From: Nicolas Peslerbe @ 2021-08-13 15:35 UTC (permalink / raw)
To: linux-riscv@lists.infradead.org
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.
Signed-off-by: Nicolas Peslerbe <nicolas.peslerbe@huawei.com>
---
arch/riscv/include/asm/pci.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/include/asm/pci.h b/arch/riscv/include/asm/pci.h index 7fd52a30e605..15da9129aace 100644
--- a/arch/riscv/include/asm/pci.h
+++ b/arch/riscv/include/asm/pci.h
@@ -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
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-13 15:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-13 15:35 [PATCH] This patch propose to solve a driver incompatibility issue due to the current starting IO address for PCI addressing on RISCV arch Nicolas Peslerbe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox