@@ -30,6 +30,7 @@
#include <xen/lib.h>
#include <xen/errno.h>
#include <xen/sched.h>
+#include <xen/viommu.h>
#include <public/hvm/ioreq.h>
#include <asm/hvm/io.h>
#include <asm/hvm/vpic.h>
@@ -387,9 +388,17 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
struct vlapic *target;
struct vcpu *v;
unsigned int irq = vioapic->base_gsi + pin;
+ struct arch_irq_remapping_request request;
ASSERT(spin_is_locked(&d->arch.hvm_domain.irq_lock));
+ irq_request_ioapic_fill(&request, vioapic->id, vioapic->redirtbl[pin].bits);
+ if ( viommu_check_irq_remapping(d, &request) )
+ {
+ viommu_handle_irq_request(d, &request);
+ return;
+ }
+
HVM_DBG_LOG(DBG_LEVEL_IOAPIC,
"dest=%x dest_mode=%x delivery_mode=%x "
"vector=%x trig_mode=%x",
@@ -49,6 +49,15 @@ struct arch_irq_remapping_request
enum viommu_irq_request_type type;
};
+static inline void irq_request_ioapic_fill(
+ struct arch_irq_remapping_request *req, uint32_t ioapic_id, uint64_t rte)
+{
+ ASSERT(req);
+ req->type = VIOMMU_REQUEST_IRQ_APIC;
+ req->source_id = ioapic_id;
+ req->msg.rte = rte;
+}
+
#endif /* __ARCH_X86_VIOMMU_H__ */
/*