Skip to contentSkip to conversation

x86: quark: Configure MTRR to enable cache

PATCH New Bin Meng 2 participants 3 messages Sep 14, 2015 – Sep 17, 2015 x86

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 x86: quark: Configure MTRR to enable cache

Quark SoC does not support MSR MTRRs. Fixed and variable range MTRRs are accessed indirectly via the message port and not the traditional MSR mechanism. Only UC, WT and WB cache types are supported.

We configure all the fixed range MTRRs with common values (VGA RAM as UC, others as WB) and 3 variable range MTRRs for ROM/eSRAM/RAM as WB, which significantly improves the boot time performance.

With this commit, it takes only 2 seconds for U-Boot to boot to shell on Intel Galileo board. Previously it took about 6 seconds.

---

 arch/x86/cpu/quark/dram.c               | 10 ++++++
 arch/x86/cpu/quark/quark.c              | 57 +++++++++++++++++++++++++++++++++
 arch/x86/include/asm/arch-quark/quark.h | 44 +++++++++++++++++++++++++
 3 files changed, 111 insertions(+)
arch/x86/cpu/quark/dram.c +10 -0
index 9cac846..1b89376 100644
@@ -7,8 +7,10 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <asm/mtrr.h>
 #include <asm/post.h>
 #include <asm/arch/mrc.h>
+#include <asm/arch/msg_port.h>
 #include <asm/arch/quark.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -111,6 +113,14 @@ int dram_init(void)
 	gd->ram_size = mrc_params.mem_size;
 	post_code(POST_DRAM);
 
+	/* variable range MTRR#2: RAM area */
+	disable_caches();
+	msg_port_write(MSG_PORT_HOST_BRIDGE, MTRR_VAR_PHYBASE(MTRR_VAR_RAM),
+		       0 | MTRR_TYPE_WRBACK);
+	msg_port_write(MSG_PORT_HOST_BRIDGE, MTRR_VAR_PHYMASK(MTRR_VAR_RAM),
+		       (~(gd->ram_size - 1)) | MTRR_PHYS_MASK_VALID);
+	enable_caches();
+
 	return 0;
 }
 
arch/x86/cpu/quark/quark.c +57 -0

75 lines not on this page · raw message

arch/x86/include/asm/arch-quark/quark.h +44 -0

50 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#1 lore raw

PATCH 1/1 x86: quark: Configure MTRR to enable cache

Quoted 11 lines · Bin Meng

Quark SoC does not support MSR MTRRs. Fixed and variable range MTRRs are accessed indirectly via the message port and not the traditional MSR mechanism. Only UC, WT and WB cache types are supported.

We configure all the fixed range MTRRs with common values (VGA RAM as UC, others as WB) and 3 variable range MTRRs for ROM/eSRAM/RAM as WB, which significantly improves the boot time performance.

With this commit, it takes only 2 seconds for U-Boot to boot to shell on Intel Galileo board. Previously it took about 6 seconds.

Quoted 7 lines

---

 arch/x86/cpu/quark/dram.c               | 10 ++++++
 arch/x86/cpu/quark/quark.c              | 57 +++++++++++++++++++++++++++++++++
 arch/x86/include/asm/arch-quark/quark.h | 44 +++++++++++++++++++++++++
 3 files changed, 111 insertions(+)

Gosh what a strange an incompatible architecture we have here :-)

#2 lore raw

PATCH 1/1 x86: quark: Configure MTRR to enable cache

Quoted 20 lines · Simon Glass
Quoted 11 lines · Bin Meng

Quark SoC does not support MSR MTRRs. Fixed and variable range MTRRs are accessed indirectly via the message port and not the traditional MSR mechanism. Only UC, WT and WB cache types are supported.

We configure all the fixed range MTRRs with common values (VGA RAM as UC, others as WB) and 3 variable range MTRRs for ROM/eSRAM/RAM as WB, which significantly improves the boot time performance.

With this commit, it takes only 2 seconds for U-Boot to boot to shell on Intel Galileo board. Previously it took about 6 seconds.

Quoted 7 lines

---

 arch/x86/cpu/quark/dram.c               | 10 ++++++
 arch/x86/cpu/quark/quark.c              | 57 +++++++++++++++++++++++++++++++++
 arch/x86/include/asm/arch-quark/quark.h | 44 +++++++++++++++++++++++++
 3 files changed, 111 insertions(+)
Quoted 4 lines

Gosh what a strange an incompatible architecture we have here :-)

Applied to u-boot-x86, thanks!