PCIe BAR length limit

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PCIe BAR length limit

Jump to solution
35,397 Views
Nevyn75
Contributor I

Hi.

I have a custom FPGA connected to i.mx6q on pcie bus.

I need to open 2 BARs with lengths of 64MB and 256KB but after some tests I found that it seems to be a limit of 4MB for memory regions under which everything's ok and over which I get these messages on kernel startup:

[    1.307700] pci 0000:01:00.0: BAR 0: can't assign mem pref (size 0x4000000)

[    1.314698] pci 0000:01:00.0: BAR 1: can't assign mem pref (size 0x40000)

I've found a similar problem on a previous application with Marvell Armada Xp and I solved it by changing a couple of parameters inside kernel board drivers, but I can't find similar defines inside linux sources for i.mx6.

Can someone help me in finding a solution please?

Thank you very much.

Labels (3)
Tags (3)
1 Solution
16,371 Views
karina_valencia
NXP Apps Support
NXP Apps Support
Re: PCIe BAR length limit

Hongxing ZhuEmployee

Based on the imx_3.0.35.4.0  FSL Linux BSP release, the layout of the 16MB address space of PCIe RC is listed below:

         * i.MX6 defines 16MB in the AXI address map for PCIe.

         *

         * That address space excepted the pcie registers is

         * split and defined into different regions by iATU,

         * with sizes and offsets as follows:

         *

         * RC:

         * 0x0100_0000 --- 0x010F_FFFF 1MB IORESOURCE_IO

         * 0x0110_0000 --- 0x01EF_FFFF 14MB IORESOURCE_MEM

         * 0x01F0_0000 --- 0x01FF_FFFF 1MB Cfg + MSI + Registers

         *

0x0110_0000 ~ 0x01EF_FFFF 14MB would be used for MEM allocation.

But the "IORESOURCE_SIZEALIGN" would be used during the Linux PCI/PCIe subsystem probe/scan the bus and allocate the resources.

If the 8MB MEM is required, the start address 0x0180_0000 would be used by Linux PCI/PCIe subsystem, trying to

allocate the 8MB MEM space (0x0180_0000 ~ 0x01FF_FFFF), this operation would be failed.

Because that the limitation of the MEM space of iMX6 PCIe RC is

* 0x0110_0000 --- 0x01EF_FFFF 14MB IORESOURCE_MEM

So, One method to allocate the 8MB(the biggest size of IO/MEM space) MEM space on iMX6 PCIe RC.

Adjust the layout of the 16MB address space of iMX6 PCIe RC, like this:

         * RC:

         * 0x0100_0000 --- 0x01DF_FFFF 14MB IORESOURCE_MEM

         * 0x01E0_0000 --- 0x01EF_FFFF 1MB IORESOURCE_IO

         * 0x01F0_0000 --- 0x01FF_FFFF 1MB Cfg + MSI + Registers

The 8MB space would be allocated from 0x0100_0000 ~ 0x017F_FFFF.

Based two imx6 platforms, one is used as RC, the other is used as RC.

Here is the test log at RC side:

iMX6 PCIe PCIe RC mode imx_pcie_pltfm_probe entering.

PCIE: imx_pcie_pltfm_probe start link up.

IMX PCIe port: link up.

PCI: bus0: Fast back to back transfers disabled

PCI: bus1: Fast back to back transfers disabled

pci 0000:00:00.0: BAR 8: assigned [mem 0x01000000-0x017fffff]

pci 0000:00:00.0: BAR 0: assigned [mem 0x01800000-0x018fffff 64bit pref]

pci 0000:00:00.0: BAR 0: set to [mem 0x01800000-0x018fffff 64bit pref] (PCI address [0x1800000-0x18fffff])

pci 0000:00:00.0: BAR 9: assigned [mem 0x01900000-0x019fffff pref]

pci 0000:00:00.0: BAR 6: assigned [mem 0x01a00000-0x01a0ffff pref]

pci 0000:00:00.0: BAR 7: assigned [io  0x1e00000-0x1e00fff]

pci 0000:01:00.0: BAR 0: assigned [mem 0x01000000-0x017fffff]

pci 0000:01:00.0: BAR 0: set to [mem 0x01000000-0x017fffff] (PCI address [0x1000000-0x17fffff])

pci 0000:01:00.0: BAR 6: assigned [mem 0x01900000-0x0190ffff pref]

pci 0000:01:00.0: BAR 2: assigned [io  0x1e00000-0x1e00fff]

pci 0000:01:00.0: BAR 2: set to [io  0x1e00000-0x1e00fff] (PCI address [0x1e00000-0x1e00fff])

pci 0000:01:00.0: BAR 3: assigned [mem 0x01910000-0x019100ff pref]

pci 0000:01:00.0: BAR 3: set to [mem 0x01910000-0x019100ff pref] (PCI address [0x1910000-0x19100ff])

pci 0000:00:00.0: PCI bridge to [bus 01-01]

pci 0000:00:00.0:   bridge window [io  0x1e00000-0x1e00fff]

pci 0000:00:00.0:   bridge window [mem 0x01000000-0x017fffff]

pci 0000:00:00.0:   bridge window [mem 0x01900000-0x019fffff pref]

Based on the imx_3.0.35.4.0 release, attach the patch


View solution in original post

31 Replies
7,494 Views
claudechaussé
Contributor I

Hi,

Would it be possible to have access to this patch ? (I get access denied when I try to get it)

I have a similar problem trying to connect Imx6 to a DSP.

Thank you

0 Kudos
Reply
1,924 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Can you try again?

0 Kudos
Reply
1,924 Views
claudechaussé
Contributor I

Hi,

I did but I get: https://community.freescale.com/login.jspa?authzFailed=true

Maybe my profile does not allow me to download stuff "???

0 Kudos
Reply
1,924 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Maybe  you can try with  other  browser to see if this  works.

0 Kudos
Reply
1,924 Views
claudechaussé
Contributor I

I am sorry but I tried Safari, Chrome and Firefox and it does not work. Can you email me the patch since it is only 1.3K ? I really need it and I don't want to screw up the PCIe driver if I try to do it myself.

0 Kudos
Reply
1,924 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Hi Claude,

I tried  by  community but it doesnt  work.

you can send  me a private message with your email

0 Kudos
Reply
1,924 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Did you get it?

0 Kudos
Reply
1,924 Views
anayetullah
Contributor I

Hi Karina, I got a similar problem. Can you send me the patch as well? 

0 Kudos
Reply
1,924 Views
claudechaussé
Contributor I

I got it.

Fantastic :smileyhappy:

0 Kudos
Reply
1,924 Views
mannsikchung
Contributor III

Dear Karina and Claude.

May I get the patch? I have similar problem.
The link is not allowed for me.

Please send it by email?

jake@flyingloft.com

BR.

0 Kudos
Reply
1,924 Views
winfrieddobbe
Contributor II

I have the same imx6 BAR problem. Could you send me the patch as well (to winfried<dot>dobbe<at>dynniq<dot>com) because my community account doesn't give me permission to download the patch.

Thanks in advance,

Winfried

0 Kudos
Reply