xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH RFC 09/10] passthrough/intel: put some code under CONFIG_HVM
Date: Wed, 21 Feb 2018 21:47:00 +0000	[thread overview]
Message-ID: <20180221214701.1646-10-wei.liu2@citrix.com> (raw)
In-Reply-To: <20180221214701.1646-1-wei.liu2@citrix.com>

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@citrix.com>
---
Cc: Kevin Tian <kevin.tian@intel.com>
---
 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-02-21 21:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 21:46 [PATCH RFC 00/10] x86 passthrough code cleanup Wei Liu
2018-02-21 21:46 ` [PATCH RFC 01/10] passthrough: rearrange x86 code Wei Liu
2018-04-23 15:27   ` Jan Beulich
2018-02-21 21:46 ` [PATCH RFC 02/10] passthrough: split out x86 PCI code to x86/pci.c Wei Liu
2018-02-26 10:57   ` Julien Grall
2018-04-23 15:34   ` Jan Beulich
2018-04-24  9:08     ` Julien Grall
2018-02-21 21:46 ` [PATCH RFC 03/10] x86/passthrough: io.c is used for HVM only Wei Liu
2018-04-23 15:37   ` Jan Beulich
2018-02-21 21:46 ` [PATCH RFC 04/10] x86/passthrough: arch_pci_clean_irqs is " Wei Liu
2018-02-21 21:46 ` [PATCH RFC 05/10] x86/passthrough: move hvm_dpci_isairq_eoi Wei Liu
2018-04-23 15:39   ` Jan Beulich
2018-02-21 21:46 ` [PATCH RFC 06/10] passthrough/amd: remove guest iommu support Wei Liu
2018-05-02 17:10   ` Suravee Suthikulpanit
2018-02-21 21:46 ` [PATCH RFC 07/10] passthrough/amd: split out hvm code from iommu_map.c Wei Liu
2018-04-23 15:43   ` Jan Beulich
2018-05-02 17:32   ` Suravee Suthikulpanit
2018-02-21 21:46 ` [PATCH RFC 08/10] passthrough/amd: make clear_iommu_pte_present static Wei Liu
2018-02-21 21:47 ` Wei Liu [this message]
2018-04-23 15:47   ` [PATCH RFC 09/10] passthrough/intel: put some code under CONFIG_HVM Jan Beulich
2018-02-21 21:47 ` [PATCH RFC 10/10] x86: check hvm domain before calling pt_irq_destroy_bind Wei Liu
2018-02-23  5:12 ` [PATCH RFC 00/10] x86 passthrough code cleanup Tian, Kevin
2018-02-23 16:08   ` Wei Liu
2018-02-24  3:23     ` Tian, Kevin
2018-02-26  8:20       ` Jan Beulich
2018-02-26 12:45       ` Wei Liu
2018-02-24  4:39   ` Doug Goldstein
2018-02-26  0:47     ` Marek Marczykowski-Górecki
2018-02-26 12:49       ` Wei Liu
2018-03-08 12:18 ` Wei Liu
2018-03-08 12:37   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180221214701.1646-10-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=kevin.tian@intel.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).