Skip to contentSkip to conversation

tboot: fix tboot memory mapping for 32b

Xen-changelog Mark Johnson 1 participant 1 message Sep 22, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 35 lines · Xen patchbot-unstable

# HG changeset patch
# User Keir Fraser <[email protected]> # Date 1253605000 -3600
# Node ID bcb6b95b30b13efa9635f8b8e1b7ff57c50dae3d # Parent  be747c582738035889d5f3f9d40051818e1af50e
tboot: fix tboot memory mapping for 32b

This patch used fixmap to get TXT heap base/size and SINIT base/size from TXT pub config registers (whose address starts from 0xfed20000), and get DMAR table copy from TXT heap (whose address may start from 0x7d520000) for tboot, instead of using map_pages_to_xen(), which will cause panic on x86_32.

---
 xen/arch/x86/tboot.c         |   94 ++++++++++++++++++++++++------------------- xen/include/asm-x86/fixmap.h |    1

 2 files changed, 54 insertions(+), 41 deletions(-)

diff -r be747c582738 -r bcb6b95b30b1 xen/arch/x86/tboot.c

xen/arch/x86/tboot.c      Tue Sep 22 08:36:40 2009 +0100 renamed from xen/arch/x86/tboot.c      Tue Sep 22 08:28:26 2009 +0100 +9 -0
@@ -69,12 +69,29 @@ typedef struct __packed {
     uint32_t     vtd_dmars_off;
  } sinit_mle_data_t;
 
+static void tboot_copy_memory(unsigned char *va, uint32_t size,
+                              unsigned long pa)
+{
+    uint32_t map_base;
+    unsigned long map_addr;
+    int i;
+
+    map_base = 0;
+    for (i = 0; i < size; i++) {

xen/arch/x86/tboot.c      Tue Sep 22 08:36:40 2009 +0100 typedef struct __packed { · line 90

Quoted 10 lines
xen/arch/x86/tboot.c      Tue Sep 22 08:36:40 2009 +0100 renamed from xen/arch/x86/tboot.c      Tue Sep 22 08:28:26 2009 +0100 +10 -0
+        if ( map_base != PFN_DOWN(pa + i) ) {
+            map_base = PFN_DOWN(pa + i);
+            set_fixmap(FIX_TBOOT_MAP_ADDRESS, map_base << PAGE_SHIFT);
+            map_addr = (unsigned long)fix_to_virt(FIX_TBOOT_MAP_ADDRESS);
+        }
+        *(va + i) = *(unsigned char *)(map_addr + pa + i
+                                       - (map_base << PAGE_SHIFT));
+    }
+}
+

I see the following error with this change..

tboot.c: In function `tboot_copy_memory':
tboot.c:76: warning: 'map_addr' might be used uninitialized in this function gmake[5]: *** [tboot.o] Error 1

MRJ