Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9346
-gerrit
commit 0ee308248f48c8798a3fa28137fbdc8353e9ef51
Author: Tom Warren <twarren(a)nvidia.com>
Date: Fri Oct 17 10:27:09 2014 -0700
tegra132: Remove clamp_tristate_inputs() call
As per NV SysEng, setting PINMUX_CLAMP_INPUTS=1 is now
considered a bad thing. It clamps _all_ tristated inputs
to zero, and isn't really the panacea for duplicated pinmux
mappings as was stated previously.
BUG=None
BRANCH=None
TEST=Built both Rush and Ryu OK. Tested on Rush, booted kernel
OK.
Change-Id: I7d6982a18a772efda7f1d3bf0dcb0d4d0a5bed8f
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: c5f77fa31961d39dd7b4bd2902288ead9ad80100
Original-Change-Id: I566c4516b34686b744a47a2b0c18c4b801456727
Original-Signed-off-by: Tom Warren <twarren(a)nvidia.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/224032
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/soc/nvidia/tegra132/bootblock.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/soc/nvidia/tegra132/bootblock.c b/src/soc/nvidia/tegra132/bootblock.c
index 6f25050..0394c78 100644
--- a/src/soc/nvidia/tegra132/bootblock.c
+++ b/src/soc/nvidia/tegra132/bootblock.c
@@ -59,9 +59,6 @@ void __attribute__((weak)) bootblock_mainboard_early_init(void)
void main(void)
{
- // enable pinmux clamp inputs
- clamp_tristate_inputs();
-
// enable JTAG at the earliest stage
enable_jtag();
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9343
-gerrit
commit 182141ee45812c2606bbcb74e20a878c78515244
Author: Julius Werner <jwerner(a)chromium.org>
Date: Thu Oct 16 09:56:27 2014 -0700
armv7: Change all memory domains to Client so XN bits work
Remember the XN bit? The one we had so much fun with on Nyan (LPAE)
because not setting it allows random instruction prefetches to device
memory that hang the system every few thousand boots? Thankfully, we had
always been setting it in the non-LPAE MMU code already...
"When the XN bit is 1, a Permission fault is generated if the processor
attempts to execute an instruction fetched from the corresponding memory
region. However, when using the Short-descriptor translation table
format, the fault is generated only if the access is to memory in the
Client domain, see Domains[...]" - ARM A.R.M. section B3.7.2
Oops. This patch changes our Domain Access Control Register (DACR) to
set domain 0 (the only one we are using) to Client. This means that
access permissions (AP[2:0] bits) become enforced, but they are already
set to full access (0b011). It also means that non-LPAE systems will not
be allowed to execute from DCACHE_OFF memory with enabled MMU anymore.
As far as I can see, Veyron_Pinky has been the only board that does
that.
BUG=chrome-os-partner:32118
TEST=Booted Veyron_Pinky with MMU in the bootblock, saw hangs that look
like spurious prefetches and confirmed that this patch fixes them.
Change-Id: I81c00743f938924a5dc8825389fe512a069b77db
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: cbc96db296a41ae700371a8515a1179c142f58e7
Original-Change-Id: I30676a5bfe12d516e5f910f51ee6854f6e5be557
Original-Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/223783
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/arch/arm/armv7/mmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/arch/arm/armv7/mmu.c b/src/arch/arm/armv7/mmu.c
index de7fa40..581c572 100644
--- a/src/arch/arm/armv7/mmu.c
+++ b/src/arch/arm/armv7/mmu.c
@@ -302,6 +302,6 @@ void mmu_init(void)
0 << 16 | 0 << 0 /* Use TTBR0 for all addresses */
);
- /* disable domain-level checking of permissions */
- write_dacr(~0);
+ /* Set domain 0 to Client so XN bit works (to prevent prefetches) */
+ write_dacr(0x5);
}
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9342
-gerrit
commit acfcba96f000243306a1382ccf9d796a0ac45ff7
Author: Julius Werner <jwerner(a)chromium.org>
Date: Wed Oct 15 18:50:45 2014 -0700
rk3288: Add early SRAM mapping
Solving the DACR bug will mean that XN bits suddenly become enforced on
non-LPAE systems, and we will no longer be able to execute out of a
region mapped DCACHE_OFF. When we enable the MMU in romstage we are
still executing out of SRAM, so we would instantly kill ourselves.
Solve this issue by enabling the MMU earlier (in the bootblock) and
mapping the SRAM regions as DCACHE_WRITETHROUGH. They should really be
DCACHE_WRITEBACK, but it looks like there might be hardware limitations
in the Cortex-A12 cache architecture that prevent us from doing so.
Write-through mappings are equivalent to normal non-cacheable on the A12
anyway, and by using this attribute we don't need to introduce a new
DCACHE_OFF_BUT_WITHOUT_XN_BIT type in our API. (Also, using normal
non-cacheable might still have a slight speed advantage over strongly
ordered since it should fetch whole cache lines at once if the processor
finds enough accesses it can combine.)
CQ-DEPEND=CL:223783
BUG=chrome-os-partner:32118
TEST=None (depends on follow-up CL)
Change-Id: I1e5127421f82177ca11af892b1539538b379625e
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: e7b079f4b6a69449f3c7cc18ef0e1704f2006847
Original-Change-Id: I53e827d95acc2db909f1251de78d65e295eceaa7
Original-Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/223782
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/mainboard/google/veyron_pinky/romstage.c | 18 ++++--------------
src/soc/rockchip/rk3288/bootblock.c | 11 +++++++++++
src/soc/rockchip/rk3288/memlayout.ld | 3 ++-
3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/mainboard/google/veyron_pinky/romstage.c b/src/mainboard/google/veyron_pinky/romstage.c
index 1d7812b..6f9b9d1 100644
--- a/src/mainboard/google/veyron_pinky/romstage.c
+++ b/src/mainboard/google/veyron_pinky/romstage.c
@@ -64,10 +64,6 @@ void main(void)
uint64_t base_time = timestamp_get();
start_romstage_time = timestamp_get();
#endif
- /* used for MMU and CBMEM setup, in MB */
- u32 dram_start_mb = (uintptr_t)_dram/MiB;
- u32 dram_size_mb = CONFIG_DRAM_SIZE_MB;
- u32 dram_end_mb = dram_start_mb + dram_size_mb;
console_init();
@@ -80,18 +76,12 @@ void main(void)
#if CONFIG_COLLECT_TIMESTAMPS
after_dram_time = timestamp_get();
#endif
- mmu_init();
- /* Device memory below DRAM is uncached. */
- mmu_config_range(0, dram_start_mb, DCACHE_OFF);
- /* DRAM is cached. */
- mmu_config_range(dram_start_mb, dram_size_mb, DCACHE_WRITEBACK);
- /* A window for DMA is uncached. */
+
+ /* Now that DRAM is up, add mappings for it and DMA coherency buffer. */
+ mmu_config_range((uintptr_t)_dram/MiB,
+ CONFIG_DRAM_SIZE_MB, DCACHE_WRITEBACK);
mmu_config_range((uintptr_t)_dma_coherent/MiB,
_dma_coherent_size/MiB, DCACHE_OFF);
- /* The space above DRAM is uncached. */
- if (dram_end_mb < 4096)
- mmu_config_range(dram_end_mb, 4096 - dram_end_mb, DCACHE_OFF);
- dcache_mmu_enable();
cbmem_initialize_empty();
diff --git a/src/soc/rockchip/rk3288/bootblock.c b/src/soc/rockchip/rk3288/bootblock.c
index eec3456..b2f5bd9 100644
--- a/src/soc/rockchip/rk3288/bootblock.c
+++ b/src/soc/rockchip/rk3288/bootblock.c
@@ -17,10 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <arch/cache.h>
#include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h>
#include <soc/rockchip/rk3288/grf.h>
+#include <symbols.h>
#include "addressmap.h"
#include "timer.h"
#include "clock.h"
@@ -41,4 +43,13 @@ static void bootblock_cpu_init(void)
}
rkclk_init();
+
+ mmu_init();
+ /* Start with a clean slate. */
+ mmu_config_range(0, 4096, DCACHE_OFF);
+ /* SRAM is tightly wedged between registers, need to use subtables. Map
+ * write-through as equivalent for non-cacheable without XN on A17. */
+ mmu_config_range_kb((uintptr_t)_sram/KiB,
+ _sram_size/KiB, DCACHE_WRITETHROUGH);
+ dcache_mmu_enable();
}
diff --git a/src/soc/rockchip/rk3288/memlayout.ld b/src/soc/rockchip/rk3288/memlayout.ld
index 6faec63..2ddb6a6 100644
--- a/src/soc/rockchip/rk3288/memlayout.ld
+++ b/src/soc/rockchip/rk3288/memlayout.ld
@@ -34,7 +34,8 @@ SECTIONS
SRAM_START(0xFF700000)
TTB(0xFF700000, 16K)
- BOOTBLOCK(0xFF704004, 16K - 4)
+ BOOTBLOCK(0xFF704004, 15K - 4)
+ TTB_SUBTABLES(0xFF707c00, 1K)
VBOOT2_WORK(0xFF708000, 16K)
OVERLAP_VERSTAGE_ROMSTAGE(0xFF70C000, 40K)
PRERAM_CBFS_CACHE(0xFF716000, 4K)