All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Mike Travis <travis@sgi.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	David Woodhouse <dwmw2@infradead.org>,
	Chris Wright <chrisw@sous-sol.org>, Daniel Rahn <drahn@suse.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Jack Steiner <steiner@sgi.com>, Tony Ernst <tee@sgi.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] x86, pci: Increase the number of iommus supported to be MAX_IO_APICS v2
Date: Thu, 23 Feb 2012 12:30:11 -0800	[thread overview]
Message-ID: <20120223123011.cfe4ae35.akpm@linux-foundation.org> (raw)
In-Reply-To: <20120223004931.121722197@gulag1.americas.sgi.com>

On Wed, 22 Feb 2012 18:49:32 -0600
Mike Travis <travis@sgi.com> wrote:

> The number of IOMMUs supported should be the same as the number of IO APICS.
> This limit comes into play when the IOMMUs are identity mapped, thus the
> number of possible IOMMUs in the "static identity" (si) domain should be
> this same number.
> 
> Version 2: Fix compile error on ia64 (it uses the DMAR logic but does not
> define MAX_IO_APICS.)  Check to insure that iommu_bmp does not overflow.

Here's your v2 delta:

--- a/drivers/iommu/intel-iommu.c~x86-pci-increase-the-number-of-iommus-supported-to-be-max_io_apics-v2
+++ a/drivers/iommu/intel-iommu.c
@@ -354,10 +354,17 @@ static int hw_pass_through = 1;
 /* si_domain contains mulitple devices */
 #define DOMAIN_FLAG_STATIC_IDENTITY	(1 << 2)
 
+/* define the limit of IOMMUs supported in each domain */
+#ifdef	CONFIG_X86
+#define	IOMMU_UNITS_SUPPORTED	MAX_IO_APICS
+#else
+#define	IOMMU_UNITS_SUPPORTED	64
+#endif
+
 struct dmar_domain {
 	int	id;			/* domain id */
 	int	nid;			/* node id */
-	DECLARE_BITMAP(iommu_bmp, MAX_IO_APICS);
+	DECLARE_BITMAP(iommu_bmp, IOMMU_UNITS_SUPPORTED);
 					/* bitmap of iommus this domain uses*/
 
 	struct list_head devices; 	/* all devices' list */
@@ -2401,12 +2408,17 @@ static int __init init_dmars(void)
 	 * endfor
 	 */
 	for_each_drhd_unit(drhd) {
-		g_num_of_iommus++;
 		/*
 		 * lock not needed as this is only incremented in the single
 		 * threaded kernel __init code path all other access are read
 		 * only
 		 */
+		if (g_num_of_iommus < IOMMU_UNITS_SUPPORTED)
+			g_num_of_iommus++;
+		else
+			printk_once(KERN_ERR,
+			  "MAX number (%d) of IOMMUs supported exceeded\n",
+			  IOMMU_UNITS_SUPPORTED);
 	}
 
 	g_iommus = kcalloc(g_num_of_iommus, sizeof(struct intel_iommu *),


The printk_once() is wrong, isn't it?  There should not be a comma.

Also we can tweak the code flow and the message to avoid dorky
80-column games:

--- a/drivers/iommu/intel-iommu.c~x86-pci-increase-the-number-of-iommus-supported-to-be-max_io_apics-v2-fix
+++ a/drivers/iommu/intel-iommu.c
@@ -2413,11 +2413,11 @@ static int __init init_dmars(void)
 		 * threaded kernel __init code path all other access are read
 		 * only
 		 */
-		if (g_num_of_iommus < IOMMU_UNITS_SUPPORTED)
+		if (g_num_of_iommus < IOMMU_UNITS_SUPPORTED) {
 			g_num_of_iommus++;
-		else
-			printk_once(KERN_ERR,
-			  "MAX number (%d) of IOMMUs supported exceeded\n",
+			continue;
+		}
+		printk_once(KERN_ERR "intel-iommu: exceeded %d IOMMUs\n",
 			  IOMMU_UNITS_SUPPORTED);
 	}
 
_


  reply	other threads:[~2012-02-23 20:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23  0:49 [PATCH 0/2] Updates for SGI UV1/UV2 systems Mike Travis
2012-02-23  0:49 ` [PATCH 1/2] x86 PCI: Fix identity mapping for sandy bridge Mike Travis
2012-02-23  0:49 ` [PATCH 2/2] x86, pci: Increase the number of iommus supported to be MAX_IO_APICS v2 Mike Travis
2012-02-23 20:30   ` Andrew Morton [this message]
2012-02-27  7:57     ` Ingo Molnar
2012-02-27  8:03       ` Andrew Morton
2012-02-27  9:15         ` Ingo Molnar

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=20120223123011.cfe4ae35.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chrisw@sous-sol.org \
    --cc=drahn@suse.com \
    --cc=dwmw2@infradead.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=steiner@sgi.com \
    --cc=tee@sgi.com \
    --cc=travis@sgi.com \
    --cc=x86@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 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.