linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] irqchip/gicv3-its: use IORT only if IOMMU support is enabled
@ 2017-04-27 14:26 Arnd Bergmann
  2017-04-27 15:43 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-04-27 14:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Arnd Bergmann, Jason Cooper, Marc Zyngier, Lorenzo Pieralisi,
	Hanjun Guo, Tomasz Nowicki, Will Deacon, Rafael J. Wysocki,
	linux-kernel

When the IOMMU subsystem is disabled, we cannot build ARM64 kernels with ACPI:

drivers/acpi/arm64/iort.c: In function 'iort_iommu_xlate':
drivers/acpi/arm64/iort.c:647:22: error: 'struct iommu_fwspec' has no member named 'ops'

This adds a Kconfig dependency to only enable ACPI_IORT when it acutally
builds, along with addititonal dummy helper functions to make its
users build without IOMMU/IORT.

Fixes: 3f010cf19732 ("irqchip/gicv3-its: Probe ITS in the ACPI way")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/irqchip/Kconfig   | 2 +-
 include/linux/acpi_iort.h | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 478f8ace2664..f0516740c03f 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -39,7 +39,7 @@ config ARM_GIC_V3_ITS
 	bool
 	depends on PCI
 	depends on PCI_MSI
-	select ACPI_IORT if ACPI
+	select ACPI_IORT if ACPI && IOMMU
 
 config ARM_NVIC
 	bool
diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h
index 3ff9acea8616..918906d189d3 100644
--- a/include/linux/acpi_iort.h
+++ b/include/linux/acpi_iort.h
@@ -26,10 +26,10 @@
 #define IORT_IRQ_MASK(irq)		(irq & 0xffffffffULL)
 #define IORT_IRQ_TRIGGER_MASK(irq)	((irq >> 32) & 0xffffffffULL)
 
+#ifdef CONFIG_ACPI_IORT
 int iort_register_domain_token(int trans_id, struct fwnode_handle *fw_node);
 void iort_deregister_domain_token(int trans_id);
 struct fwnode_handle *iort_find_domain_token(int trans_id);
-#ifdef CONFIG_ACPI_IORT
 void acpi_iort_init(void);
 bool iort_node_match(u8 type);
 u32 iort_msi_map_rid(struct device *dev, u32 req_id);
@@ -40,6 +40,9 @@ int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
 void iort_set_dma_mask(struct device *dev);
 const struct iommu_ops *iort_iommu_configure(struct device *dev);
 #else
+static inline int iort_register_domain_token(int trans_id, struct fwnode_handle *fw_node) { return -ENOSYS; }
+static inline void iort_deregister_domain_token(int trans_id) {}
+static inline struct fwnode_handle *iort_find_domain_token(int trans_id) { return NULL;}
 static inline void acpi_iort_init(void) { }
 static inline bool iort_node_match(u8 type) { return false; }
 static inline u32 iort_msi_map_rid(struct device *dev, u32 req_id)
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] irqchip/gicv3-its: use IORT only if IOMMU support is enabled
  2017-04-27 14:26 [PATCH] irqchip/gicv3-its: use IORT only if IOMMU support is enabled Arnd Bergmann
@ 2017-04-27 15:43 ` Lorenzo Pieralisi
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Pieralisi @ 2017-04-27 15:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Hanjun Guo,
	Tomasz Nowicki, Will Deacon, Rafael J. Wysocki, linux-kernel

On Thu, Apr 27, 2017 at 04:26:12PM +0200, Arnd Bergmann wrote:
> When the IOMMU subsystem is disabled, we cannot build ARM64 kernels with ACPI:
> 
> drivers/acpi/arm64/iort.c: In function 'iort_iommu_xlate':
> drivers/acpi/arm64/iort.c:647:22: error: 'struct iommu_fwspec' has no member named 'ops'

Damn it. This is triggered by 5a1bb638d567 ("drivers: acpi: Handle IOMMU
lookup failure with deferred probing or error") in -next.

There are a couple of things to fix here but not with this patch
(it is not correct to add a dependency on IOMMU on GIC V3 ITS).

I am not even sure that the series containing the above commit will
get merged so it is not easy to decide how to fix it up.

The ACPI_IORT Kconfig selection _must_ be reworked but not now, it
is too late in the cycle IMO.

I suspect the only thing I can do is to send Joerg a fix-up in case
the series containing the above commit is actually merged (he will
send it upstream through the IOMMU tree).

At -rc1 I will definitely have a patch ready to rework the ACPI_IORT
Kconfig selection because it is just wrong at the moment.

Thanks for the heads-up,
Lorenzo

> This adds a Kconfig dependency to only enable ACPI_IORT when it acutally
> builds, along with addititonal dummy helper functions to make its
> users build without IOMMU/IORT.
> 
> Fixes: 3f010cf19732 ("irqchip/gicv3-its: Probe ITS in the ACPI way")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/irqchip/Kconfig   | 2 +-
>  include/linux/acpi_iort.h | 5 ++++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> index 478f8ace2664..f0516740c03f 100644
> --- a/drivers/irqchip/Kconfig
> +++ b/drivers/irqchip/Kconfig
> @@ -39,7 +39,7 @@ config ARM_GIC_V3_ITS
>  	bool
>  	depends on PCI
>  	depends on PCI_MSI
> -	select ACPI_IORT if ACPI
> +	select ACPI_IORT if ACPI && IOMMU
>  
>  config ARM_NVIC
>  	bool
> diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h
> index 3ff9acea8616..918906d189d3 100644
> --- a/include/linux/acpi_iort.h
> +++ b/include/linux/acpi_iort.h
> @@ -26,10 +26,10 @@
>  #define IORT_IRQ_MASK(irq)		(irq & 0xffffffffULL)
>  #define IORT_IRQ_TRIGGER_MASK(irq)	((irq >> 32) & 0xffffffffULL)
>  
> +#ifdef CONFIG_ACPI_IORT
>  int iort_register_domain_token(int trans_id, struct fwnode_handle *fw_node);
>  void iort_deregister_domain_token(int trans_id);
>  struct fwnode_handle *iort_find_domain_token(int trans_id);
> -#ifdef CONFIG_ACPI_IORT
>  void acpi_iort_init(void);
>  bool iort_node_match(u8 type);
>  u32 iort_msi_map_rid(struct device *dev, u32 req_id);
> @@ -40,6 +40,9 @@ int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
>  void iort_set_dma_mask(struct device *dev);
>  const struct iommu_ops *iort_iommu_configure(struct device *dev);
>  #else
> +static inline int iort_register_domain_token(int trans_id, struct fwnode_handle *fw_node) { return -ENOSYS; }
> +static inline void iort_deregister_domain_token(int trans_id) {}
> +static inline struct fwnode_handle *iort_find_domain_token(int trans_id) { return NULL;}
>  static inline void acpi_iort_init(void) { }
>  static inline bool iort_node_match(u8 type) { return false; }
>  static inline u32 iort_msi_map_rid(struct device *dev, u32 req_id)
> -- 
> 2.9.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-27 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 14:26 [PATCH] irqchip/gicv3-its: use IORT only if IOMMU support is enabled Arnd Bergmann
2017-04-27 15:43 ` Lorenzo Pieralisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).