WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] to put dmar hidding/restoring into Xen to fix S3 w/

To: "keir@xxxxxxx" <keir@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Cihula, Joseph" <joseph.cihula@xxxxxxxxx>
Subject: [Xen-devel] [PATCH] to put dmar hidding/restoring into Xen to fix S3 w/ TXT (Resend)
From: "Wang, Shane" <shane.wang@xxxxxxxxx>
Date: Mon, 10 Jan 2011 11:32:37 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc:
Delivery-date: Sun, 09 Jan 2011 19:33:26 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcuwbVdzXFWiVlP4Rri+llqiaezlAQACWgcQ
Thread-topic: [PATCH] to put dmar hidding/restoring into Xen to fix S3 w/ TXT (Resend)
Put the code for hidding and restoring DMAR table from tboot into Xen in order 
to fix S3 broken issue with TXT launch.

Signed-off-by: Shane Wang <shane.wang@xxxxxxxxx>

diff -r 946d84529a07 xen/arch/x86/tboot.c
--- a/xen/arch/x86/tboot.c      Sat Jan 08 11:07:18 2011 +0000
+++ b/xen/arch/x86/tboot.c      Wed Jan 12 01:37:14 2011 +0800
@@ -352,6 +352,9 @@ void tboot_shutdown(uint32_t shutdown_ty
 
     /* if this is S3 then set regions to MAC */
     if ( shutdown_type == TB_SHUTDOWN_S3 ) {
+        /* restore DMAR table */
+        acpi_dmar_reinstate();
+
         /*
          * Xen regions for tboot to MAC
          */
@@ -484,6 +487,7 @@ int tboot_s3_resume(void)
 int tboot_s3_resume(void)
 {
     vmac_t mac;
+    int ret = 0;
 
     if ( !tboot_in_measured_env() )
         return 0;
@@ -492,22 +496,30 @@ int tboot_s3_resume(void)
     tboot_gen_xenheap_integrity(g_tboot_shared->s3_key, &mac);
     printk("MAC for xenheap before S3 is: 0x%08"PRIx64"\n", xenheap_mac);
     printk("MAC for xenheap after S3 is: 0x%08"PRIx64"\n", mac);
-    if ( mac != xenheap_mac )
-        return -1;
+    if ( mac != xenheap_mac ) {
+        ret = -1;
+        goto exit;
+    }
 
     tboot_gen_frametable_integrity(g_tboot_shared->s3_key, &mac);
     printk("MAC for frametable before S3 is: 0x%08"PRIx64"\n", frametable_mac);
     printk("MAC for frametable after S3 is: 0x%08"PRIx64"\n", mac);
-    if ( mac != frametable_mac )
-        return -2;
+    if ( mac != frametable_mac ) {
+        ret = -2;
+        goto exit;
+    }
 
     tboot_gen_domain_integrity(g_tboot_shared->s3_key, &mac);
     printk("MAC for domains before S3 is: 0x%08"PRIx64"\n", domain_mac);
     printk("MAC for domains after S3 is: 0x%08"PRIx64"\n", mac);
-    if ( mac != domain_mac )
-        return -3;
+    if ( mac != domain_mac ) {
+        ret = -3;
+        goto exit;
+    }
 
-    return 0;
+exit:
+    acpi_dmar_zap();
+    return ret;
 }
 
 /*

Attachment: dmar.patch
Description: dmar.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel