2023-05-16 19:47:07

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h

From: Arnd Bergmann <[email protected]>

The unxlate_dev_mem_ptr() function has no prototype on the mips
architecture, which does not include asm-generic/io.h, so gcc warns
about the __weak definition:

drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]

Since everyone else already gets the generic definition or has a custom
one, there is not really much point in having a __weak version as well.

Remove this one, and instead add a trivial macro to the mips header.
Once we convert mips to use the asm-generic header, this can go away
again.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/mips/include/asm/io.h | 1 +
drivers/char/mem.c | 7 -------
2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index cc28d207a061..affd21e9c20b 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -554,6 +554,7 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
* access
*/
#define xlate_dev_mem_ptr(p) __va(p)
+#define unxlate_dev_mem_ptr(p, v) do { } while (0)

void __ioread64_copy(void *to, const void __iomem *from, size_t count);

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index f494d31f2b98..94eff6a2a7b6 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -90,13 +90,6 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
}
#endif

-#ifndef unxlate_dev_mem_ptr
-#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr
-void __weak unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
-{
-}
-#endif
-
static inline bool should_stop_iteration(void)
{
if (need_resched())
--
2.39.2



2023-05-16 19:49:55

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 2/2] mips: asm-offsets: add missing prototypes

From: Arnd Bergmann <[email protected]>

Building with -Werror and W=1 fails entirely because of warnings in
asm-offsets.c:

arch/mips/kernel/asm-offsets.c:26:6: error: no previous prototype for 'output_ptreg_defines' [-Werror=missing-prototypes]
arch/mips/kernel/asm-offsets.c:78:6: error: no previous prototype for 'output_task_defines' [-Werror=missing-prototypes]
arch/mips/kernel/asm-offsets.c:92:6: error: no previous prototype for 'output_thread_info_defines' [-Werror=missing-prototypes]
arch/mips/kernel/asm-offsets.c:108:6: error: no previous prototype for 'output_thread_defines' [-Werror=missing-prototypes]
arch/mips/kernel/asm-offsets.c:136:6: error: no previous prototype for 'output_thread_fpu_defines' [-Werror=missing-prototypes]

Nothing actually calls these functions, so just add prototypes to shut
up the warnings.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/mips/kernel/asm-offsets.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 40fd4051bb3d..d1b11f66f748 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -23,6 +23,7 @@

#include <linux/kvm_host.h>

+void output_ptreg_defines(void);
void output_ptreg_defines(void)
{
COMMENT("MIPS pt_regs offsets.");
@@ -75,6 +76,7 @@ void output_ptreg_defines(void)
BLANK();
}

+void output_task_defines(void);
void output_task_defines(void)
{
COMMENT("MIPS task_struct offsets.");
@@ -89,6 +91,7 @@ void output_task_defines(void)
BLANK();
}

+void output_thread_info_defines(void);
void output_thread_info_defines(void)
{
COMMENT("MIPS thread_info offsets.");
@@ -105,6 +108,7 @@ void output_thread_info_defines(void)
BLANK();
}

+void output_thread_defines(void);
void output_thread_defines(void)
{
COMMENT("MIPS specific thread_struct offsets.");
@@ -133,6 +137,7 @@ void output_thread_defines(void)
}

#ifdef CONFIG_MIPS_FP_SUPPORT
+void output_thread_fpu_defines(void);
void output_thread_fpu_defines(void)
{
OFFSET(THREAD_FPU, task_struct, thread.fpu);
@@ -176,6 +181,7 @@ void output_thread_fpu_defines(void)
}
#endif

+void output_mm_defines(void);
void output_mm_defines(void)
{
COMMENT("Size of struct page");
@@ -210,6 +216,7 @@ void output_mm_defines(void)
}

