Patchwork [v4,05/28] VIOMMU: Introduce callback of checking irq remapping mode

login
register
mail settings
Submitter Chao Gao
Date Nov. 17, 2017, 6:22 a.m.
Message ID <1510899755-40237-6-git-send-email-chao.gao@intel.com>
Download mbox | patch
Permalink /patch/385483/
State New
Headers show

Comments

Chao Gao - Nov. 17, 2017, 6:22 a.m.
From: Lan Tianyu <tianyu.lan@intel.com>

This patch is to add callback for vIOAPIC and vMSI to check whether interrupt
remapping is enabled.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
---
 xen/common/viommu.c      | 15 +++++++++++++++
 xen/include/xen/viommu.h |  4 ++++
 2 files changed, 19 insertions(+)

Patch

diff --git a/xen/common/viommu.c b/xen/common/viommu.c
index 9eafdef..72173c3 100644
--- a/xen/common/viommu.c
+++ b/xen/common/viommu.c
@@ -145,6 +145,21 @@  int viommu_get_irq_info(const struct domain *d,
     return viommu->ops->get_irq_info(d, request, irq_info);
 }
 
+bool viommu_check_irq_remapping(const struct domain *d,
+                                const struct arch_irq_remapping_request *request)
+{
+    const struct viommu *viommu = d->arch.hvm_domain.viommu;
+
+    if ( !viommu )
+        return false;
+
+    ASSERT(viommu->ops);
+    if ( !viommu->ops->check_irq_remapping )
+        return false;
+
+    return viommu->ops->check_irq_remapping(d, request);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/viommu.h b/xen/include/xen/viommu.h
index 73b853f..c1dfaec 100644
--- a/xen/include/xen/viommu.h
+++ b/xen/include/xen/viommu.h
@@ -29,6 +29,8 @@  struct viommu;
 struct viommu_ops {
     uint8_t type;
     int (*create)(struct domain *d, struct viommu *viommu);
+    bool (*check_irq_remapping)(const struct domain *d,
+                                const struct arch_irq_remapping_request *request);
     int (*destroy)(struct viommu *viommu);
     int (*handle_irq_request)(const struct domain *d,
                               const struct arch_irq_remapping_request *request);
@@ -56,6 +58,8 @@  int viommu_handle_irq_request(const struct domain *d,
 int viommu_get_irq_info(const struct domain *d,
                         const struct arch_irq_remapping_request *request,
                         struct arch_irq_remapping_info *irq_info);
+bool viommu_check_irq_remapping(const struct domain *d,
+                                const struct arch_irq_remapping_request *request);
 #else
 static inline int viommu_destroy_domain(struct domain *d)
 {