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: Keir Fraser <keir@xxxxxxx>, "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: "Wang, Shane" <shane.wang@xxxxxxxxx>
Date: Tue, 11 Jan 2011 08:14:06 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc:
Delivery-date: Mon, 10 Jan 2011 16:15:26 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C95075D7.29D3B%keir@xxxxxxx>
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>
References: <D5AB6E638E5A3E4B8F4406B113A5A19A31B07719@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <C95075D7.29D3B%keir@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcuwbVdzXFWiVlP4Rri+llqiaezlAQACWgcQAAq5ls8AIKYxMA==
Thread-topic: [PATCH] to put dmar hidding/restoring into Xen to fix S3 w/ TXT (Resend)
OK. Then restoring DMAR is not necessary before S3.
But I am thinking whether we need to hide DMAR again after S3 resume.

Thanks.
Shane

Keir Fraser wrote on 2011-01-10:

> 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