#ifdef CONFIG_32BIT
+void output_sc_defines(void);
void output_sc_defines(void)
{
COMMENT("Linux sigcontext offsets.");
@@ -232,6 +239,7 @@ void output_sc_defines(void)
#endif

#ifdef CONFIG_64BIT
+void output_sc_defines(void);
void output_sc_defines(void)
{
COMMENT("Linux sigcontext offsets.");
@@ -245,6 +253,7 @@ void output_sc_defines(void)
}
#endif

+void output_signal_defined(void);
void output_signal_defined(void)
{
COMMENT("Linux signal numbers.");
@@ -284,6 +293,7 @@ void output_signal_defined(void)
}

#ifdef CONFIG_CPU_CAVIUM_OCTEON
+void output_octeon_cop2_state_defines(void);
void output_octeon_cop2_state_defines(void)
{
COMMENT("Octeon specific octeon_cop2_state offsets.");
@@ -315,6 +325,7 @@ void output_octeon_cop2_state_defines(void)
#endif

#ifdef CONFIG_HIBERNATION
+void output_pbe_defines(void);
void output_pbe_defines(void)
{
COMMENT(" Linux struct pbe offsets. ");
@@ -327,6 +338,7 @@ void output_pbe_defines(void)
#endif

#ifdef CONFIG_CPU_PM
+void output_pm_defines(void);
void output_pm_defines(void)
{
COMMENT(" PM offsets. ");
@@ -341,6 +353,7 @@ void output_pm_defines(void)
#endif

#ifdef CONFIG_MIPS_FP_SUPPORT
+void output_kvm_defines(void);
void output_kvm_defines(void)
{
COMMENT(" KVM/MIPS Specific offsets. ");
@@ -385,6 +398,7 @@ void output_kvm_defines(void)
#endif

#ifdef CONFIG_MIPS_CPS
+void output_cps_defines(void);
void output_cps_defines(void)
{
COMMENT(" MIPS CPS offsets. ");
--
2.39.2


2023-06-09 08:33:42

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h

On Tue, May 16, 2023 at 09:39:42PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
>
> The unxlate_dev_mem_ptr() function has no prototype on the mips
> architecture, which does not include asm-generic/io.h, so gcc warns
> about the __weak definition:
>
> drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]
>
> Since everyone else already gets the generic definition or has a custom
> one, there is not really much point in having a __weak version as well.
>
> Remove this one, and instead add a trivial macro to the mips header.
> Once we convert mips to use the asm-generic header, this can go away
> again.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
> arch/mips/include/asm/io.h | 1 +
> drivers/char/mem.c | 7 -------
> 2 files changed, 1 insertion(+), 7 deletions(-)

applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

2023-06-09 08:53:12

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH 2/2] mips: asm-offsets: add missing prototypes

On Tue, May 16, 2023 at 09:39:43PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
>
> Building with -Werror and W=1 fails entirely because of warnings in
> asm-offsets.c:
>
> arch/mips/kernel/asm-offsets.c:26:6: error: no previous prototype for 'output_ptreg_defines' [-Werror=missing-prototypes]
> arch/mips/kernel/asm-offsets.c:78:6: error: no previous prototype for 'output_task_defines' [-Werror=missing-prototypes]
> arch/mips/kernel/asm-offsets.c:92:6: error: no previous prototype for 'output_thread_info_defines' [-Werror=missing-prototypes]
> arch/mips/kernel/asm-offsets.c:108:6: error: no previous prototype for 'output_thread_defines' [-Werror=missing-prototypes]
> arch/mips/kernel/asm-offsets.c:136:6: error: no previous prototype for 'output_thread_fpu_defines' [-Werror=missing-prototypes]
>
> Nothing actually calls these functions, so just add prototypes to shut
> up the warnings.
>
> Signed-off-by: Arnd Bergmann <[email protected]>

applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

2023-06-21 14:02:32

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h

On Tue, May 16, 2023 at 09:39:42PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <[email protected]>
>
> The unxlate_dev_mem_ptr() function has no prototype on the mips
> architecture, which does not include asm-generic/io.h, so gcc warns
> about the __weak definition:
>
> drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]
>
> Since everyone else already gets the generic definition or has a custom
> one, there is not really much point in having a __weak version as well.
>
> Remove this one, and instead add a trivial macro to the mips header.
> Once we convert mips to use the asm-generic header, this can go away
> again.
>

This results in build failures when trying to build sh4 images.

drivers/char/mem.c: In function 'read_mem':
drivers/char/mem.c:164:25: error: implicit declaration of function 'unxlate_dev_mem_ptr'

Guenter

2023-06-21 14:28:25

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h

On Wed, Jun 21, 2023, at 15:52, Guenter Roeck wrote:
> On Tue, May 16, 2023 at 09:39:42PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <[email protected]>
>>
>> The unxlate_dev_mem_ptr() function has no prototype on the mips
>> architecture, which does not include asm-generic/io.h, so gcc warns
>> about the __weak definition:
>>
>> drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]
>>
>> Since everyone else already gets the generic definition or has a custom
>> one, there is not really much point in having a __weak version as well.
>>
>> Remove this one, and instead add a trivial macro to the mips header.
>> Once we convert mips to use the asm-generic header, this can go away
>> again.
>>
>
> This results in build failures when trying to build sh4 images.
>
> drivers/char/mem.c: In function 'read_mem':
> drivers/char/mem.c:164:25: error: implicit declaration of function
> 'unxlate_dev_mem_ptr'

Odd, it looks like arch/sh/ is also missing an #include
<asm-generic/io.h> in its asm/io.h, I was sure that mips was the
only one to still not have that.

There are already patches on the list to convert both, so I think
we'll be fine on sh after this one gets merged:
https://lore.kernel.org/all/[email protected]/

Arnd

2023-06-23 13:33:19

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH 1/2] mips: provide unxlate_dev_mem_ptr() in asm/io.h

On Wed, Jun 21, 2023 at 04:05:11PM +0200, Arnd Bergmann wrote:
> On Wed, Jun 21, 2023, at 15:52, Guenter Roeck wrote:
> > On Tue, May 16, 2023 at 09:39:42PM +0200, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <[email protected]>
> >>
> >> The unxlate_dev_mem_ptr() function has no prototype on the mips
> >> architecture, which does not include asm-generic/io.h, so gcc warns
> >> about the __weak definition:
> >>
> >> drivers/char/mem.c:94:29: error: no previous prototype for 'unxlate_dev_mem_ptr' [-Werror=missing-prototypes]
> >>
> >> Since everyone else already gets the generic definition or has a custom
> >> one, there is not really much point in having a __weak version as well.
> >>
> >> Remove this one, and instead add a trivial macro to the mips header.
> >> Once we convert mips to use the asm-generic header, this can go away
> >> again.
> >>
> >
> > This results in build failures when trying to build sh4 images.
> >
> > drivers/char/mem.c: In function 'read_mem':
> > drivers/char/mem.c:164:25: error: implicit declaration of function
> > 'unxlate_dev_mem_ptr'
>
> Odd, it looks like arch/sh/ is also missing an #include
> <asm-generic/io.h> in its asm/io.h, I was sure that mips was the
> only one to still not have that.
>
> There are already patches on the list to convert both, so I think
> we'll be fine on sh after this one gets merged:
> https://lore.kernel.org/all/[email protected]/

which is already taken ages, so I'm not that confident, that this
will happen before merge window starts...

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]