# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1255967414 -3600
# Node ID 1c928c3566e0f41ba582edd21ae02f0787bf1362
# Parent ea34183c5c11a5c0525da7871be79309d3fdda64
vtd: Disable VT-d if no DRHD units are probed.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
xen/drivers/passthrough/iommu.c | 8 +++++---
xen/drivers/passthrough/vtd/iommu.c | 21 +++++++++------------
2 files changed, 14 insertions(+), 15 deletions(-)
diff -r ea34183c5c11 -r 1c928c3566e0 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c Mon Oct 19 13:31:21 2009 +0100
+++ b/xen/drivers/passthrough/iommu.c Mon Oct 19 16:50:14 2009 +0100
@@ -266,9 +266,11 @@ int iommu_setup(void)
{
int rc = -ENODEV;
- rc = iommu_hardware_setup();
-
- iommu_enabled = (rc == 0);
+ if ( iommu_enabled )
+ {
+ rc = iommu_hardware_setup();
+ iommu_enabled = (rc == 0);
+ }
if ( force_iommu && !iommu_enabled )
panic("IOMMU setup failed, crash Xen for security purpose!\n");
diff -r ea34183c5c11 -r 1c928c3566e0 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c Mon Oct 19 13:31:21 2009 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c Mon Oct 19 16:50:14 2009 +0100
@@ -1707,7 +1707,7 @@ int intel_vtd_setup(void)
struct acpi_drhd_unit *drhd;
struct iommu *iommu;
- if ( !iommu_enabled )
+ if ( list_empty(&acpi_drhd_units) )
return -ENODEV;
platform_quirks();
@@ -1760,18 +1760,15 @@ int intel_vtd_setup(void)
P(iommu_intremap, "Interrupt Remapping");
#undef P
+ /* Allocate domain id bitmap, and set bit 0 as reserved. */
drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list);
- if ( drhd != NULL )
- {
- /* Allocate domain id bitmap, and set bit 0 as reserved. */
- domid_bitmap_size = cap_ndoms(drhd->iommu->cap);
- domid_bitmap = xmalloc_array(unsigned long,
- BITS_TO_LONGS(domid_bitmap_size));
- if ( domid_bitmap == NULL )
- goto error;
- memset(domid_bitmap, 0, domid_bitmap_size / 8);
- __set_bit(0, domid_bitmap);
- }
+ domid_bitmap_size = cap_ndoms(drhd->iommu->cap);
+ domid_bitmap = xmalloc_array(unsigned long,
+ BITS_TO_LONGS(domid_bitmap_size));
+ if ( domid_bitmap == NULL )
+ goto error;
+ memset(domid_bitmap, 0, domid_bitmap_size / 8);
+ __set_bit(0, domid_bitmap);
scan_pci_devices();
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|