[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH 17/23] X86/vvtd: Enable Interrupt Remapping through GCMD
From: Chao Gao <chao.gao@xxxxxxxxx> Software uses this field to enable/disable interrupt reampping. This patch emulate IRES field of GCMD. Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx> Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx> --- xen/arch/x86/hvm/vvtd.c | 26 ++++++++++++++++++++++++++ xen/drivers/passthrough/vtd/iommu.h | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vvtd.c b/xen/arch/x86/hvm/vvtd.c index ba4d585..a7bba51 100644 --- a/xen/arch/x86/hvm/vvtd.c +++ b/xen/arch/x86/hvm/vvtd.c @@ -274,6 +274,24 @@ static int vvtd_handle_gcmd_qie(struct vvtd *vvtd, unsigned long val) return X86EMUL_OKAY; } +static int vvtd_handle_gcmd_ire(struct vvtd *vvtd, unsigned long val) +{ + VVTD_DEBUG(VVTD_DBG_RW, "Enable Interrupt Remapping."); + + if ( val & DMA_GCMD_IRE ) + { + vvtd->status |= VIOMMU_STATUS_IRQ_REMAPPING_ENABLED; + __vvtd_set_bit(vvtd, DMAR_GSTS_REG, DMA_GSTS_IRES_BIT); + } + else + { + vvtd->status |= ~VIOMMU_STATUS_IRQ_REMAPPING_ENABLED; + __vvtd_clear_bit(vvtd, DMAR_GSTS_REG, DMA_GSTS_IRES_BIT); + } + + return X86EMUL_OKAY; +} + static int vvtd_handle_gcmd_sirtp(struct vvtd *vvtd, unsigned long val) { uint64_t irta; @@ -281,6 +299,10 @@ static int vvtd_handle_gcmd_sirtp(struct vvtd *vvtd, unsigned long val) if ( !(val & DMA_GCMD_SIRTP) ) return X86EMUL_OKAY; + if ( vvtd_irq_remapping_enabled(vvtd) ) + VVTD_DEBUG(VVTD_DBG_RW, "Update Interrupt Remapping Table when " + "active." ); + vvtd_get_reg_quad(vvtd, DMAR_IRTA_REG, irta); vvtd->irt = DMA_IRTA_ADDR(irta) >> PAGE_SHIFT; vvtd->irt_max_entry = DMA_IRTA_SIZE(irta); @@ -307,6 +329,10 @@ static int vvtd_write_gcmd(struct vvtd *vvtd, unsigned long val) vvtd_handle_gcmd_sirtp(vvtd, val); if ( changed & DMA_GCMD_QIE ) vvtd_handle_gcmd_qie(vvtd, val); + if ( changed & DMA_GCMD_IRE ) + vvtd_handle_gcmd_ire(vvtd, val); + if ( changed & ~(DMA_GCMD_QIE | DMA_GCMD_SIRTP | DMA_GCMD_IRE) ) + gdprintk(XENLOG_INFO, "Only QIE,SIRTP,IRE in GCMD_REG are handled.\n"); return X86EMUL_OKAY; } diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h index dd38c39..14fba1e 100644 --- a/xen/drivers/passthrough/vtd/iommu.h +++ b/xen/drivers/passthrough/vtd/iommu.h @@ -195,7 +195,8 @@ #define DMA_GSTS_WBFS (((u64)1) << 27) #define DMA_GSTS_QIES_BIT 26 #define DMA_GSTS_QIES (((u64)1) << DMA_GSTS_QIES_BIT) -#define DMA_GSTS_IRES (((u64)1) <<25) +#define DMA_GSTS_IRES_BIT 25 +#define DMA_GSTS_IRES (((u64)1) << DMA_GSTS_IRES_BIT) #define DMA_GSTS_SIRTPS_BIT 24 #define DMA_GSTS_SIRTPS (((u64)1) << DMA_GSTS_SIRTPS_BIT) #define DMA_GSTS_CFIS (((u64)1) <<23) -- 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 |