xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] x86/dmar: zap DMAR signature for dom0 once in TBOOT case
@ 2018-08-20  3:32 Zhenzhong Duan
  2018-08-20  8:30 ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Zhenzhong Duan @ 2018-08-20  3:32 UTC (permalink / raw)
  To: Xen-Devel; +Cc: Andrew Cooper3, Boris Ostrovsky, JBeulich, Srinivas REDDY Eeda

When TBOOT enabled, acpi_parse_dmar() zap a copy of DMAR table rather
than the real table, so make it controled by config option based on the
fact that we already have done the real zapping in tboot_parse_dmar_table().

As said above, acpi_parse_dmar() doesn't zaps APCI DMAR signature in
real TXT heap table, fix the stale comments.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
---
 xen/arch/x86/tboot.c               |    3 +--
 xen/drivers/passthrough/vtd/dmar.c |    2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index d5a5292..f22fa24 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -490,8 +490,7 @@ int __init tboot_parse_dmar_table(acpi_table_handler dmar_handler)
     rc = dmar_handler(dmar_table);
     xfree(dmar_table);
 
-    /* acpi_parse_dmar() zaps APCI DMAR signature in TXT heap table */
-    /* but dom0 will read real table, so must zap it there too */
+    /* Dom0 will read real DMAR table, so must zap it there */
     acpi_dmar_zap();
 
     return rc;
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 8c5fa80..ed4c04e 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -866,8 +866,10 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
     }
 
 out:
+#ifndef CONFIG_TBOOT
     /* Zap ACPI DMAR signature to prevent dom0 using vt-d HW. */
     acpi_dmar_zap();
+#endif
     return ret;
 }
 
-- 
1.7.3

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] x86/dmar: zap DMAR signature for dom0 once in TBOOT case
  2018-08-20  3:32 [PATCH 2/2] x86/dmar: zap DMAR signature for dom0 once in TBOOT case Zhenzhong Duan
@ 2018-08-20  8:30 ` Jan Beulich
  2018-08-20  8:40   ` Zhenzhong Duan
  2018-08-20  8:44   ` Andrew Cooper
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Beulich @ 2018-08-20  8:30 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: Kevin Tian, Andrew Cooper, Xen-Devel, Shane Wang, Boris Ostrovsky,
	Srinivas REDDY Eeda, Gang Wei

>>> On 20.08.18 at 05:32, <zhenzhong.duan@oracle.com> wrote:
> When TBOOT enabled, acpi_parse_dmar() zap a copy of DMAR table rather
> than the real table, so make it controled by config option based on the
> fact that we already have done the real zapping in tboot_parse_dmar_table().

Is this just a cosmetic change, or is there any harm done by the extra
zapping?

> As said above, acpi_parse_dmar() doesn't zaps APCI DMAR signature in
> real TXT heap table, fix the stale comments.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> ---
>  xen/arch/x86/tboot.c               |    3 +--
>  xen/drivers/passthrough/vtd/dmar.c |    2 ++
>  2 files changed, 3 insertions(+), 2 deletions(-)

You've again failed to Cc maintainers (included now).

Jan

> --- a/xen/arch/x86/tboot.c
> +++ b/xen/arch/x86/tboot.c
> @@ -490,8 +490,7 @@ int __init tboot_parse_dmar_table(acpi_table_handler dmar_handler)
>      rc = dmar_handler(dmar_table);
>      xfree(dmar_table);
>  
> -    /* acpi_parse_dmar() zaps APCI DMAR signature in TXT heap table */
> -    /* but dom0 will read real table, so must zap it there too */
> +    /* Dom0 will read real DMAR table, so must zap it there */
>      acpi_dmar_zap();
>  
>      return rc;
> --- a/xen/drivers/passthrough/vtd/dmar.c
> +++ b/xen/drivers/passthrough/vtd/dmar.c
> @@ -866,8 +866,10 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
>      }
>  
>  out:
> +#ifndef CONFIG_TBOOT
>      /* Zap ACPI DMAR signature to prevent dom0 using vt-d HW. */
>      acpi_dmar_zap();
> +#endif
>      return ret;
>  }
>  



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] x86/dmar: zap DMAR signature for dom0 once in TBOOT case
  2018-08-20  8:30 ` Jan Beulich
