Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH] iommu: PGTABLE_LPAE is also for RISCV
@ 2023-03-30  6:01 Randy Dunlap
  2023-03-30  6:25 ` Conor Dooley
  2023-03-30 16:34 ` Robin Murphy
  0 siblings, 2 replies; 11+ messages in thread
From: Randy Dunlap @ 2023-03-30  6:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Joerg Roedel, Will Deacon, Robin Murphy, iommu,
	Conor Dooley, linux-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")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: iommu@lists.linux.dev
Cc: Conor Dooley <conor@kernel.org>
Cc: linux-riscv@lists.infradead.org
---
 drivers/iommu/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
--- 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.

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30  6:01 [PATCH] iommu: PGTABLE_LPAE is also for RISCV Randy Dunlap
@ 2023-03-30  6:25 ` Conor Dooley
  2023-03-30  7:31   ` Geert Uytterhoeven
  2023-03-30 16:34 ` Robin Murphy
  1 sibling, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2023-03-30  6:25 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, Joerg Roedel, Will Deacon, Robin Murphy, iommu,
	Conor Dooley, linux-riscv, geert+renesas

[-- Attachment #1: Type: text/plain, Size: 2519 bytes --]

Hey Randy,

On Wed, Mar 29, 2023 at 11:01:05PM -0700, Randy Dunlap wrote:
> 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")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Will Deacon <will@kernel.org>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: iommu@lists.linux.dev
> Cc: Conor Dooley <conor@kernel.org>
> Cc: linux-riscv@lists.infradead.org
> ---
>  drivers/iommu/Kconfig |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> --- 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"

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.

>  	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.
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30  6:25 ` Conor Dooley
@ 2023-03-30  7:31   ` Geert Uytterhoeven
  2023-03-30 10:43     ` Robin Murphy
  2023-03-30 15:48     ` Randy Dunlap
  0 siblings, 2 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2023-03-30  7:31 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Randy Dunlap, linux-kernel, Joerg Roedel, Will Deacon,
	Robin Murphy, iommu, Conor Dooley, linux-riscv, geert+renesas

Hi Conor,

On Thu, Mar 30, 2023 at 8:25 AM Conor Dooley <conor.dooley@microchip.com> wrote:
> On Wed, Mar 29, 2023 at 11:01:05PM -0700, Randy Dunlap wrote:
> > 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")
> > Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> > Cc: Joerg Roedel <joro@8bytes.org>
> > Cc: Will Deacon <will@kernel.org>
> > Cc: Robin Murphy <robin.murphy@arm.com>
> > Cc: iommu@lists.linux.dev
> > Cc: Conor Dooley <conor@kernel.org>
> > Cc: linux-riscv@lists.infradead.org
> > ---
> >  drivers/iommu/Kconfig |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > --- 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"
>
> 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.

> 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

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

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30  7:31   ` Geert Uytterhoeven
@ 2023-03-30 10:43     ` Robin Murphy
  2023-03-30 15:48     ` Randy Dunlap
  1 sibling, 0 replies; 11+ messages in thread
From: Robin Murphy @ 2023-03-30 10:43 UTC (permalink / raw)
  To: Geert Uytterhoeven, Conor Dooley
  Cc: Randy Dunlap, linux-kernel, Joerg Roedel, Will Deacon, iommu,
	Conor Dooley, linux-riscv, geert+renesas

On 2023-03-30 08:31, Geert Uytterhoeven wrote:
> Hi Conor,
> 
> On Thu, Mar 30, 2023 at 8:25 AM Conor Dooley <conor.dooley@microchip.com> wrote:
>> On Wed, Mar 29, 2023 at 11:01:05PM -0700, Randy Dunlap wrote:
>>> 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")
>>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>>> Cc: Joerg Roedel <joro@8bytes.org>
>>> Cc: Will Deacon <will@kernel.org>
>>> Cc: Robin Murphy <robin.murphy@arm.com>
>>> Cc: iommu@lists.linux.dev
>>> Cc: Conor Dooley <conor@kernel.org>
>>> Cc: linux-riscv@lists.infradead.org
>>> ---
>>>   drivers/iommu/Kconfig |    2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
>>> --- 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"
>>
>> 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.
> 
>> 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.

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

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30  7:31   ` Geert Uytterhoeven
  2023-03-30 10:43     ` Robin Murphy
