linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: Drop virt_to_phys define to self
@ 2023-08-08  9:29 Linus Walleij
  2023-08-08 13:12 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2023-08-08  9:29 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Florian Fainelli
  Cc: linux-mips, linux-kernel, Linus Walleij

The function virt_to_phys was defined to virt_to_phys and then
implemented right below.

I can't understand why, just drop it and let the actual function
slot in.

Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/mips/include/asm/io.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index affd21e9c20b..18ed44843541 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -111,7 +111,6 @@ extern phys_addr_t __virt_to_phys(volatile const void *x);
 #define __virt_to_phys(x)	__virt_to_phys_nodebug(x)
 #endif
 
-#define virt_to_phys virt_to_phys
 static inline phys_addr_t virt_to_phys(const volatile void *x)
 {
 	return __virt_to_phys(x);

---
base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
change-id: 20230808-virt-to-phys-mips-226e409a84a7

Best regards,
-- 
Linus Walleij <linus.walleij@linaro.org>


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

* Re: [PATCH] MIPS: Drop virt_to_phys define to self
  2023-08-08  9:29 [PATCH] MIPS: Drop virt_to_phys define to self Linus Walleij
@ 2023-08-08 13:12 ` Linus Walleij
  2023-08-08 13:45   ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2023-08-08 13:12 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Florian Fainelli, Arnd Bergmann
  Cc: linux-mips, linux-kernel

On Tue, Aug 8, 2023 at 11:29 AM Linus Walleij <linus.walleij@linaro.org> wrote:

> The function virt_to_phys was defined to virt_to_phys and then
> implemented right below.
>
> I can't understand why, just drop it and let the actual function
> slot in.
>
> Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/mips/include/asm/io.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
> index affd21e9c20b..18ed44843541 100644
> --- a/arch/mips/include/asm/io.h
> +++ b/arch/mips/include/asm/io.h
> @@ -111,7 +111,6 @@ extern phys_addr_t __virt_to_phys(volatile const void *x);
>  #define __virt_to_phys(x)      __virt_to_phys_nodebug(x)
>  #endif
>
> -#define virt_to_phys virt_to_phys
>  static inline phys_addr_t virt_to_phys(const volatile void *x)
>  {
>         return __virt_to_phys(x);

Just have to CC Arnd on this because I never feel I understand this
properly.

Normally you would do this so as to override the default virt_to_phys()
from include/asm-generic/io.h, but we do not seem to be using it here?

Further right below we are implementing phys_to_virt() with no
corresponding define, so in any case this needs to go or that one
needs a define.

That said they seem like a good candidate to replace with the
generic variant because the content is the same sans some debug
hacks that I doubt are still needed.

Yours,
Linus Walleij

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

* Re: [PATCH] MIPS: Drop virt_to_phys define to self
  2023-08-08 13:12 ` Linus Walleij
@ 2023-08-08 13:45   ` Arnd Bergmann
  2023-08-08 20:05     ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2023-08-08 13:45 UTC (permalink / raw)
  To: Linus Walleij, Thomas Bogendoerfer, Florian Fainelli, Baoquan He,
	Jiaxun Yang
  Cc: linux-mips, linux-kernel

On Tue, Aug 8, 2023, at 15:12, Linus Walleij wrote:
> On Tue, Aug 8, 2023 at 11:29 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
>> The function virt_to_phys was defined to virt_to_phys and then
>> implemented right below.
>>
>> I can't understand why, just drop it and let the actual function
>> slot in.
>>
>> Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>> ---
>>  arch/mips/include/asm/io.h | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
>> index affd21e9c20b..18ed44843541 100644
>> --- a/arch/mips/include/asm/io.h
>> +++ b/arch/mips/include/asm/io.h
>> @@ -111,7 +111,6 @@ extern phys_addr_t __virt_to_phys(volatile const void *x);
>>  #define __virt_to_phys(x)      __virt_to_phys_nodebug(x)
>>  #endif
>>
>> -#define virt_to_phys virt_to_phys
>>  static inline phys_addr_t virt_to_phys(const volatile void *x)
>>  {
>>         return __virt_to_phys(x);
>
> Just have to CC Arnd on this because I never feel I understand this
> properly.
>
> Normally you would do this so as to override the default virt_to_phys()
> from include/asm-generic/io.h, but we do not seem to be using it here?

Correct. In linux-next, we have converted arch/sh to use
include/asm-generic/io.h, so arch/mips is now the last one
to not use it. 

I see that Jiaxun Yang posted a patch for this in May and it looked
like it should finally work [1], but there seems to still be something
missing.

> Further right below we are implementing phys_to_virt() with no
> corresponding define, so in any case this needs to go or that one
> needs a define.
>
> That said they seem like a good candidate to replace with the
> generic variant because the content is the same sans some debug
> hacks that I doubt are still needed.

I think the ARCH_HAS_DEBUG_VIRTUAL option is useful in
general, I'd rather move that into the common code if
we were to unify it.

For the moment, I'd suggest we leave the #define in place
here in order to finish the patch that starts using the
asm-generic header, and then we can look into using more
of the generic code.

       Arnd

[1] https://lore.kernel.org/linux-mips/20230519195135.79600-1-jiaxun.yang@flygoat.com/

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

* Re: [PATCH] MIPS: Drop virt_to_phys define to self
  2023-08-08 13:45   ` Arnd Bergmann
@ 2023-08-08 20:05     ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-08-08 20:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Thomas Bogendoerfer, Florian Fainelli, Baoquan He, Jiaxun Yang,
	linux-mips, linux-kernel

On Tue, Aug 8, 2023 at 3:46 PM Arnd Bergmann <arnd@arndb.de> wrote:
> On Tue, Aug 8, 2023, at 15:12, Linus Walleij wrote:

> > Normally you would do this so as to override the default virt_to_phys()
> > from include/asm-generic/io.h, but we do not seem to be using it here?
>
> Correct. In linux-next, we have converted arch/sh to use
> include/asm-generic/io.h, so arch/mips is now the last one
> to not use it.
>
> I see that Jiaxun Yang posted a patch for this in May and it looked
> like it should finally work [1], but there seems to still be something
> missing.

Oh that's a nice patch!

> For the moment, I'd suggest we leave the #define in place
> here in order to finish the patch that starts using the
> asm-generic header, and then we can look into using more
> of the generic code.

Sure, no point in causing stir with Jiaxun's work, let's drop
this patch.

Yours,
Linus Walleij

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

end of thread, other threads:[~2023-08-08 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08  9:29 [PATCH] MIPS: Drop virt_to_phys define to self Linus Walleij
2023-08-08 13:12 ` Linus Walleij
2023-08-08 13:45   ` Arnd Bergmann
2023-08-08 20:05     ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).