linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andrew@ado.is-a-geek.net
To: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	Andrew Oakley <andrew@ado.is-a-geek.net>
Subject: [PATCH] iommu/amd: Workaround wrong IOAPIC devid in IVRS.
Date: Wed, 10 Oct 2012 23:05:09 +0100	[thread overview]
Message-ID: <1349906709-5846-1-git-send-email-andrew@ado.is-a-geek.net> (raw)
In-Reply-To: <20121010230231.2fb3c3b9@ado-amd-gentoo.moore.slainvet.net>

From: Andrew Oakley <andrew@ado.is-a-geek.net>

The IOAPIC always has the same device id but is sometimes reported in
the IVRS table with a different id.  This patch allows interrupt
remapping to work on devices with this bug.
---
 drivers/iommu/amd_iommu_init.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 18b0d99..ca266b9 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -751,6 +751,9 @@ static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
 	}
 }
 
+/* SB IOAPIC is always on this device in AMD systems */
+#define IOAPIC_SB_DEVID		((0x00 << 8) | PCI_DEVFN(0x14, 0))
+
 /*
  * Takes a pointer to an AMD IOMMU entry in the ACPI table and
  * initializes the hardware and our data structures with it.
@@ -928,6 +931,12 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
 				    PCI_SLOT(devid),
 				    PCI_FUNC(devid));
 
+			if (type == IVHD_SPECIAL_IOAPIC &&
+			    devid != IOAPIC_SB_DEVID) {
+				pr_err(FW_BUG "AMD-Vi: wrong IOAPIC devid\n");
+				devid = IOAPIC_SB_DEVID;
+			}
+
 			set_dev_entry_from_acpi(iommu, devid, e->flags, 0);
 			ret = add_special_device(type, handle, devid);
 			if (ret)
-- 
1.7.8.6


  reply	other threads:[~2012-10-10 22:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 15:23 [git pull] IOMMU Updates for v3.7-rc1 Joerg Roedel
2012-10-09 21:45 ` Andrew Oakley
2012-10-10  7:30   ` Joerg Roedel
2012-10-10  8:58     ` Andrew Oakley
2012-10-10 13:32       ` Joerg Roedel
2012-10-10 19:11         ` Andrew Oakley
2012-10-10 22:02           ` Andrew Oakley
2012-10-10 22:05             ` andrew [this message]
2012-10-11  9:32             ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349906709-5846-1-git-send-email-andrew@ado.is-a-geek.net \
    --to=andrew@ado.is-a-geek.net \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).