All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] VT-d: prevent dom0 to use VT-d HW
@ 2009-09-08  2:24 Han, Weidong
  2009-09-08 11:43 ` Christian Tramnitz
  2009-09-09 22:32 ` Jeremy Fitzhardinge
  0 siblings, 2 replies; 8+ messages in thread
From: Han, Weidong @ 2009-09-08  2:24 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com
  Cc: Kay, Allen M, 'Keir.Fraser@eu.citrix.com'

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

pv-ops dom0 contains Linux upstream VT-d driver, and will go to enable it when VT-d is set in kernel config file. It should not enable VT-d in dom0.

Currently it already zaps ACPI DMAR signature to prevents dom0 using VT-d HW when VT-d is enabled for Xen. But when VT-d is not enabled for Xen, and VT-d is set in pv-ops kernel config file, pv-ops dom0 will go to enable it. This will results in pv-ops dom0 booting failure. This patch prevents dom0 to use VT-d HW whether VT-d is enabled or disabled for Xen. 

Signed-off-by: Weidong Han <weidong.han@intel.com>

[-- Attachment #2: disable-dom0-vtd.patch --]
[-- Type: application/octet-stream, Size: 1244 bytes --]

diff -r 18cd7c378c48 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Mon Sep 07 14:26:06 2009 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Tue Sep 08 10:05:44 2009 +0800
@@ -517,6 +517,12 @@ static int __init acpi_parse_dmar(struct
 
     dmar = (struct acpi_table_dmar *)table;
 
+    if ( !iommu_enabled )
+    {
+        ret = -EINVAL;
+        goto out;
+    }
+
     if ( !dmar->width )
     {
         dprintk(XENLOG_WARNING VTDPREFIX, "Zero: Invalid DMAR width\n");
@@ -563,9 +569,6 @@ static int __init acpi_parse_dmar(struct
         entry_header = ((void *)entry_header + entry_header->length);
     }
 
-    /* Zap APCI DMAR signature to prevent dom0 using vt-d HW. */
-    dmar->header.signature[0] = '\0';
-
     if ( ret )
     {
         if ( force_iommu )
@@ -579,6 +582,9 @@ static int __init acpi_parse_dmar(struct
         }
     }
 
+out:
+    /* Zap ACPI DMAR signature to prevent dom0 using vt-d HW. */
+    dmar->header.signature[0] = '\0';
     return ret;
 }
 
@@ -599,9 +605,6 @@ int acpi_dmar_init(void)
     if ( force_iommu )
         iommu_enabled = 1;
 
-    if ( !iommu_enabled )
-        goto fail;
-
     rc = parse_dmar_table(acpi_parse_dmar);
     if ( rc )
         goto fail;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

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

* Re: [PATCH] VT-d: prevent dom0 to use VT-d HW
  2009-09-08  2:24 [PATCH] VT-d: prevent dom0 to use VT-d HW Han, Weidong
@ 2009-09-08 11:43 ` Christian Tramnitz
  2009-09-08 11:51   ` Teo En Ming (Zhang Enming)
  2009-09-08 14:07   ` Ian Jackson
  2009-09-09 22:32 ` Jeremy Fitzhardinge
  1 sibling, 2 replies; 8+ messages in thread
From: Christian Tramnitz @ 2009-09-08 11:43 UTC (permalink / raw)
  To: xen-devel

Han, Weidong wrote:
> pv-ops dom0 contains Linux upstream VT-d driver, and will go to enable it when VT-d is set in kernel config file. It should not enable VT-d in dom0.
> 
> Currently it already zaps ACPI DMAR signature to prevents dom0 using VT-d HW when VT-d is enabled for Xen. But when VT-d is not enabled for Xen, and VT-d is set in pv-ops kernel config file, pv-ops dom0 will go to enable it. This will results in pv-ops dom0 booting failure. This patch prevents dom0 to use VT-d HW whether VT-d is enabled or disabled for Xen. 

Wouldn't be easier (and more likely to be adopted by upstream) to add a 
Kconfig dependency like "depends on !XEN_DOM0" to VT-d?


Best regards,
   Christian

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

* RE: Re: [PATCH] VT-d: prevent dom0 to use VT-d HW
  2009-09-08 11:43 ` Christian Tramnitz
@ 2009-09-08 11:51   ` Teo En Ming (Zhang Enming)
  2009-09-08 14:07   ` Ian Jackson
  1 sibling, 0 replies; 8+ messages in thread
From: Teo En Ming (Zhang Enming) @ 2009-09-08 11:51 UTC (permalink / raw)
  To: chris.ace, xen-devel

Dear Christian,

Could you help to look at my problem? Thank you.

Regards,
 
Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics Engineering)
BEng(Hons)(Mechanical Engineering) 
Technical Support Engineer 
Information Technology Department
Asiasoft Online Pte Ltd
Tampines Central 1 #04-01 Tampines Plaza 
Singapore 529541
Republic of Singapore
Mobile: +65-9648-9798
MSN: teoenming@hotmail.com
-----Original Message-----
From: xen-devel-bounces@lists.xensource.com
[mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Christian
Tramnitz
Sent: Tuesday, September 08, 2009 7:43 PM
To: xen-devel@lists.xensource.com
Subject: [Xen-devel] Re: [PATCH] VT-d: prevent dom0 to use VT-d HW

Han, Weidong wrote:
> pv-ops dom0 contains Linux upstream VT-d driver, and will go to enable it
when VT-d is set in kernel config file. It should not enable VT-d in dom0.
> 
> Currently it already zaps ACPI DMAR signature to prevents dom0 using VT-d
HW when VT-d is enabled for Xen. But when VT-d is not enabled for Xen, and
VT-d is set in pv-ops kernel config file, pv-ops dom0 will go to enable it.
This will results in pv-ops dom0 booting failure. This patch prevents dom0
to use VT-d HW whether VT-d is enabled or disabled for Xen. 

Wouldn't be easier (and more likely to be adopted by upstream) to add a 
Kconfig dependency like "depends on !XEN_DOM0" to VT-d?


Best regards,
   Christian


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

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.409 / Virus Database: 270.13.83/2352 - Release Date: 09/07/09
18:03:00

No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.5.409 / Virus Database: 270.13.83/2352 - Release Date: 09/07/09
18:03:00

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

* Re: [PATCH] VT-d: prevent dom0 to use VT-d HW
  2009-09-08 11:43 ` Christian Tramnitz
  2009-09-08 11:51   ` Teo En Ming (Zhang Enming)
@ 2009-09-08 14:07   ` Ian Jackson
  2009-09-08 14:14     ` Keir Fraser
  1 sibling, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2009-09-08 14:07 UTC (permalink / raw)
  To: Christian Tramnitz; +Cc: xen-devel

Christian Tramnitz writes ("[Xen-devel] Re: [PATCH] VT-d: prevent dom0 to use VT-d HW"):
> Wouldn't be easier (and more likely to be adopted by upstream) to add a 
> Kconfig dependency like "depends on !XEN_DOM0" to VT-d?

I don't think that would be right.  Nowadays we want to be able to
build kernels that will work on bare hardware, or under Xen, rather
than baking the configuration statically into the kernel image.

Ian.

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

* Re: Re: [PATCH] VT-d: prevent dom0 to use VT-d HW
  2009-09-08 14:07   ` Ian Jackson
@ 2009-09-08 14:14     ` Keir Fraser
  0 siblings, 0 replies; 8+ messages in thread
From: Keir Fraser @ 2009-09-08 14:14 UTC (permalink / raw)
  To: Ian Jackson, Christian Tramnitz; +Cc: xen-devel@lists.xensource.com

On 08/09/2009 15:07, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:

> Christian Tramnitz writes ("[Xen-devel] Re: [PATCH] VT-d: prevent dom0 to use
> VT-d HW"):
>> Wouldn't be easier (and more likely to be adopted by upstream) to add a
>> Kconfig dependency like "depends on !XEN_DOM0" to VT-d?
> 
> I don't think that would be right.  Nowadays we want to be able to
> build kernels that will work on bare hardware, or under Xen, rather
> than baking the configuration statically into the kernel image.

The correct alternative would be to gate VT-d initialisation at run-time,
conditional on being run as dom0. Probably would need a hook and probably
would not be hugely palatable to the kernel maintainers. This effective
'virtualisation'/hack of the ACPI tables is probably the right way to go.

 -- Keir

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

* Re: [PATCH] VT-d: prevent dom0 to use VT-d HW
  2009-09-08  2:24 [PATCH] VT-d: prevent dom0 to use VT-d HW Han, Weidong
  2009-09-08 11:43 ` Christian Tramnitz
@ 2009-09-09 22:32 ` Jeremy Fitzhardinge
  2009-09-09 22:35   ` Kay, Allen M
  1 sibling, 1 reply; 8+ messages in thread
From: Jeremy Fitzhardinge @ 2009-09-09 22:32 UTC (permalink / raw)
  To: Han, Weidong
  Cc: xen-devel@lists.xensource.com, Kay, Allen M,
	'Keir.Fraser@eu.citrix.com'

On 09/07/09 19:24, Han, Weidong wrote:
> pv-ops dom0 contains Linux upstream VT-d driver, and will go to enable it when VT-d is set in kernel config file. It should not enable VT-d in dom0.
>
> Currently it already zaps ACPI DMAR signature to prevents dom0 using VT-d HW when VT-d is enabled for Xen. But when VT-d is not enabled for Xen, and VT-d is set in pv-ops kernel config file, pv-ops dom0 will go to enable it. This will results in pv-ops dom0 booting failure. This patch prevents dom0 to use VT-d HW whether VT-d is enabled or disabled for Xen. 
>   

Which tree is this against?  My dom0 tree doesn't have
drivers/passthrough/vtd/.  Is there a branch you'd like me to pull in?

Thanks,
    J

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

* RE: [PATCH] VT-d: prevent dom0 to use VT-d HW
  2009-09-09 22:32 ` Jeremy Fitzhardinge
@ 2009-09-09 22:35   ` Kay, Allen M
  2009-09-09 22:41     ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 8+ messages in thread
From: Kay, Allen M @ 2009-09-09 22:35 UTC (permalink / raw)
  To: Jeremy Fitzhardinge, Han, Weidong
  Cc: xen-devel@lists.xensource.com,
	'Keir.Fraser@eu.citrix.com'

The patch is for xen source tree, not pv-ops tree.

-----Original Message-----
From: Jeremy Fitzhardinge [mailto:jeremy@goop.org] 
Sent: Wednesday, September 09, 2009 3:32 PM
To: Han, Weidong
Cc: xen-devel@lists.xensource.com; Kay, Allen M; 'Keir.Fraser@eu.citrix.com'
Subject: Re: [Xen-devel] [PATCH] VT-d: prevent dom0 to use VT-d HW

On 09/07/09 19:24, Han, Weidong wrote:
> pv-ops dom0 contains Linux upstream VT-d driver, and will go to enable it when VT-d is set in kernel config file. It should not enable VT-d in dom0.
>
> Currently it already zaps ACPI DMAR signature to prevents dom0 using VT-d HW when VT-d is enabled for Xen. But when VT-d is not enabled for Xen, and VT-d is set in pv-ops kernel config file, pv-ops dom0 will go to enable it. This will results in pv-ops dom0 booting failure. This patch prevents dom0 to use VT-d HW whether VT-d is enabled or disabled for Xen. 
>   

Which tree is this against?  My dom0 tree doesn't have
drivers/passthrough/vtd/.  Is there a branch you'd like me to pull in?

Thanks,
    J

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

* Re: [PATCH] VT-d: prevent dom0 to use VT-d HW
  2009-09-09 22:35   ` Kay, Allen M
@ 2009-09-09 22:41     ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 8+ messages in thread
From: Jeremy Fitzhardinge @ 2009-09-09 22:41 UTC (permalink / raw)
  To: Kay, Allen M
  Cc: xen-devel@lists.xensource.com, Han, Weidong,
	'Keir.Fraser@eu.citrix.com'

On 09/09/09 15:35, Kay, Allen M wrote:
> The patch is for xen source tree, not pv-ops tree.
>   

Ah, of course.  Silly me.

On the other hand, if someone were to submit some passthough patches for
pvops, I'd be very appreciative.

    J

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

end of thread, other threads:[~2009-09-09 22:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-08  2:24 [PATCH] VT-d: prevent dom0 to use VT-d HW Han, Weidong
2009-09-08 11:43 ` Christian Tramnitz
2009-09-08 11:51   ` Teo En Ming (Zhang Enming)
2009-09-08 14:07   ` Ian Jackson
2009-09-08 14:14     ` Keir Fraser
2009-09-09 22:32 ` Jeremy Fitzhardinge
2009-09-09 22:35   ` Kay, Allen M
2009-09-09 22:41     ` Jeremy Fitzhardinge

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.