Skip to contentSkip to conversation

RISC-V: Disable IPMMU_VMSA on rv32

PATCH In review Palmer Dabbelt 5 participants 7 messages Dec 14, 2022 – Dec 15, 2022

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

PATCH 1/1 RISC-V: Disable IPMMU_VMSA on rv32

Without this I get a Kconfig warning and then subsequent build failure when building allmodconfig on rv32.

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

linux/drivers/iommu/io-pgtable-arm.c: Assembler messages:
linux/drivers/iommu/io-pgtable-arm.c:330: Error: unrecognized opcode lr.d s4,0(s1)' linux/drivers/iommu/io-pgtable-arm.c:332: Error: unrecognized opcode sc.d.rl a5,s6,0(s1)' make[5]: *** [linux/scripts/Makefile.build:250: drivers/iommu/io-pgtable-arm.o] Error 1 make[4]: *** [linux/scripts/Makefile.build:502: drivers/iommu] Error 2 make[3]: *** [linux/scripts/Makefile.build:502: drivers] Error 2

---

This one seems pretty ugly, but I like to at least have a workaround for the allmodconfig failures before sending up a PR.

---
 arch/riscv/configs/32-bit.config | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/configs/32-bit.config +1 -0
index f6af0f708df4..7a2fa9b37b1c 100644
@@ -2,3 +2,4 @@ CONFIG_ARCH_RV32I=y
 CONFIG_32BIT=y
 # CONFIG_PORTABLE is not set
 CONFIG_NONPORTABLE=y
+CONFIG_IPMMU_VMSA=n
Signature · 1 line
2.38.1
#1 lore raw
Quoted 7 lines · Palmer Dabbelt

Without this I get a Kconfig warning and then subsequent build failure when building allmodconfig on rv32.

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

This here is your problem afaict
I got a report from lkp about it yesterday, "blaming" Prabhakar for it:
https://lore.kernel.org/all/[email protected]/

I hate selects, just ignores the dependency :(

&& !GENERIC_ATOMIC64 [=y])

Quoted 27 lines

linux/drivers/iommu/io-pgtable-arm.c: Assembler messages:
linux/drivers/iommu/io-pgtable-arm.c:330: Error: unrecognized opcode lr.d s4,0(s1)' linux/drivers/iommu/io-pgtable-arm.c:332: Error: unrecognized opcode sc.d.rl a5,s6,0(s1)' make[5]: *** [linux/scripts/Makefile.build:250: drivers/iommu/io-pgtable-arm.o] Error 1 make[4]: *** [linux/scripts/Makefile.build:502: drivers/iommu] Error 2 make[3]: *** [linux/scripts/Makefile.build:502: drivers] Error 2

---

This one seems pretty ugly, but I like to at least have a workaround for the allmodconfig failures before sending up a PR.
---
arch/riscv/configs/32-bit.config | 1 +

1 file changed, 1 insertion(+)
arch/riscv/configs/32-bit.config +0 -0
index f6af0f708df4..7a2fa9b37b1c 100644
@@ -2,3 +2,4 @@ CONFIG_ARCH_RV32I=y

CONFIG_32BIT=y
# CONFIG_PORTABLE is not set
CONFIG_NONPORTABLE=y
+CONFIG_IPMMU_VMSA=n

reviewer
#2 lore raw
Quoted 11 lines · Conor Dooley
Quoted 7 lines · Palmer Dabbelt

Without this I get a Kconfig warning and then subsequent build failure when building allmodconfig on rv32.

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

Quoted 7 lines

This here is your problem afaict
I got a report from lkp about it yesterday, "blaming" Prabhakar for it:
https://lore.kernel.org/all/[email protected]/

I hate selects, just ignores the dependency :(

&& !GENERIC_ATOMIC64 [=y])

I think the existing assumption was that ARCH_RENESAS implied !GENERIC_ATOMIC64. If that is no longer true then please feel free to adjust drivers/iommu/Kconfig to suit.

Thanks,
Robin.

Quoted 27 lines
Quoted 26 lines

linux/drivers/iommu/io-pgtable-arm.c: Assembler messages:
linux/drivers/iommu/io-pgtable-arm.c:330: Error: unrecognized opcode lr.d s4,0(s1)' linux/drivers/iommu/io-pgtable-arm.c:332: Error: unrecognized opcode sc.d.rl a5,s6,0(s1)' make[5]: *** [linux/scripts/Makefile.build:250: drivers/iommu/io-pgtable-arm.o] Error 1 make[4]: *** [linux/scripts/Makefile.build:502: drivers/iommu] Error 2 make[3]: *** [linux/scripts/Makefile.build:502: drivers] Error 2

---

This one seems pretty ugly, but I like to at least have a workaround for the allmodconfig failures before sending up a PR.
---
arch/riscv/configs/32-bit.config | 1 +

1 file changed, 1 insertion(+)
arch/riscv/configs/32-bit.config +0 -0
index f6af0f708df4..7a2fa9b37b1c 100644
@@ -2,3 +2,4 @@ CONFIG_ARCH_RV32I=y

CONFIG_32BIT=y
# CONFIG_PORTABLE is not set
CONFIG_NONPORTABLE=y
+CONFIG_IPMMU_VMSA=n

#3 lore raw

Hi,

Quoted 32 lines

-----Original Message-----
From: Robin Murphy <[email protected]>
Sent: 14 December 2022 21:04
To: Conor Dooley <[email protected]>; [email protected]; Palmer Dabbelt <[email protected]>; [email protected]; [email protected]
Cc: Prabhakar Mahadev Lad <[email protected]>
Subject: Re: [PATCH] RISC-V: Disable IPMMU_VMSA on rv32

Quoted 8 lines · Conor Dooley
Quoted 5 lines · Palmer Dabbelt

Without this I get a Kconfig warning and then subsequent build failure when building allmodconfig on rv32.

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

[=y])

Quoted 14 lines
Quoted 3 lines

Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] ||
COMPILE_TEST [=y]

This here is your problem afaict
I got a report from lkp about it yesterday, "blaming" Prabhakar for it:
https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
.kernel.org%2Fall%2F202212142355.b7vf3Jh0-lkp%40intel.com%2F&amp;data= 05%7C01%7Cprabhakar.mahadev-lad.rj%40bp.renesas.com%7Ca51ccd27ccda45e7 53c208dade16c553%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C63806648 6632283001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=FshRCpnIoU0b c38MYnesotcgOV4JT%2FXVOidbDMpAWbc%3D&amp;reserved=0

Quoted 7 lines
Quoted 3 lines

I hate selects, just ignores the dependency :(

&& !GENERIC_ATOMIC64 [=y])

I think the existing assumption was that ARCH_RENESAS implied !GENERIC_ATOMIC64. If that is no longer true then please feel free to adjust drivers/iommu/Kconfig to suit.

IPMMU is not available on Renesas RISCV SoCs, so maybe something like below?

drivers/iommu/Kconfig +1 -1
@@ -283,7 +283,7 @@ config EXYNOS_IOMMU_DEBUG
 
 config IPMMU_VMSA
        bool "Renesas VMSA-compatible IPMMU"
-       depends on ARCH_RENESAS || (COMPILE_TEST && !GENERIC_ATOMIC64)
+       depends on (ARCH_RENESAS && !RISCV) || (COMPILE_TEST && !GENERIC_ATOMIC64)
        select IOMMU_API
        select IOMMU_IO_PGTABLE_LPAE
        select ARM_DMA_USE_IOMMU

Cheers,
Prabhakar

reviewer
#4 lore raw
Quoted 34 lines · Prabhakar Mahadev Lad

Hi,

Quoted 32 lines

-----Original Message-----
From: Robin Murphy <[email protected]>
Sent: 14 December 2022 21:04
To: Conor Dooley <[email protected]>; [email protected]; Palmer Dabbelt <[email protected]>; [email protected]; [email protected]
Cc: Prabhakar Mahadev Lad <[email protected]>
Subject: Re: [PATCH] RISC-V: Disable IPMMU_VMSA on rv32

Quoted 8 lines · Conor Dooley
Quoted 5 lines · Palmer Dabbelt

Without this I get a Kconfig warning and then subsequent build failure when building allmodconfig on rv32.

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

[=y])

Quoted 14 lines
Quoted 3 lines

Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] ||
COMPILE_TEST [=y]

This here is your problem afaict
I got a report from lkp about it yesterday, "blaming" Prabhakar for it:
https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
.kernel.org%2Fall%2F202212142355.b7vf3Jh0-lkp%40intel.com%2F&amp;data= 05%7C01%7Cprabhakar.mahadev-lad.rj%40bp.renesas.com%7Ca51ccd27ccda45e7 53c208dade16c553%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C63806648 6632283001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=FshRCpnIoU0b c38MYnesotcgOV4JT%2FXVOidbDMpAWbc%3D&amp;reserved=0

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

I hate selects, just ignores the dependency :(

   && !GENERIC_ATOMIC64 [=y])

I think the existing assumption was that ARCH_RENESAS implied !GENERIC_ATOMIC64. If that is no longer true then please feel free to adjust drivers/iommu/Kconfig to suit.

IPMMU is not available on Renesas RISCV SoCs, so maybe something like below?

Seems fair to me, especially if it also means hiding a pointless choice for a normal interactive config :)

Cheers,
Robin.

Quoted 14 lines
drivers/iommu/Kconfig +1 -1
@@ -283,7 +283,7 @@ config EXYNOS_IOMMU_DEBUG
 
  config IPMMU_VMSA
         bool "Renesas VMSA-compatible IPMMU"
-       depends on ARCH_RENESAS || (COMPILE_TEST && !GENERIC_ATOMIC64)
+       depends on (ARCH_RENESAS && !RISCV) || (COMPILE_TEST && !GENERIC_ATOMIC64)
         select IOMMU_API
         select IOMMU_IO_PGTABLE_LPAE
         select ARM_DMA_USE_IOMMU

Cheers,
Prabhakar

#5 lore raw
In reply to Prabhakar Mahadev Lad

Hi Prabhakar,

Quoted 35 lines · Prabhakar Mahadev Lad
Quoted 23 lines

From: Robin Murphy <[email protected]>

Quoted 6 lines · Conor Dooley
Quoted 5 lines · Palmer Dabbelt

Without this I get a Kconfig warning and then subsequent build failure when building allmodconfig on rv32.

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

[=y])

Quoted 14 lines
Quoted 3 lines

Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y] ||
COMPILE_TEST [=y]

This here is your problem afaict
I got a report from lkp about it yesterday, "blaming" Prabhakar for it:
https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
.kernel.org%2Fall%2F202212142355.b7vf3Jh0-lkp%40intel.com%2F&amp;data= 05%7C01%7Cprabhakar.mahadev-lad.rj%40bp.renesas.com%7Ca51ccd27ccda45e7 53c208dade16c553%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C63806648 6632283001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=FshRCpnIoU0b c38MYnesotcgOV4JT%2FXVOidbDMpAWbc%3D&amp;reserved=0

Quoted 7 lines
Quoted 3 lines

I hate selects, just ignores the dependency :(

&& !GENERIC_ATOMIC64 [=y])

I think the existing assumption was that ARCH_RENESAS implied !GENERIC_ATOMIC64. If that is no longer true then please feel free to adjust drivers/iommu/Kconfig to suit.

IPMMU is not available on Renesas RISCV SoCs, so maybe something like below?

drivers/iommu/Kconfig config EXYNOS_IOMMU_DEBUG · line 286

Quoted 5 lines
drivers/iommu/Kconfig +1 -1
@@ -283,7 +283,7 @@ config EXYNOS_IOMMU_DEBUG
 
 config IPMMU_VMSA
        bool "Renesas VMSA-compatible IPMMU"
-       depends on ARCH_RENESAS || (COMPILE_TEST && !GENERIC_ATOMIC64)
+       depends on (ARCH_RENESAS && !RISCV) || (COMPILE_TEST && !GENERIC_ATOMIC64)