@ 2018-08-20  8:40   ` Zhenzhong Duan
  2018-08-20  8:44     ` Jan Beulich
  2018-08-20  8:44   ` Andrew Cooper
  1 sibling, 1 reply; 6+ messages in thread
From: Zhenzhong Duan @ 2018-08-20  8:40 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Kevin Tian, Andrew Cooper, Xen-Devel, Shane Wang, Boris Ostrovsky,
	Srinivas REDDY Eeda, Gang Wei

On 2018/8/20 16:30, Jan Beulich wrote:
>>>> On 20.08.18 at 05:32, <zhenzhong.duan@oracle.com> wrote:
>> When TBOOT enabled, acpi_parse_dmar() zap a copy of DMAR table rather
>> than the real table, so make it controled by config option based on the
>> fact that we already have done the real zapping in tboot_parse_dmar_table().
> 
> Is this just a cosmetic change, or is there any harm done by the extra
> zapping?
Cosmetic change, I feel it isn't necessory to zap a copy of DMAR table 
which is freed later.

Thanks
Zhenzhong
> 
>> As said above, acpi_parse_dmar() doesn't zaps APCI DMAR signature in
>> real TXT heap table, fix the stale comments.
>>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
>> ---
>>   xen/arch/x86/tboot.c               |    3 +--
>>   xen/drivers/passthrough/vtd/dmar.c |    2 ++
>>   2 files changed, 3 insertions(+), 2 deletions(-)
> 
> You've again failed to Cc maintainers (included now).
> 
> Jan
> 
>> --- a/xen/arch/x86/tboot.c
>> +++ b/xen/arch/x86/tboot.c
>> @@ -490,8 +490,7 @@ int __init tboot_parse_dmar_table(acpi_table_handler dmar_handler)
>>       rc = dmar_handler(dmar_table);
>>       xfree(dmar_table);
>>   
>> -    /* acpi_parse_dmar() zaps APCI DMAR signature in TXT heap table */
>> -    /* but dom0 will read real table, so must zap it there too */
>> +    /* Dom0 will read real DMAR table, so must zap it there */
>>       acpi_dmar_zap();
>>   
>>       return rc;
>> --- a/xen/drivers/passthrough/vtd/dmar.c
>> +++ b/xen/drivers/passthrough/vtd/dmar.c
>> @@ -866,8 +866,10 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
>>       }
>>   
>>   out:
>> +#ifndef CONFIG_TBOOT
>>       /* Zap ACPI DMAR signature to prevent dom0 using vt-d HW. */
>>       acpi_dmar_zap();
>> +#endif
>>       return ret;
>>   }
>>   
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] x86/dmar: zap DMAR signature for dom0 once in TBOOT case
  2018-08-20  8:30 ` Jan Beulich
  2018-08-20  8:40   ` Zhenzhong Duan
@ 2018-08-20  8:44   ` Andrew Cooper
  2018-08-20  8:58     ` Zhenzhong Duan
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Cooper @ 2018-08-20  8:44 UTC (permalink / raw)
  To: Jan Beulich, Zhenzhong Duan
  Cc: Kevin Tian, Shane Wang, Srinivas REDDY Eeda, Boris Ostrovsky,
	Xen-Devel, Gang Wei

On 20/08/2018 09:30, Jan Beulich wrote:
>>>> On 20.08.18 at 05:32, <zhenzhong.duan@oracle.com> wrote:
>> When TBOOT enabled, acpi_parse_dmar() zap a copy of DMAR table rather
>> than the real table, so make it controled by config option based on the
>> fact that we already have done the real zapping in tboot_parse_dmar_table().
> Is this just a cosmetic change, or is there any harm done by the extra
> zapping?

Before 123c7793797502b222300eb710cd3873dcca41ee, calling it multiple
times would require an equivalent number of reinstate calls for it to work.

That change went into Xen 4.6, whereas I guess this is a patch being
upstreamed from Oracles 4.4 patchqueue?

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] x86/dmar: zap DMAR signature for dom0 once in TBOOT case
  2018-08-20  8:40   ` Zhenzhong Duan
@ 2018-08-20  8:44     ` Jan Beulich
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2018-08-20  8:44 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: Kevin Tian, Andrew Cooper, Xen-Devel, Shane Wang, Boris Ostrovsky,
	Srinivas REDDY Eeda, Gang Wei

>>> On 20.08.18 at 10:40, <zhenzhong.duan@oracle.com> wrote:
> On 2018/8/20 16:30, Jan Beulich wrote:
>>>>> On 20.08.18 at 05:32, <zhenzhong.duan@oracle.com> wrote:
>>> When TBOOT enabled, acpi_parse_dmar() zap a copy of DMAR table rather
>>> than the real table, so make it controled by config option based on the
>>> fact that we already have done the real zapping in tboot_parse_dmar_table().
>> 
>> Is this just a cosmetic change, or is there any harm done by the extra
>> zapping?
> Cosmetic change, I feel it isn't necessory to zap a copy of DMAR table 
> which is freed later.

In which case please clarify this in the description.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] x86/dmar: zap DMAR signature for dom0 once in TBOOT case
  2018-08-20  8:44   ` Andrew Cooper
@ 2018-08-20  8:58     ` Zhenzhong Duan
  0 siblings, 0 replies; 6+ messages in thread
From: Zhenzhong Duan @ 2018-08-20  8:58 UTC (permalink / raw)
  To: Andrew Cooper, Jan Beulich
  Cc: Kevin Tian, Shane Wang, Srinivas REDDY Eeda, Boris Ostrovsky,
	Xen-Devel, Gang Wei

On 2018/8/20 16:44, Andrew Cooper wrote:
> On 20/08/2018 09:30, Jan Beulich wrote:
>>>>> On 20.08.18 at 05:32, <zhenzhong.duan@oracle.com> wrote:
>>> When TBOOT enabled, acpi_parse_dmar() zap a copy of DMAR table rather
>>> than the real table, so make it controled by config option based on the
>>> fact that we already have done the real zapping in tboot_parse_dmar_table().
>> Is this just a cosmetic change, or is there any harm done by the extra
>> zapping?
> 
> Before 123c7793797502b222300eb710cd3873dcca41ee, calling it multiple
> times would require an equivalent number of reinstate calls for it to work.
> 
> That change went into Xen 4.6, whereas I guess this is a patch being
> upstreamed from Oracles 4.4 patchqueue?
Not for that reason. Patch is for upstream.
tboot_parse_dmar_table() called acpi_dmar_zap() the first time, 
acpi_parse_dmar called it the second time, I thought it's a dup.

Thanks
Zhenzhong

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-20  8:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-20  3:32 [PATCH 2/2] x86/dmar: zap DMAR signature for dom0 once in TBOOT case Zhenzhong Duan
2018-08-20  8:30 ` Jan Beulich
2018-08-20  8:40   ` Zhenzhong Duan
2018-08-20  8:44     ` Jan Beulich
2018-08-20  8:44   ` Andrew Cooper
2018-08-20  8:58     ` Zhenzhong Duan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).