@ 2023-03-30 15:48     ` Randy Dunlap
  2023-03-30 16:11       ` Geert Uytterhoeven
  1 sibling, 1 reply; 11+ messages in thread
From: Randy Dunlap @ 2023-03-30 15:48 UTC (permalink / raw)
  To: Geert Uytterhoeven, Conor Dooley
  Cc: linux-kernel, Joerg Roedel, Will Deacon, Robin Murphy, iommu,
	Conor Dooley, linux-riscv, geert+renesas

[-- Attachment #1: Type: text/plain, Size: 3643 bytes --]

Hi all,

On 3/30/23 00:31, Geert Uytterhoeven wrote:
> Hi Conor,
> 
> On Thu, Mar 30, 2023 at 8:25 AM Conor Dooley <conor.dooley@microchip.com> wrote:
>> On Wed, Mar 29, 2023 at 11:01:05PM -0700, Randy Dunlap wrote:
>>> 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")
>>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>>> Cc: Joerg Roedel <joro@8bytes.org>
>>> Cc: Will Deacon <will@kernel.org>
>>> Cc: Robin Murphy <robin.murphy@arm.com>
>>> Cc: iommu@lists.linux.dev
>>> Cc: Conor Dooley <conor@kernel.org>
>>> Cc: linux-riscv@lists.infradead.org
>>> ---
>>>  drivers/iommu/Kconfig |    2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
>>> --- 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"
>>
>> 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.
> 
>> 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.

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

-- 
~Randy

[-- Attachment #2: rv64-iommu-vmsa.config --]
[-- Type: application/x-config, Size: 126278 bytes --]

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30 15:48     ` Randy Dunlap
@ 2023-03-30 16:11       ` Geert Uytterhoeven
  2023-03-30 16:33         ` Randy Dunlap
  0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2023-03-30 16:11 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Conor Dooley, linux-kernel, Joerg Roedel, Will Deacon,
	Robin Murphy, iommu, Conor Dooley, linux-riscv, geert+renesas

Hi Randy,

On Thu, Mar 30, 2023 at 5:48 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> On 3/30/23 00:31, Geert Uytterhoeven wrote:
> > On Thu, Mar 30, 2023 at 8:25 AM Conor Dooley <conor.dooley@microchip.com> wrote:
> >> On Wed, Mar 29, 2023 at 11:01:05PM -0700, Randy Dunlap wrote:
> >>> 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")
> >>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> >>> Cc: Joerg Roedel <joro@8bytes.org>
> >>> Cc: Will Deacon <will@kernel.org>
> >>> Cc: Robin Murphy <robin.murphy@arm.com>
> >>> Cc: iommu@lists.linux.dev
> >>> Cc: Conor Dooley <conor@kernel.org>
> >>> Cc: linux-riscv@lists.infradead.org
> >>> ---
> >>>  drivers/iommu/Kconfig |    2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> >>> --- 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"
> >>
> >> 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.
> >
> >> 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

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

>
> 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]
-- 
Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30 16:11       ` Geert Uytterhoeven
@ 2023-03-30 16:33         ` Randy Dunlap
  0 siblings, 0 replies; 11+ messages in thread
From: Randy Dunlap @ 2023-03-30 16:33 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Conor Dooley, linux-kernel, Joerg Roedel, Will Deacon,
	Robin Murphy, iommu, Conor Dooley, linux-riscv, geert+renesas

Hi--

On 3/30/23 09:11, Geert Uytterhoeven wrote:
> Hi Randy,
> 
> On Thu, Mar 30, 2023 at 5:48 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>> On 3/30/23 00:31, Geert Uytterhoeven wrote:
>>> On Thu, Mar 30, 2023 at 8:25 AM Conor Dooley <conor.dooley@microchip.com> wrote:
>>>> On Wed, Mar 29, 2023 at 11:01:05PM -0700, Randy Dunlap wrote:
>>>>> 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")
>>>>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>>>>> Cc: Joerg Roedel <joro@8bytes.org>
>>>>> Cc: Will Deacon <will@kernel.org>
>>>>> Cc: Robin Murphy <robin.murphy@arm.com>
>>>>> Cc: iommu@lists.linux.dev
>>>>> Cc: Conor Dooley <conor@kernel.org>
>>>>> Cc: linux-riscv@lists.infradead.org
>>>>> ---
>>>>>  drivers/iommu/Kconfig |    2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
>>>>> --- 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"
>>>>
>>>> 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.
>>>
>>>> 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
> 
> 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
> 

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.
-- 
~Randy

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30  6:01 [PATCH] iommu: PGTABLE_LPAE is also for RISCV Randy Dunlap
  2023-03-30  6:25 ` Conor Dooley
@ 2023-03-30 16:34 ` Robin Murphy
  2023-03-30 16:49   ` Randy Dunlap
  1 sibling, 1 reply; 11+ messages in thread
From: Robin Murphy @ 2023-03-30 16:34 UTC (permalink / raw)
  To: Randy Dunlap, linux-kernel
  Cc: Joerg Roedel, Will Deacon, iommu, Conor Dooley, linux-riscv

On 2023-03-30 07:01, Randy Dunlap wrote:
> 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")

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.

> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Will Deacon <will@kernel.org>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: iommu@lists.linux.dev
> Cc: Conor Dooley <conor@kernel.org>
> Cc: linux-riscv@lists.infradead.org
> ---
>   drivers/iommu/Kconfig |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -- a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> --- 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.

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30 16:34 ` Robin Murphy
@ 2023-03-30 16:49   ` Randy Dunlap
  2023-05-16  7:02     ` Alexandre Ghiti
  0 siblings, 1 reply; 11+ messages in thread
From: Randy Dunlap @ 2023-03-30 16:49 UTC (permalink / raw)
  To: Robin Murphy, linux-kernel
  Cc: Joerg Roedel, Will Deacon, iommu, Conor Dooley, linux-riscv



On 3/30/23 09:34, Robin Murphy wrote:
> On 2023-03-30 07:01, Randy Dunlap wrote:
>> 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")
> 
> 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.

-- 
~Randy

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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-03-30 16:49   ` Randy Dunlap
@ 2023-05-16  7:02     ` Alexandre Ghiti
  2023-05-16  7:12       ` Conor Dooley
  0 siblings, 1 reply; 11+ messages in thread
From: Alexandre Ghiti @ 2023-05-16  7:02 UTC (permalink / raw)
  To: Randy Dunlap, Robin Murphy, linux-kernel
  Cc: Joerg Roedel, Will Deacon, iommu, Conor Dooley, linux-riscv

Hi Randy,


On 3/30/23 18:49, Randy Dunlap wrote:
>
> On 3/30/23 09:34, Robin Murphy wrote:
>> On 2023-03-30 07:01, Randy Dunlap wrote:
>>> 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")
>> 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


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

* Re: [PATCH] iommu: PGTABLE_LPAE is also for RISCV
  2023-05-16  7:02     ` Alexandre Ghiti
@ 2023-05-16  7:12       ` Conor Dooley
  0 siblings, 0 replies; 11+ messages in thread
From: Conor Dooley @ 2023-05-16  7:12 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: Randy Dunlap, Robin Murphy, linux-kernel, Joerg Roedel,
	Will Deacon, iommu, Conor Dooley, linux-riscv

[-- Attachment #1: Type: text/plain, Size: 2000 bytes --]

On Tue, May 16, 2023 at 09:02:50AM +0200, Alexandre Ghiti wrote:
> Hi Randy,
> 
> 
> On 3/30/23 18:49, Randy Dunlap wrote:
> > 
> > On 3/30/23 09:34, Robin Murphy wrote:
> > > On 2023-03-30 07:01, Randy Dunlap wrote:
> > > > 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")
> > > 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/20230330165817.21920-1-rdunlap@infradead.org/

I guess that never went anywhere?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2023-05-16  7:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-30  6:01 [PATCH] iommu: PGTABLE_LPAE is also for RISCV Randy Dunlap
2023-03-30  6:25 ` Conor Dooley
2023-03-30  7:31   ` Geert Uytterhoeven
2023-03-30 10:43     ` Robin Murphy
2023-03-30 15:48     ` Randy Dunlap
2023-03-30 16:11       ` Geert Uytterhoeven
2023-03-30 16:33         ` Randy Dunlap
2023-03-30 16:34 ` Robin Murphy
2023-03-30 16:49   ` Randy Dunlap
2023-05-16  7:02     ` Alexandre Ghiti
2023-05-16  7:12       ` Conor Dooley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox