aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-01-07 02:31:28 -0500
committerThomas Gleixner <tglx@linutronix.de>2015-01-15 05:24:22 -0500
commita1dafe857db56c35878c71560089a4694ac841fd (patch)
treeff793dd8cfbe73b697ee5e5a1284a6130e02fd9b /drivers/iommu
parenteaa27f34e91a14cdceed26ed6c6793ec1d186115 (diff)
iommu, x86: Restructure setup of the irq remapping feature
enable_IR_x2apic() calls setup_irq_remapping_ops() which by default installs the intel dmar remapping ops and then calls the amd iommu irq remapping prepare callback to figure out whether we are running on an AMD machine with irq remapping hardware. Right after that it calls irq_remapping_prepare() which pointlessly checks: if (!remap_ops || !remap_ops->prepare) return -ENODEV; and then calls remap_ops->prepare() which is silly in the AMD case as it got called from setup_irq_remapping_ops() already a few microseconds ago. Simplify this and just collapse everything into irq_remapping_prepare(). The irq_remapping_prepare() remains still silly as it assigns blindly the intel ops, but that's not scope of this patch. The scope here is to move the preperatory work, i.e. memory allocations out of the atomic section which is required to enable irq remapping. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Borislav Petkov <bp@alien8.de> Acked-and-tested-by: Joerg Roedel <joro@8bytes.org> Cc: Tony Luck <tony.luck@intel.com> Cc: iommu@lists.linux-foundation.org Cc: Joerg Roedel <jroedel@suse.de> Cc: H. Peter Anvin <hpa@linux.intel.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> Cc: Jan Beulich <JBeulich@suse.com> Cc: Richard Weinberger <richard@nod.at> Cc: Oren Twaig <oren@scalemp.com> Cc: x86@kernel.org Link: http://lkml.kernel.org/r/20141205084147.232633738@linutronix.de Link: http://lkml.kernel.org/r/1420615903-28253-2-git-send-email-jiang.liu@linux.intel.com Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/irq_remapping.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
index 89c4846683be..91d5884d3ed9 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
@@ -194,16 +194,6 @@ static __init int setup_irqremap(char *str)
194} 194}
195early_param("intremap", setup_irqremap); 195early_param("intremap", setup_irqremap);
196 196
197void __init setup_irq_remapping_ops(void)
198{
199 remap_ops = &intel_irq_remap_ops;
200
201#ifdef CONFIG_AMD_IOMMU
202 if (amd_iommu_irq_ops.prepare() == 0)
203 remap_ops = &amd_iommu_irq_ops;
204#endif
205}
206
207void set_irq_remapping_broken(void) 197void set_irq_remapping_broken(void)
208{ 198{
209 irq_remap_broken = 1; 199 irq_remap_broken = 1;
@@ -222,9 +212,14 @@ int irq_remapping_supported(void)
222 212
223int __init irq_remapping_prepare(void) 213int __init irq_remapping_prepare(void)
224{ 214{
225 if (!remap_ops || !remap_ops->prepare) 215 remap_ops = &intel_irq_remap_ops;
226 return -ENODEV;
227 216
217#ifdef CONFIG_AMD_IOMMU
218 if (amd_iommu_irq_ops.prepare() == 0) {
219 remap_ops = &amd_iommu_irq_ops;
220 return 0;
221 }
222#endif
228 return remap_ops->prepare(); 223 return remap_ops->prepare();
229} 224}
230 225