From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753350AbdJTMJr (ORCPT ); Fri, 20 Oct 2017 08:09:47 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:56817 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753332AbdJTMJp (ORCPT ); Fri, 20 Oct 2017 08:09:45 -0400 X-Google-Smtp-Source: ABhQp+T7WWM8PiwZjPjvGl+reJ8cdMHAqcMM4xybNCAGl41cqGLAIgkoGnEmHyBHkVdmocrL1C5uTGUIL02upwP0nLs= MIME-Version: 1.0 In-Reply-To: References: <20171019105451.2892046-1-arnd@arndb.de> <20171020111120.gl3x6hhnkbexdx6i@gmail.com> From: Arnd Bergmann Date: Fri, 20 Oct 2017 14:09:44 +0200 X-Google-Sender-Auth: f5jHLteoq4FGx1AuUCWvR72BoD4 Message-ID: Subject: Re: [tip:x86/timers] x86: Don't include asm/x86_init.h in asm/setup.h To: Thomas Gleixner Cc: Ingo Molnar , Linux Kernel Mailing List , Joerg Roedel , "H. Peter Anvin" , linux-tip-commits@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 20, 2017 at 1:48 PM, Thomas Gleixner wrote: > On Fri, 20 Oct 2017, Arnd Bergmann wrote: >> On Fri, Oct 20, 2017 at 1:11 PM, Ingo Molnar wrote: >> >> #include >> >> +#include >> >> >> >> #include "irq_remapping.h" >> > >> > This breaks the IA64 build: >> > >> > drivers/iommu/dmar.c:44:26: fatal error: asm/x86_init.h: No such file or directory >> >> I've sent a fixup to add an #ifdef around it now. Alternatively, we >> could include >> it implicitly in asm/iommu_table.h, which would avoid the #ifdef but >> seem a little >> hacky. > > Hrm. Both solutions are ugly. Is there no other way to split stuff up in > those headers (maybe create an extra one). Hmm, looking at it again, I think we can get away without the explicit include, and rely on asm/pci.h to include x86_init.h. For some files I had build failures without the explicit include and for others I added it for consistency. From looking at the source, this file seems to belong in the second category. If you think that's ok, I'll do some more build testing without the #include and send a new version. Another idea: add an abstraction for the init handler assignment, see untested patch below. Arnd --- diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h index 1d1212901ae7..f2ad4a39bafe 100644 --- a/arch/ia64/include/asm/iommu.h +++ b/arch/ia64/include/asm/iommu.h @@ -18,4 +18,8 @@ extern int iommu_detected; extern void iommu_dma_init(void); extern void machvec_init(const char *name); +static inline void iommu_set_init_handler(int (*init_fn)(void)) +{ +} + #endif diff --git a/arch/x86/include/asm/iommu.h b/arch/x86/include/asm/iommu.h index fca144a104e4..09cbbc6beaab 100644 --- a/arch/x86/include/asm/iommu.h +++ b/arch/x86/include/asm/iommu.h @@ -1,6 +1,8 @@ #ifndef _ASM_X86_IOMMU_H #define _ASM_X86_IOMMU_H +#include + extern const struct dma_map_ops nommu_dma_ops; extern int force_iommu, no_iommu; extern int iommu_detected; @@ -8,6 +10,11 @@ extern int iommu_pass_through; int x86_dma_supported(struct device *dev, u64 mask); +static inline void iommu_set_init_handler(int (*init_fn)(void)) +{ + x86_init.iommu.iommu_init = init_fn; +} + /* 10 seconds */ #define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 6fe2d0346073..f464aef16a02 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -2781,7 +2781,7 @@ int __init amd_iommu_detect(void) amd_iommu_detected = true; iommu_detected = 1; - x86_init.iommu.iommu_init = amd_iommu_init; + iomm_set_init_handler(amd_iommu_init); return 1; } diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 1ea7cd537873..b3bcbb07f789 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c @@ -905,10 +905,8 @@ int __init detect_intel_iommu(void) pci_request_acs(); } -#ifdef CONFIG_X86 if (!ret) - x86_init.iommu.iommu_init = intel_iommu_init; -#endif + iommu_set_init_handler(intel_iommu_init); if (dmar_tbl) { acpi_put_table(dmar_tbl);