linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Joerg Roedel <joro@8bytes.org>
Subject: [PATCH 5/9] iommu/amd: Extend IVRS special device data structure
Date: Tue,  9 Apr 2013 22:13:00 +0200	[thread overview]
Message-ID: <1365538384-12426-6-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1365538384-12426-1-git-send-email-joro@8bytes.org>

This patch extends the devid_map data structure to allow
ioapic and hpet entries in ivrs to be overridden on the
kernel command line.

Signed-off-by: Joerg Roedel <joro@8bytes.org>
---
 drivers/iommu/amd_iommu_init.c  |   28 +++++++++++++++++++---------
 drivers/iommu/amd_iommu_types.h |    1 +
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 6dc8d8d..3a210f0 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -708,20 +708,30 @@ static int __init add_special_device(u8 type, u8 id, u16 devid, bool cmd_line)
 	struct devid_map *entry;
 	struct list_head *list;
 
-	if (type != IVHD_SPECIAL_IOAPIC && type != IVHD_SPECIAL_HPET)
+	if (type == IVHD_SPECIAL_IOAPIC)
+		list = &ioapic_map;
+	else if (type == IVHD_SPECIAL_HPET)
+		list = &hpet_map;
+	else
 		return -EINVAL;
 
+	list_for_each_entry(entry, list, list) {
+		if (!(entry->id == id && entry->cmd_line))
+			continue;
+
+		pr_info("AMD-Vi: Command-line override present for %s id %d - ignoring\n",
+			type == IVHD_SPECIAL_IOAPIC ? "IOAPIC" : "HPET", id);
+
+		return 0;
+	}
+
 	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
 	if (!entry)
 		return -ENOMEM;
 
-	entry->id    = id;
-	entry->devid = devid;
-
-	if (type == IVHD_SPECIAL_IOAPIC)
-		list = &ioapic_map;
-	else
-		list = &hpet_map;
+	entry->id	= id;
+	entry->devid	= devid;
+	entry->cmd_line	= cmd_line;
 
 	list_add_tail(&entry->list, list);
 
@@ -929,7 +939,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
 				    PCI_FUNC(devid));
 
 			set_dev_entry_from_acpi(iommu, devid, e->flags, 0);
-			ret = add_special_device(type, handle, devid);
+			ret = add_special_device(type, handle, devid, false);
 			if (ret)
 				return ret;
 			break;
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
index e38ab43..f0a85fa 100644
--- a/drivers/iommu/amd_iommu_types.h
+++ b/drivers/iommu/amd_iommu_types.h
@@ -591,6 +591,7 @@ struct devid_map {
 	struct list_head list;
 	u8 id;
 	u16 devid;
+	bool cmd_line;
 };
 
 /* Map HPET and IOAPIC ids to the devid used by the IOMMU */
-- 
1.7.9.5



  parent reply	other threads:[~2013-04-09 20:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 20:12 [PATCH 0/9] AMD IOMMU cleanups, fixes and IVRS bug workarounds Joerg Roedel
2013-04-09 20:12 ` [PATCH 1/9] iommu/amd: Remove map_sg_no_iommu() Joerg Roedel
2013-04-10 16:03   ` Shuah Khan
2013-04-09 20:12 ` [PATCH 2/9] iommu/amd: Use AMD specific data structure for irq remapping Joerg Roedel
2013-04-10 16:03   ` Shuah Khan
2013-04-09 20:12 ` [PATCH 3/9] iommu/amd: Properly initialize irq-table lock Joerg Roedel
2013-04-09 20:12 ` [PATCH 4/9] iommu/amd: Move add_special_device() to __init Joerg Roedel
2013-04-09 20:13 ` Joerg Roedel [this message]
2013-04-09 20:13 ` [PATCH 6/9] iommu/amd: Add early maps for ioapic and hpet Joerg Roedel
2013-04-09 20:13 ` [PATCH 7/9] iommu/amd: Add ioapic and hpet ivrs override Joerg Roedel
2013-04-09 20:29   ` Joerg Roedel
2013-04-11 21:40     ` Suravee Suthikulanit
2013-04-12  8:04       ` Joerg Roedel
2013-04-09 20:13 ` [PATCH 8/9] iommu/amd: Don't report firmware bugs with cmd-line ivrs overrides Joerg Roedel
2013-04-10 15:59   ` Shuah Khan
2013-04-09 20:13 ` [PATCH 9/9] iommu/amd: Document ivrs_ioapic and ivrs_hpet parameters Joerg Roedel
2013-04-10 16:06 ` [PATCH 0/9] AMD IOMMU cleanups, fixes and IVRS bug workarounds Shuah Khan
2013-04-12  8:06   ` Joerg Roedel
2013-04-13 15:06     ` Andrew Cooks
2013-04-13 15:26       ` Joerg Roedel
2013-04-13 23:14         ` Shuah Khan

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=1365538384-12426-6-git-send-email-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=iommu@lists.linux-foundation.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).