In my pcie switcher system, there are one rc and two ep. Every ep’s BAR0_SIZE is SZ_512M. When i set BAR0_SIZE to SZ_2G, and on rc, lspci -v:
0005:12:00.0 RAM memory: NVIDIA Corporation Device 1ada
Flags: fast devsel, IRQ 39
Memory at 1c00000000 (64-bit, prefetchable) [disabled] [size=128K]
Memory at (64-bit, non-prefetchable) [disabled]
I download jetson4.6 source code.
how to support BAR0_SIZE to SZ_2G or SZ_4G?
1)pci-epf-nv-test.c中
ret = pci_epc_set_bar(epc, BAR_0, xdma->bar0_iova, BAR0_SIZE,
PCI_BASE_ADDRESS_SPACE_MEMORY |
PCI_BASE_ADDRESS_MEM_TYPE_32);
BAR0_SIZE定义为SZ_2G
2)rc上dmesg中log:
[ 5.689745] pci 0005:12:00.0: BAR 0: no space for [mem size 0x80000000]
[ 5.689748] pci 0005:12:00.0: BAR 0: failed to assign [mem size 0x80000000]
Hi William,
Would you please apply below and have a go ?
1.
diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c
index 6424c63…b80b887 100644
— a/drivers/pci/dwc/pcie-designware-ep.c
+++ b/drivers/pci/dwc/pcie-designware-ep.c
@@ -169,6 +169,11 @@
static int dw_pcie_ep_set_bar(struct pci_epc *epc, enum pci_barno bar,
Also, Please don’t forget to modify the memory type form PCI_BASE_ADDRESS_MEM_TYPE_32 to PCI_BASE_ADDRESS_MEM_TYPE_64
in drivers/pci/endpoint/functions/pci-epf-nv-test.c
94 ret = pci_epc_set_bar(epc, BAR_0, epfnv->bar0_iova, BAR0_SIZE,
95 PCI_BASE_ADDRESS_SPACE_MEMORY |
96 PCI_BASE_ADDRESS_MEM_TYPE_64);
So, if really need to allocate 4G memory, maybe the “dma_alloc_coherent” no suitable.
An alternative:
a. reserved 4G memory
b. map the reserved memory to PCIe domain.
There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks