Skip to contentSkip to conversation

x86/dmar: zap DMAR signature for dom0 once in TBOOT case

PATCH Superseded Zhenzhong Duan 3 participants 6 messages Aug 20, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 x86/dmar: zap DMAR signature for dom0 once in TBOOT case

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.

---
 xen/arch/x86/tboot.c               |    3 +--
 xen/drivers/passthrough/vtd/dmar.c |    2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)
xen/arch/x86/tboot.c +1 -2
index d5a5292..f22fa24 100644
@@ -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;
xen/drivers/passthrough/vtd/dmar.c +2 -0
index 8c5fa80..ed4c04e 100644
@@ -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;
 }
 
Signature · 6 lines
1.7.3

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.08.18 at 05:32, <[email protected]> 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?

Quoted 8 lines

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

---
 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

Quoted 15 lines
xen/arch/x86/tboot.c +1 -2
@@ -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;

xen/drivers/passthrough/vtd/dmar.c static int __init acpi_parse_dmar(struct acpi_table_header *table) · line 875

Quoted 10 lines
xen/drivers/passthrough/vtd/dmar.c +2 -0
@@ -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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 7 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.08.18 at 05:32, <[email protected]> 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

Quoted 31 lines
Quoted 9 lines

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

---
  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

Quoted 17 lines
xen/arch/x86/tboot.c +1 -2
@@ -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;
xen/drivers/passthrough/vtd/dmar.c +0 -0
@@ -866,8 +866,10 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
      }
 
Quoted 10 lines

xen/drivers/passthrough/vtd/dmar.c static int __init acpi_parse_dmar(struct acpi_table_header *table) · line 875

Quoted 8 lines
xen/drivers/passthrough/vtd/dmar.c +2 -0
  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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 20.08.18 at 10:40, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.08.18 at 05:32, <[email protected]> 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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
In reply to Jan Beulich
Quoted 6 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.08.18 at 05:32, <[email protected]> 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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 5 lines · Andrew Cooper
Quoted 4 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.08.18 at 05:32, <[email protected]> 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().

Quoted 8 lines
Quoted 2 lines

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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel