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] Re: [PATCH] to put dmar hidding/restoring into Xen to fix S3

To: "Wang, Shane" <shane.wang@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Cihula, Joseph" <joseph.cihula@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] to put dmar hidding/restoring into Xen to fix S3 w/ TXT (Resend)
From: Keir Fraser <keir@xxxxxxx>
Date: Mon, 10 Jan 2011 08:37:43 +0000
Cc:
Delivery-date: Mon, 10 Jan 2011 00:38:47 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:user-agent:date :subject:from:to:message-id:thread-topic:thread-index:in-reply-to :mime-version:content-type:content-transfer-encoding; bh=iY7eV3jeq5cNqdKsPbP9KwoJHF7GxnwSwjP8+LfrytM=; b=TGymp8GYZZsqbucJgVDNSyCqfr2LFM5lQJZrmkAGPYlOmfukutZ1sSe7yldvbLvrAh 4MyjYeyikgQWXEeAe29GtL4qE/lNIY93o6J/plLu5DU9PIIQoEWBMX5jc+ClrCFjyO8P TbdxQwdPCgRMYnMyX0QSCXDyx02W3qUgwRs0Q=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=RHn1V2MmubHWwnQXYFnj+yHGl3MTZgGyJHs/3wytbQZbYv6zUaBnB6XMsswBK9QBXG GOEuNSRqrSFvBgPtWRCkiogCdesI/sN64ZAkqOi+jvrxyeYzejjVdyPKgma7+cKvWsOU iVhO7MLKMszoQQ0xcXVDGL671ZzGbN+NWop8I=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <D5AB6E638E5A3E4B8F4406B113A5A19A31B07719@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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+llqiaezlAQACWgcQAAq5ls8=
Thread-topic: [PATCH] to put dmar hidding/restoring into Xen to fix S3 w/ TXT (Resend)
User-agent: Microsoft-Entourage/12.27.0.100910
On 10/01/2011 03:32, "Wang, Shane" <shane.wang@xxxxxxxxx> wrote:

> Put the code for hidding and restoring DMAR table from tboot into Xen in order
> to fix S3 broken issue with TXT launch.

We already do this in arch/x86/acpi/power.c:enter_state(). Since
enter_state() is in the call stack of tboot_shutdown(), via tboot_sleep(),
this patch is unnecessary. In fact acpi_dmar_reinstate() is not idempotent,
so I actually think this patch takes a reinstated DMAR and breaks its
checksum!

 -- Keir

> 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;
>  }
>  
>  /*



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