Messages in this thread Patches in this message | | | Date | Thu, 23 Feb 2012 12:30:11 -0800 | From | Andrew Morton <> | Subject | Re: [PATCH 2/2] x86, pci: Increase the number of iommus supported to be MAX_IO_APICS v2 |
| |
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); } _
| |