Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936069Ab3DRQC3 (ORCPT ); Thu, 18 Apr 2013 12:02:29 -0400 Received: from 8bytes.org ([85.214.48.195]:49124 "EHLO mail.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932602Ab3DRQC2 (ORCPT ); Thu, 18 Apr 2013 12:02:28 -0400 Date: Thu, 18 Apr 2013 18:02:24 +0200 From: Joerg Roedel To: suravee.suthikulpanit@amd.com Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2 V2] iommu/amd: Add workaround for ERBT1312 Message-ID: <20130418160220.GA4153@8bytes.org> References: <1366009666-44792-1-git-send-email-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1366009666-44792-1-git-send-email-suravee.suthikulpanit@amd.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Thu Apr 18 18:02:26 2013 X-DSPAM-Confidence: 0.9995 X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 5170191223671437818720 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2340 Lines: 67 On Mon, Apr 15, 2013 at 02:07:46AM -0500, suravee.suthikulpanit@amd.com wrote: > drivers/iommu/amd_iommu.c | 145 +++++++++++++++++++++++++++++---------------- That is way too much for a simple erratum workaround, and too much for a stable backport. I queued the patch below instead, which has a much smaller diff and does the same. Please rebase your second patch on-top of this one and send it again. >From 4ba052102863da02db79c03d2483b6ad905737ad Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Thu, 18 Apr 2013 17:55:04 +0200 Subject: [PATCH] iommu/amd: Workaround for ERBT1312 Work around an IOMMU hardware bug where clearing the EVT_INT bit in the status register may race with the hardware trying to set it again. When not handled the bit might not be cleared and we lose all future event interrupts. Reported-by: Suravee Suthikulpanit Cc: stable@vger.kernel.org Signed-off-by: Joerg Roedel --- drivers/iommu/amd_iommu.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index f42793d..de5ae4b 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -700,14 +700,23 @@ retry: static void iommu_poll_events(struct amd_iommu *iommu) { - u32 head, tail; + u32 head, tail, status; unsigned long flags; - /* enable event interrupts again */ - writel(MMIO_STATUS_EVT_INT_MASK, iommu->mmio_base + MMIO_STATUS_OFFSET); - spin_lock_irqsave(&iommu->lock, flags); + /* enable event interrupts again */ + do { + /* + * Workaround for Erratum ERBT1312 + * Clearing the EVT_INT bit may race in the hardware, so read + * it again and make sure it was really cleared + */ + status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET); + writel(MMIO_STATUS_EVT_INT_MASK, + iommu->mmio_base + MMIO_STATUS_OFFSET); + } while (status & MMIO_STATUS_EVT_INT_MASK); + head = readl(iommu->mmio_base + MMIO_EVT_HEAD_OFFSET); tail = readl(iommu->mmio_base + MMIO_EVT_TAIL_OFFSET); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/