Skip to contentSkip to conversation

iommu: PGTABLE_LPAE is also for RISCV

PATCH In review Randy Dunlap 5 participants 11 messages Mar 30, 2023 – May 16, 2023

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

PATCH 1/1 iommu: PGTABLE_LPAE is also for RISCV

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Conor Dooley <[email protected]>
---
 drivers/iommu/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/Kconfig +1 -1
diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
@@ -32,7 +32,7 @@ config IOMMU_IO_PGTABLE
 config IOMMU_IO_PGTABLE_LPAE
 	bool "ARMv7/v8 Long Descriptor Format"
 	select IOMMU_IO_PGTABLE
-	depends on ARM || ARM64 || COMPILE_TEST
+	depends on ARM || ARM64 || RISCV || COMPILE_TEST
 	depends on !GENERIC_ATOMIC64	# for cmpxchg64()
 	help
 	  Enable support for the ARM long descriptor pagetable format.
#1 lore raw

Hey Randy,

Quoted 37 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Conor Dooley <[email protected]>
---
 drivers/iommu/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 33

Quoted 2 lines
drivers/iommu/Kconfig +0 -0
@@ -32,7 +32,7 @@ config IOMMU_IO_PGTABLE
 config IOMMU_IO_PGTABLE_LPAE
 	bool "ARMv7/v8 Long Descriptor Format"

I'm probably missing something here, but why would we want to enable "ARMv7/v8 Long Descriptor Format" on RISC-V?
Would it not be better to make the Renesas depend on, rather than select the option? It does seem highly arch specific, and I feel like Geert previously mentioned that the RZ/Five (their RISC-V offering) didn't use it.

Cheers,
Conor.

Quoted 7 lines
drivers/iommu/Kconfig +1 -1
 	select IOMMU_IO_PGTABLE
-	depends on ARM || ARM64 || COMPILE_TEST
+	depends on ARM || ARM64 || RISCV || COMPILE_TEST
 	depends on !GENERIC_ATOMIC64	# for cmpxchg64()
 	help
 	  Enable support for the ARM long descriptor pagetable format.
#2 lore raw

Hi Conor,

Quoted 34 lines · Conor Dooley
Quoted 33 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Conor Dooley <[email protected]>
---
 drivers/iommu/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 33

Quoted 6 lines

diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig

drivers/iommu/Kconfig +0 -0
@@ -32,7 +32,7 @@ config IOMMU_IO_PGTABLE
 config IOMMU_IO_PGTABLE_LPAE
      bool "ARMv7/v8 Long Descriptor Format"

I'm probably missing something here, but why would we want to enable "ARMv7/v8 Long Descriptor Format" on RISC-V?

Indeed, we should not enable it, unless compile-testing.

Quoted 4 lines

Would it not be better to make the Renesas depend on, rather than select the option? It does seem highly arch specific, and I feel like Geert previously mentioned that the RZ/Five (their RISC-V offering) didn't use it.

I think the IPMMU_VMSA dependency should gain

        depends on ARM || ARM64 || COMPILE_TEST
Quoted 6 lines

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 38

Quoted 6 lines
drivers/iommu/Kconfig +1 -1
      select IOMMU_IO_PGTABLE
-     depends on ARM || ARM64 || COMPILE_TEST
+     depends on ARM || ARM64 || RISCV || COMPILE_TEST
      depends on !GENERIC_ATOMIC64    # for cmpxchg64()
      help
        Enable support for the ARM long descriptor pagetable format.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
reviewer
#3 lore raw
Quoted 49 lines · Geert Uytterhoeven

Hi Conor,

Quoted 34 lines · Conor Dooley
Quoted 33 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Conor Dooley <[email protected]>
---
  drivers/iommu/Kconfig |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 33

Quoted 6 lines

diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig

drivers/iommu/Kconfig +0 -0
@@ -32,7 +32,7 @@ config IOMMU_IO_PGTABLE
  config IOMMU_IO_PGTABLE_LPAE
       bool "ARMv7/v8 Long Descriptor Format"

I'm probably missing something here, but why would we want to enable "ARMv7/v8 Long Descriptor Format" on RISC-V?

Indeed, we should not enable it, unless compile-testing.

Quoted 8 lines
Quoted 4 lines

Would it not be better to make the Renesas depend on, rather than select the option? It does seem highly arch specific, and I feel like Geert previously mentioned that the RZ/Five (their RISC-V offering) didn't use it.

I think the IPMMU_VMSA dependency should gain

         depends on ARM || ARM64 || COMPILE_TEST

Indeed, I thought we'd settled on something like that in the previous thread(s) on ARCH_RENESAS vs. RV32, but I guess nobody got round to actually respininng the patch (possibly since my refactoring here ended up papering over the immediate RV32 issue).

Cheers,
Robin.

Quoted 11 lines
Quoted 6 lines

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 38

Quoted 6 lines
drivers/iommu/Kconfig +1 -1
       select IOMMU_IO_PGTABLE
