[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [PATCH] to put dmar hidding/restoring into Xen to fix S3 w/ TXT (Resend)


  • To: "Wang, Shane" <shane.wang@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Cihula, Joseph" <joseph.cihula@xxxxxxxxx>
  • 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
  • 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=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcuwbVdzXFWiVlP4Rri+llqiaezlAQACWgcQAAq5ls8=
  • Thread-topic: [PATCH] to put dmar hidding/restoring into Xen to fix S3 w/ TXT (Resend)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.