From: "Jan Beulich" Subject: Re: [PATCH 2/2] iommu/amd: Workaround for ERBT1312 Date: Fri, 19 Apr 2013 08:44:52 +0100 Message-ID: <5171121402000078000CED67@nat28.tlf.novell.com> References: <1366310479-2602-1-git-send-email-suravee.suthikulpanit@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1366310479-2602-1-git-send-email-suravee.suthikulpanit@amd.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: suravee.suthikulpanit@amd.com Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 18.04.13 at 20:41, wrote: What is ERBT1312? Please reference at least the title of the document containing this in the description, so that in few months/years time one can still reconstruct what this refers to. > --- a/xen/drivers/passthrough/amd/iommu_init.c > +++ b/xen/drivers/passthrough/amd/iommu_init.c > @@ -615,16 +615,23 @@ static void iommu_check_event_log(struct amd_iommu *iommu) > sizeof(event_entry_t), parse_event_log_entry); > > spin_lock_irqsave(&iommu->lock, flags); > - > - /*check event overflow */ > + > entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); > > - if ( iommu_get_bit(entry, IOMMU_STATUS_EVENT_OVERFLOW_SHIFT) ) > - iommu_reset_log(iommu, &iommu->event_log, set_iommu_event_log_control); > + 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); > > - /* reset interrupt status bit */ > - writel(IOMMU_STATUS_EVENT_LOG_INT_MASK, > - iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); > + /* reset interrupt status bit */ > + writel(IOMMU_STATUS_EVENT_LOG_INT_MASK, > + iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); > + > + /* This is a hardware bug workaround (ERBT1312) */ > + entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); > + } > > spin_unlock_irqrestore(&iommu->lock, flags); > } > @@ -681,18 +688,24 @@ static void iommu_check_ppr_log(struct amd_iommu *iommu) > > iommu_read_log(iommu, &iommu->ppr_log, > sizeof(ppr_entry_t), parse_ppr_log_entry); > - > + > spin_lock_irqsave(&iommu->lock, flags); > > - /*check event overflow */ > entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); > > - if ( iommu_get_bit(entry, IOMMU_STATUS_PPR_LOG_OVERFLOW_SHIFT) ) > - iommu_reset_log(iommu, &iommu->ppr_log, set_iommu_ppr_log_control); > + 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); > > - /* reset interrupt status bit */ > - writel(IOMMU_STATUS_PPR_LOG_INT_MASK, > - iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); > + /* reset interrupt status bit */ > + writel(IOMMU_STATUS_PPR_LOG_INT_MASK, > + iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); > + > + /* This is a hardware bug workaround (ERBT1312) */ > + entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET); > + } > > spin_unlock_irqrestore(&iommu->lock, flags); > } This needs cleaning up from a coding style perspective: No hard tabs, braces on separate lines, spaces inside the outermost parentheses following keywords, a space following the opening /* of comments, proper indentation of multi-line function arguments. Jan