[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 09/10] passthrough/intel: put some code under CONFIG_HVM



The code which references code under arch/x86/hvm/ is surrounded by
CONFIG_HVM now.

The basic idea is that in !CONFIG_HVM && CONFIG_PV case we still want
to retain the host side IOMMU code so that PV guests can use it if
necessary.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
---
 xen/drivers/passthrough/x86/vtd/iommu.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/x86/vtd/iommu.c 
b/xen/drivers/passthrough/x86/vtd/iommu.c
index 1d161fe149..c27e63dfc1 100644
--- a/xen/drivers/passthrough/x86/vtd/iommu.c
+++ b/xen/drivers/passthrough/x86/vtd/iommu.c
@@ -32,7 +32,6 @@
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
 #include <asm/irq.h>
-#include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
 #include <mach_apic.h>
 #include "iommu.h"
@@ -41,6 +40,10 @@
 #include "vtd.h"
 #include "../../ats.h"
 
+#ifdef CONFIG_HVM
+#include <asm/hvm/vmx/vmx.h>
+#endif
+
 struct mapped_rmrr {
     struct list_head list;
     u64 base, end;
@@ -1873,6 +1876,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
     return rc;
 }
 
+#ifdef CONFIG_HVM
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
@@ -1885,6 +1889,7 @@ static int __init vtd_ept_page_compatible(struct iommu 
*iommu)
     return (ept_has_2mb(ept_cap) && opt_hap_2mb) == cap_sps_2mb(vtd_cap) &&
            (ept_has_1gb(ept_cap) && opt_hap_1gb) == cap_sps_1gb(vtd_cap);
 }
+#endif
 
 /*
  * set VT-d page table directory to EPT table if allowed
@@ -2280,7 +2285,9 @@ int __init intel_vtd_setup(void)
         if ( !cap_intr_post(iommu->cap) || !cpu_has_cx16 )
             iommu_intpost = 0;
 
+#ifdef CONFIG_HVM
         if ( !vtd_ept_page_compatible(iommu) )
+#endif
             iommu_hap_pt_share = 0;
 
         ret = iommu_set_interrupt(drhd);
@@ -2376,14 +2383,18 @@ static int reassign_device_ownership(
     if ( ret )
         return ret;
 
+#ifdef CONFIG_HVM
     if ( !has_arch_pdevs(target) )
         vmx_pi_hooks_assign(target);
+#endif
 
     ret = domain_context_mapping(target, devfn, pdev);
     if ( ret )
     {
+#ifdef CONFIG_HVM
         if ( !has_arch_pdevs(target) )
             vmx_pi_hooks_deassign(target);
+#endif
 
         return ret;
     }
@@ -2394,8 +2405,10 @@ static int reassign_device_ownership(
         pdev->domain = target;
     }
 
+#ifdef CONFIG_HVM
     if ( !has_arch_pdevs(source) )
         vmx_pi_hooks_deassign(source);
+#endif
 
     return ret;
 }
-- 
2.11.0


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.