Negative dependencies on a symbol like that tend to need future extension.

What about

depends on ARCH_RENESAS || COMPILE_TEST
depends on !GENERIC_ATOMIC64

instead?

That does mean the question will show up on RV64, too. Adding

    depends on ARM || ARM64 || COMPILE_TEST

(like we sort of had before commit 97215a7df4351fdd ("iommu/renesas: Expand COMPILE_TEST coverage") would fix that.

drivers/iommu/Kconfig config EXYNOS_IOMMU_DEBUG · line 289

Quoted 3 lines
drivers/iommu/Kconfig +0 -0
        select IOMMU_API
        select IOMMU_IO_PGTABLE_LPAE
        select ARM_DMA_USE_IOMMU

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 Geert,

Quoted 70 lines

-----Original Message-----
From: Geert Uytterhoeven <[email protected]>
Sent: 15 December 2022 09:05
To: Prabhakar Mahadev Lad <[email protected]>
Cc: Robin Murphy <[email protected]>; Conor Dooley <[email protected]>; linux- [email protected]; Palmer Dabbelt <[email protected]>; [email protected]; [email protected]; Linux-Renesas <[email protected]>
Subject: Re: [PATCH] RISC-V: Disable IPMMU_VMSA on rv32

Hi Prabhakar,

Quoted 30 lines · Prabhakar Mahadev Lad
Quoted 30 lines

From: Robin Murphy <[email protected]> On 2022-12-14 19:46, Conor

Quoted 7 lines · Dooley
Quoted 6 lines · Palmer Dabbelt

Without this I get a Kconfig warning and then subsequent build failure when building allmodconfig on rv32.

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

[=y])

Quoted 20 lines
Quoted 3 lines

Selected by [y]:
- IPMMU_VMSA [=y] && IOMMU_SUPPORT [=y] && (ARCH_RENESAS [=y]
|| COMPILE_TEST [=y]

This here is your problem afaict
I got a report from lkp about it yesterday, "blaming" Prabhakar for it:
https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lore .kernel.org%2Fall%2F202212142355.b7vf3Jh0-lkp%40intel.com%2F&amp;d ata= 05%7C01%7Cprabhakar.mahadev-lad.rj%40bp.renesas.com%7Ca51ccd27ccda 45e7 53c208dade16c553%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6380 6648 6632283001%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2l uMzI iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=FshRCpnI oU0b
c38MYnesotcgOV4JT%2FXVOidbDMpAWbc%3D&amp;reserved=0

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

I hate selects, just ignores the dependency :(

&& !GENERIC_ATOMIC64 [=y])

I think the existing assumption was that ARCH_RENESAS implied
!GENERIC_ATOMIC64. If that is no longer true then please feel free to adjust drivers/iommu/Kconfig

to suit.

drivers/iommu/Kconfig config EXYNOS_IOMMU_DEBUG · line 287

Quoted 12 lines
Quoted 1 line

IPMMU is not available on Renesas RISCV SoCs, so maybe something like below?

drivers/iommu/Kconfig +2 -1
@@ -283,7 +283,7 @@ config EXYNOS_IOMMU_DEBUG
 
 config IPMMU_VMSA
        bool "Renesas VMSA-compatible IPMMU"
-       depends on ARCH_RENESAS || (COMPILE_TEST && !GENERIC_ATOMIC64)
+       depends on (ARCH_RENESAS && !RISCV) || (COMPILE_TEST &&
+ !GENERIC_ATOMIC64)

Negative dependencies on a symbol like that tend to need future extension.

What about

depends on ARCH_RENESAS || COMPILE_TEST
depends on !GENERIC_ATOMIC64

Quoted 7 lines

instead?

That does mean the question will show up on RV64, too. Adding

    depends on ARM || ARM64 || COMPILE_TEST

Guo has posted a similar patch [0].

[0] https://patchwork.kernel.org/project/linux-riscv/patch/[email protected]/

Cheers,
Prabhakar