We don't set the affinity for posted format IRTE, since the destination of these interrupts is vCPU and the vCPU affinity is set during vCPU scheduling.
Signed-off-by: Feng Wu <feng...@intel.com> --- v5: - Only suppress affinity related IRTE updates for PI xen/drivers/passthrough/vtd/intremap.c | 52 ++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index bfd468b..8dd0373 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -547,6 +547,49 @@ static int remap_entry_to_msi_msg( return 0; } +static bool_t pi_can_suppress_irte_update(struct iremap_entry *new, + const struct iremap_entry *old) +{ + bool_t ret = 1; + u16 fpd, sid, sq, svt; + + if ( !old->remap.p || !old->remap.im ) + return 0; + + fpd = new->post.fpd; + sid = new->post.sid; + sq = new->post.sq; + svt = new->post.svt; + + *new = *old; + + if ( fpd != old->post.fpd ) + { + new->post.fpd = fpd; + ret = 0; + } + + if ( sid != old->post.sid ) + { + new->post.sid = sid; + ret = 0; + } + + if ( sq != old->post.sq ) + { + new->post.sq = sq; + ret = 0; + } + + if ( svt != old->post.svt ) + { + new->post.svt = svt; + ret = 0; + } + + return ret; +} + static int msi_msg_to_remap_entry( struct iommu *iommu, struct pci_dev *pdev, struct msi_desc *msi_desc, struct msi_msg *msg) @@ -637,9 +680,12 @@ static int msi_msg_to_remap_entry( remap_rte->address_hi = 0; remap_rte->data = index - i; - memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry)); - iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry)); - iommu_flush_iec_index(iommu, 0, index); + if ( !pi_can_suppress_irte_update(&new_ire, iremap_entry) ) + { + memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry)); + iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry)); + iommu_flush_iec_index(iommu, 0, index); + } unmap_vtd_domain_page(iremap_entries); spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags); -- 2.1.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel