diff mbox

[v4,13/28] x86/vvtd: add a helper function to decide the interrupt format

Message ID 1510899755-40237-14-git-send-email-chao.gao@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chao Gao Nov. 17, 2017, 6:22 a.m. UTC
Different platform may use different method to distinguish
remapping format interrupt and normal format interrupt.

Intel uses one bit in IOAPIC RTE or MSI address register to
indicate the interrupt is remapping format. vvtd should handle
all the interrupts when .check_irq_remapping() return true.

Signed-off-by: Chao Gao <chao.gao@intel.com>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>

---
v3:
 - new
---
 xen/drivers/passthrough/vtd/vvtd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox

Patch

diff --git a/xen/drivers/passthrough/vtd/vvtd.c b/xen/drivers/passthrough/vtd/vvtd.c
index 9890cc2..d3dec01 100644
--- a/xen/drivers/passthrough/vtd/vvtd.c
+++ b/xen/drivers/passthrough/vtd/vvtd.c
@@ -565,6 +565,15 @@  static int vvtd_get_irq_info(const struct domain *d,
     return 0;
 }
 
+/* check whether the interrupt request is remappable */
+static bool vvtd_is_remapping(const struct domain *d,
+                              const struct arch_irq_remapping_request *irq)
+{
+    uint32_t idx;
+
+    return !irq_remapping_request_index(irq, &idx);
+}
+
 static void vvtd_reset(struct vvtd *vvtd)
 {
     uint64_t cap = cap_set_num_fault_regs(VVTD_FRCD_NUM)
@@ -628,6 +637,7 @@  static const struct viommu_ops vvtd_hvm_vmx_ops = {
     .destroy = vvtd_destroy,
     .handle_irq_request = vvtd_handle_irq_request,
     .get_irq_info = vvtd_get_irq_info,
+    .check_irq_remapping = vvtd_is_remapping,
 };
 
 REGISTER_VIOMMU(vvtd_hvm_vmx_ops);