All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 6/9] iommu/amd: Add early maps for ioapic and hpet
Date: Tue,  9 Apr 2013 22:13:01 +0200	[thread overview]
Message-ID: <1365538384-12426-7-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1365538384-12426-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>

This is needed in a later patch were ioapic_map and hpet_map
entries are created before the slab allocator is initialized
(and thus add_special_device() can't be used).

Signed-off-by: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
---
 drivers/iommu/amd_iommu_init.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 3a210f0..2a3b1b1 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -213,6 +213,13 @@ enum iommu_init_state {
 	IOMMU_INIT_ERROR,
 };
 
+/* Early ioapic and hpet maps from kernel command line */
+#define EARLY_MAP_SIZE		4
+static struct devid_map __initdata early_ioapic_map[EARLY_MAP_SIZE];
+static struct devid_map __initdata early_hpet_map[EARLY_MAP_SIZE];
+static int __initdata early_ioapic_map_size;
+static int __initdata early_hpet_map_size;
+
 static enum iommu_init_state init_state = IOMMU_START_STATE;
 
 static int amd_iommu_enable_interrupts(void);
@@ -738,6 +745,31 @@ static int __init add_special_device(u8 type, u8 id, u16 devid, bool cmd_line)
 	return 0;
 }
 
+static int __init add_early_maps(void)
+{
+	int i, ret;
+
+	for (i = 0; i < early_ioapic_map_size; ++i) {
+		ret = add_special_device(IVHD_SPECIAL_IOAPIC,
+					 early_ioapic_map[i].id,
+					 early_ioapic_map[i].devid,
+					 early_ioapic_map[i].cmd_line);
+		if (ret)
+			return ret;
+	}
+
+	for (i = 0; i < early_hpet_map_size; ++i) {
+		ret = add_special_device(IVHD_SPECIAL_HPET,
+					 early_hpet_map[i].id,
+					 early_hpet_map[i].devid,
+					 early_hpet_map[i].cmd_line);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 /*
  * Reads the device exclusion range from ACPI and initializes the IOMMU with
  * it
@@ -774,6 +806,12 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
 	u32 dev_i, ext_flags = 0;
 	bool alias = false;
 	struct ivhd_entry *e;
+	int ret;
+
+
+	ret = add_early_maps();
+	if (ret)
+		return ret;
 
 	/*
 	 * First save the recommended feature enable bits from ACPI
-- 
1.7.9.5

WARNING: multiple messages have this Message-ID (diff)
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 6/9] iommu/amd: Add early maps for ioapic and hpet
Date: Tue,  9 Apr 2013 22:13:01 +0200	[thread overview]
Message-ID: <1365538384-12426-7-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1365538384-12426-1-git-send-email-joro@8bytes.org>

This is needed in a later patch were ioapic_map and hpet_map
entries are created before the slab allocator is initialized
(and thus add_special_device() can't be used).

Signed-off-by: Joerg Roedel <joro@8bytes.org>
---
 drivers/iommu/amd_iommu_init.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 3a210f0..2a3b1b1 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -213,6 +213,13 @@ enum iommu_init_state {
 	IOMMU_INIT_ERROR,
 };
 
+/* Early ioapic and hpet maps from kernel command line */
+#define EARLY_MAP_SIZE		4
+static struct devid_map __initdata early_ioapic_map[EARLY_MAP_SIZE];
+static struct devid_map __initdata early_hpet_map[EARLY_MAP_SIZE];
+static int __initdata early_ioapic_map_size;
+static int __initdata early_hpet_map_size;
+
 static enum iommu_init_state init_state = IOMMU_START_STATE;
 
 static int amd_iommu_enable_interrupts(void);
@@ -738,6 +745,31 @@ static int __init add_special_device(u8 type, u8 id, u16 devid, bool cmd_line)
 	return 0;
 }
 
+static int __init add_early_maps(void)
+{
+	int i, ret;
+
+	for (i = 0; i < early_ioapic_map_size; ++i) {
+		ret = add_special_device(IVHD_SPECIAL_IOAPIC,
+					 early_ioapic_map[i].id,
+					 early_ioapic_map[i].devid,
+					 early_ioapic_map[i].cmd_line);
+		if (ret)
+			return ret;
+	}
+
+	for (i = 0; i < early_hpet_map_size; ++i) {
+		ret = add_special_device(IVHD_SPECIAL_HPET,
+					 early_hpet_map[i].id,
+					 early_hpet_map[i].devid,
+					 early_hpet_map[i].cmd_line);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 /*
  * Reads the device exclusion range from ACPI and initializes the IOMMU with
  * it
@@ -774,6 +806,12 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
 	u32 dev_i, ext_flags = 0;
 	bool alias = false;
 	struct ivhd_entry *e;
+	int ret;
+
+
+	ret = add_early_maps();
+	if (ret)
+		return ret;
 
 	/*
 	 * First save the recommended feature enable bits from ACPI
-- 
1.7.9.5



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

Thread overview: 43+ 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 ` Joerg Roedel
     [not found] ` <1365538384-12426-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-04-09 20:12   ` [PATCH 1/9] iommu/amd: Remove map_sg_no_iommu() Joerg Roedel
2013-04-09 20:12     ` Joerg Roedel
     [not found]     ` <1365538384-12426-2-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-04-10 16:03       ` Shuah Khan
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-09 20:12     ` Joerg Roedel
     [not found]     ` <1365538384-12426-3-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-04-10 16:03       ` Shuah Khan
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     ` Joerg Roedel
2013-04-09 20:12   ` [PATCH 4/9] iommu/amd: Move add_special_device() to __init Joerg Roedel
2013-04-09 20:12     ` Joerg Roedel
2013-04-09 20:13   ` [PATCH 5/9] iommu/amd: Extend IVRS special device data structure Joerg Roedel
2013-04-09 20:13     ` 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:13     ` Joerg Roedel
     [not found]     ` <1365538384-12426-8-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-04-09 20:29       ` Joerg Roedel
2013-04-09 20:29         ` Joerg Roedel
     [not found]         ` <20130409202941.GJ6858-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-04-11 21:40           ` Suravee Suthikulanit
2013-04-11 21:40             ` Suravee Suthikulanit
     [not found]             ` <51672DB7.4010403-5C7GfCeVMHo@public.gmane.org>
2013-04-12  8:04               ` Joerg Roedel
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-09 20:13     ` Joerg Roedel
     [not found]     ` <1365538384-12426-9-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-04-10 15:59       ` Shuah Khan
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-09 20:13     ` Joerg Roedel
2013-04-10 16:06   ` [PATCH 0/9] AMD IOMMU cleanups, fixes and IVRS bug workarounds Shuah Khan
2013-04-10 16:06     ` Shuah Khan
     [not found]     ` <CAKocOOP5tMsDLS8Wotu0kMNjSVJpN+pPhE9zj+n9ZKS9EcVR+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-12  8:06       ` Joerg Roedel
2013-04-12  8:06         ` Joerg Roedel
     [not found]         ` <20130412080637.GN6858-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-04-13 15:06           ` Andrew Cooks
2013-04-13 15:06             ` Andrew Cooks
     [not found]             ` <CAJtEV7aLa2tKw-B0f0ZNHdP86yxpvUAofs9eVPYCeib6m67f8g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-13 15:26               ` Joerg Roedel
2013-04-13 15:26                 ` Joerg Roedel
     [not found]                 ` <20130413152602.GO6858-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-04-13 23:14                   ` Shuah Khan
2013-04-13 23:14                     ` Shuah Khan
     [not found]                     ` <CAKocOOMZ-s-SHdJ0mb=EngiS2szGraK+=GNPpkmwALhi1hutnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-13 23:33                       ` Linda Knippers

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-7-git-send-email-joro@8bytes.org \
    --to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.