Skip to contentSkip to conversation

iova: Allow compiling the library without IOMMU support

PATCH Applied Sakari Ailus 4 participants 5 messages Jan 2, 2019 – Jan 11, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iova: Allow compiling the library without IOMMU support

Drivers such as the Intel IPU3 ImgU driver use the IOVA library to manage the device's own virtual address space while not implementing the IOMMU API. Currently the IOVA library is only compiled if the IOMMU support is enabled, resulting into a failure during linking due to missing symbols.

Fix this by defining IOVA library Kconfig bits independently of IOMMU support configuration, and descending to the iommu directory unconditionally during the build.

---
 drivers/Makefile      | 2 +-
 drivers/iommu/Kconfig | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/Makefile +1 -1
index 578f469f72fb..d9c469983592 100644
@@ -56,7 +56,7 @@ obj-y				+= tty/
 obj-y				+= char/
 
 # iommu/ comes before gpu as gpu are using iommu controllers
-obj-$(CONFIG_IOMMU_SUPPORT)	+= iommu/
+obj-y				+= iommu/
 
 # gpu/ comes after char for AGP vs DRM startup and after iommu
 obj-y				+= gpu/
drivers/iommu/Kconfig +4 -3
index d9a25715650e..d2c83e62873d 100644
@@ -1,3 +1,7 @@
+# The IOVA library may also be used by non-IOMMU_API users
+config IOMMU_IOVA
+	tristate
+
 # IOMMU_API always gets selected by whoever wants it.
 config IOMMU_API
 	bool
@@ -81,9 +85,6 @@ config IOMMU_DEFAULT_PASSTHROUGH
 
 	  If unsure, say N here.
 
-config IOMMU_IOVA
-	tristate
-
 config OF_IOMMU
        def_bool y
        depends on OF && IOMMU_API
Signature · 1 line
2.11.0

A message that is not in the archive (sent off-list or not yet received): 20190102211657.13192-1-sakari.ailus-VuQAYsv1563Yd54FQh9/[email protected]

#2 lore raw

Hi Sakari,

Thank you for the patch.

Quoted 3 lines · On Wednesday, 2 January 2019 23:16:57 EET Sakari Ailus wrote:

Drivers such as the Intel IPU3 ImgU driver use the IOVA library to manage the device's own virtual address space while not implementing the IOMMU API.

Why is that ? Could the IPU3 IOMMU be implemented as an IOMMU driver ?

Quoted 48 lines

Currently the IOVA library is only compiled if the IOMMU support is enabled, resulting into a failure during linking due to missing symbols.

Fix this by defining IOVA library Kconfig bits independently of IOMMU support configuration, and descending to the iommu directory unconditionally during the build.

---
 drivers/Makefile      | 2 +-
 drivers/iommu/Kconfig | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/Makefile +1 -1
index 578f469f72fb..d9c469983592 100644
@@ -56,7 +56,7 @@ obj-y				+= tty/
 obj-y				+= char/
 
 # iommu/ comes before gpu as gpu are using iommu controllers
-obj-$(CONFIG_IOMMU_SUPPORT)	+= iommu/
+obj-y				+= iommu/
 
 # gpu/ comes after char for AGP vs DRM startup and after iommu
 obj-y				+= gpu/
drivers/iommu/Kconfig +4 -3
index d9a25715650e..d2c83e62873d 100644
@@ -1,3 +1,7 @@
+# The IOVA library may also be used by non-IOMMU_API users
+config IOMMU_IOVA
+	tristate
+
 # IOMMU_API always gets selected by whoever wants it.
 config IOMMU_API
 	bool
@@ -81,9 +85,6 @@ config IOMMU_DEFAULT_PASSTHROUGH
 
 	  If unsure, say N here.
 
-config IOMMU_IOVA
-	tristate
-
 config OF_IOMMU
        def_bool y
        depends on OF && IOMMU_API
Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw

Hi Laurent,

Quoted 10 lines · Laurent Pinchart

Hi Sakari,

Thank you for the patch.

Quoted 3 lines · On Wednesday, 2 January 2019 23:16:57 EET Sakari Ailus wrote:

Drivers such as the Intel IPU3 ImgU driver use the IOVA library to manage the device's own virtual address space while not implementing the IOMMU API.

Why is that ? Could the IPU3 IOMMU be implemented as an IOMMU driver ?

You could do that, but:

- it's a single PCI device so there's no advantage in doing so and

- doing that would render the device inoperable if an IOMMU is enabled in the system, as chaining IOMMUs is not supported in the IOMMU framework AFAIK.

Quoted 58 lines
Quoted 49 lines

Currently the IOVA library is only compiled if the IOMMU support is enabled, resulting into a failure during linking due to missing symbols.

Fix this by defining IOVA library Kconfig bits independently of IOMMU support configuration, and descending to the iommu directory unconditionally during the build.

---
 drivers/Makefile      | 2 +-
 drivers/iommu/Kconfig | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/Makefile +1 -1
index 578f469f72fb..d9c469983592 100644
@@ -56,7 +56,7 @@ obj-y				+= tty/
 obj-y				+= char/
 
 # iommu/ comes before gpu as gpu are using iommu controllers
-obj-$(CONFIG_IOMMU_SUPPORT)	+= iommu/
+obj-y				+= iommu/
 
 # gpu/ comes after char for AGP vs DRM startup and after iommu
 obj-y				+= gpu/
drivers/iommu/Kconfig +4 -3
index d9a25715650e..d2c83e62873d 100644
@@ -1,3 +1,7 @@
+# The IOVA library may also be used by non-IOMMU_API users
+config IOMMU_IOVA
+	tristate
+
 # IOMMU_API always gets selected by whoever wants it.
 config IOMMU_API
 	bool
@@ -81,9 +85,6 @@ config IOMMU_DEFAULT_PASSTHROUGH
 
 	  If unsure, say N here.
 
-config IOMMU_IOVA
-	tristate
-
 config OF_IOMMU
        def_bool y
        depends on OF && IOMMU_API
Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 2 lines
Sakari Ailus
sakari.ailus-VuQAYsv1563Yd54FQh9/[email protected]

A message that is not in the archive (sent off-list or not yet received): 20190103201126.zzqpn2eylm4m2zxn-WV0MzMiPiMJ82hYKe6nXyg@public.gmane.org

#5 lore raw

----- Original Message -----

Quoted 2 lines

From: "Sakari Ailus" <sakari.ailus-VuQAYsv1563Yd54FQh9/[email protected]>
Sent: Thursday, January 3, 2019 2:11:27 PM

Hi Laurent and Sakari,

I don't have much else to offer here, but wanted to second Sakari's use case below.

Quoted 12 lines

Hi Laurent,

Quoted 9 lines · Laurent Pinchart

Hi Sakari,

Thank you for the patch.

Quoted 3 lines · On Wednesday, 2 January 2019 23:16:57 EET Sakari Ailus wrote:

Drivers such as the Intel IPU3 ImgU driver use the IOVA library to manage the device's own virtual address space while not implementing the IOMMU API.

Quoted 5 lines
Quoted 1 line

Why is that ? Could the IPU3 IOMMU be implemented as an IOMMU driver ?

You could do that, but:

- it's a single PCI device so there's no advantage in doing so and

I also use the IOVA library for a PCI device (PCIe-VME bridge) that has IOMMU features, but isn't a general purpose IOMMU. I am eagerly following along.

-Aaron

Quoted 13 lines

- doing that would render the device inoperable if an IOMMU is enabled in the system, as chaining IOMMUs is not supported in the IOMMU framework AFAIK.

Quoted 9 lines
Quoted 9 lines

Currently the IOVA library is only compiled if the IOMMU support is enabled, resulting into a failure during linking due to missing symbols.

Fix this by defining IOVA library Kconfig bits independently of IOMMU support configuration, and descending to the iommu directory unconditionally during the build.

Applied
#6 lore raw
In reply to a message not in the archive
Quoted 10 lines · Sakari Ailus

Drivers such as the Intel IPU3 ImgU driver use the IOVA library to manage the device's own virtual address space while not implementing the IOMMU API. Currently the IOVA library is only compiled if the IOMMU support is enabled, resulting into a failure during linking due to missing symbols.

Fix this by defining IOVA library Kconfig bits independently of IOMMU support configuration, and descending to the iommu directory unconditionally during the build.

Applied, thanks.