[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/2 v3] iommu/amd: Workaround for erratum 787
The IOMMU interrupt handling in bottom half must clear the PPR log interrupt and event log interrupt bits to re-enable the interrupt. This is done by writing 1 to the memory mapped register to clear the bit. Due to hardware bug, if the driver tries to clear this bit while the IOMMU hardware also setting this bit, the conflict will result with the bit being set. If the interrupt handling code does not make sure to clear this bit, subsequent changes in the event/PPR logs will no longer generating interrupts, and would result if buffer overflow. After clearing the bits, the driver must read back the register to verify. Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> Adjust to apply on top of heavily modified patch 1. Adjust flow to get away with a single readl() in each instance of the status register checks. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- a/xen/drivers/passthrough/amd/iommu_init.c +++ b/xen/drivers/passthrough/amd/iommu_init.c @@ -616,13 +616,18 @@ static void iommu_check_event_log(struct spin_lock_irqsave(&iommu->lock, flags); - /*check event overflow */ - entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); - - /* RW1C interrupt status bit */ - writel(IOMMU_STATUS_EVENT_LOG_INT_MASK, - iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); + do { + /* RW1C interrupt status bit */ + writel(IOMMU_STATUS_EVENT_LOG_INT_MASK, + iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); + /* + * Workaround for erratum787: + * Re-check to make sure the bit has been cleared. + */ + entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); + } while ( entry & IOMMU_STATUS_EVENT_LOG_INT_MASK ); + /* Check event overflow. */ if ( iommu_get_bit(entry, IOMMU_STATUS_EVENT_OVERFLOW_SHIFT) ) iommu_reset_log(iommu, &iommu->event_log, set_iommu_event_log_control); else @@ -690,13 +695,18 @@ static void iommu_check_ppr_log(struct a spin_lock_irqsave(&iommu->lock, flags); - /*check event overflow */ - entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); - - /* RW1C interrupt status bit */ - writel(IOMMU_STATUS_PPR_LOG_INT_MASK, - iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); + do { + /* RW1C interrupt status bit */ + writel(IOMMU_STATUS_PPR_LOG_INT_MASK, + iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); + /* + * Workaround for erratum787: + * Re-check to make sure the bit has been cleared. + */ + entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); + } while ( entry & IOMMU_STATUS_PPR_LOG_INT_MASK ); + /* Check event overflow. */ if ( iommu_get_bit(entry, IOMMU_STATUS_PPR_LOG_OVERFLOW_SHIFT) ) iommu_reset_log(iommu, &iommu->ppr_log, set_iommu_ppr_log_control); else Attachment:
AMD-IOMMU-erratum-787-workaround _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |