[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 18/23] x86/vpt: Get interrupt vector through a vioapic interface
From: Chao Gao <chao.gao@xxxxxxxxx> When irq remapping enabled, IRE may not contain the vector of interrupt. So, a new function, vioapic_gsi_vector() is added to translate gsi to vector. Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx> Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx> --- xen/arch/x86/hvm/vioapic.c | 26 ++++++++++++++++++++++++++ xen/arch/x86/hvm/vpt.c | 2 +- xen/include/asm-x86/hvm/vioapic.h | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c index 6a00644..95a2e15 100644 --- a/xen/arch/x86/hvm/vioapic.c +++ b/xen/arch/x86/hvm/vioapic.c @@ -276,6 +276,32 @@ static inline int pit_channel0_enabled(void) return pt_active(¤t->domain->arch.vpit.pt0); } +int vioapic_gsi_vector(struct domain *d, unsigned int gsi) +{ + int err; + struct irq_remapping_request request; + struct hvm_hw_vioapic *vioapic = domain_vioapic(d); + struct irq_remapping_info info; + + if ( vioapic->redirtbl[gsi].ir.format ) + { + irq_request_ioapic_fill(&request, vioapic->id, + vioapic->redirtbl[gsi].bits); + err = viommu_get_irq_info(d, &request, &info); + if ( err < 0 ) + { + gdprintk(XENLOG_ERR, "Bad gsi or bad interrupt remapping table " + "entry.\n"); + domain_crash(d); + } + return info.vector; + } + else + { + return vioapic->redirtbl[gsi].fields.vector; + } +} + static void vioapic_deliver(struct hvm_hw_vioapic *vioapic, int irq) { uint16_t dest = vioapic->redirtbl[irq].fields.dest_id; diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 5c48fdb..a1fafe2 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -91,7 +91,7 @@ static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src) + (isa_irq & 7)); ASSERT(src == hvm_intsrc_lapic); - return domain_vioapic(v->domain)->redirtbl[gsi].fields.vector; + return vioapic_gsi_vector(v->domain, gsi); } static int pt_irq_masked(struct periodic_time *pt) diff --git a/xen/include/asm-x86/hvm/vioapic.h b/xen/include/asm-x86/hvm/vioapic.h index 745c09a..fc3dc22 100644 --- a/xen/include/asm-x86/hvm/vioapic.h +++ b/xen/include/asm-x86/hvm/vioapic.h @@ -56,6 +56,7 @@ struct hvm_vioapic { #define vioapic_domain(v) (container_of((v), struct hvm_vioapic, \ hvm_hw_vioapic)->domain) +int vioapic_gsi_vector(struct domain *d, unsigned int gsi); int vioapic_init(struct domain *d); void vioapic_deinit(struct domain *d); void vioapic_reset(struct domain *d); -- 1.8.3.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |