2020-12-18 09:37:55

by Isaac J. Manjarres

[permalink] [raw]
Subject: [RFC PATCH 0/3] iommu: Permit modular builds of io-pgtable drivers

The goal of the Generic Kernel Image (GKI) effort is to have a common
image that works across multiple Android devices. This involves generating
a kernel image that has core features integrated into it, while SoC specific
functionality can be added to the kernel for the device as a module.

Along with modularizing IOMMU drivers, this also means building the io-pgtable
code as modules, which allows for SoC vendors to only include the io-pgtable
implementations that they use. For example, GKI for arm64 must include
support for both the IOMMU ARM LPAE/V7S formats at the moment. Having the code
for both formats as modules allows SoC vendors to only provide the page table
format that they use, along with their IOMMU driver.

Modularizing both io-pgtable.c, as well as the io-pgtable-arm[-v7s].c files,
works out rather nicely, as the main interface that clients use to interact
with the page tables is already exported (i.e. alloc_io_pgtable_ops and
free_io_pgtable_ops). It also makes it so that neither the io-pgtable-arm[-v7s]
modules or the io-pgtable modules can be unloaded without unloading the IOMMU
driver, which can only happen when there aren't any references to the IOMMU
driver module.

Thanks in advance for the feedback,

Isaac J. Manjarres

Isaac J. Manjarres (3):
iommu/io-pgtable-arm: Prepare for modularization
iommu/io-pgtable: Prepare for modularization
iommu/io-pgtable: Allow building as a module

drivers/iommu/Kconfig | 6 +++---
drivers/iommu/io-pgtable-arm-v7s.c | 4 ++++
drivers/iommu/io-pgtable-arm.c | 8 ++++++++
drivers/iommu/io-pgtable.c | 7 +++++--
4 files changed, 20 insertions(+), 5 deletions(-)

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2020-12-18 09:39:03

by Isaac J. Manjarres

[permalink] [raw]
Subject: [PATCH 3/3] iommu/io-pgtable: Allow building as a module

Now that all of the required symbols have been exported,
and the io-pgtable code can correctly refer to the
io-pgtable init functions when their source files are built
as modules, allow the io-pgtable code to be built as a module. The
expectation is that the io-pgtable core code, along with
the descriptor format (either or both ARM LPAE and ARMV7S)
can be built as modules.

Signed-off-by: Isaac J. Manjarres <[email protected]>
---
drivers/iommu/Kconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 192ef8f..d7de6db 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -27,10 +27,10 @@ menu "Generic IOMMU Pagetable Support"

# Selected by the actual pagetable implementations
config IOMMU_IO_PGTABLE
- bool
+ tristate

config IOMMU_IO_PGTABLE_LPAE
- bool "ARMv7/v8 Long Descriptor Format"
+ tristate "ARMv7/v8 Long Descriptor Format"
select IOMMU_IO_PGTABLE
depends on ARM || ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64)
help
@@ -49,7 +49,7 @@ config IOMMU_IO_PGTABLE_LPAE_SELFTEST
If unsure, say N here.

config IOMMU_IO_PGTABLE_ARMV7S
- bool "ARMv7/v8 Short Descriptor Format"
+ tristate "ARMv7/v8 Short Descriptor Format"
select IOMMU_IO_PGTABLE
depends on ARM || ARM64 || COMPILE_TEST
help
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project