x86: baytrail: PCI is not always mapped to end of ram
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to 0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.
--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/baytrail/pci.c +1 -1
@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, +0x80000000 ,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); hose->region_count =4 ;
Signature · 1 line
1.9.1
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
I see from minnowmax.h, the PCI address starts from 0xd0000000.
#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000
#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000
Quoted 10 lines
Signed-off-by Andrew Bradford <[email protected]>--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/cpu/baytrail/pci.c +0
-0
arch/x86/cpu/baytrail/pci.c void board_pci_setup_hose(struct pci_controller *hose)
Quoted 9 lines
arch/x86/cpu/baytrail/pci.c +1
-2@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, +0x80000000 ,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); hose->region_count =4 ; --
Regards,
Bin
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000
I see that hose->regions+0 is set to CONFIG_PCI_MEM_BUS and hose->regions+2 is set to CONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values from minnowmax.h *are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.
Possibly my address of 0x80000000 is not correct, even though it works for me. But 0x80000000 is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "pci_hose_bus_to_phys: invalid physical address" errors.
Quoted 18 lines
Quoted 18 lines
Signed-off-by Andrew Bradford <[email protected]>--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/cpu/baytrail/pci.c +1
-1@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, +0x80000000 ,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );
Quoted 5 lines
arch/x86/cpu/baytrail/pci.c void board_pci_setup_hose(struct pci_controller *hose)
Quoted 2 lines
arch/x86/cpu/baytrail/pci.c +0
-1hose->region_count =4 ; --Regards,
Bin
Thanks,
Andrew
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Andrew,
Quoted 16 lines · Andrew Bradford
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.
Quoted 8 lines
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
Ah, that's exactly the information I want :)
Quoted 22 lines
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000
Quoted 6 lines
I see that hose->regions+0 is set to
CONFIG_PCI_MEM_BUSand hose->regions+2 is set toCONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values fromminnowmax.h*are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.
The regions+3 is used by the inbound access, eg: PCI device access to system memory.
Quoted 4 lines
Possibly my address of
0x80000000is not correct, even though it works for me. But0x80000000is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).
You understanding is correct. We should only open 2GiB inbound memory window for PCI devices.
Quoted 9 lines
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "
pci_hose_bus_to_phys: invalid physical address" errors.
Yes, this all makes sense, so
Regards,
Bin
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Bin,
Quoted 63 lines · Bin Meng
Hi Andrew,
Quoted 16 lines · Andrew Bradford
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.Quoted 8 lines
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
Ah, that's exactly the information I want :)
Quoted 22 lines
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000Quoted 6 lines
I see that hose->regions+0 is set to
CONFIG_PCI_MEM_BUSand hose->regions+2 is set toCONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values fromminnowmax.h*are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.The regions+3 is used by the inbound access, eg: PCI device access to system memory.
Quoted 7 lines
Quoted 4 lines
Possibly my address of
0x80000000is not correct, even though it works for me. But0x80000000is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).You understanding is correct. We should only open 2GiB inbound memory window for PCI devices.
But, if you have less than 2 GiB of memory, my patch in theory *could* break things, right?. It seems like a better approach would be to limit the size to the lesser of 0x80000000 and gd->ram_size. Does that make sense?
Quoted 10 lines
Quoted 9 lines
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "
pci_hose_bus_to_phys: invalid physical address" errors.
Quoted 3 lines
Yes, this all makes sense, so
Reviewed-by Bin Meng <[email protected]>
Thanks!
-Andrew
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Andrew,
Quoted 71 lines · Andrew Bradford
Hi Bin,
Quoted 68 lines · Bin Meng
Hi Andrew,
Quoted 16 lines · Andrew Bradford
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.Quoted 8 lines
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
Ah, that's exactly the information I want :)
Quoted 22 lines
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000Quoted 6 lines
I see that hose->regions+0 is set to
CONFIG_PCI_MEM_BUSand hose->regions+2 is set toCONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values fromminnowmax.h*are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.The regions+3 is used by the inbound access, eg: PCI device access to system memory.
Quoted 4 lines
Possibly my address of
0x80000000is not correct, even though it works for me. But0x80000000is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).
Quoted 8 lines
Quoted 2 lines
You understanding is correct. We should only open 2GiB inbound memory window for PCI devices.
But, if you have less than 2 GiB of memory, my patch in theory *could* break things, right?. It seems like a better approach would be to limit the size to the lesser of
0x80000000andgd->ram_size. Does that make sense?
I think 2GB is a safe value and won't break things. Region 0 and region 3 should not overlap.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "
pci_hose_bus_to_phys: invalid physical address" errors.
Can you add some printf to show all of the pci_hose_bus_to_phys() parameters' value here when 4GB RAM is mounted? I'd like to understand how the message "pci_hose_bus_to_phys: invalid physical address" is produced.
Regards,
Bin
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Bin,
Quoted 96 lines · Bin Meng
Hi Andrew,
Quoted 71 lines · Andrew Bradford
Hi Bin,
Quoted 68 lines · Bin Meng
Hi Andrew,
Quoted 16 lines · Andrew Bradford
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.Quoted 8 lines
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
Ah, that's exactly the information I want :)
Quoted 22 lines
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000Quoted 6 lines
I see that hose->regions+0 is set to
CONFIG_PCI_MEM_BUSand hose->regions+2 is set toCONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values fromminnowmax.h*are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.The regions+3 is used by the inbound access, eg: PCI device access to system memory.
Quoted 4 lines
Possibly my address of
0x80000000is not correct, even though it works for me. But0x80000000is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).Quoted 8 lines
Quoted 2 lines
You understanding is correct. We should only open 2GiB inbound memory window for PCI devices.
But, if you have less than 2 GiB of memory, my patch in theory *could* break things, right?. It seems like a better approach would be to limit the size to the lesser of
0x80000000andgd->ram_size. Does that make sense?I think 2GB is a safe value and won't break things. Region 0 and region 3 should not overlap.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "
pci_hose_bus_to_phys: invalid physical address" errors.
Quoted 4 lines
Can you add some printf to show all of the
pci_hose_bus_to_phys()parameters' value here when 4GB RAM is mounted? I'd like to understand how the message "pci_hose_bus_to_phys: invalid physical address" is produced.
Patch of my changes to enable reporting of physical addresses being used looks like:
drivers/pci/pci_common.c +2 -1
@@ -205,7 +205,7 @@ int __pci_hose_bus_to_phys(struct pci_controller *hose,return 0 ; } } - +printf ("__pci_hose_bus_to_phys() failed!\n" );return 1 ; }
@@ -237,6 +237,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,if (ret)puts ("pci_hose_bus_to_phys: invalid physical address\n" ); +printf ("bus_addr: 0x%x \t flags: 0x%lx \t phys_addr: %llx\n" , bus_addr, flags, phys_addr);return phys_addr; }
When I only configure 2GB of RAM, this prints bus and physical addresses in the 0x7adc0000 range when interfacing to the RTL8111. Everything works as expected, and I get only 1 copy of my "failed" message for each printing of my bus_addr, flags, and phys_addr data.
When I switch to 4 GB of RAM configured, now __pci_hose_bus_to_phys() will not perform the modification to the physical address that gets passed to it. Then I see accesses to phys_addr to 0x7adc0000 range but phys_addresses are printed as 0 and I get 2 copies of my "failed" message for each printing of my bus_addr, flags, and phys_addr data. Ethernet does not work in this case.
When I change to 1 GB of RAM, everything works and the phys and bus addresses are in the 0x3adc0000 range and I only get 1 "failed" message for each printing of bus_addr, flags, and phys_addr data. Just like in the 2GB case.
Once I apply my patch to change region+3 to 0x80000000, then both 1GB and 2 GB work the same as before, but now with 4 GB things work and the output from my new printf()s matches the 2GB operation with phys and bus addresses in the 0x7adc0000 range.
Sorry I'm relaying information rather than giving direct output from the board, but I don't yet have a UART setup on my Valley Island from within u-boot, I'm doing all my work via the vesa console and a USB keyboard.
Thanks,
Andrew
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Andrew,
Quoted 146 lines · Andrew Bradford
Hi Bin,
Quoted 96 lines · Bin Meng
Hi Andrew,
Quoted 71 lines · Andrew Bradford
Hi Bin,
Quoted 68 lines · Bin Meng
Hi Andrew,
Quoted 16 lines · Andrew Bradford
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.Quoted 8 lines
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
Ah, that's exactly the information I want :)
Quoted 22 lines
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000Quoted 6 lines
I see that hose->regions+0 is set to
CONFIG_PCI_MEM_BUSand hose->regions+2 is set toCONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values fromminnowmax.h*are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.The regions+3 is used by the inbound access, eg: PCI device access to system memory.
Quoted 4 lines
Possibly my address of
0x80000000is not correct, even though it works for me. But0x80000000is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).Quoted 8 lines
Quoted 2 lines
You understanding is correct. We should only open 2GiB inbound memory window for PCI devices.
But, if you have less than 2 GiB of memory, my patch in theory *could* break things, right?. It seems like a better approach would be to limit the size to the lesser of
0x80000000andgd->ram_size. Does that make sense?I think 2GB is a safe value and won't break things. Region 0 and region 3 should not overlap.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "
pci_hose_bus_to_phys: invalid physical address" errors.Quoted 4 lines
Can you add some printf to show all of the
pci_hose_bus_to_phys()parameters' value here when 4GB RAM is mounted? I'd like to understand how the message "pci_hose_bus_to_phys: invalid physical address" is produced.Patch of my changes to enable reporting of physical addresses being used looks like:
drivers/pci/pci_common.c +2
-1@@ -205,7 +205,7 @@ int __pci_hose_bus_to_phys(struct pci_controller *hose,return 0 ; } } - +printf ("__pci_hose_bus_to_phys() failed!\n" );return 1 ; }@@ -237,6 +237,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,if (ret)puts ("pci_hose_bus_to_phys: invalid physical address\n" ); +printf ("bus_addr: 0x%x \t flags: 0x%lx \t phys_addr: %llx\n" , bus_addr, flags, phys_addr);return phys_addr; }When I only configure 2GB of RAM, this prints bus and physical addresses in the
0x7adc0000range when interfacing to the RTL8111. Everything works as expected, and I get only 1 copy of my "failed" message for each printing of mybus_addr, flags, andphys_addrdata.When I switch to 4 GB of RAM configured, now
__pci_hose_bus_to_phys()will not perform the modification to the physical address that gets passed to it. Then I see accesses tophys_addrto0x7adc0000range butphys_addressesare printed as 0 and I get 2 copies of my "failed" message for each printing of mybus_addr, flags, andphys_addrdata. Ethernet does not work in this case.When I change to 1 GB of RAM, everything works and the phys and bus addresses are in the
0x3adc0000range and I only get 1 "failed" message for each printing ofbus_addr, flags, andphys_addrdata. Just like in the 2GB case.
Quoted 4 lines
Once I apply my patch to change region+3 to
0x80000000, then both 1GB and 2 GB work the same as before, but now with 4 GB things work and the output from my new printf()s matches the 2GB operation with phys and bus addresses in the0x7adc0000range.
What's the value of gd->ram_size when you have 4GB RAM mounted? My read of __pci_hose_bus_to_phys() logic is that it should still return 0x7adc0000 with the logic below.
if (bus_addr >= res->bus_start && (bus_addr - res->bus_start)
< res->size) {
*pa = (bus_addr - res->bus_start + res->phys_start);
return 0;Quoted 4 lines
Sorry I'm relaying information rather than giving direct output from the board, but I don't yet have a UART setup on my Valley Island from within u-boot, I'm doing all my work via the vesa console and a USB keyboard.
I thought you just wanted to enable the early debug UART on the Valley Island board before to debug FSP, but it looks to me that you did not get U-Boot's console on any (legacy or PCI) serial port when U-Boot is up? Yes? Since you mentioned that Valley Island board has the PCI UART connected from the BayTrail SoC, I think you can refer to Crown Bay's implementation (arch/x86/dts/crownbay.dts) to add PCI UART in the board's device tree so you can have a working U-Boot console over a PCI UART.
chosen {
/*
* By default the legacy superio serial port is used as the
* U-Boot serial console. If we want to use UART from Topcliff
* PCH as the console, change this property to &pciuart#.
*
* For example, stdout-path = &pciuart0 will use the first
* UART on Topcliff PCH.
*/
stdout-path = "/serial";
};Regards,
Bin
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Bin,
Quoted 159 lines · Bin Meng
Hi Andrew,
Quoted 146 lines · Andrew Bradford
Hi Bin,
Quoted 96 lines · Bin Meng
Hi Andrew,
Quoted 71 lines · Andrew Bradford
Hi Bin,
Quoted 68 lines · Bin Meng
Hi Andrew,
Quoted 16 lines · Andrew Bradford
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.Quoted 8 lines
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
Ah, that's exactly the information I want :)
Quoted 22 lines
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000Quoted 6 lines
I see that hose->regions+0 is set to
CONFIG_PCI_MEM_BUSand hose->regions+2 is set toCONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values fromminnowmax.h*are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.The regions+3 is used by the inbound access, eg: PCI device access to system memory.
Quoted 4 lines
Possibly my address of
0x80000000is not correct, even though it works for me. But0x80000000is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).Quoted 8 lines
Quoted 2 lines
You understanding is correct. We should only open 2GiB inbound memory window for PCI devices.
But, if you have less than 2 GiB of memory, my patch in theory *could* break things, right?. It seems like a better approach would be to limit the size to the lesser of
0x80000000andgd->ram_size. Does that make sense?I think 2GB is a safe value and won't break things. Region 0 and region 3 should not overlap.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "
pci_hose_bus_to_phys: invalid physical address" errors.Quoted 4 lines
Can you add some printf to show all of the
pci_hose_bus_to_phys()parameters' value here when 4GB RAM is mounted? I'd like to understand how the message "pci_hose_bus_to_phys: invalid physical address" is produced.Patch of my changes to enable reporting of physical addresses being used looks like:
drivers/pci/pci_common.c +2
-1@@ -205,7 +205,7 @@ int __pci_hose_bus_to_phys(struct pci_controller *hose,return 0 ; } } - +printf ("__pci_hose_bus_to_phys() failed!\n" );return 1 ; }@@ -237,6 +237,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,if (ret)puts ("pci_hose_bus_to_phys: invalid physical address\n" ); +printf ("bus_addr: 0x%x \t flags: 0x%lx \t phys_addr: %llx\n" , bus_addr, flags, phys_addr);return phys_addr; }When I only configure 2GB of RAM, this prints bus and physical addresses in the
0x7adc0000range when interfacing to the RTL8111. Everything works as expected, and I get only 1 copy of my "failed" message for each printing of mybus_addr, flags, andphys_addrdata.When I switch to 4 GB of RAM configured, now
__pci_hose_bus_to_phys()will not perform the modification to the physical address that gets passed to it. Then I see accesses tophys_addrto0x7adc0000range butphys_addressesare printed as 0 and I get 2 copies of my "failed" message for each printing of mybus_addr, flags, andphys_addrdata. Ethernet does not work in this case.When I change to 1 GB of RAM, everything works and the phys and bus addresses are in the
0x3adc0000range and I only get 1 "failed" message for each printing ofbus_addr, flags, andphys_addrdata. Just like in the 2GB case.Quoted 4 lines
Once I apply my patch to change region+3 to
0x80000000, then both 1GB and 2 GB work the same as before, but now with 4 GB things work and the output from my new printf()s matches the 2GB operation with phys and bus addresses in the0x7adc0000range.What's the value of
gd->ram_sizewhen you have 4GB RAM mounted? My read of__pci_hose_bus_to_phys()logic is that it should still return0x7adc0000with the logic below.
Quoted 4 lines
if (bus_addr >= res->bus_start && (bus_addr - res->bus_start)
< res->size) {
*pa = (bus_addr - res->bus_start + res->phys_start);
return 0;gd->ram_size is 0x100000000 when I have 4 GB of SDRAM. dram_init() in fsp_dram.c sets the gd->ram_size by simply summing the sizes of all of the HOBs that get returned as resource descriptors of type system or reserved memory.
Without patch [1] the meminfo command will report 0 bytes of RAM, but with patch [1] then the meminfo command reports 4 GB of RAM.
[1]:http://git.denx.de/?p=u-boot.git;a=commitdiff;h=ea11b401b5ca10b5991e7c65832cfb7db54996c1
Without the patch from this thread (not [1]), and with 4 GB of RAM, hose region 3 is bus_start=0, phys_start=0, and size=0. And __pci_hose_bus_to_phys() is going through regions 0, 1, 2, and 3. It's region 3 that's failing. Regions 0, 1, and 2 seem fine with or without my patch from this thread.
With the patch from this thread, then the size for region 3 is 0x80000000 and regions 0, 1, and 2 have the same values as without the patch. With the patch, __pci_hose_bus_to_phys() works the same for configurations of 1, 2, or 4 GB of RAM.
I'm still concerned about the less than 2 GB of RAM case, as with my patch then region 3 will always be 0x80000000 in size and we may not actually have that much RAM. Likely this won't actually cause a problem, but it still worries me.
My test case that fails is trying to run the 'dhcp' command to fetch the Linux kernel over the Ethernet network connected to the RTL8111.
Quoted 14 lines
Quoted 4 lines
Sorry I'm relaying information rather than giving direct output from the board, but I don't yet have a UART setup on my Valley Island from within u-boot, I'm doing all my work via the vesa console and a USB keyboard.
I thought you just wanted to enable the early debug UART on the Valley Island board before to debug FSP, but it looks to me that you did not get U-Boot's console on any (legacy or PCI) serial port when U-Boot is up? Yes? Since you mentioned that Valley Island board has the PCI UART connected from the BayTrail SoC, I think you can refer to Crown Bay's implementation (
arch/x86/dts/crownbay.dts) to add PCI UART in the board's device tree so you can have a working U-Boot console over a PCI UART.
Quoted 11 lines
chosen {
/*
* By default the legacy superio serial port is used as the
* U-Boot serial console. If we want to use UART from Topcliff
* PCH as the console, change this property to &pciuart#.
*
* For example, stdout-path = &pciuart0 will use the first
* UART on Topcliff PCH.
*/
stdout-path = "/serial";
};OK, I'll give this a shot soon, thanks for the pointers! :)
-Andrew
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Andrew,
Quoted 162 lines · Andrew Bradford
Hi Bin,
Quoted 159 lines · Bin Meng
Hi Andrew,
Quoted 146 lines · Andrew Bradford
Hi Bin,
Quoted 96 lines · Bin Meng
Hi Andrew,
Quoted 71 lines · Andrew Bradford
Hi Bin,
Quoted 68 lines · Bin Meng
Hi Andrew,
Quoted 16 lines · Andrew Bradford
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.Quoted 8 lines
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
Ah, that's exactly the information I want :)
Quoted 22 lines
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000Quoted 6 lines
I see that hose->regions+0 is set to
CONFIG_PCI_MEM_BUSand hose->regions+2 is set toCONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values fromminnowmax.h*are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.The regions+3 is used by the inbound access, eg: PCI device access to system memory.
Quoted 4 lines
Possibly my address of
0x80000000is not correct, even though it works for me. But0x80000000is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).Quoted 8 lines
Quoted 2 lines
You understanding is correct. We should only open 2GiB inbound memory window for PCI devices.
But, if you have less than 2 GiB of memory, my patch in theory *could* break things, right?. It seems like a better approach would be to limit the size to the lesser of
0x80000000andgd->ram_size. Does that make sense?I think 2GB is a safe value and won't break things. Region 0 and region 3 should not overlap.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "
pci_hose_bus_to_phys: invalid physical address" errors.Quoted 4 lines
Can you add some printf to show all of the
pci_hose_bus_to_phys()parameters' value here when 4GB RAM is mounted? I'd like to understand how the message "pci_hose_bus_to_phys: invalid physical address" is produced.Patch of my changes to enable reporting of physical addresses being used looks like:
drivers/pci/pci_common.c +2
-1@@ -205,7 +205,7 @@ int __pci_hose_bus_to_phys(struct pci_controller *hose,return 0 ; } } - +printf ("__pci_hose_bus_to_phys() failed!\n" );return 1 ; }@@ -237,6 +237,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,if (ret)puts ("pci_hose_bus_to_phys: invalid physical address\n" ); +printf ("bus_addr: 0x%x \t flags: 0x%lx \t phys_addr: %llx\n" , bus_addr, flags, phys_addr);return phys_addr; }When I only configure 2GB of RAM, this prints bus and physical addresses in the
0x7adc0000range when interfacing to the RTL8111. Everything works as expected, and I get only 1 copy of my "failed" message for each printing of mybus_addr, flags, andphys_addrdata.When I switch to 4 GB of RAM configured, now
__pci_hose_bus_to_phys()will not perform the modification to the physical address that gets passed to it. Then I see accesses tophys_addrto0x7adc0000range butphys_addressesare printed as 0 and I get 2 copies of my "failed" message for each printing of mybus_addr, flags, andphys_addrdata. Ethernet does not work in this case.When I change to 1 GB of RAM, everything works and the phys and bus addresses are in the
0x3adc0000range and I only get 1 "failed" message for each printing ofbus_addr, flags, andphys_addrdata. Just like in the 2GB case.Quoted 4 lines
Once I apply my patch to change region+3 to
0x80000000, then both 1GB and 2 GB work the same as before, but now with 4 GB things work and the output from my new printf()s matches the 2GB operation with phys and bus addresses in the0x7adc0000range.What's the value of
gd->ram_sizewhen you have 4GB RAM mounted? My read of__pci_hose_bus_to_phys()logic is that it should still return0x7adc0000with the logic below.
Quoted 6 lines
Quoted 4 lines
if (bus_addr >= res->bus_start && (bus_addr - res->bus_start) < res->size) { *pa = (bus_addr - res->bus_start + res->phys_start); return 0;
gd->ram_sizeis0x100000000when I have 4 GB of SDRAM.dram_init()in
Ah, I did not realize gd->ram_size can be exactly 4GiB on the MinnowMax board. My previous assumption was it should be something like 0xffxxxxxx as there has to be some memory hole configured by the FSP, as was seen on my Crown Bay board (it has 1GiB memory but gd->ram_size reports 1023MiB). So this explains the failure you saw.
Quoted 20 lines
fsp_dram.csets thegd->ram_sizeby simply summing the sizes of all of the HOBs that get returned as resource descriptors of type system or reserved memory.Without patch [1] the meminfo command will report 0 bytes of RAM, but with patch [1] then the meminfo command reports 4 GB of RAM.
[1]:http://git.denx.de/?p=u-boot.git;a=commitdiff;h=ea11b401b5ca10b5991e7c65832cfb7db54996c1
Without the patch from this thread (not [1]), and with 4 GB of RAM, hose region 3 is bus_start=0, phys_start=0, and size=0. And
__pci_hose_bus_to_phys()is going through regions 0, 1, 2, and 3. It's region 3 that's failing. Regions 0, 1, and 2 seem fine with or without my patch from this thread.With the patch from this thread, then the size for region 3 is
0x80000000and regions 0, 1, and 2 have the same values as without the patch. With the patch,__pci_hose_bus_to_phys()works the same for configurations of 1, 2, or 4 GB of RAM.
Quoted 5 lines
I'm still concerned about the less than 2 GB of RAM case, as with my patch then region 3 will always be
0x80000000in size and we may not actually have that much RAM. Likely this won't actually cause a problem, but it still worries me.
This should not matter. The region 3 is just by U-Boot to translate the bus address. It is not configured to any hardware registers. But if you worry that too much, you can configure region 3 as:
pci_set_region(hose->regions + 3,
0,
0,
- gd->ram_size,
+ gd->ram_size < 0x80000000 ? gd->ram_size : 0x80000000;,
PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);Quoted 3 lines
My test case that fails is trying to run the 'dhcp' command to fetch the Linux kernel over the Ethernet network connected to the RTL8111.
Is your test case fails because of this region3 size equals to 2GiB? I don't think so.
Quoted 26 lines
Quoted 14 lines
Quoted 4 lines
Sorry I'm relaying information rather than giving direct output from the board, but I don't yet have a UART setup on my Valley Island from within u-boot, I'm doing all my work via the vesa console and a USB keyboard.
I thought you just wanted to enable the early debug UART on the Valley Island board before to debug FSP, but it looks to me that you did not get U-Boot's console on any (legacy or PCI) serial port when U-Boot is up? Yes? Since you mentioned that Valley Island board has the PCI UART connected from the BayTrail SoC, I think you can refer to Crown Bay's implementation (
arch/x86/dts/crownbay.dts) to add PCI UART in the board's device tree so you can have a working U-Boot console over a PCI UART.Quoted 11 lines
chosen { /* * By default the legacy superio serial port is used as the * U-Boot serial console. If we want to use UART from Topcliff * PCH as the console, change this property to &pciuart#. * * For example, stdout-path = &pciuart0 will use the first * UART on Topcliff PCH. */ stdout-path = "/serial"; };
Quoted 2 lines
OK, I'll give this a shot soon, thanks for the pointers! :)
Regards,
Bin
PATCH 1/1 x86: baytrail: PCI is not always mapped to end of ram
Hi Bin,
Quoted 212 lines · Bin Meng
Hi Andrew,
Quoted 162 lines · Andrew Bradford
Hi Bin,
Quoted 159 lines · Bin Meng
Hi Andrew,
Quoted 146 lines · Andrew Bradford
Hi Bin,
Quoted 96 lines · Bin Meng
Hi Andrew,
Quoted 71 lines · Andrew Bradford
Hi Bin,
Quoted 68 lines · Bin Meng
Hi Andrew,
Quoted 16 lines · Andrew Bradford
Hi Bin,
Quoted 13 lines · Bin Meng
+Simon.
Hi Andrew,
Quoted 7 lines · On Sat, May 23, 2015 at 3:09 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
PCI on Intel Baytrail is mapped to
0x80000000, which is not always at the end of SDRAM, such as when running with 4 GiB of SDRAM. The PCI bus memory mapping must stay within low memory and so when running with > 2 GiB of SDRAM, there is a hole in the SDRAM between 2 GiB and 4 GiB for memory mapped IO, such as PCI.Quoted 8 lines
Quoted 3 lines
Are you saying that if we mount 4GB DDR DIMM on the MinnowMax board, the Intel FSP will only put 0~2G as system RAM space, and leave 2G~4G as PCI address and other I/Os?
Yes. If you mount 4 GiB of SDRAM onto an E3800 processor, then physical addresses from 0 to just below 2 GiB will be SDRAM (as per the HOBs) and also from 4 GiB to 6 GiB (also verified via the HOBs). The space from 2 GiB to 4 GiB will be mapped as various other regions.
Ah, that's exactly the information I want :)
Quoted 22 lines
If you see section 4.1.1.1 (page 71 in the January 2015, Revision 3.6) E3800 datasheet, it shows that from 2 GiB to 4 GiB is mapped for PCI, Abort Page, Local APIC, and the Boot Vector. There's a lot of space in this area which appears unused, so I'm unsure as to why the area is so large.
I have an Intel Valley Island board with E3825 and a 4 GiB SODIMM. I'm working on getting patches ready for this board but found that if I enabled all 4 GiB of SDRAM that the PCI bus would not function correctly. With this patch then the PCI bus functions (I'm able to do network operations with the RTL8111 Ethernet adapter).
Quoted 9 lines
I see from
minnowmax.h, the PCI address starts from0xd0000000.#define CONFIG_PCI_MEM_BUS 0xd0000000 #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x10000000#define CONFIG_PCI_PREF_BUS 0xc0000000 #define CONFIG_PCI_PREF_PHYS CONFIG_PCI_PREF_BUS #define CONFIG_PCI_PREF_SIZE 0x10000000Quoted 6 lines
I see that hose->regions+0 is set to
CONFIG_PCI_MEM_BUSand hose->regions+2 is set toCONFIG_PCI_PREF_BUS. However I'm modifying hose->regions+3. So the values fromminnowmax.h*are* being used. I'm not yet that familiar with PCI configuration, so likely I'm not fully understanding how u-boot sets this up.The regions+3 is used by the inbound access, eg: PCI device access to system memory.
Quoted 4 lines
Possibly my address of
0x80000000is not correct, even though it works for me. But0x80000000is where it was being placed before, since it was going at the end of SDRAM (2GiB on minnowmax).Quoted 8 lines
Quoted 2 lines
You understanding is correct. We should only open 2GiB inbound memory window for PCI devices.
But, if you have less than 2 GiB of memory, my patch in theory *could* break things, right?. It seems like a better approach would be to limit the size to the lesser of
0x80000000andgd->ram_size. Does that make sense?I think 2GB is a safe value and won't break things. Region 0 and region 3 should not overlap.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
If I artificially limit the amount of SDRAM by setting the fsp configuration to memory-down and then setting the DRAM configuration values such that I mimmic 1 GiB or 2 GiB of SDRAM, having my patch still provides access to the PCI bus, so with my patch there should be no adverse affects on E3800 systems that have less than 4 GiB of SDRAM. But without my patch, when running with >=4 GiB of SDRAM, PCI accesses end up returning "
pci_hose_bus_to_phys: invalid physical address" errors.Quoted 4 lines
Can you add some printf to show all of the
pci_hose_bus_to_phys()parameters' value here when 4GB RAM is mounted? I'd like to understand how the message "pci_hose_bus_to_phys: invalid physical address" is produced.Patch of my changes to enable reporting of physical addresses being used looks like:
drivers/pci/pci_common.c +2
-1@@ -205,7 +205,7 @@ int __pci_hose_bus_to_phys(struct pci_controller *hose,return 0 ; } } - +printf ("__pci_hose_bus_to_phys() failed!\n" );return 1 ; }@@ -237,6 +237,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,if (ret)puts ("pci_hose_bus_to_phys: invalid physical address\n" ); +printf ("bus_addr: 0x%x \t flags: 0x%lx \t phys_addr: %llx\n" , bus_addr, flags, phys_addr);return phys_addr; }When I only configure 2GB of RAM, this prints bus and physical addresses in the
0x7adc0000range when interfacing to the RTL8111. Everything works as expected, and I get only 1 copy of my "failed" message for each printing of mybus_addr, flags, andphys_addrdata.When I switch to 4 GB of RAM configured, now
__pci_hose_bus_to_phys()will not perform the modification to the physical address that gets passed to it. Then I see accesses tophys_addrto0x7adc0000range butphys_addressesare printed as 0 and I get 2 copies of my "failed" message for each printing of mybus_addr, flags, andphys_addrdata. Ethernet does not work in this case.When I change to 1 GB of RAM, everything works and the phys and bus addresses are in the
0x3adc0000range and I only get 1 "failed" message for each printing ofbus_addr, flags, andphys_addrdata. Just like in the 2GB case.Quoted 4 lines
Once I apply my patch to change region+3 to
0x80000000, then both 1GB and 2 GB work the same as before, but now with 4 GB things work and the output from my new printf()s matches the 2GB operation with phys and bus addresses in the0x7adc0000range.What's the value of
gd->ram_sizewhen you have 4GB RAM mounted? My read of__pci_hose_bus_to_phys()logic is that it should still return0x7adc0000with the logic below.Quoted 6 lines
Quoted 4 lines
if (bus_addr >= res->bus_start && (bus_addr - res->bus_start) < res->size) { *pa = (bus_addr - res->bus_start + res->phys_start); return 0;
gd->ram_sizeis0x100000000when I have 4 GB of SDRAM.dram_init()inAh, I did not realize
gd->ram_sizecan be exactly 4GiB on the MinnowMax board. My previous assumption was it should be something like 0xffxxxxxx as there has to be some memory hole configured by the FSP, as was seen on my Crown Bay board (it has 1GiB memory butgd->ram_sizereports 1023MiB). So this explains the failure you saw.Quoted 20 lines
fsp_dram.csets thegd->ram_sizeby simply summing the sizes of all of the HOBs that get returned as resource descriptors of type system or reserved memory.Without patch [1] the meminfo command will report 0 bytes of RAM, but with patch [1] then the meminfo command reports 4 GB of RAM.
[1]:http://git.denx.de/?p=u-boot.git;a=commitdiff;h=ea11b401b5ca10b5991e7c65832cfb7db54996c1
Without the patch from this thread (not [1]), and with 4 GB of RAM, hose region 3 is bus_start=0, phys_start=0, and size=0. And
__pci_hose_bus_to_phys()is going through regions 0, 1, 2, and 3. It's region 3 that's failing. Regions 0, 1, and 2 seem fine with or without my patch from this thread.With the patch from this thread, then the size for region 3 is
0x80000000and regions 0, 1, and 2 have the same values as without the patch. With the patch,__pci_hose_bus_to_phys()works the same for configurations of 1, 2, or 4 GB of RAM.Quoted 5 lines
I'm still concerned about the less than 2 GB of RAM case, as with my patch then region 3 will always be
0x80000000in size and we may not actually have that much RAM. Likely this won't actually cause a problem, but it still worries me.This should not matter. The region 3 is just by U-Boot to translate the bus address. It is not configured to any hardware registers. But if you worry that too much, you can configure region 3 as:
pci_set_region(hose->regions + 3, 0, 0,
Review
Quoted 3 lines
(quoted diff) +1
-1- gd->ram_size, + gd->ram_size < 0x80000000 ? gd->ram_size : 0x80000000;, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
Yes, this would make me worry less :)
I can submit a v2.
Quoted 6 lines
Quoted 3 lines
My test case that fails is trying to run the 'dhcp' command to fetch the Linux kernel over the Ethernet network connected to the RTL8111.
Is your test case fails because of this region3 size equals to 2GiB? I don't think so.
My test case failes because region 3 shows a size of 0, without my patch when you have 4 GB of RAM.
Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 4 lines
Sorry I'm relaying information rather than giving direct output from the board, but I don't yet have a UART setup on my Valley Island from within u-boot, I'm doing all my work via the vesa console and a USB keyboard.
I thought you just wanted to enable the early debug UART on the Valley Island board before to debug FSP, but it looks to me that you did not get U-Boot's console on any (legacy or PCI) serial port when U-Boot is up? Yes? Since you mentioned that Valley Island board has the PCI UART connected from the BayTrail SoC, I think you can refer to Crown Bay's implementation (
arch/x86/dts/crownbay.dts) to add PCI UART in the board's device tree so you can have a working U-Boot console over a PCI UART.chosen { /* * By default the legacy superio serial port is used as the * U-Boot serial console. If we want to use UART from Topcliff * PCH as the console, change this property to &pciuart#. * * For example, stdout-path = &pciuart0 will use the first * UART on Topcliff PCH. */ stdout-path = "/serial"; };
Quoted 1 line
Quoted 1 line
OK, I'll give this a shot soon, thanks for the pointers! :)
Thanks,
Andrew
PATCH v2 1/1 x86: baytrail: pci region 3 is not always mapped to end of ram
In reply to andrew at bradfordembedded.comFrom: Andrew Bradford <[email protected]>
Baytrail physically maps the first 2 GB of SDRAM from 0x0 to 0x7FFFFFFF and additional SDRAM is mapped from 0x100000000 and up. There is a physical memory hole from 0x80000000 to 0xFFFFFFFF for other uses. Because of this, PCI region 3 should only try to use up to the amount of SDRAM or 0x80000000, which ever is less.
---
v2: limit maximum size to lesser of SDRAM or 0x80000000
--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/baytrail/pci.c +1 -1
@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, + gd->ram_size < 0x80000000 ? gd->ram_size : 0x80000000;,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); hose->region_count =4 ;
Signature · 1 line
1.9.1
PATCH v2 1/1 x86: baytrail: pci region 3 is not always mapped to end of ram
Quoted 20 lines · andrew at bradfordembedded.com
From: Andrew Bradford <[email protected]>
Baytrail physically maps the first 2 GB of SDRAM from
0x0to0x7FFFFFFFand additional SDRAM is mapped from0x100000000and up. There is a physical memory hole from0x80000000to0xFFFFFFFFfor other uses. Because of this, PCI region 3 should only try to use up to the amount of SDRAM or0x80000000, which ever is less.Signed-off-by Andrew Bradford <[email protected]>---
v2: limit maximum size to lesser of SDRAM or0x80000000--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/cpu/baytrail/pci.c +0
-0
arch/x86/cpu/baytrail/pci.c void board_pci_setup_hose(struct pci_controller *hose) · line 45
Quoted 8 lines
arch/x86/cpu/baytrail/pci.c +1
-1@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, + gd->ram_size < 0x80000000 ? gd->ram_size : 0x80000000;,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); hose->region_count =4 ;
I'm very sorry, please disregard this!
It does not actually build.
I will fix and send a v3.
Thanks,
Andrew
PATCH v3 1/1 x86: baytrail: pci region 3 is not always mapped to end of ram
In reply to andrew at bradfordembedded.comFrom: Andrew Bradford <[email protected]>
Baytrail physically maps the first 2 GB of SDRAM from 0x0 to 0x7FFFFFFF and additional SDRAM is mapped from 0x100000000 and up. There is a physical memory hole from 0x80000000 to 0xFFFFFFFF for other uses. Because of this, PCI region 3 should only try to use up to the amount of SDRAM or 0x80000000, which ever is less.
---
v3: Fix build breakage due to semicolon
v2: limit maximum size to lesser of SDRAM or 0x80000000
--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/baytrail/pci.c +1 -1
@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, + gd->ram_size <0x80000000 ? gd->ram_size :0x80000000 ,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); hose->region_count =4 ;
Signature · 1 line
1.9.1
PATCH v3 1/1 x86: baytrail: pci region 3 is not always mapped to end of ram
Quoted 21 lines · On Thu, Jun 4, 2015 at 12:37 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
Baytrail physically maps the first 2 GB of SDRAM from
0x0to0x7FFFFFFFand additional SDRAM is mapped from0x100000000and up. There is a physical memory hole from0x80000000to0xFFFFFFFFfor other uses. Because of this, PCI region 3 should only try to use up to the amount of SDRAM or0x80000000, which ever is less.Signed-off-by Andrew Bradford <[email protected]>---
v3: Fix build breakage due to semicolon
v2: limit maximum size to lesser of SDRAM or0x80000000--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/cpu/baytrail/pci.c +0
-0
arch/x86/cpu/baytrail/pci.c void board_pci_setup_hose(struct pci_controller *hose)
Quoted 9 lines
arch/x86/cpu/baytrail/pci.c +1
-2@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, + gd->ram_size <0x80000000 ? gd->ram_size :0x80000000 ,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); hose->region_count =4 ; --
PATCH v3 1/1 x86: baytrail: pci region 3 is not always mapped to end of ram
Quoted 29 lines · Bin Meng
Quoted 28 lines · On Thu, Jun 4, 2015 at 12:37 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
Baytrail physically maps the first 2 GB of SDRAM from
0x0to0x7FFFFFFFand additional SDRAM is mapped from0x100000000and up. There is a physical memory hole from0x80000000to0xFFFFFFFFfor other uses. Because of this, PCI region 3 should only try to use up to the amount of SDRAM or0x80000000, which ever is less.Signed-off-by Andrew Bradford <[email protected]>---
v3: Fix build breakage due to semicolon
v2: limit maximum size to lesser of SDRAM or0x80000000--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/cpu/baytrail/pci.c +1
-1@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, + gd->ram_size <0x80000000 ? gd->ram_size :0x80000000 ,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );
Quoted 4 lines
arch/x86/cpu/baytrail/pci.c void board_pci_setup_hose(struct pci_controller *hose)
Quoted 2 lines
arch/x86/cpu/baytrail/pci.c +0
-1hose->region_count =4 ; --Reviewed-by Bin Meng <[email protected]>
PATCH v3 1/1 x86: baytrail: pci region 3 is not always mapped to end of ram
Quoted 30 lines · Simon Glass
Quoted 29 lines · Bin Meng
Quoted 28 lines · On Thu, Jun 4, 2015 at 12:37 AM, <[email protected]> wrote:
From: Andrew Bradford <[email protected]>
Baytrail physically maps the first 2 GB of SDRAM from
0x0to0x7FFFFFFFand additional SDRAM is mapped from0x100000000and up. There is a physical memory hole from0x80000000to0xFFFFFFFFfor other uses. Because of this, PCI region 3 should only try to use up to the amount of SDRAM or0x80000000, which ever is less.Signed-off-by Andrew Bradford <[email protected]>---
v3: Fix build breakage due to semicolon
v2: limit maximum size to lesser of SDRAM or0x80000000--- arch/x86/cpu/baytrail/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/cpu/baytrail/pci.c +1
-1@@ -39,7 +39,7 @@ void board_pci_setup_hose(struct pci_controller *hose)pci_set_region (hose->regions +3 ,0 ,0 , - gd->ram_size, + gd->ram_size <0x80000000 ? gd->ram_size :0x80000000 ,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );
Quoted 6 lines
Quoted 4 lines
arch/x86/cpu/baytrail/pci.c void board_pci_setup_hose(struct pci_controller *hose)
Quoted 2 lines
arch/x86/cpu/baytrail/pci.c +0
-1hose->region_count =4 ; --Reviewed-by Bin Meng <[email protected]>Acked-by Simon Glass <[email protected]>
Applied to u-boot-x86, thanks!