RISC-V Fixes for 5.8-rc3

This contains a handful of fixes I'd like to target for rc3.  Most of them fix
 issues with the conversion of our vDSO to C.  There is also one fix to the
 SiFive PRCI driver that I picked up as it's causing boot issues on the
 hardware.
 
 * A fix to allow kernels with dynamic ftrace to use the vDSO.
 * Some build fixes for the C vDSO functions.
 * A fix to the PRCI driver's memory allocation, which was the cause of some
   boot panics with FREELIST_RANDOM.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEKzw3R0RoQ7JKlDp6LhMZ81+7GIkFAl72MdQTHHBhbG1lckBk
 YWJiZWx0LmNvbQAKCRAuExnzX7sYieNsEACluidZsgOe1yI6SfKSh3EE4mt1GA4l
 gmUe5eBw4tvam4EpF+qZrqcRIeIrJVFg3OV0Fy1DBGOEvmsxBETtPy9ZsriEkaqK
 6qsjMNGK93B5/xbS1hPVNVCKLsWQ58hUivdMxVR53oyf0YZVOC5buW3br41W4xzo
 o56eJreJQDVMwerwPA/0Wo6M/NjPOwsJWJ81zpt5ABFWbb48/emIawifzMaaZ1nb
 qjeXebWHl1iayo93aiiCfWPjfUrKsDWNIqhtJ9c5VX8n3w/sODdaZLZnIGAWH4b5
 Bnki8+lbsjkrRGWKu1zssMa+76njuzBolXiHo3iygGL/dbsiDyqE6OFw6lIqkhDT
 v4ioliIbp3OFQCNAQMFqWcbDIqalRkmklYWPJ2KffntH+MsdkQYICy1Gt0J+5jXE
 g7E8xGMZdGDCLvPUtfKLhULvFIY2kQzz6jlAyueVp9VuOT/OaaHbu1yKMOEJLpjq
 t3qqwtNnLsu5eTuB34WMs6zliC1fcFR4JbbX3N4rLI7euRhpt9Wa8pcI3InhP211
 0VruvaDnRj2mfUTCYHRamJJrq9c16jauT97ATxHmRQQvaAqyt/s+1tnvdh6lf09D
 b97WtPyc0gPI7VavfPzoKUFo2g8rzmvQB2Tc4v9lMB1nxWqe5ozH9+e7ZMTXTUJ6
 JPjVNf/B0hVS1w==
 =Pupr
 -----END PGP SIGNATURE-----

Merge tag 'riscv-for-linus-5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:
 "This contains a handful of fixes I'd like to target for rc3.

  Most of them fix issues with the conversion of our vDSO to C. There is
  also one fix to the SiFive PRCI driver that I picked up as it's
  causing boot issues on the hardware.

   - A fix to allow kernels with dynamic ftrace to use the vDSO.

   - Some build fixes for the C vDSO functions.

   - A fix to the PRCI driver's memory allocation, which was the cause
     of some boot panics with FREELIST_RANDOM"

* tag 'riscv-for-linus-5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: Fixup __vdso_gettimeofday broke dynamic ftrace
  riscv: Add extern declarations for vDSO time-related functions
  clk: sifive: allocate sufficient memory for struct __prci_data
  riscv: Add -fPIC option to CFLAGS_vgettimeofday.o
This commit is contained in:
Linus Torvalds 2020-06-27 08:49:12 -07:00
commit 3b6ab1012c
3 changed files with 14 additions and 2 deletions

View File

@ -17,7 +17,7 @@ vdso-syms += flush_icache
obj-vdso = $(patsubst %, %.o, $(vdso-syms)) note.o
ifneq ($(c-gettimeofday-y),)
CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
CFLAGS_vgettimeofday.o += -fPIC -include $(c-gettimeofday-y)
endif
# Build rules
@ -27,6 +27,9 @@ obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
obj-y += vdso.o vdso-syms.o
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
# Disable -pg to prevent insert call site
CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
# Disable gcov profiling for VDSO code
GCOV_PROFILE := n

View File

@ -9,16 +9,22 @@
#include <linux/time.h>
#include <linux/types.h>
extern
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts);
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
{
return __cvdso_clock_gettime(clock, ts);
}
extern
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
{
return __cvdso_gettimeofday(tv, tz);
}
extern
int __vdso_clock_getres(clockid_t clock_id, struct __kernel_timespec *res);
int __vdso_clock_getres(clockid_t clock_id, struct __kernel_timespec *res)
{
return __cvdso_clock_getres(clock_id, res);

View File

@ -586,7 +586,10 @@ static int sifive_fu540_prci_probe(struct platform_device *pdev)
struct __prci_data *pd;
int r;
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
pd = devm_kzalloc(dev,
struct_size(pd, hw_clks.hws,
ARRAY_SIZE(__prci_init_clocks)),
GFP_KERNEL);
if (!pd)
return -ENOMEM;