Blame SOURCES/kexec-tools-2.0.8-arm64-Enable-disable-D-cache-before-after-sha-verifi.patch

a6d77e
From 2939844d0211a820cf22a8d666df90af889ec6f1 Mon Sep 17 00:00:00 2001
a6d77e
Message-Id: <2939844d0211a820cf22a8d666df90af889ec6f1.1430751022.git.panand@redhat.com>
a6d77e
In-Reply-To: <8b40614f4c1925fe94f274dfc69d1a63537fe399.1430751022.git.panand@redhat.com>
a6d77e
References: <8b40614f4c1925fe94f274dfc69d1a63537fe399.1430751022.git.panand@redhat.com>
a6d77e
From: Pratyush Anand <panand@redhat.com>
a6d77e
Date: Mon, 4 May 2015 17:50:21 +0530
a6d77e
Subject: [PATCH 3/3] arm64: Enable/disable D-cache before/after sha
a6d77e
 verification
a6d77e
a6d77e
Enable D cache before SHA verification and disable it before switching
a6d77e
to kernel.
a6d77e
a6d77e
Since we only map RAM area, therefore currently no printf is allowed
a6d77e
between d-cache enable and disable events. Identity mapping for port
a6d77e
area with device type memory attributes need to be created for printf to
a6d77e
work.
a6d77e
a6d77e
Signed-off-by: Pratyush Anand <panand@redhat.com>
a6d77e
---
a6d77e
 purgatory/arch/arm64/purgatory-arm64.c | 12 ++++++++++++
a6d77e
 1 file changed, 12 insertions(+)
a6d77e
a6d77e
diff --git a/purgatory/arch/arm64/purgatory-arm64.c b/purgatory/arch/arm64/purgatory-arm64.c
a6d77e
index 3a1c9243bfa2..e045039039b6 100644
a6d77e
--- a/purgatory/arch/arm64/purgatory-arm64.c
a6d77e
+++ b/purgatory/arch/arm64/purgatory-arm64.c
a6d77e
@@ -2,6 +2,7 @@
a6d77e
  * ARM64 purgatory.
a6d77e
  */
a6d77e
 
a6d77e
+#include "cache.h"
a6d77e
 #include <stdint.h>
a6d77e
 #include <purgatory.h>
a6d77e
 
a6d77e
@@ -10,6 +11,8 @@
a6d77e
 extern uint32_t *arm64_sink;
a6d77e
 extern void (*arm64_kernel_entry)(uint64_t);
a6d77e
 extern uint64_t arm64_dtb_addr;
a6d77e
+extern uint64_t arm64_ram_start;
a6d77e
+extern uint64_t arm64_ram_end;
a6d77e
 
a6d77e
 static void wait_for_xmit_complete(void)
a6d77e
 {
a6d77e
@@ -44,14 +47,23 @@ void putchar(int ch)
a6d77e
 	}
a6d77e
 }
a6d77e
 
a6d77e
+uint64_t page_table[PAGE_TABLE_SIZE / sizeof(uint64_t)] __attribute__ ((aligned (PAGE_TABLE_SIZE))) = { };
a6d77e
+extern void enable_dcache(uint64_t , uint64_t , uint64_t *);
a6d77e
+extern void disable_dcache(uint64_t , uint64_t);
a6d77e
+
a6d77e
 void setup_arch(void)
a6d77e
 {
a6d77e
 	printf("purgatory: kernel_entry: %lx\n",
a6d77e
 		(unsigned long)arm64_kernel_entry);
a6d77e
 	printf("purgatory: dtb:          %lx\n", arm64_dtb_addr);
a6d77e
+	printf("purgatory: RAM start: %lx\n", arm64_ram_start);
a6d77e
+	printf("purgatory: RAM end: %lx\n", arm64_ram_end);
a6d77e
+
a6d77e
+	enable_dcache(arm64_ram_start, arm64_ram_end, page_table);
a6d77e
 }
a6d77e
 
a6d77e
 void post_verification_setup_arch(void)
a6d77e
 {
a6d77e
+	disable_dcache(arm64_ram_start, arm64_ram_end);
a6d77e
 	arm64_kernel_entry(arm64_dtb_addr);
a6d77e
 }
a6d77e
-- 
a6d77e
2.1.0
a6d77e