linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc: add enable_kernel_fp() stub for ALTIVEC without PPC_FPU
@ 2021-04-18 20:17 Randy Dunlap
  2021-04-18 20:17 ` [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2021-04-18 20:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, kernel test robot, Michael Ellerman, linuxppc-dev,
	Christophe Leroy, Segher Boessenkool

On a kernel config with ALTIVEC=y and PPC_FPU not set/enabled,
there is a build error:

drivers/cpufreq/pmac32-cpufreq.c:262:2: error: implicit declaration of function 'enable_kernel_fp' [-Werror,-Wimplicit-function-declaration]
           enable_kernel_fp();

so add a stub function for that when PPC_FPU is not set.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: lkp@intel.com
---
 arch/powerpc/include/asm/switch_to.h |    1 +
 1 file changed, 1 insertion(+)

--- linux-next-20210416.orig/arch/powerpc/include/asm/switch_to.h
+++ linux-next-20210416/arch/powerpc/include/asm/switch_to.h
@@ -48,6 +48,7 @@ static inline void disable_kernel_fp(voi
 #else
 static inline void save_fpu(struct task_struct *t) { }
 static inline void flush_fp_to_thread(struct task_struct *t) { }
+static inline void enable_kernel_fp(void) { }
 #endif
 
 #ifdef CONFIG_ALTIVEC

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

* [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set
  2021-04-18 20:17 [PATCH 1/2] powerpc: add enable_kernel_fp() stub for ALTIVEC without PPC_FPU Randy Dunlap
@ 2021-04-18 20:17 ` Randy Dunlap
  2021-04-19 13:32   ` Segher Boessenkool
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2021-04-18 20:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, kernel test robot, Michael Ellerman, linuxppc-dev,
	Christophe Leroy, Segher Boessenkool

When PPC_FPU is not set and ALTIVEC=y, arch/powerpc/lib/ldstfp.c is not
being built, but it is also needed when ALTIVEC=y for get_vr() and
put_vr().

../arch/powerpc/lib/sstep.c: In function 'do_vec_load':
../arch/powerpc/lib/sstep.c:637:3: error: implicit declaration of function 'put_vr' [-Werror=implicit-function-declaration]
  637 |   put_vr(rn, &u.v);
      |   ^~~~~~
../arch/powerpc/lib/sstep.c: In function 'do_vec_store':
../arch/powerpc/lib/sstep.c:660:3: error: implicit declaration of function 'get_vr'; did you mean 'get_oc'? [-Werror=implicit-function-declaration]
  660 |   get_vr(rn, &u.v);
      |   ^~~~~~


Add ldstfp.o to the Makefile for CONFIG_ALTIVEC and add
externs for get_vr() and put_vr() in lib/sstep.c to fix the
build errors.

This was seen in a kernel config from kernel test robot <lkp@intel.com>
that reported a different build issue (for pmac32-cpufreq.c).

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: lkp@intel.com
---
 arch/powerpc/lib/Makefile |    1 +
 arch/powerpc/lib/sstep.c  |    5 +++++
 2 files changed, 6 insertions(+)

--- linux-next-20210416.orig/arch/powerpc/lib/Makefile
+++ linux-next-20210416/arch/powerpc/lib/Makefile
@@ -54,6 +54,7 @@ obj-y			+= checksum_$(BITS).o checksum_w
 
 obj-y			+= sstep.o
 obj-$(CONFIG_PPC_FPU)	+= ldstfp.o
+obj-$(CONFIG_ALTIVEC)	+= ldstfp.o
 obj64-y			+= quad.o
 
 obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
--- linux-next-20210416.orig/arch/powerpc/lib/sstep.c
+++ linux-next-20210416/arch/powerpc/lib/sstep.c
@@ -50,6 +50,11 @@ extern void conv_sp_to_dp(const float *s
 extern void conv_dp_to_sp(const double *dp, float *sp);
 #endif
 
+#ifdef CONFIG_ALTIVEC
+extern void get_vr(int rn, __vector128 *p);
+extern void put_vr(int rn, __vector128 *p);
+#endif /* CONFIG_ALTIVEC */
+
 #ifdef __powerpc64__
 /*
  * Functions in quad.S

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

* Re: [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set
  2021-04-18 20:17 ` [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set Randy Dunlap
@ 2021-04-19 13:32   ` Segher Boessenkool
  2021-04-19 13:38     ` Christophe Leroy
  0 siblings, 1 reply; 5+ messages in thread
From: Segher Boessenkool @ 2021-04-19 13:32 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, kernel test robot, Michael Ellerman, linuxppc-dev,
	Christophe Leroy

Hi!

On Sun, Apr 18, 2021 at 01:17:26PM -0700, Randy Dunlap wrote:
> Add ldstfp.o to the Makefile for CONFIG_ALTIVEC and add
> externs for get_vr() and put_vr() in lib/sstep.c to fix the
> build errors.

>  obj-$(CONFIG_PPC_FPU)	+= ldstfp.o
> +obj-$(CONFIG_ALTIVEC)	+= ldstfp.o

It is probably a good idea to split ldstfp.S into two, one for each of
the two configuration options?


Segher

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

* Re: [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set
  2021-04-19 13:32   ` Segher Boessenkool
@ 2021-04-19 13:38     ` Christophe Leroy
  2021-04-19 13:57       ` Segher Boessenkool
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Leroy @ 2021-04-19 13:38 UTC (permalink / raw)
  To: Segher Boessenkool, Randy Dunlap
  Cc: linux-kernel, kernel test robot, Michael Ellerman, linuxppc-dev



Le 19/04/2021 à 15:32, Segher Boessenkool a écrit :
> Hi!
> 
> On Sun, Apr 18, 2021 at 01:17:26PM -0700, Randy Dunlap wrote:
>> Add ldstfp.o to the Makefile for CONFIG_ALTIVEC and add
>> externs for get_vr() and put_vr() in lib/sstep.c to fix the
>> build errors.
> 
>>   obj-$(CONFIG_PPC_FPU)	+= ldstfp.o
>> +obj-$(CONFIG_ALTIVEC)	+= ldstfp.o
> 
> It is probably a good idea to split ldstfp.S into two, one for each of
> the two configuration options?
> 

Or we can build it all the time and #ifdef the FPU part.

Because it contains FPU, ALTIVEC and VSX stuff.

Christophe

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

* Re: [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set
  2021-04-19 13:38     ` Christophe Leroy
@ 2021-04-19 13:57       ` Segher Boessenkool
  0 siblings, 0 replies; 5+ messages in thread
From: Segher Boessenkool @ 2021-04-19 13:57 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Randy Dunlap, linux-kernel, kernel test robot, Michael Ellerman,
	linuxppc-dev

On Mon, Apr 19, 2021 at 03:38:02PM +0200, Christophe Leroy wrote:
> Le 19/04/2021 à 15:32, Segher Boessenkool a écrit :
> >On Sun, Apr 18, 2021 at 01:17:26PM -0700, Randy Dunlap wrote:
> >>Add ldstfp.o to the Makefile for CONFIG_ALTIVEC and add
> >>externs for get_vr() and put_vr() in lib/sstep.c to fix the
> >>build errors.
> >
> >>  obj-$(CONFIG_PPC_FPU)	+= ldstfp.o
> >>+obj-$(CONFIG_ALTIVEC)	+= ldstfp.o
> >
> >It is probably a good idea to split ldstfp.S into two, one for each of
> >the two configuration options?
> >
> 
> Or we can build it all the time and #ifdef the FPU part.
> 
> Because it contains FPU, ALTIVEC and VSX stuff.

So it becomes an empty object file if none of the options are selected?
Good idea :-)


Segher

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

end of thread, other threads:[~2021-04-19 14:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-18 20:17 [PATCH 1/2] powerpc: add enable_kernel_fp() stub for ALTIVEC without PPC_FPU Randy Dunlap
2021-04-18 20:17 ` [PATCH 2/2] powerpc: add ALTIVEC support to lib/ when PPC_FPU not set Randy Dunlap
2021-04-19 13:32   ` Segher Boessenkool
2021-04-19 13:38     ` Christophe Leroy
2021-04-19 13:57       ` Segher Boessenkool

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