-     depends on ARM || ARM64 || COMPILE_TEST
+     depends on ARM || ARM64 || RISCV || COMPILE_TEST
       depends on !GENERIC_ATOMIC64    # for cmpxchg64()
       help
         Enable support for the ARM long descriptor pagetable format.

Gr{oetje,eeting}s,

Geert

#4 lore raw
In reply to Geert Uytterhoeven

Hi all,

Quoted 49 lines · Geert Uytterhoeven

Hi Conor,

Quoted 34 lines · Conor Dooley
Quoted 33 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Conor Dooley <[email protected]>
---
 drivers/iommu/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 33

Quoted 6 lines

diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig

drivers/iommu/Kconfig +0 -0
@@ -32,7 +32,7 @@ config IOMMU_IO_PGTABLE
 config IOMMU_IO_PGTABLE_LPAE
      bool "ARMv7/v8 Long Descriptor Format"

I'm probably missing something here, but why would we want to enable "ARMv7/v8 Long Descriptor Format" on RISC-V?

Indeed, we should not enable it, unless compile-testing.

Quoted 8 lines
Quoted 4 lines

Would it not be better to make the Renesas depend on, rather than select the option? It does seem highly arch specific, and I feel like Geert previously mentioned that the RZ/Five (their RISC-V offering) didn't use it.

I think the IPMMU_VMSA dependency should gain

        depends on ARM || ARM64 || COMPILE_TEST

so like this?
Or did you mean to drop the ARCH_RENESAS part also?

config IPMMU_VMSA
bool "Renesas VMSA-compatible IPMMU"

-       depends on ARCH_RENESAS || COMPILE_TEST
+       depends on ARCH_RENESAS || ARM || ARM64 || COMPILE_TEST

The failing config file has ARCH_RENESAS=y. After the change above, I still get:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

I am attaching the config file.

Quoted 11 lines
Quoted 6 lines

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 38

Quoted 6 lines
drivers/iommu/Kconfig +1 -1
      select IOMMU_IO_PGTABLE
-     depends on ARM || ARM64 || COMPILE_TEST
+     depends on ARM || ARM64 || RISCV || COMPILE_TEST
      depends on !GENERIC_ATOMIC64    # for cmpxchg64()
      help
        Enable support for the ARM long descriptor pagetable format.

Gr{oetje,eeting}s,

Geert

Signature · 1 line
~Randy
#5 lore raw

Hi Randy,

Quoted 63 lines · Randy Dunlap
Quoted 47 lines · Geert Uytterhoeven
Quoted 34 lines · Conor Dooley
Quoted 33 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Conor Dooley <[email protected]>
---
 drivers/iommu/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 33

Quoted 6 lines

diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig

drivers/iommu/Kconfig +0 -0
@@ -32,7 +32,7 @@ config IOMMU_IO_PGTABLE
 config IOMMU_IO_PGTABLE_LPAE
      bool "ARMv7/v8 Long Descriptor Format"

I'm probably missing something here, but why would we want to enable "ARMv7/v8 Long Descriptor Format" on RISC-V?

Indeed, we should not enable it, unless compile-testing.

Quoted 8 lines
Quoted 4 lines

Would it not be better to make the Renesas depend on, rather than select the option? It does seem highly arch specific, and I feel like Geert previously mentioned that the RZ/Five (their RISC-V offering) didn't use it.

I think the IPMMU_VMSA dependency should gain

        depends on ARM || ARM64 || COMPILE_TEST

so like this?
Or did you mean to drop the ARCH_RENESAS part also?

config IPMMU_VMSA
bool "Renesas VMSA-compatible IPMMU"

Review

Quoted 2 lines
(quoted diff) +1 -1
-       depends on ARCH_RENESAS || COMPILE_TEST
+       depends on ARCH_RENESAS || ARM || ARM64 || COMPILE_TEST

No, you want "depends on (ARCH_RENESAS && (ARM || ARM64)) || COMPILE_TEST", which is a bit hard to read.

Hence I really meant adding that line, i.e.:

config IPMMU_VMSA
bool "Renesas VMSA-compatible IPMMU" depends on ARCH_RENESAS || COMPILE_TEST
+ depends on ARM || ARM64 || COMPILE_TEST

Quoted 7 lines

The failing config file has ARCH_RENESAS=y. After the change above, I still get:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

Signature · 10 lines
Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#6 lore raw

Hi--

Quoted 72 lines · Geert Uytterhoeven

Hi Randy,

Quoted 63 lines · Randy Dunlap
Quoted 47 lines · Geert Uytterhoeven
Quoted 34 lines · Conor Dooley
Quoted 33 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")
Cc Joerg Roedel <[email protected]>
Cc Will Deacon <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Conor Dooley <[email protected]>
---
 drivers/iommu/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines

drivers/iommu/Kconfig config IOMMU_IO_PGTABLE · line 33

Quoted 6 lines

diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig

drivers/iommu/Kconfig +0 -0
@@ -32,7 +32,7 @@ config IOMMU_IO_PGTABLE
 config IOMMU_IO_PGTABLE_LPAE
      bool "ARMv7/v8 Long Descriptor Format"

I'm probably missing something here, but why would we want to enable "ARMv7/v8 Long Descriptor Format" on RISC-V?

Indeed, we should not enable it, unless compile-testing.

Quoted 8 lines
Quoted 4 lines

Would it not be better to make the Renesas depend on, rather than select the option? It does seem highly arch specific, and I feel like Geert previously mentioned that the RZ/Five (their RISC-V offering) didn't use it.

I think the IPMMU_VMSA dependency should gain

        depends on ARM || ARM64 || COMPILE_TEST

so like this?
Or did you mean to drop the ARCH_RENESAS part also?

config IPMMU_VMSA
bool "Renesas VMSA-compatible IPMMU"

Review

Quoted 2 lines
(quoted diff) +1 -1
-       depends on ARCH_RENESAS || COMPILE_TEST
+       depends on ARCH_RENESAS || ARM || ARM64 || COMPILE_TEST

No, you want "depends on (ARCH_RENESAS && (ARM || ARM64)) || COMPILE_TEST", which is a bit hard to read.

Quoted 7 lines

Hence I really meant adding that line, i.e.:

config IPMMU_VMSA
bool "Renesas VMSA-compatible IPMMU" depends on ARCH_RENESAS || COMPILE_TEST
+ depends on ARM || ARM64 || COMPILE_TEST

OK, that fixes the kconfig warning and the build errors. I can read the first method easier that the second one, but I'll go with your suggestion. Hopefully no one will come along and "fix it up" but instead muck it up.

Thanks.

Signature · 1 line
~Randy
reviewer
#7 lore raw
In reply to Randy Dunlap
Quoted 19 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Quoted 3 lines

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")

BTW that doesn't look like the right fix target - this presumably dates back as far as when ARCH_RENESAS was added to RISCV, such that it was possible to start selecting IPMMU_VMSA without COMPILE_TEST?

Thanks,
Robin.

Quoted 23 lines
---
  drivers/iommu/Kconfig |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig

drivers/iommu/Kconfig +1 -1
@@ -32,7 +32,7 @@ config IOMMU_IO_PGTABLE
  config IOMMU_IO_PGTABLE_LPAE
  	bool "ARMv7/v8 Long Descriptor Format"
  	select IOMMU_IO_PGTABLE
-	depends on ARM || ARM64 || COMPILE_TEST
+	depends on ARM || ARM64 || RISCV || COMPILE_TEST
  	depends on !GENERIC_ATOMIC64	# for cmpxchg64()
  	help
  	  Enable support for the ARM long descriptor pagetable format.
#8 lore raw
Quoted 20 lines · Robin Murphy
Quoted 19 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
   Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
   - IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Quoted 5 lines
Quoted 3 lines

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")

BTW that doesn't look like the right fix target - this presumably dates back as far as when ARCH_RENESAS was added to RISCV, such that it was possible to start selecting IPMMU_VMSA without COMPILE_TEST?

OK, I can go with that. Thanks for your help.

Signature · 1 line
~Randy
#9 lore raw

Hi Randy,

Quoted 22 lines · Randy Dunlap
Quoted 20 lines · Robin Murphy
Quoted 19 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
   Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
   - IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")

BTW that doesn't look like the right fix target - this presumably dates back as far as when ARCH_RENESAS was added to RISCV, such that it was possible to start selecting IPMMU_VMSA without COMPILE_TEST?

OK, I can go with that. Thanks for your help.

Any updates on this fix?

Thanks,

Alex

#10 lore raw
Quoted 26 lines · Alexandre Ghiti

Hi Randy,

Quoted 22 lines · Randy Dunlap
Quoted 20 lines · Robin Murphy
Quoted 19 lines · Randy Dunlap

On riscv64, linux-next-20233030 (and for several days earlier), there is a kconfig warning:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE_LPAE
   Depends on [n]: IOMMU_SUPPORT [=y] && (ARM || ARM64 || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n] Selected by [y]:
   - IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] || COMPILE_TEST [=n]) && !GENERIC_ATOMIC64 [=n]

and build errors:

riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L140':
io-pgtable-arm.c:(.init.text+0x1e8): undefined reference to `alloc_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/io-pgtable-arm.o: in function `.L168':
io-pgtable-arm.c:(.init.text+0xab0): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L140':
ipmmu-vmsa.c:(.text+0xbc4): undefined reference to `free_io_pgtable_ops'
riscv64-linux-ld: drivers/iommu/ipmmu-vmsa.o: in function `.L0 ':
ipmmu-vmsa.c:(.text+0x145e): undefined reference to `alloc_io_pgtable_ops'

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

Add RISCV as an allowed ARCH dependency to fix these problems.

Fixes d286a58bc8f4 ("iommu: Tidy up io-pgtable dependencies")

BTW that doesn't look like the right fix target - this presumably dates back as far as when ARCH_RENESAS was added to RISCV, such that it was possible to start selecting IPMMU_VMSA without COMPILE_TEST?

OK, I can go with that. Thanks for your help.

Any updates on this fix?

Superseeded by
https://lore.kernel.org/linux-iommu/[email protected]/

I guess that never went anywhere?