Re: riscv+KASAN does not boot

2021-02-16 Thread Tobias Klauser
On 2021-02-16 at 12:17:30 +0100, Dmitry Vyukov  wrote:
> On Fri, Jan 29, 2021 at 9:11 AM Dmitry Vyukov  wrote:
> > > I was fixing KASAN support for my sv48 patchset so I took a look at your
> > > issue: I built a kernel on top of the branch riscv/fixes using
> > > https://github.com/google/syzkaller/blob/269d24e857a757d09a898086a2fa6fa5d827c3e1/dashboard/config/linux/upstream-riscv64-kasan.config
> > > and Buildroot 2020.11. I have the warnings regarding the use of
> > > __virt_to_phys on wrong addresses (but that's normal since this function
> > > is used in virt_addr_valid) but not the segfaults you describe.
> >
> > Hi Alex,
> >
> > Let me try to rebuild buildroot image. Maybe there was something wrong
> > with my build, though, I did 'make clean' before doing. But at the
> > same time it worked back in June...
> >
> > Re WARNINGs, they indicate kernel bugs. I am working on setting up a
> > syzbot instance on riscv. If there a WARNING during boot then the
> > kernel will be marked as broken. No further testing will happen.
> > Is it a mis-use of WARN_ON? If so, could anybody please remove it or
> > replace it with pr_err.
> 
> 
> Hi,
> 
> I've localized one issue with riscv/KASAN:
> KASAN breaks VDSO and that's I think the root cause of weird faults I
> saw earlier. The following patch fixes it.
> Could somebody please upstream this fix? I don't know how to add/run
> tests for this.

Thanks. I've tested the fix locally using vDSO selftests and sent the
fix upstream [1]

[1] 
https://lore.kernel.org/linux-riscv/20210216173305.2500-1-tklau...@distanz.ch/T/#u


Re: [PATCH] selftests/vDSO: fix ABI selftest on riscv

2021-02-10 Thread Tobias Klauser
On 2021-02-09 at 00:37:24 +0100, Shuah Khan  wrote:
> On 2/5/21 12:57 AM, Tobias Klauser wrote:
> > On 2021-02-05 at 08:06:37 +0100, Palmer Dabbelt  wrote:
> > > On Thu, 04 Feb 2021 06:50:42 PST (-0800), tklau...@distanz.ch wrote:
> > 
> > [...]
> > 
> > > Reviewed-by: Palmer Dabbelt 
> > > Acked-by: Palmer Dabbelt 
> > 
> > Thank you!
> > 
> > > Not sure if you want this through the RISC-V tree, so I'm leaving it out 
> > > for
> > > now and assuming it'll go through a kselftest tree.
> > 
> > Either way is fine for me.
> > 
> 
> Thank you. Applied to linux-kselftest next for 5.12-rc1

Thank you Shuah!


Re: [PATCH] selftests/vDSO: fix ABI selftest on riscv

2021-02-05 Thread Tobias Klauser
On 2021-02-05 at 08:06:37 +0100, Palmer Dabbelt  wrote:
> On Thu, 04 Feb 2021 06:50:42 PST (-0800), tklau...@distanz.ch wrote:

[...]

> Reviewed-by: Palmer Dabbelt 
> Acked-by: Palmer Dabbelt 

Thank you!

> Not sure if you want this through the RISC-V tree, so I'm leaving it out for
> now and assuming it'll go through a kselftest tree.

Either way is fine for me.


[PATCH] selftests/vDSO: fix ABI selftest on riscv

2021-02-04 Thread Tobias Klauser
Only older versions of the RISC-V GCC toolchain define __riscv__. Check
for __riscv as well, which is used by newer GCC toolchains. Also set
VDSO_32BIT based on __riscv_xlen.

Before (on riscv64):

$ ./vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_4
Could not find __vdso_gettimeofday
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_REALTIME [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_BOOTTIME [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_TAI [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_REALTIME_COARSE [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC_RAW [PASS]
Could not find __vdso_clock_gettime
Could not find __vdso_clock_getres
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __vdso_time

After (on riscv32):

$ ./vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_4.15
The time is 1612449376.015086
The time is 1612449376.18340784
The resolution is 0 1
clock_id: CLOCK_REALTIME [PASS]
The time is 774.842586182
The resolution is 0 1
clock_id: CLOCK_BOOTTIME [PASS]
The time is 1612449376.22536565
The resolution is 0 1
clock_id: CLOCK_TAI [PASS]
The time is 1612449376.20885172
The resolution is 0 400
clock_id: CLOCK_REALTIME_COARSE [PASS]
The time is 774.845491269
The resolution is 0 1
clock_id: CLOCK_MONOTONIC [PASS]
The time is 774.849534200
The resolution is 0 1
clock_id: CLOCK_MONOTONIC_RAW [PASS]
The time is 774.842139684
The resolution is 0 400
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __vdso_time

Signed-off-by: Tobias Klauser 
---
 tools/testing/selftests/vDSO/vdso_config.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vDSO/vdso_config.h 
b/tools/testing/selftests/vDSO/vdso_config.h
index 6a6fe8d4ff55..6188b16827d1 100644
--- a/tools/testing/selftests/vDSO/vdso_config.h
+++ b/tools/testing/selftests/vDSO/vdso_config.h
@@ -47,10 +47,12 @@
 #elif defined(__x86_64__)
 #define VDSO_VERSION   0
 #define VDSO_NAMES 1
-#elif defined(__riscv__)
+#elif defined(__riscv__) || defined(__riscv)
 #define VDSO_VERSION   5
 #define VDSO_NAMES 1
+#if __riscv_xlen == 32
 #define VDSO_32BIT 1
+#endif
 #else /* nds32 */
 #define VDSO_VERSION   4
 #define VDSO_NAMES 1
-- 
2.30.0



Re: riscv+KASAN does not boot

2021-01-18 Thread Tobias Klauser
On 2021-01-14 at 11:24:07 +0100, Dmitry Vyukov  wrote:
> On Thu, Jan 14, 2021 at 10:23 AM Dmitry Vyukov  wrote:
> >
> > On Thu, Jan 14, 2021 at 5:57 AM Palmer Dabbelt  
> > wrote:
> > >
> > > On Fri, 25 Dec 2020 09:13:23 PST (-0800), dvyu...@google.com wrote:
> > > > On Fri, Dec 25, 2020 at 5:58 PM Andreas Schwab  
> > > > wrote:
> > > >>
> > > >> On Dez 25 2020, Dmitry Vyukov wrote:
> > > >>
> > > >> > qemu-system-riscv64 \
> > > >> > -machine virt -bios default -smp 1 -m 2G \
> > > >> > -device virtio-blk-device,drive=hd0 \
> > > >> > -drive file=buildroot-riscv64.ext4,if=none,format=raw,id=hd0 \
> > > >> > -kernel arch/riscv/boot/Image \
> > > >> > -nographic \
> > > >> > -device virtio-rng-device,rng=rng0 -object
> > > >> > rng-random,filename=/dev/urandom,id=rng0 \
> > > >> > -netdev user,id=net0,host=10.0.2.10,hostfwd=tcp::10022-:22 -device
> > > >> > virtio-net-device,netdev=net0 \
> > > >> > -append "root=/dev/vda earlyprintk=serial console=ttyS0 oops=panic
> > > >> > panic_on_warn=1 panic=86400"
> > > >>
> > > >> Do you get more output with earlycon=sbi?
> > > >
> > > > Hi Andreas,
> > > >
> > > > For defconfig+kvm_guest.config+ scripts/config -e KASAN -e
> > > > KASAN_INLINE it actually gave me more output:
> > > >
> > > >
> > > > OpenSBI v0.7
> > > >_  _
> > > >   / __ \  / |  _ \_   _|
> > > >  | |  | |_ __   ___ _ __ | (___ | |_) || |
> > > >  | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
> > > >  | |__| | |_) |  __/ | | |) | |_) || |_
> > > >   \/| .__/ \___|_| |_|_/|/_|
> > > > | |
> > > > |_|
> > > >
> > > > Platform Name  : QEMU Virt Machine
> > > > Platform HART Features : RV64ACDFIMSU
> > > > Current Hart   : 0
> > > > Firmware Base  : 0x8000
> > > > Firmware Size  : 132 KB
> > > > Runtime SBI Version: 0.2
> > > >
> > > > MIDELEG : 0x0222
> > > > MEDELEG : 0xb109
> > > > PMP0: 0x8000-0x8003 (A)
> > > > PMP1: 0x-0x (A,R,W,X)
> > > > [0.00] Linux version 5.10.0-01370-g71c5f03154ac
> > > > (dvyu...@dvyukov-desk.muc.corp.google.com) (riscv64-linux-gnu-gcc
> > > > (Debian 10.2.0-9) 10.2.0, GNU ld (GNU Binutils for Debian) 2.35.1) #17
> > > > SMP Fri Dec 25 18:10:12 CET 2020
> > > > [0.00] OF: fdt: Ignoring memory range 0x8000 - 0x8020
> > > > [0.00] earlycon: sbi0 at I/O port 0x0 (options '')
> > > > [0.00] printk: bootconsole [sbi0] enabled
> > > > [0.00] efi: UEFI not found.
> > > > [0.00] Zone ranges:
> > > > [0.00]   DMA32[mem 0x8020-0x]
> > > > [0.00]   Normal   empty
> > > > [0.00] Movable zone start for each node
> > > > [0.00] Early memory node ranges
> > > > [0.00]   node   0: [mem 0x8020-0x]
> > > > [0.00] Initmem setup node 0 [mem 
> > > > 0x8020-0x]
> > > > [0.00] SBI specification v0.2 detected
> > > > [0.00] SBI implementation ID=0x1 Version=0x7
> > > > [0.00] SBI v0.2 TIME extension detected
> > > > [0.00] SBI v0.2 IPI extension detected
> > > > [0.00] SBI v0.2 RFENCE extension detected
> > > > [0.00] software IO TLB: mapped [mem
> > > > 0xfa3f9000-0xfe3f9000] (64MB)
> > > > [0.00] Unable to handle kernel paging request at virtual
> > > > address dfc81004
> > > > [0.00] Oops [#1]
> > > > [0.00] Modules linked in:
> > > > [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted
> > > > 5.10.0-01370-g71c5f03154ac #17
> > > > [0.00] epc: ffe00042e3e4 ra : ffe000c0462c sp : 
> > > > ffe001603ea0
> > > > [0.00]  gp : ffe0016e3c60 tp : ffe00160cd40 t0 :
> > > > dfc81004
> > > > [0.00]  t1 : ffe000e0a838 t2 :  s0 :
> > > > ffe001603f50
> > > > [0.00]  s1 : ffe0016e50a8 a0 : dfc81004 a1 :
> > > > 
> > > > [0.00]  a2 : 0ffc a3 : dfc82000 a4 :
> > > > 
> > > > [0.00]  a5 : 3e8c6001 a6 : ffe000e0a820 a7 :
> > > > 0900
> > > > [0.00]  s2 : dfc82000 s3 : dfc8 s4 :
> > > > 0001
> > > > [0.00]  s5 : ffe0016e5108 s6 : f000 s7 :
> > > > dfc81004
> > > > [0.00]  s8 : 0080 s9 :  s10:
> > > > ffe07a119000
> > > > [0.00]  s11: ffc0 t3 : ffe0016eb908 t4 :
> > > > 0001
> > > > [0.00]  t5 : ffc4001c150a t6 : ffe001603be8
> > > > [0.00] status: 0100 badaddr: dfc81004
> > > > cause: 000f
> > > > [0.00] random: get_random_bytes called from
> > > > oops_exit+0x30/0x58 with crng_init=0
> > > > [0.00] ---[ end 

[PATCH] selftests/timens: add futex binary to .gitignore

2020-12-18 Thread Tobias Klauser
Add the futex test binary introduced by commit a4fd8414659b
("selftests/timens: Add a test for futex()") to .gitignore.

Signed-off-by: Tobias Klauser 
---
 tools/testing/selftests/timens/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/timens/.gitignore 
b/tools/testing/selftests/timens/.gitignore
index 2e43851b47c1..fe1eb8271b35 100644
--- a/tools/testing/selftests/timens/.gitignore
+++ b/tools/testing/selftests/timens/.gitignore
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 clock_nanosleep
 exec
+futex
 gettime_perf
 gettime_perf_cold
 procfs
-- 
2.29.0



[PATCH] selftests/vDSO: fix -Wformat warning in vdso_test_correctness

2020-12-17 Thread Tobias Klauser
Fix the following -Wformat warnings in vdso_test_correctness.c:

vdso_test_correctness.c: In function ‘test_one_clock_gettime64’:
vdso_test_correctness.c:352:21: warning: format ‘%ld’ expects argument of type 
‘long int’, but argument 3 has type ‘long long int’ [-Wformat=]
  352 |  printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
  | ^
  | |
  | long int
  | %09lld
  353 | (unsigned long long)start.tv_sec, start.tv_nsec,
  |   ~
  ||
  |long long int
vdso_test_correctness.c:352:32: warning: format ‘%ld’ expects argument of type 
‘long int’, but argument 5 has type ‘long long int’ [-Wformat=]
  352 |  printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
  |^
  ||
  |long int
  |%09lld
  353 | (unsigned long long)start.tv_sec, start.tv_nsec,
  354 | (unsigned long long)vdso.tv_sec, vdso.tv_nsec,
  |  
  |  |
  |  long long int
vdso_test_correctness.c:352:43: warning: format ‘%ld’ expects argument of type 
‘long int’, but argument 7 has type ‘long long int’ [-Wformat=]

The tv_sec member of __kernel_timespec is long long, both in
uapi/linux/time_types.h and locally in vdso_test_correctness.c.

Signed-off-by: Tobias Klauser 
---
 tools/testing/selftests/vDSO/vdso_test_correctness.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c 
b/tools/testing/selftests/vDSO/vdso_test_correctness.c
index 5029ef9b228c..c4aea794725a 100644
--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
+++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
@@ -349,7 +349,7 @@ static void test_one_clock_gettime64(int clock, const char 
*name)
return;
}
 
-   printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n",
+   printf("\t%llu.%09lld %llu.%09lld %llu.%09lld\n",
   (unsigned long long)start.tv_sec, start.tv_nsec,
   (unsigned long long)vdso.tv_sec, vdso.tv_nsec,
   (unsigned long long)end.tv_sec, end.tv_nsec);
-- 
2.29.0



[PATCH] selftests/vDSO: add additional binaries to .gitignore

2020-12-17 Thread Tobias Klauser
Add the test binaries introduced by commit 693f5ca08ca0 ("kselftest:
Extend vDSO selftest"), commit 03f55c7952c9 ("kselftest: Extend vDSO
selftest to clock_getres") and commit c7e5789b24d3 ("kselftest: Move
test_vdso to the vDSO test suite") to .gitignore.

Signed-off-by: Tobias Klauser 
---
 tools/testing/selftests/vDSO/.gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/vDSO/.gitignore 
b/tools/testing/selftests/vDSO/.gitignore
index 5eb64d41e541..a8dc51af5a9c 100644
--- a/tools/testing/selftests/vDSO/.gitignore
+++ b/tools/testing/selftests/vDSO/.gitignore
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 vdso_test
+vdso_test_abi
+vdso_test_clock_getres
+vdso_test_correctness
 vdso_test_gettimeofday
 vdso_test_getcpu
 vdso_standalone_test_x86
-- 
2.29.0



Re: [PATCH 2/2] tools, bpftool: Remove two unused variables.

2020-10-28 Thread Tobias Klauser
On 2020-10-28 at 00:36:46 +0100, Ian Rogers  wrote:
> Avoid an unused variable warning.
> 
> Signed-off-by: Ian Rogers 

Reviewed-by: Tobias Klauser 


Re: [PATCH 1/2] tools, bpftool: Avoid array index warnings.

2020-10-28 Thread Tobias Klauser
On 2020-10-28 at 00:36:45 +0100, Ian Rogers  wrote:
> The bpf_caps array is shorter without CAP_BPF, avoid out of bounds reads
> if this isn't defined. Working around this avoids -Wno-array-bounds with
> clang.
> 
> Signed-off-by: Ian Rogers 

Reviewed-by: Tobias Klauser 


[tip: core/rcu] rcu: Fix kerneldoc comments in rcupdate.h

2020-10-09 Thread tip-bot2 for Tobias Klauser
The following commit has been merged into the core/rcu branch of tip:

Commit-ID: 000601bb62330f18dc8f5d2d0b82e9aec3e207c4
Gitweb:
https://git.kernel.org/tip/000601bb62330f18dc8f5d2d0b82e9aec3e207c4
Author:Tobias Klauser 
AuthorDate:Thu, 09 Jul 2020 15:05:59 +02:00
Committer: Paul E. McKenney 
CommitterDate: Mon, 24 Aug 2020 18:36:08 -07:00

rcu: Fix kerneldoc comments in rcupdate.h

This commit fixes the kerneldoc comments for rcu_read_unlock_bh(),
rcu_read_unlock_sched() and rcu_head_after_call_rcu() so they e.g. get
properly linked in the API documentation. Also add parenthesis after
function names to match the notation used in other kerneldoc comments in
the same file.

Signed-off-by: Tobias Klauser 
Signed-off-by: Paul E. McKenney 
---
 include/linux/rcupdate.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d15d46d..b47d6b6 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -709,8 +709,8 @@ static inline void rcu_read_lock_bh(void)
 "rcu_read_lock_bh() used illegally while idle");
 }
 
-/*
- * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section
+/**
+ * rcu_read_unlock_bh() - marks the end of a softirq-only RCU critical section
  *
  * See rcu_read_lock_bh() for more information.
  */
@@ -751,10 +751,10 @@ static inline notrace void 
rcu_read_lock_sched_notrace(void)
__acquire(RCU_SCHED);
 }
 
-/*
- * rcu_read_unlock_sched - marks the end of a RCU-classic critical section
+/**
+ * rcu_read_unlock_sched() - marks the end of a RCU-classic critical section
  *
- * See rcu_read_lock_sched for more information.
+ * See rcu_read_lock_sched() for more information.
  */
 static inline void rcu_read_unlock_sched(void)
 {
@@ -945,7 +945,7 @@ static inline void rcu_head_init(struct rcu_head *rhp)
 }
 
 /**
- * rcu_head_after_call_rcu - Has this rcu_head been passed to call_rcu()?
+ * rcu_head_after_call_rcu() - Has this rcu_head been passed to call_rcu()?
  * @rhp: The rcu_head structure to test.
  * @f: The function passed to call_rcu() along with @rhp.
  *


[tip: core/rcu] docs: Fix typo in synchronize_rcu() function name

2020-10-09 Thread tip-bot2 for Tobias Klauser
The following commit has been merged into the core/rcu branch of tip:

Commit-ID: 77f808607a62c3685381a5732a88b30bad8893b5
Gitweb:
https://git.kernel.org/tip/77f808607a62c3685381a5732a88b30bad8893b5
Author:Tobias Klauser 
AuthorDate:Thu, 02 Jul 2020 18:28:10 +02:00
Committer: Paul E. McKenney 
CommitterDate: Mon, 24 Aug 2020 14:29:16 -07:00

docs: Fix typo in synchronize_rcu() function name

s/sychronize_rcu/synchronize_rcu/

Signed-off-by: Tobias Klauser 
Signed-off-by: Paul E. McKenney 
---
 Documentation/RCU/whatisRCU.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/RCU/whatisRCU.rst b/Documentation/RCU/whatisRCU.rst
index c7f147b..fb3ff76 100644
--- a/Documentation/RCU/whatisRCU.rst
+++ b/Documentation/RCU/whatisRCU.rst
@@ -360,7 +360,7 @@ order to amortize their overhead over many uses of the 
corresponding APIs.
 
 There are at least three flavors of RCU usage in the Linux kernel. The diagram
 above shows the most common one. On the updater side, the rcu_assign_pointer(),
-sychronize_rcu() and call_rcu() primitives used are the same for all three
+synchronize_rcu() and call_rcu() primitives used are the same for all three
 flavors. However for protection (on the reader side), the primitives used vary
 depending on the flavor:
 


[PATCH] stackleak: let stack_erasing_sysctl take a kernel pointer buffer

2020-09-07 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
signature of stack_erasing_sysctl to match ctl_table.proc_handler which
fixes the following sparse warning:

kernel/stackleak.c:31:50: warning: incorrect type in argument 3 (different 
address spaces)
kernel/stackleak.c:31:50:expected void *
kernel/stackleak.c:31:50:got void [noderef] __user *buffer

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Cc: Al Viro 
Signed-off-by: Tobias Klauser 
---
 include/linux/stackleak.h | 2 +-
 kernel/stackleak.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/stackleak.h b/include/linux/stackleak.h
index 3d5c3271a9a8..a59db2f08e76 100644
--- a/include/linux/stackleak.h
+++ b/include/linux/stackleak.h
@@ -25,7 +25,7 @@ static inline void stackleak_task_init(struct task_struct *t)
 
 #ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
 int stack_erasing_sysctl(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos);
+   void *buffer, size_t *lenp, loff_t *ppos);
 #endif
 
 #else /* !CONFIG_GCC_PLUGIN_STACKLEAK */
diff --git a/kernel/stackleak.c b/kernel/stackleak.c
index a8fc9ae1d03d..ce161a8e8d97 100644
--- a/kernel/stackleak.c
+++ b/kernel/stackleak.c
@@ -20,7 +20,7 @@
 static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass);
 
 int stack_erasing_sysctl(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos)
+   void *buffer, size_t *lenp, loff_t *ppos)
 {
int ret = 0;
int state = !static_branch_unlikely(_erasing_bypass);
-- 
2.27.0



[PATCH] ftrace: let ftrace_enable_sysctl take a kernel pointer buffer

2020-09-07 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
signature of ftrace_enable_sysctl to match ctl_table.proc_handler which
fixes the following sparse warning:

kernel/trace/ftrace.c:7544:43: warning: incorrect type in argument 3 (different 
address spaces)
kernel/trace/ftrace.c:7544:43:expected void *
kernel/trace/ftrace.c:7544:43:got void [noderef] __user *buffer

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Cc: Al Viro 
Signed-off-by: Tobias Klauser 
---
 include/linux/ftrace.h | 3 +--
 kernel/trace/ftrace.c  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ce2c06f72e86..e5c2d5cc6e6a 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -85,8 +85,7 @@ static inline int ftrace_mod_get_kallsym(unsigned int symnum, 
unsigned long *val
 extern int ftrace_enabled;
 extern int
 ftrace_enable_sysctl(struct ctl_table *table, int write,
-void __user *buffer, size_t *lenp,
-loff_t *ppos);
+void *buffer, size_t *lenp, loff_t *ppos);
 
 struct ftrace_ops;
 
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 275441254bb5..e9fa580f3083 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7531,8 +7531,7 @@ static bool is_permanent_ops_registered(void)
 
 int
 ftrace_enable_sysctl(struct ctl_table *table, int write,
-void __user *buffer, size_t *lenp,
-loff_t *ppos)
+void *buffer, size_t *lenp, loff_t *ppos)
 {
int ret = -ENODEV;
 
-- 
2.27.0



[PATCH] fs: adjust dirtytime_interval_handler definition to match prototype

2020-09-07 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
definition of dirtytime_interval_handler to match its prototype in
linux/writeback.h which fixes the following sparse error/warning:

fs/fs-writeback.c:2189:50: warning: incorrect type in argument 3 (different 
address spaces)
fs/fs-writeback.c:2189:50:expected void *
fs/fs-writeback.c:2189:50:got void [noderef] __user *buffer
fs/fs-writeback.c:2184:5: error: symbol 'dirtytime_interval_handler' redeclared 
with different type (incompatible argument 3 (different address spaces)):
fs/fs-writeback.c:2184:5:int extern [addressable] [signed] [toplevel] 
dirtytime_interval_handler( ... )
fs/fs-writeback.c: note: in included file:
./include/linux/writeback.h:374:5: note: previously declared as:
./include/linux/writeback.h:374:5:int extern [addressable] [signed] 
[toplevel] dirtytime_interval_handler( ... )

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Cc: Al Viro 
Signed-off-by: Tobias Klauser 
---
 fs/fs-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 149227160ff0..58b27e4070a3 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -2184,7 +2184,7 @@ static int __init start_dirtytime_writeback(void)
 __initcall(start_dirtytime_writeback);
 
 int dirtytime_interval_handler(struct ctl_table *table, int write,
-  void __user *buffer, size_t *lenp, loff_t *ppos)
+  void *buffer, size_t *lenp, loff_t *ppos)
 {
int ret;
 
-- 
2.27.0



[PATCH] ipc: adjust proc_ipc_sem_dointvec definition to match prototype

2020-08-25 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
signature of proc_ipc_sem_dointvec to match ctl_table.proc_handler which
fixes the following sparse error/warning:

ipc/ipc_sysctl.c:94:47: warning: incorrect type in argument 3 (different 
address spaces)
ipc/ipc_sysctl.c:94:47:expected void *buffer
ipc/ipc_sysctl.c:94:47:got void [noderef] __user *buffer
ipc/ipc_sysctl.c:194:35: warning: incorrect type in initializer (incompatible 
argument 3 (different address spaces))
ipc/ipc_sysctl.c:194:35:expected int ( [usertype] *proc_handler )( ... )
ipc/ipc_sysctl.c:194:35:got int ( * )( ... )

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Signed-off-by: Tobias Klauser 
---
 ipc/ipc_sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index d1b8644bfb88..3f312bf2b116 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -85,7 +85,7 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int 
write,
 }
 
 static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos)
+   void *buffer, size_t *lenp, loff_t *ppos)
 {
int ret, semmni;
struct ipc_namespace *ns = current->nsproxy->ipc_ns;
-- 
2.27.0



[PATCH] fs: adjust dirtytime_interval_handler definition to match prototype

2020-08-25 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
definition of dirtytime_interval_handler to match its prototype in
linux/writeback.h which fixes the following sparse error/warning:

fs/fs-writeback.c:2189:50: warning: incorrect type in argument 3 (different 
address spaces)
fs/fs-writeback.c:2189:50:expected void *
fs/fs-writeback.c:2189:50:got void [noderef] __user *buffer
fs/fs-writeback.c:2184:5: error: symbol 'dirtytime_interval_handler' redeclared 
with different type (incompatible argument 3 (different address spaces)):
fs/fs-writeback.c:2184:5:int extern [addressable] [signed] [toplevel] 
dirtytime_interval_handler( ... )
fs/fs-writeback.c: note: in included file:
./include/linux/writeback.h:374:5: note: previously declared as:
./include/linux/writeback.h:374:5:int extern [addressable] [signed] 
[toplevel] dirtytime_interval_handler( ... )

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Signed-off-by: Tobias Klauser 
---
 fs/fs-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index a605c3dddabc..7a6e6155807c 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -2182,7 +2182,7 @@ static int __init start_dirtytime_writeback(void)
 __initcall(start_dirtytime_writeback);
 
 int dirtytime_interval_handler(struct ctl_table *table, int write,
-  void __user *buffer, size_t *lenp, loff_t *ppos)
+  void *buffer, size_t *lenp, loff_t *ppos)
 {
int ret;
 
-- 
2.27.0



[PATCH] fork: adjust sysctl_max_threads definition to match prototype

2020-08-25 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
definition of sysctl_max_threads to match its prototype in
linux/sysctl.h which fixes the following sparse error/warning:

kernel/fork.c:3050:47: warning: incorrect type in argument 3 (different address 
spaces)
kernel/fork.c:3050:47:expected void *
kernel/fork.c:3050:47:got void [noderef] __user *buffer
kernel/fork.c:3036:5: error: symbol 'sysctl_max_threads' redeclared with 
different type (incompatible argument 3 (different address spaces)):
kernel/fork.c:3036:5:int extern [addressable] [signed] [toplevel] 
sysctl_max_threads( ... )
kernel/fork.c: note: in included file (through include/linux/key.h, 
include/linux/cred.h, include/linux/sched/signal.h, 
include/linux/sched/cputime.h):
./include/linux/sysctl.h:242:5: note: previously declared as:
./include/linux/sysctl.h:242:5:int extern [addressable] [signed] [toplevel] 
sysctl_max_threads( ... )

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Signed-off-by: Tobias Klauser 
---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 04975f582015..494ed46dd061 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -3034,7 +3034,7 @@ int unshare_files(struct files_struct **displaced)
 }
 
 int sysctl_max_threads(struct ctl_table *table, int write,
-  void __user *buffer, size_t *lenp, loff_t *ppos)
+  void *buffer, size_t *lenp, loff_t *ppos)
 {
struct ctl_table t;
int ret;
-- 
2.27.0



[PATCH] stackleak: let stack_erasing_sysctl take a kernel pointer buffer

2020-08-25 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
signature of stack_erasing_sysctl to match ctl_table.proc_handler which
fixes the following sparse warning:

kernel/stackleak.c:31:50: warning: incorrect type in argument 3 (different 
address spaces)
kernel/stackleak.c:31:50:expected void *
kernel/stackleak.c:31:50:got void [noderef] __user *buffer

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Signed-off-by: Tobias Klauser 
---
 include/linux/stackleak.h | 2 +-
 kernel/stackleak.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/stackleak.h b/include/linux/stackleak.h
index 3d5c3271a9a8..a59db2f08e76 100644
--- a/include/linux/stackleak.h
+++ b/include/linux/stackleak.h
@@ -25,7 +25,7 @@ static inline void stackleak_task_init(struct task_struct *t)
 
 #ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
 int stack_erasing_sysctl(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos);
+   void *buffer, size_t *lenp, loff_t *ppos);
 #endif
 
 #else /* !CONFIG_GCC_PLUGIN_STACKLEAK */
diff --git a/kernel/stackleak.c b/kernel/stackleak.c
index a8fc9ae1d03d..ce161a8e8d97 100644
--- a/kernel/stackleak.c
+++ b/kernel/stackleak.c
@@ -20,7 +20,7 @@
 static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass);
 
 int stack_erasing_sysctl(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos)
+   void *buffer, size_t *lenp, loff_t *ppos)
 {
int ret = 0;
int state = !static_branch_unlikely(_erasing_bypass);
-- 
2.27.0



[PATCH] ftrace: let ftrace_enable_sysctl take a kernel pointer buffer

2020-08-25 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
signature of ftrace_enable_sysctl to match ctl_table.proc_handler which
fixes the following sparse warning:

kernel/trace/ftrace.c:7544:43: warning: incorrect type in argument 3 (different 
address spaces)
kernel/trace/ftrace.c:7544:43:expected void *
kernel/trace/ftrace.c:7544:43:got void [noderef] __user *buffer

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Signed-off-by: Tobias Klauser 
---
 include/linux/ftrace.h | 3 +--
 kernel/trace/ftrace.c  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ce2c06f72e86..e5c2d5cc6e6a 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -85,8 +85,7 @@ static inline int ftrace_mod_get_kallsym(unsigned int symnum, 
unsigned long *val
 extern int ftrace_enabled;
 extern int
 ftrace_enable_sysctl(struct ctl_table *table, int write,
-void __user *buffer, size_t *lenp,
-loff_t *ppos);
+void *buffer, size_t *lenp, loff_t *ppos);
 
 struct ftrace_ops;
 
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 275441254bb5..e9fa580f3083 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7531,8 +7531,7 @@ static bool is_permanent_ops_registered(void)
 
 int
 ftrace_enable_sysctl(struct ctl_table *table, int write,
-void __user *buffer, size_t *lenp,
-loff_t *ppos)
+void *buffer, size_t *lenp, loff_t *ppos)
 {
int ret = -ENODEV;
 
-- 
2.27.0



[PATCH bpf] bpf, sysctl: let bpf_stats_handler take a kernel pointer buffer

2020-08-24 Thread Tobias Klauser
Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
signature of bpf_stats_handler to match ctl_table.proc_handler which
fixes the following sparse warning:

kernel/sysctl.c:226:49: warning: incorrect type in argument 3 (different 
address spaces)
kernel/sysctl.c:226:49:expected void *
kernel/sysctl.c:226:49:got void [noderef] __user *buffer
kernel/sysctl.c:2640:35: warning: incorrect type in initializer (incompatible 
argument 3 (different address spaces))
kernel/sysctl.c:2640:35:expected int ( [usertype] *proc_handler )( ... )
kernel/sysctl.c:2640:35:got int ( * )( ... )

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Cc: Christoph Hellwig 
Signed-off-by: Tobias Klauser 
---
 kernel/sysctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 287862f91717..09e70ee2332e 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -204,8 +204,7 @@ static int max_extfrag_threshold = 1000;
 
 #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
 static int bpf_stats_handler(struct ctl_table *table, int write,
-void __user *buffer, size_t *lenp,
-loff_t *ppos)
+void *buffer, size_t *lenp, loff_t *ppos)
 {
struct static_key *key = (struct static_key *)table->data;
static int saved_val;
-- 
2.27.0



Re: [PATCH] tools/bpf/bpftool: Fix wrong return value in do_dump()

2020-08-03 Thread Tobias Klauser
On 2020-08-02 at 13:15:40 +0200, Tianjia Zhang 
 wrote:
> In case of btf_id does not exist, a negative error code -ENOENT
> should be returned.
> 
> Fixes: c93cc69004df3 ("bpftool: add ability to dump BTF types")
> Cc: Andrii Nakryiko 
> Signed-off-by: Tianjia Zhang 

Reviewed-by: Tobias Klauser 

> ---
>  tools/bpf/bpftool/btf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
> index faac8189b285..c2f1fd414820 100644
> --- a/tools/bpf/bpftool/btf.c
> +++ b/tools/bpf/bpftool/btf.c
> @@ -596,7 +596,7 @@ static int do_dump(int argc, char **argv)
>   goto done;
>   }
>   if (!btf) {
> - err = ENOENT;
> + err = -ENOENT;
>   p_err("can't find btf with ID (%u)", btf_id);
>   goto done;
>   }
> -- 
> 2.26.2
> 


Re: [PATCH] serial: altera_jtaguart: Replace HTTP links with HTTPS ones

2020-07-20 Thread Tobias Klauser
On 2020-07-18 at 12:30:18 +0200, Alexander A. Klimov  
wrote:
> Rationale:
> Reduces attack surface on kernel devs opening the links for MITM
> as HTTPS traffic is much harder to manipulate.
> 
> Deterministic algorithm:
> For each file:
>   If not .svg:
> For each line:
>   If doesn't contain `\bxmlns\b`:
> For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
> If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
> If both the HTTP and HTTPS versions
> return 200 OK and serve the same content:
>   Replace HTTP with HTTPS.
> 
> Signed-off-by: Alexander A. Klimov 

Acked-by: Tobias Klauser 

Thanks


[PATCH v2] phy: zynqmp: Fix unused-function compiler warning

2020-07-01 Thread Tobias Klauser
Mark xpsgtr_suspend and xpsgtr_resume as __maybe_unused to fix the
following compiler warning when building with !CONFIG_PM_SLEEP:

drivers/phy/xilinx/phy-zynqmp.c:830:12: warning: ‘xpsgtr_resume’ defined but 
not used [-Wunused-function]
  830 | static int xpsgtr_resume(struct device *dev)
  |^
drivers/phy/xilinx/phy-zynqmp.c:819:12: warning: ‘xpsgtr_suspend’ defined but 
not used [-Wunused-function]
  819 | static int xpsgtr_suspend(struct device *dev)
  |^~

Also drop the existing #ifdef CONFIG_PM so the functions are always
compile-checked regardless of CONFIG_PM and/or CONFIG_PM_SLEEP being
set.

Reviewed-by: Laurent Pinchart 
Signed-off-by: Tobias Klauser 
---
 drivers/phy/xilinx/phy-zynqmp.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
index 8babee2ce9ec..2b0f921b6ee3 100644
--- a/drivers/phy/xilinx/phy-zynqmp.c
+++ b/drivers/phy/xilinx/phy-zynqmp.c
@@ -815,8 +815,7 @@ static struct phy *xpsgtr_xlate(struct device *dev,
  * Power Management
  */
 
-#ifdef CONFIG_PM
-static int xpsgtr_suspend(struct device *dev)
+static int __maybe_unused xpsgtr_suspend(struct device *dev)
 {
struct xpsgtr_dev *gtr_dev = dev_get_drvdata(dev);
 
@@ -827,7 +826,7 @@ static int xpsgtr_suspend(struct device *dev)
return 0;
 }
 
-static int xpsgtr_resume(struct device *dev)
+static int __maybe_unused xpsgtr_resume(struct device *dev)
 {
struct xpsgtr_dev *gtr_dev = dev_get_drvdata(dev);
unsigned int icm_cfg0, icm_cfg1;
@@ -854,7 +853,6 @@ static int xpsgtr_resume(struct device *dev)
 
return 0;
 }
-#endif /* CONFIG_PM */
 
 static const struct dev_pm_ops xpsgtr_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(xpsgtr_suspend, xpsgtr_resume)
-- 
2.27.0



Re: [PATCH] phy: zynqmp: Fix unused-function compiler warning

2020-07-01 Thread Tobias Klauser
On 2020-07-01 at 16:01:08 +0200, Laurent Pinchart 
 wrote:
> On Wed, Jul 01, 2020 at 04:00:26PM +0200, Tobias Klauser wrote:
> > On 2020-07-01 at 15:44:43 +0200, Laurent Pinchart 
> >  wrote:
> > > On Wed, Jul 01, 2020 at 07:06:43PM +0530, Vinod Koul wrote:
> > > > On 01-07-20, 16:19, Laurent Pinchart wrote:
> > > > > On Wed, Jul 01, 2020 at 11:04:38AM +0200, Tobias Klauser wrote:
> > > > > > This fixes the following compiler warning when building with
> > > > > > CONFIG_PM && !CONFIG_PM_SLEEP:
> > > > > > 
> > > > > > drivers/phy/xilinx/phy-zynqmp.c:830:12: warning: ‘xpsgtr_resume’ 
> > > > > > defined but not used [-Wunused-function]
> > > > > >   830 | static int xpsgtr_resume(struct device *dev)
> > > > > >   |^
> > > > > > drivers/phy/xilinx/phy-zynqmp.c:819:12: warning: ‘xpsgtr_suspend’ 
> > > > > > defined but not used [-Wunused-function]
> > > > > >   819 | static int xpsgtr_suspend(struct device *dev)
> > > > > >   |^~
> > > > > 
> > > > > Oops :-S Sorry about that.
> > > > > 
> > > > > Reviewed-by: Laurent Pinchart 
> > 
> > Thanks for the review Laurent.
> > 
> > > > > Vinod or Kishon, can you pick this patch up, or do I need to send a 
> > > > > pull
> > > > > request ? (It's my first driver in the PHY subsystem so I don't know
> > > > > what the usual practices are there)
> > > > 
> > > > patches are welcome :-)
> > > > 
> > > > > 
> > > > > > Signed-off-by: Tobias Klauser 
> > > > > > ---
> > > > > >  drivers/phy/xilinx/phy-zynqmp.c | 4 ++--
> > > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/drivers/phy/xilinx/phy-zynqmp.c 
> > > > > > b/drivers/phy/xilinx/phy-zynqmp.c
> > > > > > index 8babee2ce9ec..22a0ae635797 100644
> > > > > > --- a/drivers/phy/xilinx/phy-zynqmp.c
> > > > > > +++ b/drivers/phy/xilinx/phy-zynqmp.c
> > > > > > @@ -815,7 +815,7 @@ static struct phy *xpsgtr_xlate(struct device 
> > > > > > *dev,
> > > > > >   * Power Management
> > > > > >   */
> > > > > >  
> > > > > > -#ifdef CONFIG_PM
> > > > > > +#ifdef CONFIG_PM_SLEEP
> > > > 
> > > > How about marking it as __maybe_unused instead?
> > > 
> > > I don't mind either, I'll let Tobias decide, but his patch seems fine,
> > > is there a drawback in his approach ? If it's just a matter of personal
> > > preference, I'd rather not require a v2.
> > 
> > I don't mind either, it was just what seemed the more straight-forward
> > fix. On the other hand, it seems that marking these functions as
> > __maybe_unused is the more widely used method in other PHY drivers. In
> > addition it would have the nice side-effect of the code always being
> > compile-checked regardless of the value of CONFIG_PM_SLEEP.
> 
> That's a good point, haven't thought about it.
> 
> > Will send a v2 using __maybe_unused and will let you decide which one to
> > pick :)
> 
> You can keep my R-b :-)

Thanks :) FWIW, I'd also drop the #ifdef CONFIG_PM in the same patch for
the same reason. Is that OK with you as well?


Re: [PATCH] phy: zynqmp: Fix unused-function compiler warning

2020-07-01 Thread Tobias Klauser
On 2020-07-01 at 15:44:43 +0200, Laurent Pinchart 
 wrote:
> On Wed, Jul 01, 2020 at 07:06:43PM +0530, Vinod Koul wrote:
> > On 01-07-20, 16:19, Laurent Pinchart wrote:
> > > On Wed, Jul 01, 2020 at 11:04:38AM +0200, Tobias Klauser wrote:
> > > > This fixes the following compiler warning when building with
> > > > CONFIG_PM && !CONFIG_PM_SLEEP:
> > > > 
> > > > drivers/phy/xilinx/phy-zynqmp.c:830:12: warning: ‘xpsgtr_resume’ 
> > > > defined but not used [-Wunused-function]
> > > >   830 | static int xpsgtr_resume(struct device *dev)
> > > >   |^
> > > > drivers/phy/xilinx/phy-zynqmp.c:819:12: warning: ‘xpsgtr_suspend’ 
> > > > defined but not used [-Wunused-function]
> > > >   819 | static int xpsgtr_suspend(struct device *dev)
> > > >   |^~
> > > 
> > > Oops :-S Sorry about that.
> > > 
> > > Reviewed-by: Laurent Pinchart 

Thanks for the review Laurent.

> > > Vinod or Kishon, can you pick this patch up, or do I need to send a pull
> > > request ? (It's my first driver in the PHY subsystem so I don't know
> > > what the usual practices are there)
> > 
> > patches are welcome :-)
> > 
> > > 
> > > > Signed-off-by: Tobias Klauser 
> > > > ---
> > > >  drivers/phy/xilinx/phy-zynqmp.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/phy/xilinx/phy-zynqmp.c 
> > > > b/drivers/phy/xilinx/phy-zynqmp.c
> > > > index 8babee2ce9ec..22a0ae635797 100644
> > > > --- a/drivers/phy/xilinx/phy-zynqmp.c
> > > > +++ b/drivers/phy/xilinx/phy-zynqmp.c
> > > > @@ -815,7 +815,7 @@ static struct phy *xpsgtr_xlate(struct device *dev,
> > > >   * Power Management
> > > >   */
> > > >  
> > > > -#ifdef CONFIG_PM
> > > > +#ifdef CONFIG_PM_SLEEP
> > 
> > How about marking it as __maybe_unused instead?
> 
> I don't mind either, I'll let Tobias decide, but his patch seems fine,
> is there a drawback in his approach ? If it's just a matter of personal
> preference, I'd rather not require a v2.

I don't mind either, it was just what seemed the more straight-forward
fix. On the other hand, it seems that marking these functions as
__maybe_unused is the more widely used method in other PHY drivers. In
addition it would have the nice side-effect of the code always being
compile-checked regardless of the value of CONFIG_PM_SLEEP.

Will send a v2 using __maybe_unused and will let you decide which one to
pick :)

Thanks


[PATCH] phy: zynqmp: Fix unused-function compiler warning

2020-07-01 Thread Tobias Klauser
This fixes the following compiler warning when building with
CONFIG_PM && !CONFIG_PM_SLEEP:

drivers/phy/xilinx/phy-zynqmp.c:830:12: warning: ‘xpsgtr_resume’ defined but 
not used [-Wunused-function]
  830 | static int xpsgtr_resume(struct device *dev)
  |^
drivers/phy/xilinx/phy-zynqmp.c:819:12: warning: ‘xpsgtr_suspend’ defined but 
not used [-Wunused-function]
  819 | static int xpsgtr_suspend(struct device *dev)
  |^~

Signed-off-by: Tobias Klauser 
---
 drivers/phy/xilinx/phy-zynqmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c
index 8babee2ce9ec..22a0ae635797 100644
--- a/drivers/phy/xilinx/phy-zynqmp.c
+++ b/drivers/phy/xilinx/phy-zynqmp.c
@@ -815,7 +815,7 @@ static struct phy *xpsgtr_xlate(struct device *dev,
  * Power Management
  */
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int xpsgtr_suspend(struct device *dev)
 {
struct xpsgtr_dev *gtr_dev = dev_get_drvdata(dev);
@@ -854,7 +854,7 @@ static int xpsgtr_resume(struct device *dev)
 
return 0;
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops xpsgtr_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(xpsgtr_suspend, xpsgtr_resume)
-- 
2.27.0



[PATCH v2] riscv: Allow building with kcov coverage

2020-06-26 Thread Tobias Klauser
Add ARCH_HAS_KCOV and HAVE_GCC_PLUGINS to the riscv Kconfig.
Also disable instrumentation of some early boot code and vdso.

Boot-tested on QEMU's riscv64 virt machine.

Cc: Björn Töpel 
Cc: Dmitry Vyukov 
Signed-off-by: Tobias Klauser 
---
 arch/riscv/Kconfig  | 2 ++
 arch/riscv/boot/Makefile| 2 ++
 arch/riscv/kernel/vdso/Makefile | 1 +
 arch/riscv/mm/Makefile  | 2 ++
 4 files changed, 7 insertions(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 089293e4ad46..a7d7f8184f15 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -19,6 +19,7 @@ config RISCV
select ARCH_HAS_DEBUG_WX
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_HAS_GIGANTIC_PAGE
+   select ARCH_HAS_KCOV
select ARCH_HAS_MMIOWB
select ARCH_HAS_PTE_SPECIAL
select ARCH_HAS_SET_DIRECT_MAP
@@ -57,6 +58,7 @@ config RISCV
select HAVE_DMA_CONTIGUOUS if MMU
select HAVE_EBPF_JIT if MMU
select HAVE_FUTEX_CMPXCHG if FUTEX
+   select HAVE_GCC_PLUGINS
select HAVE_GENERIC_VDSO if MMU && 64BIT
select HAVE_PCI
select HAVE_PERF_EVENTS
diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
index 3530c59b3ea7..c59fca695f9d 100644
--- a/arch/riscv/boot/Makefile
+++ b/arch/riscv/boot/Makefile
@@ -14,6 +14,8 @@
 # Based on the ia64 and arm64 boot/Makefile.
 #
 
+KCOV_INSTRUMENT := n
+
 OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
 
 targets := Image loader
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index 29cf052f6541..4b0d3bcc44e5 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -29,6 +29,7 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
+KCOV_INSTRUMENT := n
 
 # Force dependency
 $(obj)/vdso.o: $(obj)/vdso.so
diff --git a/arch/riscv/mm/Makefile b/arch/riscv/mm/Makefile
index 363ef01c30b1..c0185e556ca5 100644
--- a/arch/riscv/mm/Makefile
+++ b/arch/riscv/mm/Makefile
@@ -5,6 +5,8 @@ ifdef CONFIG_FTRACE
 CFLAGS_REMOVE_init.o = -pg
 endif
 
+KCOV_INSTRUMENT_init.o := n
+
 obj-y += init.o
 obj-y += extable.o
 obj-$(CONFIG_MMU) += fault.o pageattr.o
-- 
2.27.0



Re: [PATCH] csky: remove unusued thread_saved_pc and *_segments functions/macros

2020-06-15 Thread Tobias Klauser
On 2020-06-13 at 10:42:07 +0200, Guo Ren  wrote:
> Acked-by: Guo Ren 

Thanks for the Ack. Are you taking this patch through your own tree or
should I directly submit to someone else?

> On Wed, Jun 10, 2020 at 11:45 PM Tobias Klauser  wrote:
> >
> > These are used nowhere in the tree (except for some architectures which
> > define them for their own use) and were already removed for other
> > architectures in:
> >
> > commit 6474924e2b5d ("arch: remove unused macro/function thread_saved_pc()")
> > commit c17c02040bf0 ("arch: remove unused *_segments() macros/functions")
> >
> > Remove them from arch/csky as well.
> >
> > Signed-off-by: Tobias Klauser 
> > ---
> >  arch/csky/include/asm/processor.h |  6 --
> >  arch/csky/kernel/process.c| 10 --
> >  2 files changed, 16 deletions(-)
> >
> > diff --git a/arch/csky/include/asm/processor.h 
> > b/arch/csky/include/asm/processor.h
> > index 24442d8e86f9..4800f6563abb 100644
> > --- a/arch/csky/include/asm/processor.h
> > +++ b/arch/csky/include/asm/processor.h
> > @@ -82,12 +82,6 @@ static inline void release_thread(struct task_struct 
> > *dead_task)
> >
> >  extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long 
> > flags);
> >
> > -#define copy_segments(tsk, mm) do { } while (0)
> > -#define release_segments(mm)   do { } while (0)
> > -#define forget_segments()  do { } while (0)
> > -
> > -extern unsigned long thread_saved_pc(struct task_struct *tsk);
> > -
> >  unsigned long get_wchan(struct task_struct *p);
> >
> >  #define KSTK_EIP(tsk)  (task_pt_regs(tsk)->pc)
> > diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c
> > index 8b3fad062ab2..3da63cf0bfde 100644
> > --- a/arch/csky/kernel/process.c
> > +++ b/arch/csky/kernel/process.c
> > @@ -30,16 +30,6 @@ asmlinkage void ret_from_kernel_thread(void);
> >   */
> >  void flush_thread(void){}
> >
> > -/*
> > - * Return saved PC from a blocked thread
> > - */
> > -unsigned long thread_saved_pc(struct task_struct *tsk)
> > -{
> > -   struct switch_stack *sw = (struct switch_stack *)tsk->thread.sp;
> > -
> > -   return sw->r15;
> > -}
> > -
> >  int copy_thread_tls(unsigned long clone_flags,
> > unsigned long usp,
> > unsigned long kthread_arg,
> > --
> > 2.27.0
> >
> 
> 
> -- 
> Best Regards
>  Guo Ren
> 
> ML: https://lore.kernel.org/linux-csky/
> 


[PATCH] objtool: Free memory in error case in special_get_alts

2020-06-12 Thread Tobias Klauser
Avoid a memory leak in case get_alt_entry returns an error.

Signed-off-by: Tobias Klauser 
---
 tools/objtool/special.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/special.c b/tools/objtool/special.c
index e74e0189de22..f6f7dee1ba77 100644
--- a/tools/objtool/special.c
+++ b/tools/objtool/special.c
@@ -188,8 +188,10 @@ int special_get_alts(struct elf *elf, struct list_head 
*alts)
memset(alt, 0, sizeof(*alt));
 
ret = get_alt_entry(elf, entry, sec, idx, alt);
-   if (ret)
+   if (ret) {
+   free(alt);
return ret;
+   }
 
list_add_tail(>list, alts);
}
-- 
2.27.0



[PATCH] csky: remove unusued thread_saved_pc and *_segments functions/macros

2020-06-10 Thread Tobias Klauser
These are used nowhere in the tree (except for some architectures which
define them for their own use) and were already removed for other
architectures in:

commit 6474924e2b5d ("arch: remove unused macro/function thread_saved_pc()")
commit c17c02040bf0 ("arch: remove unused *_segments() macros/functions")

Remove them from arch/csky as well.

Signed-off-by: Tobias Klauser 
---
 arch/csky/include/asm/processor.h |  6 --
 arch/csky/kernel/process.c| 10 --
 2 files changed, 16 deletions(-)

diff --git a/arch/csky/include/asm/processor.h 
b/arch/csky/include/asm/processor.h
index 24442d8e86f9..4800f6563abb 100644
--- a/arch/csky/include/asm/processor.h
+++ b/arch/csky/include/asm/processor.h
@@ -82,12 +82,6 @@ static inline void release_thread(struct task_struct 
*dead_task)
 
 extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-#define forget_segments()  do { } while (0)
-
-extern unsigned long thread_saved_pc(struct task_struct *tsk);
-
 unsigned long get_wchan(struct task_struct *p);
 
 #define KSTK_EIP(tsk)  (task_pt_regs(tsk)->pc)
diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c
index 8b3fad062ab2..3da63cf0bfde 100644
--- a/arch/csky/kernel/process.c
+++ b/arch/csky/kernel/process.c
@@ -30,16 +30,6 @@ asmlinkage void ret_from_kernel_thread(void);
  */
 void flush_thread(void){}
 
-/*
- * Return saved PC from a blocked thread
- */
-unsigned long thread_saved_pc(struct task_struct *tsk)
-{
-   struct switch_stack *sw = (struct switch_stack *)tsk->thread.sp;
-
-   return sw->r15;
-}
-
 int copy_thread_tls(unsigned long clone_flags,
unsigned long usp,
unsigned long kthread_arg,
-- 
2.27.0



[PATCH] csky: remove unsued thread_saved_pc and *_segments functions/macros

2019-06-12 Thread Tobias Klauser
These are used nowhere in the tree (except for some architectures which
define them for their own use) and were already removed in:

commit 6474924e2b5d ("arch: remove unused macro/function thread_saved_pc()")
commit c17c02040bf0 ("arch: remove unused *_segments() macros/functions")

Remove them from arch/csky as well.

Signed-off-by: Tobias Klauser 
---
 arch/csky/include/asm/processor.h |  6 --
 arch/csky/kernel/process.c| 10 --
 2 files changed, 16 deletions(-)

diff --git a/arch/csky/include/asm/processor.h 
b/arch/csky/include/asm/processor.h
index 21e0bd5293dd..464575156f0f 100644
--- a/arch/csky/include/asm/processor.h
+++ b/arch/csky/include/asm/processor.h
@@ -83,12 +83,6 @@ static inline void release_thread(struct task_struct 
*dead_task)
 
 extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-#define forget_segments()  do { } while (0)
-
-extern unsigned long thread_saved_pc(struct task_struct *tsk);
-
 unsigned long get_wchan(struct task_struct *p);
 
 #define KSTK_EIP(tsk)  (task_pt_regs(tsk)->pc)
diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c
index e555740c0be5..adeb6b1bdb42 100644
--- a/arch/csky/kernel/process.c
+++ b/arch/csky/kernel/process.c
@@ -24,16 +24,6 @@ asmlinkage void ret_from_kernel_thread(void);
  */
 void flush_thread(void){}
 
-/*
- * Return saved PC from a blocked thread
- */
-unsigned long thread_saved_pc(struct task_struct *tsk)
-{
-   struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
-
-   return sw->r15;
-}
-
 int copy_thread(unsigned long clone_flags,
unsigned long usp,
unsigned long kthread_arg,
-- 
2.20.0



[PATCH] nios2: kconfig: remove duplicate DEBUG_STACK_USAGE symbol defintions

2018-08-16 Thread Tobias Klauser
DEBUG_STACK_USAGE is already defined in lib/Kconfig.debug

Signed-off-by: Tobias Klauser 
---
 arch/nios2/Kconfig.debug | 9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/nios2/Kconfig.debug b/arch/nios2/Kconfig.debug
index 7a49f0d28d14..f1da8a7b17ff 100644
--- a/arch/nios2/Kconfig.debug
+++ b/arch/nios2/Kconfig.debug
@@ -3,15 +3,6 @@
 config TRACE_IRQFLAGS_SUPPORT
def_bool y
 
-config DEBUG_STACK_USAGE
-   bool "Enable stack utilization instrumentation"
-   depends on DEBUG_KERNEL
-   help
- Enables the display of the minimum amount of free stack which each
- task has ever had available in the sysrq-T and sysrq-P debug output.
-
- This option will slow down process creation somewhat.
-
 config EARLY_PRINTK
bool "Activate early kernel debugging"
default y
-- 
2.18.0.130.g98da2f6b3e4a




[PATCH] nios2: kconfig: remove duplicate DEBUG_STACK_USAGE symbol defintions

2018-08-16 Thread Tobias Klauser
DEBUG_STACK_USAGE is already defined in lib/Kconfig.debug

Signed-off-by: Tobias Klauser 
---
 arch/nios2/Kconfig.debug | 9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/nios2/Kconfig.debug b/arch/nios2/Kconfig.debug
index 7a49f0d28d14..f1da8a7b17ff 100644
--- a/arch/nios2/Kconfig.debug
+++ b/arch/nios2/Kconfig.debug
@@ -3,15 +3,6 @@
 config TRACE_IRQFLAGS_SUPPORT
def_bool y
 
-config DEBUG_STACK_USAGE
-   bool "Enable stack utilization instrumentation"
-   depends on DEBUG_KERNEL
-   help
- Enables the display of the minimum amount of free stack which each
- task has ever had available in the sysrq-T and sysrq-P debug output.
-
- This option will slow down process creation somewhat.
-
 config EARLY_PRINTK
bool "Activate early kernel debugging"
default y
-- 
2.18.0.130.g98da2f6b3e4a




Re: [PATCH net-next] net: ethoc: Remove useless test before clk_disable_unprepare

2018-05-16 Thread Tobias Klauser
On 2018-05-16 at 13:18:22 +0200, YueHaibing <yuehaib...@huawei.com> wrote:
> clk_disable_unprepare() already checks that the clock pointer is valid.
> No need to test it before calling it.
> 
> Signed-off-by: YueHaibing <yuehaib...@huawei.com>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>


Re: [PATCH net-next] net: ethoc: Remove useless test before clk_disable_unprepare

2018-05-16 Thread Tobias Klauser
On 2018-05-16 at 13:18:22 +0200, YueHaibing  wrote:
> clk_disable_unprepare() already checks that the clock pointer is valid.
> No need to test it before calling it.
> 
> Signed-off-by: YueHaibing 

Reviewed-by: Tobias Klauser 


[PATCH] scripts/checkstack.pl: remove blackfin support

2018-03-14 Thread Tobias Klauser
The Blackfin port has been removed from the kernel, also remove the
blackfin specific bits from the checkstack.pl script.

Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---

Patch against the Arnd's asm-generic tree.

 scripts/checkstack.pl | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index eeb9ac8dbcfb..cbdf0dfd4c22 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -98,9 +98,6 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
# pair for larger users. -- PFM.
#a00048e0:   d4fc40f0addi.l  r15,-240,r15
$re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o;
-   } elsif ($arch =~ /^blackfin$/) {
-   #   0:   00 e8 38 01 LINK 0x4e0;
-   $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o;
} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
# f0019d10:   9d e3 bf 90 save  %sp, -112, %sp
$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
-- 
2.13.0



[PATCH] scripts/checkstack.pl: remove blackfin support

2018-03-14 Thread Tobias Klauser
The Blackfin port has been removed from the kernel, also remove the
blackfin specific bits from the checkstack.pl script.

Signed-off-by: Tobias Klauser 
---

Patch against the Arnd's asm-generic tree.

 scripts/checkstack.pl | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index eeb9ac8dbcfb..cbdf0dfd4c22 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -98,9 +98,6 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
# pair for larger users. -- PFM.
#a00048e0:   d4fc40f0addi.l  r15,-240,r15
$re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o;
-   } elsif ($arch =~ /^blackfin$/) {
-   #   0:   00 e8 38 01 LINK 0x4e0;
-   $re = qr/.*[[:space:]]LINK[[:space:]]*(0x$x{1,8})/o;
} elsif ($arch eq 'sparc' || $arch eq 'sparc64') {
# f0019d10:   9d e3 bf 90 save  %sp, -112, %sp
$re = qr/.*save.*%sp, -(([0-9]{2}|[3-9])[0-9]{2}), %sp/o;
-- 
2.13.0



Re: [PATCH] nios2: add ioremap_nocache declaration before include asm-generic/io.h.

2018-03-02 Thread Tobias Klauser
On 2018-03-01 at 17:39:43 +0100, Greentime Hu <green...@gmail.com> wrote:
> A commit for the nds32 architecture bootstrap("asm-generic/io.h:
> move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef
> CONFIG_MMU") will move the ioremap_nocache out of the CONFIG_MMU ifdef.
> This means that in order to suppress re-definition errors we need to
> setup #define's before importing asm-generic/io.h.
> 
> Signed-off-by: Greentime Hu <greent...@andestech.com>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>

Thanks


Re: [PATCH] nios2: add ioremap_nocache declaration before include asm-generic/io.h.

2018-03-02 Thread Tobias Klauser
On 2018-03-01 at 17:39:43 +0100, Greentime Hu  wrote:
> A commit for the nds32 architecture bootstrap("asm-generic/io.h:
> move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef
> CONFIG_MMU") will move the ioremap_nocache out of the CONFIG_MMU ifdef.
> This means that in order to suppress re-definition errors we need to
> setup #define's before importing asm-generic/io.h.
> 
> Signed-off-by: Greentime Hu 

Reviewed-by: Tobias Klauser 

Thanks


[PATCH] score: remove unused __ARCH_HAVE_MMU define

2018-01-25 Thread Tobias Klauser
The __ARCH_HAVE_MMU define is (and was) used nowhere in the tree and
also doesn't appear to be used by any libc.

Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---
 arch/score/include/uapi/asm/unistd.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/score/include/uapi/asm/unistd.h 
b/arch/score/include/uapi/asm/unistd.h
index 04da47bd3d46..6f37a12ee9c4 100644
--- a/arch/score/include/uapi/asm/unistd.h
+++ b/arch/score/include/uapi/asm/unistd.h
@@ -1,5 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#define __ARCH_HAVE_MMU
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SYSCALL_NO_AT
-- 
2.13.0



[PATCH] score: remove unused __ARCH_HAVE_MMU define

2018-01-25 Thread Tobias Klauser
The __ARCH_HAVE_MMU define is (and was) used nowhere in the tree and
also doesn't appear to be used by any libc.

Signed-off-by: Tobias Klauser 
---
 arch/score/include/uapi/asm/unistd.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/score/include/uapi/asm/unistd.h 
b/arch/score/include/uapi/asm/unistd.h
index 04da47bd3d46..6f37a12ee9c4 100644
--- a/arch/score/include/uapi/asm/unistd.h
+++ b/arch/score/include/uapi/asm/unistd.h
@@ -1,5 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#define __ARCH_HAVE_MMU
 
 #define __ARCH_WANT_RENAMEAT
 #define __ARCH_WANT_SYSCALL_NO_AT
-- 
2.13.0



Re: [RESEND PATCH] nios2: defconfig: Cleanup from old Kconfig options

2018-01-22 Thread Tobias Klauser
On 2017-12-26 at 14:32:07 +0100, Krzysztof Kozlowski <k...@kernel.org> wrote:
> Remove old, dead Kconfig option INET_LRO. It is gone since
> commit 7bbf3cae65b6 ("ipv4: Remove inet_lro library").
> 
> Signed-off-by: Krzysztof Kozlowski <k...@kernel.org>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>


Re: [RESEND PATCH] nios2: defconfig: Cleanup from old Kconfig options

2018-01-22 Thread Tobias Klauser
On 2017-12-26 at 14:32:07 +0100, Krzysztof Kozlowski  wrote:
> Remove old, dead Kconfig option INET_LRO. It is gone since
> commit 7bbf3cae65b6 ("ipv4: Remove inet_lro library").
> 
> Signed-off-by: Krzysztof Kozlowski 

Reviewed-by: Tobias Klauser 


Re: [PATCH 5/7] nios2: remove arch specific early_init_dt_alloc_memory_arch

2018-01-17 Thread Tobias Klauser
On 2018-01-06 at 00:20:52 +0100, Rob Herring <r...@kernel.org> wrote:
> Now that the DT core code handles bootmem arches, we can remove the nios2
> specific early_init_dt_alloc_memory_arch function.
> 
> Cc: Ley Foon Tan <lf...@altera.com>
> Cc: nios2-...@lists.rocketboards.org
> Signed-off-by: Rob Herring <r...@kernel.org>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>


Re: [PATCH 5/7] nios2: remove arch specific early_init_dt_alloc_memory_arch

2018-01-17 Thread Tobias Klauser
On 2018-01-06 at 00:20:52 +0100, Rob Herring  wrote:
> Now that the DT core code handles bootmem arches, we can remove the nios2
> specific early_init_dt_alloc_memory_arch function.
> 
> Cc: Ley Foon Tan 
> Cc: nios2-...@lists.rocketboards.org
> Signed-off-by: Rob Herring 

Reviewed-by: Tobias Klauser 


Re: [PATCH] nios2: dts: Remove leading 0x and 0s from bindings notation

2017-12-21 Thread Tobias Klauser
On 2017-12-14 at 17:53:59 +0100, Mathieu Malaterre <ma...@debian.org> wrote:
> Improve the DTS files by removing all the leading "0x" and zeros to fix the
> following dtc warnings:
> 
> Warning (unit_address_format): Node /XXX unit name should not have leading 
> "0x"
> 
> and
> 
> Warning (unit_address_format): Node /XXX unit name should not have leading 0s
> 
> Converted using the following command:
> 
> find . -type f \( -iname *.dts -o -iname *.dtsi \) -exec sed -E -i -e 
> "s/@0x([0-9a-fA-F\.]+)\s?\{/@\L\1 \{/g" -e "s/@0+([0-9a-fA-F\.]+)\s?\{/@\L\1 
> \{/g" {} +
> 
> For simplicity, two sed expressions were used to solve each warnings 
> separately.
> 
> To make the regex expression more robust a few other issues were resolved,
> namely setting unit-address to lower case, and adding a whitespace before the
> the opening curly brace:
> 
> https://elinux.org/Device_Tree_Linux#Linux_conventions
> 
> This is a follow up to commit 4c9847b7375a ("dt-bindings: Remove leading 0x 
> from bindings notation")
> 
> Reported-by: David Daney <dda...@caviumnetworks.com>
> Suggested-by: Rob Herring <r...@kernel.org>
> Signed-off-by: Mathieu Malaterre <ma...@debian.org>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>

This file was originally generated by sopc2dts [1], so it'll probably
need updating as well (Cc'ing Walter).

[1] https://github.com/wgoossens/sopc2dts

> ---
>  arch/nios2/boot/dts/3c120_devboard.dts | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/nios2/boot/dts/3c120_devboard.dts 
> b/arch/nios2/boot/dts/3c120_devboard.dts
> index 36ccdf05837d..56f4b5df6d65 100644
> --- a/arch/nios2/boot/dts/3c120_devboard.dts
> +++ b/arch/nios2/boot/dts/3c120_devboard.dts
> @@ -29,7 +29,7 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>  
> - cpu: cpu@0x0 {
> + cpu: cpu@0 {
>   device_type = "cpu";
>   compatible = "altr,nios2-1.0";
>   reg = <0x>;
> @@ -69,7 +69,7 @@
>   compatible = "altr,avalon", "simple-bus";
>   bus-frequency = <12500>;
>  
> - pb_cpu_to_io: bridge@0x800 {
> + pb_cpu_to_io: bridge@800 {
>   compatible = "simple-bus";
>   reg = <0x0800 0x0080>;
>   #address-cells = <1>;
> @@ -83,7 +83,7 @@
>   <0x8000 0x08008000 0x0020>,
>   <0x0040 0x0840 0x0020>;
>  
> - timer_1ms: timer@0x40 {
> + timer_1ms: timer@40 {
>   compatible = "altr,timer-1.0";
>   reg = <0x0040 0x0020>;
>   interrupt-parent = <>;
> @@ -91,7 +91,7 @@
>   clock-frequency = <12500>;
>   };
>  
> - timer_0: timer@0x8000 {
> + timer_0: timer@8000 {
>   compatible = "altr,timer-1.0";
>   reg = < 0x8000 0x0020 >;
>   interrupt-parent = <  >;
> @@ -99,14 +99,14 @@
>   clock-frequency = < 12500 >;
>   };
>  
> - jtag_uart: serial@0x4d50 {
> + jtag_uart: serial@4d50 {
>   compatible = "altr,juart-1.0";
>   reg = <0x4d50 0x0008>;
>   interrupt-parent = <>;
>   interrupts = <1>;
>   };
>  
> - tse_mac: ethernet@0x4000 {
> + tse_mac: ethernet@4000 {
>   compatible = "altr,tse-1.0";
>   reg = <0x4000 0x0400>,
>   <0x4400 0x0040>,
> @@ -133,7 +133,7 @@
>   };
>   };
>  
> - uart: serial@0x4c80 {
> + uart: serial@4c80 {
>   compatible = "altr,uart-1.0";
>   reg = <0x4c80 0x0020>;
>   interrupt-parent = <>;
> @@ -143,7 +143,7 @@
>   };
>   };
>  
> - cfi_flash_64m: flash@0x0 {
> + cfi_flash_64m: flash@0 {
>   compatible = "cfi-flash";
>   reg = <0x 0x0400>;
>   bank-width = <2>;
> -- 
> 2.11.0
> 


Re: [PATCH] nios2: dts: Remove leading 0x and 0s from bindings notation

2017-12-21 Thread Tobias Klauser
On 2017-12-14 at 17:53:59 +0100, Mathieu Malaterre  wrote:
> Improve the DTS files by removing all the leading "0x" and zeros to fix the
> following dtc warnings:
> 
> Warning (unit_address_format): Node /XXX unit name should not have leading 
> "0x"
> 
> and
> 
> Warning (unit_address_format): Node /XXX unit name should not have leading 0s
> 
> Converted using the following command:
> 
> find . -type f \( -iname *.dts -o -iname *.dtsi \) -exec sed -E -i -e 
> "s/@0x([0-9a-fA-F\.]+)\s?\{/@\L\1 \{/g" -e "s/@0+([0-9a-fA-F\.]+)\s?\{/@\L\1 
> \{/g" {} +
> 
> For simplicity, two sed expressions were used to solve each warnings 
> separately.
> 
> To make the regex expression more robust a few other issues were resolved,
> namely setting unit-address to lower case, and adding a whitespace before the
> the opening curly brace:
> 
> https://elinux.org/Device_Tree_Linux#Linux_conventions
> 
> This is a follow up to commit 4c9847b7375a ("dt-bindings: Remove leading 0x 
> from bindings notation")
> 
> Reported-by: David Daney 
> Suggested-by: Rob Herring 
> Signed-off-by: Mathieu Malaterre 

Reviewed-by: Tobias Klauser 

This file was originally generated by sopc2dts [1], so it'll probably
need updating as well (Cc'ing Walter).

[1] https://github.com/wgoossens/sopc2dts

> ---
>  arch/nios2/boot/dts/3c120_devboard.dts | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/nios2/boot/dts/3c120_devboard.dts 
> b/arch/nios2/boot/dts/3c120_devboard.dts
> index 36ccdf05837d..56f4b5df6d65 100644
> --- a/arch/nios2/boot/dts/3c120_devboard.dts
> +++ b/arch/nios2/boot/dts/3c120_devboard.dts
> @@ -29,7 +29,7 @@
>   #address-cells = <1>;
>   #size-cells = <0>;
>  
> - cpu: cpu@0x0 {
> + cpu: cpu@0 {
>   device_type = "cpu";
>   compatible = "altr,nios2-1.0";
>   reg = <0x>;
> @@ -69,7 +69,7 @@
>   compatible = "altr,avalon", "simple-bus";
>   bus-frequency = <12500>;
>  
> - pb_cpu_to_io: bridge@0x800 {
> + pb_cpu_to_io: bridge@800 {
>   compatible = "simple-bus";
>   reg = <0x0800 0x0080>;
>   #address-cells = <1>;
> @@ -83,7 +83,7 @@
>   <0x8000 0x08008000 0x0020>,
>   <0x0040 0x0840 0x0020>;
>  
> - timer_1ms: timer@0x40 {
> + timer_1ms: timer@40 {
>   compatible = "altr,timer-1.0";
>   reg = <0x0040 0x0020>;
>   interrupt-parent = <>;
> @@ -91,7 +91,7 @@
>   clock-frequency = <12500>;
>   };
>  
> - timer_0: timer@0x8000 {
> + timer_0: timer@8000 {
>   compatible = "altr,timer-1.0";
>   reg = < 0x8000 0x0020 >;
>   interrupt-parent = <  >;
> @@ -99,14 +99,14 @@
>   clock-frequency = < 12500 >;
>   };
>  
> - jtag_uart: serial@0x4d50 {
> + jtag_uart: serial@4d50 {
>   compatible = "altr,juart-1.0";
>   reg = <0x4d50 0x0008>;
>   interrupt-parent = <>;
>   interrupts = <1>;
>   };
>  
> - tse_mac: ethernet@0x4000 {
> + tse_mac: ethernet@4000 {
>   compatible = "altr,tse-1.0";
>   reg = <0x4000 0x0400>,
>   <0x4400 0x0040>,
> @@ -133,7 +133,7 @@
>   };
>   };
>  
> - uart: serial@0x4c80 {
> + uart: serial@4c80 {
>   compatible = "altr,uart-1.0";
>   reg = <0x4c80 0x0020>;
>   interrupt-parent = <>;
> @@ -143,7 +143,7 @@
>   };
>   };
>  
> - cfi_flash_64m: flash@0x0 {
> + cfi_flash_64m: flash@0 {
>   compatible = "cfi-flash";
>   reg = <0x 0x0400>;
>   bank-width = <2>;
> -- 
> 2.11.0
> 


Re: [PATCH 36/45] arch/nios2: remove duplicate includes

2017-12-11 Thread Tobias Klauser
On 2017-12-10 at 19:22:51 +0100, Pravin Shedge <pravin.shedge4li...@gmail.com> 
wrote:
> These duplicate includes have been found with scripts/checkincludes.pl but
> they have been removed manually to avoid removing false positives.
> 
> Signed-off-by: Pravin Shedge <pravin.shedge4li...@gmail.com>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>

Thanks


Re: [PATCH 36/45] arch/nios2: remove duplicate includes

2017-12-11 Thread Tobias Klauser
On 2017-12-10 at 19:22:51 +0100, Pravin Shedge  
wrote:
> These duplicate includes have been found with scripts/checkincludes.pl but
> they have been removed manually to avoid removing false positives.
> 
> Signed-off-by: Pravin Shedge 

Reviewed-by: Tobias Klauser 

Thanks


Re: [PATCH 03/31] nds32: Support early_printk

2017-11-08 Thread Tobias Klauser
On 2017-11-08 at 06:54:51 +0100, Greentime Hu  wrote:
> From: Greentime Hu 
> 
> Signed-off-by: Rick Chen 
> Signed-off-by: Greentime Hu 
> ---
>  arch/nds32/kernel/early_printk.c |  124 
> ++
>  1 file changed, 124 insertions(+)
>  create mode 100644 arch/nds32/kernel/early_printk.c
> 
> diff --git a/arch/nds32/kernel/early_printk.c 
> b/arch/nds32/kernel/early_printk.c
> new file mode 100644
> index 000..269c3cd
> --- /dev/null
> +++ b/arch/nds32/kernel/early_printk.c

Could be implemented using earlycon (the 8250 drivers already supports
it) instead of duplicating functionality in arch/nds32?  See e.g. the
nios2 port for how this could be done, specifically commit e118c3fec9c0
("nios2: remove custom early console implementation").


Re: [PATCH 03/31] nds32: Support early_printk

2017-11-08 Thread Tobias Klauser
On 2017-11-08 at 06:54:51 +0100, Greentime Hu  wrote:
> From: Greentime Hu 
> 
> Signed-off-by: Rick Chen 
> Signed-off-by: Greentime Hu 
> ---
>  arch/nds32/kernel/early_printk.c |  124 
> ++
>  1 file changed, 124 insertions(+)
>  create mode 100644 arch/nds32/kernel/early_printk.c
> 
> diff --git a/arch/nds32/kernel/early_printk.c 
> b/arch/nds32/kernel/early_printk.c
> new file mode 100644
> index 000..269c3cd
> --- /dev/null
> +++ b/arch/nds32/kernel/early_printk.c

Could be implemented using earlycon (the 8250 drivers already supports
it) instead of duplicating functionality in arch/nds32?  See e.g. the
nios2 port for how this could be done, specifically commit e118c3fec9c0
("nios2: remove custom early console implementation").


Re: [patch v11 4/4] Documentation: jtag: Add ABI documentation

2017-11-07 Thread Tobias Klauser
On 2017-11-03 at 16:54:09 +0100, Oleksandr Shamray  
wrote:
> Added document that describe the ABI for JTAG class drivrer
> 
> Signed-off-by: Oleksandr Shamray 
> Acked-by: Arnd Bergmann 
> ---
> v10->v11
> v9->v10
> Fixes added by Oleksandr:
> - change jtag-cdev to jtag-dev in documentation
> - update Kernel Version and Date in jtag-dev documentation;
> v8->v9
> v7->v8
> v6->v7
> Comments pointed by Pavel Machek 
> - Added jtag-cdev documentation to Documentation/ABI/testing folder
> ---
>  Documentation/ABI/testing/jatg-dev |   27 +++
>  1 files changed, 27 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/ABI/testing/jatg-dev
> 
> diff --git a/Documentation/ABI/testing/jatg-dev 
> b/Documentation/ABI/testing/jatg-dev
> new file mode 100644
> index 000..803dbab
> --- /dev/null
> +++ b/Documentation/ABI/testing/jatg-dev

Typo in the file name: s/jatg-dev/jtag-dev/

> @@ -0,0 +1,27 @@
> +What:/dev/jtag[0-9]+
> +Date:October 2017
> +KernelVersion:   4.15
> +Contact: oleksan...@mellanox.com
> +Description:
> + The misc device files /dev/jtag* are the interface
> + between JTAG master interfase and userspace.

Typo: s/interfase/interface/

> +
> + The ioctl(2)-based ABI is defined and documented in
> + [include/uapi].
> +
> + The following file operations are supported:
> +
> + open(2)
> + The argument flag currently support only one access
> + mode O_RDWR.
> +
> + ioctl(2)
> + Initiate various actions.
> + See the inline documentation in [include/uapi]
> + for descriptions of all ioctls.
> +
> + close(2)
> + Stops and free up the I/O contexts that was associated
> + with the file descriptor.
> +
> +Users:   TBD
> \ No newline at end of file
> -- 
> 1.7.1
> 


Re: [patch v11 4/4] Documentation: jtag: Add ABI documentation

2017-11-07 Thread Tobias Klauser
On 2017-11-03 at 16:54:09 +0100, Oleksandr Shamray  
wrote:
> Added document that describe the ABI for JTAG class drivrer
> 
> Signed-off-by: Oleksandr Shamray 
> Acked-by: Arnd Bergmann 
> ---
> v10->v11
> v9->v10
> Fixes added by Oleksandr:
> - change jtag-cdev to jtag-dev in documentation
> - update Kernel Version and Date in jtag-dev documentation;
> v8->v9
> v7->v8
> v6->v7
> Comments pointed by Pavel Machek 
> - Added jtag-cdev documentation to Documentation/ABI/testing folder
> ---
>  Documentation/ABI/testing/jatg-dev |   27 +++
>  1 files changed, 27 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/ABI/testing/jatg-dev
> 
> diff --git a/Documentation/ABI/testing/jatg-dev 
> b/Documentation/ABI/testing/jatg-dev
> new file mode 100644
> index 000..803dbab
> --- /dev/null
> +++ b/Documentation/ABI/testing/jatg-dev

Typo in the file name: s/jatg-dev/jtag-dev/

> @@ -0,0 +1,27 @@
> +What:/dev/jtag[0-9]+
> +Date:October 2017
> +KernelVersion:   4.15
> +Contact: oleksan...@mellanox.com
> +Description:
> + The misc device files /dev/jtag* are the interface
> + between JTAG master interfase and userspace.

Typo: s/interfase/interface/

> +
> + The ioctl(2)-based ABI is defined and documented in
> + [include/uapi].
> +
> + The following file operations are supported:
> +
> + open(2)
> + The argument flag currently support only one access
> + mode O_RDWR.
> +
> + ioctl(2)
> + Initiate various actions.
> + See the inline documentation in [include/uapi]
> + for descriptions of all ioctls.
> +
> + close(2)
> + Stops and free up the I/O contexts that was associated
> + with the file descriptor.
> +
> +Users:   TBD
> \ No newline at end of file
> -- 
> 1.7.1
> 


Re: [PATCH] asm-generic/io.h: remove unnecessary include of linux/vmalloc.h

2017-11-07 Thread Tobias Klauser
Hi Arnd

On 2017-09-05 at 17:11:50 +0200, Arnd Bergmann <a...@arndb.de> wrote:
> On Tue, Sep 5, 2017 at 1:27 PM, Tobias Klauser <tklau...@distanz.ch> wrote:
> > Including linux/vmalloc.h in asm-generic/io.h isn't necessary since none
> > of the definitions are used in the header itself. Remove the include in
> > order to avoid potential header dependency problems if other headers
> > rely on implict inclusion of linux/vmalloc.h which means that changes
> > there could break unrelated parts.
> >
> > Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
> > ---
> >  include/asm-generic/io.h | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> > index b4531e3b2120..d2d3bd163f5f 100644
> > --- a/include/asm-generic/io.h
> > +++ b/include/asm-generic/io.h
> > @@ -764,7 +764,6 @@ static inline void iowrite64_rep(volatile void __iomem 
> > *addr,
> >
> >  #ifdef __KERNEL__
> >
> > -#include 
> >  #define __io_virt(x) ((void __force *)(x))
> >
> >  #ifndef CONFIG_GENERIC_IOMAP
> 
> This seems like a good idea in principle, but I think it needs to be tested
> well before we apply it, to avoid breaking random drivers that forgot to
> add their own includes of that header.
> 
> I've added your patch to my testing queue, but not to the asm-generic
> tree now. We should see if it leads to any randconfig build regressions
> on the architectures I normally test.

Did you see any other breakages caused by this patch in your testing
queue besides the ones you alredy reported/fixed? Would this be
something appropriate to submit during the next merge window? Or at
least to be included in linux-next so it gets some more coverage?

Thanks
Tobias


Re: [PATCH] asm-generic/io.h: remove unnecessary include of linux/vmalloc.h

2017-11-07 Thread Tobias Klauser
Hi Arnd

On 2017-09-05 at 17:11:50 +0200, Arnd Bergmann  wrote:
> On Tue, Sep 5, 2017 at 1:27 PM, Tobias Klauser  wrote:
> > Including linux/vmalloc.h in asm-generic/io.h isn't necessary since none
> > of the definitions are used in the header itself. Remove the include in
> > order to avoid potential header dependency problems if other headers
> > rely on implict inclusion of linux/vmalloc.h which means that changes
> > there could break unrelated parts.
> >
> > Signed-off-by: Tobias Klauser 
> > ---
> >  include/asm-generic/io.h | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> > index b4531e3b2120..d2d3bd163f5f 100644
> > --- a/include/asm-generic/io.h
> > +++ b/include/asm-generic/io.h
> > @@ -764,7 +764,6 @@ static inline void iowrite64_rep(volatile void __iomem 
> > *addr,
> >
> >  #ifdef __KERNEL__
> >
> > -#include 
> >  #define __io_virt(x) ((void __force *)(x))
> >
> >  #ifndef CONFIG_GENERIC_IOMAP
> 
> This seems like a good idea in principle, but I think it needs to be tested
> well before we apply it, to avoid breaking random drivers that forgot to
> add their own includes of that header.
> 
> I've added your patch to my testing queue, but not to the asm-generic
> tree now. We should see if it leads to any randconfig build regressions
> on the architectures I normally test.

Did you see any other breakages caused by this patch in your testing
queue besides the ones you alredy reported/fixed? Would this be
something appropriate to submit during the next merge window? Or at
least to be included in linux-next so it gets some more coverage?

Thanks
Tobias


Re: [PATCH] net: hns: set correct return value

2017-10-30 Thread Tobias Klauser
On 2017-10-30 at 09:50:01 +0100, Pan Bian <bianpan2...@163.com> wrote:
> The function of_parse_phandle() returns a NULL pointer if it cannot
> resolve a phandle property to a device_node pointer. In function
> hns_nic_dev_probe(), its return value is passed to PTR_ERR to extract
> the error code. However, in this case, the extracted error code will
> always be zero, which is unexpected.
> 
> Signed-off-by: Pan Bian <bianpan2...@163.com>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>


Re: [PATCH] net: hns: set correct return value

2017-10-30 Thread Tobias Klauser
On 2017-10-30 at 09:50:01 +0100, Pan Bian  wrote:
> The function of_parse_phandle() returns a NULL pointer if it cannot
> resolve a phandle property to a device_node pointer. In function
> hns_nic_dev_probe(), its return value is passed to PTR_ERR to extract
> the error code. However, in this case, the extracted error code will
> always be zero, which is unexpected.
> 
> Signed-off-by: Pan Bian 

Reviewed-by: Tobias Klauser 


Re: net: hns: set correct return value

2017-10-30 Thread Tobias Klauser
On 2017-10-29 at 15:35:32 +0100, Pan Bian <bianpan2...@163.com> wrote:
> The function of_parse_phandle() returns a NULL pointer if it cannot
> resolve a phandle property to a device_node pointer. In function
> hns_nic_dev_probe(), its return value is passed to PTR_ERR to extract
> the error code. However, in this case, the extracted error code will
> always be zero, which is unexpected.
> 
> Signed-off-by: Pan Bian <bianpan2...@163.com>

The subject is missing a [PATCH] prefix which causes the patch e.g. to
not show up on patchwork [1]. Care to resend with the proper subject?

[1] https://patchwork.ozlabs.org/project/netdev/list/

Care to resend with the proper subject?

For the patch itself:

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>


Re: net: hns: set correct return value

2017-10-30 Thread Tobias Klauser
On 2017-10-29 at 15:35:32 +0100, Pan Bian  wrote:
> The function of_parse_phandle() returns a NULL pointer if it cannot
> resolve a phandle property to a device_node pointer. In function
> hns_nic_dev_probe(), its return value is passed to PTR_ERR to extract
> the error code. However, in this case, the extracted error code will
> always be zero, which is unexpected.
> 
> Signed-off-by: Pan Bian 

The subject is missing a [PATCH] prefix which causes the patch e.g. to
not show up on patchwork [1]. Care to resend with the proper subject?

[1] https://patchwork.ozlabs.org/project/netdev/list/

Care to resend with the proper subject?

For the patch itself:

Reviewed-by: Tobias Klauser 


Re: [PATCH] tty/serial: altera_uart: Convert timers to use timer_setup()

2017-10-24 Thread Tobias Klauser
On 2017-10-24 at 11:59:56 +0200, Kees Cook <keesc...@chromium.org> wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: Tobias Klauser <tklau...@distanz.ch>
> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> Cc: Jiri Slaby <jsl...@suse.com>
> Cc: linux-ser...@vger.kernel.org
> Cc: nios2-...@lists.rocketboards.org
> Signed-off-by: Kees Cook <keesc...@chromium.org>

Acked-by: Tobias Klauser <tklau...@distanz.ch>

Thank you


Re: [PATCH] tty/serial: altera_uart: Convert timers to use timer_setup()

2017-10-24 Thread Tobias Klauser
On 2017-10-24 at 11:59:56 +0200, Kees Cook  wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: Tobias Klauser 
> Cc: Greg Kroah-Hartman 
> Cc: Jiri Slaby 
> Cc: linux-ser...@vger.kernel.org
> Cc: nios2-...@lists.rocketboards.org
> Signed-off-by: Kees Cook 

Acked-by: Tobias Klauser 

Thank you


Re: [PATCH] net: dl2k: Convert timers to use timer_setup()

2017-10-05 Thread Tobias Klauser
On 2017-10-05 at 02:51:50 +0200, Kees Cook <keesc...@chromium.org> wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: "David S. Miller" <da...@davemloft.net>
> Cc: Jarod Wilson <ja...@redhat.com>
> Cc: Tobias Klauser <tklau...@distanz.ch>
> Cc: Philippe Reynes <trem...@gmail.com>
> Cc: net...@vger.kernel.org
> Cc: Thomas Gleixner <t...@linutronix.de>
> Signed-off-by: Kees Cook <keesc...@chromium.org>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>


Re: [PATCH] net: dl2k: Convert timers to use timer_setup()

2017-10-05 Thread Tobias Klauser
On 2017-10-05 at 02:51:50 +0200, Kees Cook  wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: "David S. Miller" 
> Cc: Jarod Wilson 
> Cc: Tobias Klauser 
> Cc: Philippe Reynes 
> Cc: net...@vger.kernel.org
> Cc: Thomas Gleixner 
> Signed-off-by: Kees Cook 

Reviewed-by: Tobias Klauser 


Re: [PATCH] net: tulip: de2104x: Convert timers to use

2017-10-05 Thread Tobias Klauser
On 2017-10-05 at 02:50:48 +0200, Kees Cook <keesc...@chromium.org> wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: "David S. Miller" <da...@davemloft.net>
> Cc: "yuval.sh...@oracle.com" <yuval.sh...@oracle.com>
> Cc: Tobias Klauser <tklau...@distanz.ch>
> Cc: Jarod Wilson <ja...@redhat.com>
> Cc: Philippe Reynes <trem...@gmail.com>
> Cc: net...@vger.kernel.org
> Cc: linux-par...@vger.kernel.org
> Cc: Thomas Gleixner <t...@linutronix.de>
> Signed-off-by: Kees Cook <keesc...@chromium.org>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>


Re: [PATCH] net: tulip: de2104x: Convert timers to use

2017-10-05 Thread Tobias Klauser
On 2017-10-05 at 02:50:48 +0200, Kees Cook  wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: "David S. Miller" 
> Cc: "yuval.sh...@oracle.com" 
> Cc: Tobias Klauser 
> Cc: Jarod Wilson 
> Cc: Philippe Reynes 
> Cc: net...@vger.kernel.org
> Cc: linux-par...@vger.kernel.org
> Cc: Thomas Gleixner 
> Signed-off-by: Kees Cook 

Reviewed-by: Tobias Klauser 


[PATCH] arch: remove unused *_segments() macros/functions

2017-09-22 Thread Tobias Klauser
Some architectures define the no-op macros/functions copy_segments,
release_segments and forget_segments. These are used nowhere in the
tree, so removed them.

Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---
 arch/arc/include/asm/processor.h|  3 ---
 arch/c6x/include/asm/processor.h|  3 ---
 arch/frv/include/asm/processor.h|  4 
 arch/m32r/include/asm/processor.h   |  8 
 arch/metag/include/asm/processor.h  |  3 ---
 arch/mn10300/kernel/process.c   | 12 
 arch/sh/include/asm/processor_32.h  |  4 
 arch/sh/include/asm/processor_64.h  |  4 
 arch/um/include/asm/processor-generic.h |  5 -
 arch/xtensa/include/asm/processor.h |  5 -
 10 files changed, 51 deletions(-)

diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h
index d400a2161935..8ee41e988169 100644
--- a/arch/arc/include/asm/processor.h
+++ b/arch/arc/include/asm/processor.h
@@ -78,9 +78,6 @@ struct task_struct;
 
 #endif
 
-#define copy_segments(tsk, mm)  do { } while (0)
-#define release_segments(mm)do { } while (0)
-
 #define KSTK_EIP(tsk)   (task_pt_regs(tsk)->ret)
 #define KSTK_ESP(tsk)   (task_pt_regs(tsk)->sp)
 
diff --git a/arch/c6x/include/asm/processor.h b/arch/c6x/include/asm/processor.h
index 7c87b5be53b5..8f7cce829f8e 100644
--- a/arch/c6x/include/asm/processor.h
+++ b/arch/c6x/include/asm/processor.h
@@ -92,9 +92,6 @@ static inline void release_thread(struct task_struct 
*dead_task)
 {
 }
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-
 /*
  * saved kernel SP and DP of a blocked thread.
  */
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h
index e4d08d74ed9f..021cce78b401 100644
--- a/arch/frv/include/asm/processor.h
+++ b/arch/frv/include/asm/processor.h
@@ -92,10 +92,6 @@ static inline void release_thread(struct task_struct 
*dead_task)
 extern asmlinkage void save_user_regs(struct user_context *target);
 extern asmlinkage void *restore_user_regs(const struct user_context *target, 
...);
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-#define forget_segments()  do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 
 #defineKSTK_EIP(tsk)   ((tsk)->thread.frame0->pc)
diff --git a/arch/m32r/include/asm/processor.h 
b/arch/m32r/include/asm/processor.h
index 657874eeeccc..c70fa9ac7169 100644
--- a/arch/m32r/include/asm/processor.h
+++ b/arch/m32r/include/asm/processor.h
@@ -118,14 +118,6 @@ struct mm_struct;
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Copy and release all segment info associated with a VM */
-extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
-extern void release_segments(struct mm_struct * mm);
-
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(p, mm)  do { } while (0)
-#define release_segments(mm)  do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 #define KSTK_EIP(tsk)  ((tsk)->thread.lr)
 #define KSTK_ESP(tsk)  ((tsk)->thread.sp)
diff --git a/arch/metag/include/asm/processor.h 
b/arch/metag/include/asm/processor.h
index ec6a49076980..8ae92d6abfd2 100644
--- a/arch/metag/include/asm/processor.h
+++ b/arch/metag/include/asm/processor.h
@@ -131,9 +131,6 @@ static inline void release_thread(struct task_struct 
*dead_task)
 {
 }
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-
 /*
  * Return saved PC of a blocked thread.
  */
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index 89e8027e07fb..7c475fd99c46 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -59,10 +59,6 @@ void arch_cpu_idle(void)
 }
 #endif
 
-void release_segments(struct mm_struct *mm)
-{
-}
-
 void machine_restart(char *cmd)
 {
 #ifdef CONFIG_KERNEL_DEBUGGER
@@ -113,14 +109,6 @@ void release_thread(struct task_struct *dead_task)
 }
 
 /*
- * we do not have to muck with descriptors here, that is
- * done in switch_mm() as needed.
- */
-void copy_segments(struct task_struct *p, struct mm_struct *new_mm)
-{
-}
-
-/*
  * this gets called so that we can store lazy state into memory and copy the
  * current task into the new thread.
  */
diff --git a/arch/sh/include/asm/processor_32.h 
b/arch/sh/include/asm/processor_32.h
index 18e0377f72bb..88ce1e22237b 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -136,10 +136,6 @@ extern void start_thread(struct pt_regs *regs, unsigned 
long new_pc, unsigned lo
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(p, mm)   

[PATCH] arch: remove unused *_segments() macros/functions

2017-09-22 Thread Tobias Klauser
Some architectures define the no-op macros/functions copy_segments,
release_segments and forget_segments. These are used nowhere in the
tree, so removed them.

Signed-off-by: Tobias Klauser 
---
 arch/arc/include/asm/processor.h|  3 ---
 arch/c6x/include/asm/processor.h|  3 ---
 arch/frv/include/asm/processor.h|  4 
 arch/m32r/include/asm/processor.h   |  8 
 arch/metag/include/asm/processor.h  |  3 ---
 arch/mn10300/kernel/process.c   | 12 
 arch/sh/include/asm/processor_32.h  |  4 
 arch/sh/include/asm/processor_64.h  |  4 
 arch/um/include/asm/processor-generic.h |  5 -
 arch/xtensa/include/asm/processor.h |  5 -
 10 files changed, 51 deletions(-)

diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h
index d400a2161935..8ee41e988169 100644
--- a/arch/arc/include/asm/processor.h
+++ b/arch/arc/include/asm/processor.h
@@ -78,9 +78,6 @@ struct task_struct;
 
 #endif
 
-#define copy_segments(tsk, mm)  do { } while (0)
-#define release_segments(mm)do { } while (0)
-
 #define KSTK_EIP(tsk)   (task_pt_regs(tsk)->ret)
 #define KSTK_ESP(tsk)   (task_pt_regs(tsk)->sp)
 
diff --git a/arch/c6x/include/asm/processor.h b/arch/c6x/include/asm/processor.h
index 7c87b5be53b5..8f7cce829f8e 100644
--- a/arch/c6x/include/asm/processor.h
+++ b/arch/c6x/include/asm/processor.h
@@ -92,9 +92,6 @@ static inline void release_thread(struct task_struct 
*dead_task)
 {
 }
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-
 /*
  * saved kernel SP and DP of a blocked thread.
  */
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h
index e4d08d74ed9f..021cce78b401 100644
--- a/arch/frv/include/asm/processor.h
+++ b/arch/frv/include/asm/processor.h
@@ -92,10 +92,6 @@ static inline void release_thread(struct task_struct 
*dead_task)
 extern asmlinkage void save_user_regs(struct user_context *target);
 extern asmlinkage void *restore_user_regs(const struct user_context *target, 
...);
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-#define forget_segments()  do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 
 #defineKSTK_EIP(tsk)   ((tsk)->thread.frame0->pc)
diff --git a/arch/m32r/include/asm/processor.h 
b/arch/m32r/include/asm/processor.h
index 657874eeeccc..c70fa9ac7169 100644
--- a/arch/m32r/include/asm/processor.h
+++ b/arch/m32r/include/asm/processor.h
@@ -118,14 +118,6 @@ struct mm_struct;
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Copy and release all segment info associated with a VM */
-extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
-extern void release_segments(struct mm_struct * mm);
-
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(p, mm)  do { } while (0)
-#define release_segments(mm)  do { } while (0)
-
 unsigned long get_wchan(struct task_struct *p);
 #define KSTK_EIP(tsk)  ((tsk)->thread.lr)
 #define KSTK_ESP(tsk)  ((tsk)->thread.sp)
diff --git a/arch/metag/include/asm/processor.h 
b/arch/metag/include/asm/processor.h
index ec6a49076980..8ae92d6abfd2 100644
--- a/arch/metag/include/asm/processor.h
+++ b/arch/metag/include/asm/processor.h
@@ -131,9 +131,6 @@ static inline void release_thread(struct task_struct 
*dead_task)
 {
 }
 
-#define copy_segments(tsk, mm) do { } while (0)
-#define release_segments(mm)   do { } while (0)
-
 /*
  * Return saved PC of a blocked thread.
  */
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index 89e8027e07fb..7c475fd99c46 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -59,10 +59,6 @@ void arch_cpu_idle(void)
 }
 #endif
 
-void release_segments(struct mm_struct *mm)
-{
-}
-
 void machine_restart(char *cmd)
 {
 #ifdef CONFIG_KERNEL_DEBUGGER
@@ -113,14 +109,6 @@ void release_thread(struct task_struct *dead_task)
 }
 
 /*
- * we do not have to muck with descriptors here, that is
- * done in switch_mm() as needed.
- */
-void copy_segments(struct task_struct *p, struct mm_struct *new_mm)
-{
-}
-
-/*
  * this gets called so that we can store lazy state into memory and copy the
  * current task into the new thread.
  */
diff --git a/arch/sh/include/asm/processor_32.h 
b/arch/sh/include/asm/processor_32.h
index 18e0377f72bb..88ce1e22237b 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -136,10 +136,6 @@ extern void start_thread(struct pt_regs *regs, unsigned 
long new_pc, unsigned lo
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
 
-/* Copy and release all segment info associated with a VM */
-#define copy_segments(p, mm)   do { } while(0)
-#define release

Re: [PATCH] microblaze: Add missing kvm_para.h to Kbuild

2017-09-19 Thread Tobias Klauser
On 2017-09-19 at 16:54:54 +0200, Michal Simek <michal.si...@xilinx.com> wrote:
> Running make allmodconfig;make is throwing compilation error:
>   CC  kernel/watchdog.o
> In file included from ./include/linux/kvm_para.h:4:0,
>  from kernel/watchdog.c:29:
> ./include/uapi/linux/kvm_para.h:32:26: fatal error: asm/kvm_para.h: No
> such file or directory
>  #include 
>   ^
> compilation terminated.
> make[1]: *** [kernel/watchdog.o] Error 1
> make: *** [kernel/watchdog.o] Error 2
> 
> Reported-by: Michal Hocko <mho...@kernel.org>
> Suggested-by: Geert Uytterhoeven <ge...@linux-m68k.org>
> Signed-off-by: Michal Simek <michal.si...@xilinx.com>
> Fixes: 83f0124ad81e87b ("microblaze: remove asm-generic wrapper headers")

Ugh, I somehow missed kvm_para.h in my change. Thanks a lot for the fix!

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>


Re: [PATCH] microblaze: Add missing kvm_para.h to Kbuild

2017-09-19 Thread Tobias Klauser
On 2017-09-19 at 16:54:54 +0200, Michal Simek  wrote:
> Running make allmodconfig;make is throwing compilation error:
>   CC  kernel/watchdog.o
> In file included from ./include/linux/kvm_para.h:4:0,
>  from kernel/watchdog.c:29:
> ./include/uapi/linux/kvm_para.h:32:26: fatal error: asm/kvm_para.h: No
> such file or directory
>  #include 
>   ^
> compilation terminated.
> make[1]: *** [kernel/watchdog.o] Error 1
> make: *** [kernel/watchdog.o] Error 2
> 
> Reported-by: Michal Hocko 
> Suggested-by: Geert Uytterhoeven 
> Signed-off-by: Michal Simek 
> Fixes: 83f0124ad81e87b ("microblaze: remove asm-generic wrapper headers")

Ugh, I somehow missed kvm_para.h in my change. Thanks a lot for the fix!

Reviewed-by: Tobias Klauser 


[PATCH] MIPS: make thread_saved_pc static

2017-09-18 Thread Tobias Klauser
The only user of thread_saved_pc() in non-arch-specific code was removed
in commit 8243d5597793 ("sched/core: Remove pointless printout in
sched_show_task()"), so it no longer needs to be globally defined for
MIPS and can be made static.

Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---
 arch/mips/include/asm/processor.h | 2 --
 arch/mips/kernel/process.c| 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/processor.h 
b/arch/mips/include/asm/processor.h
index 95b8c471f572..af34afbc32d9 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -368,8 +368,6 @@ struct task_struct;
 /* Free all resources held by a thread. */
 #define release_thread(thread) do { } while(0)
 
-extern unsigned long thread_saved_pc(struct task_struct *tsk);
-
 /*
  * Do necessary setup to start up a newly executed thread.
  */
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index c5ff6bfe2825..45d0b6b037ee 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -487,7 +487,7 @@ arch_initcall(frame_info_init);
 /*
  * Return saved PC of a blocked thread.
  */
-unsigned long thread_saved_pc(struct task_struct *tsk)
+static unsigned long thread_saved_pc(struct task_struct *tsk)
 {
struct thread_struct *t = >thread;
 
-- 
2.13.0




[PATCH] MIPS: make thread_saved_pc static

2017-09-18 Thread Tobias Klauser
The only user of thread_saved_pc() in non-arch-specific code was removed
in commit 8243d5597793 ("sched/core: Remove pointless printout in
sched_show_task()"), so it no longer needs to be globally defined for
MIPS and can be made static.

Signed-off-by: Tobias Klauser 
---
 arch/mips/include/asm/processor.h | 2 --
 arch/mips/kernel/process.c| 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/processor.h 
b/arch/mips/include/asm/processor.h
index 95b8c471f572..af34afbc32d9 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -368,8 +368,6 @@ struct task_struct;
 /* Free all resources held by a thread. */
 #define release_thread(thread) do { } while(0)
 
-extern unsigned long thread_saved_pc(struct task_struct *tsk);
-
 /*
  * Do necessary setup to start up a newly executed thread.
  */
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index c5ff6bfe2825..45d0b6b037ee 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -487,7 +487,7 @@ arch_initcall(frame_info_init);
 /*
  * Return saved PC of a blocked thread.
  */
-unsigned long thread_saved_pc(struct task_struct *tsk)
+static unsigned long thread_saved_pc(struct task_struct *tsk)
 {
struct thread_struct *t = >thread;
 
-- 
2.13.0




[PATCH] alpha: make thread_saved_pc static

2017-09-18 Thread Tobias Klauser
The only user of thread_saved_pc() in non-arch-specific code was removed
in commit 8243d5597793 ("sched/core: Remove pointless printout in
sched_show_task()"), so it no longer needs to be globally defined for
Alpha and can be made static.

Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---
 arch/alpha/include/asm/processor.h | 5 +
 arch/alpha/kernel/process.c| 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/processor.h 
b/arch/alpha/include/asm/processor.h
index 2fec2dee3020..1f8f20d08f66 100644
--- a/arch/alpha/include/asm/processor.h
+++ b/arch/alpha/include/asm/processor.h
@@ -39,15 +39,12 @@ typedef struct {
 struct thread_struct { };
 #define INIT_THREAD  { }
 
-/* Return saved PC of a blocked thread.  */
-struct task_struct;
-extern unsigned long thread_saved_pc(struct task_struct *);
-
 /* Do necessary setup to start up a newly executed thread.  */
 struct pt_regs;
 extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
 
 /* Free all resources held by a thread. */
+struct task_struct;
 extern void release_thread(struct task_struct *);
 
 unsigned long get_wchan(struct task_struct *p);
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 0b9635040721..f802b63ad708 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -360,7 +360,7 @@ EXPORT_SYMBOL(dump_elf_task_fp);
  * all.  -- r~
  */
 
-unsigned long
+static unsigned long
 thread_saved_pc(struct task_struct *t)
 {
unsigned long base = (unsigned long)task_stack_page(t);
-- 
2.13.0




[PATCH] alpha: make thread_saved_pc static

2017-09-18 Thread Tobias Klauser
The only user of thread_saved_pc() in non-arch-specific code was removed
in commit 8243d5597793 ("sched/core: Remove pointless printout in
sched_show_task()"), so it no longer needs to be globally defined for
Alpha and can be made static.

Signed-off-by: Tobias Klauser 
---
 arch/alpha/include/asm/processor.h | 5 +
 arch/alpha/kernel/process.c| 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/processor.h 
b/arch/alpha/include/asm/processor.h
index 2fec2dee3020..1f8f20d08f66 100644
--- a/arch/alpha/include/asm/processor.h
+++ b/arch/alpha/include/asm/processor.h
@@ -39,15 +39,12 @@ typedef struct {
 struct thread_struct { };
 #define INIT_THREAD  { }
 
-/* Return saved PC of a blocked thread.  */
-struct task_struct;
-extern unsigned long thread_saved_pc(struct task_struct *);
-
 /* Do necessary setup to start up a newly executed thread.  */
 struct pt_regs;
 extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
 
 /* Free all resources held by a thread. */
+struct task_struct;
 extern void release_thread(struct task_struct *);
 
 unsigned long get_wchan(struct task_struct *p);
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 0b9635040721..f802b63ad708 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -360,7 +360,7 @@ EXPORT_SYMBOL(dump_elf_task_fp);
  * all.  -- r~
  */
 
-unsigned long
+static unsigned long
 thread_saved_pc(struct task_struct *t)
 {
unsigned long base = (unsigned long)task_stack_page(t);
-- 
2.13.0




Re: [PATCH] asm-generic/io.h: remove unnecessary include of linux/vmalloc.h

2017-09-08 Thread Tobias Klauser
On 2017-09-07 at 21:36:45 +0200, kbuild test robot <l...@intel.com> wrote:
> Hi Tobias,
> 
> [auto build test ERROR on v4.13]
> [also build test ERROR on next-20170907]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Tobias-Klauser/asm-generic-io-h-remove-unnecessary-include-of-linux-vmalloc-h/20170908-012111
> config: arm-shmobile_defconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=arm 
> 
> All errors (new ones prefixed by >>):
> 
> >> arch/arm/mach-shmobile/pm-r8a7779.c:24:20: error: expected '=', ',', ';', 
> >> 'asm' or '__attribute__' before 'r8a7779_sysc_init'
> static void __init r8a7779_sysc_init(void)
>^
> >> arch/arm/mach-shmobile/pm-r8a7779.c:35:13: error: expected '=', ',', ';', 
> >> 'asm' or '__attribute__' before 'r8a7779_pm_init'
> void __init r8a7779_pm_init(void)
> ^~~

This warning/error is fixed by Arnd's patch posted in
https://marc.info/?l=linux-kernel=150464459009788=2


Re: [PATCH] asm-generic/io.h: remove unnecessary include of linux/vmalloc.h

2017-09-08 Thread Tobias Klauser
On 2017-09-07 at 21:36:45 +0200, kbuild test robot  wrote:
> Hi Tobias,
> 
> [auto build test ERROR on v4.13]
> [also build test ERROR on next-20170907]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Tobias-Klauser/asm-generic-io-h-remove-unnecessary-include-of-linux-vmalloc-h/20170908-012111
> config: arm-shmobile_defconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=arm 
> 
> All errors (new ones prefixed by >>):
> 
> >> arch/arm/mach-shmobile/pm-r8a7779.c:24:20: error: expected '=', ',', ';', 
> >> 'asm' or '__attribute__' before 'r8a7779_sysc_init'
> static void __init r8a7779_sysc_init(void)
>^
> >> arch/arm/mach-shmobile/pm-r8a7779.c:35:13: error: expected '=', ',', ';', 
> >> 'asm' or '__attribute__' before 'r8a7779_pm_init'
> void __init r8a7779_pm_init(void)
> ^~~

This warning/error is fixed by Arnd's patch posted in
https://marc.info/?l=linux-kernel=150464459009788=2


Re: [PATCH] asm-generic/io.h: remove unnecessary include of linux/vmalloc.h

2017-09-05 Thread Tobias Klauser
On 2017-09-05 at 17:11:50 +0200, Arnd Bergmann <a...@arndb.de> wrote:
> On Tue, Sep 5, 2017 at 1:27 PM, Tobias Klauser <tklau...@distanz.ch> wrote:
> > Including linux/vmalloc.h in asm-generic/io.h isn't necessary since none
> > of the definitions are used in the header itself. Remove the include in
> > order to avoid potential header dependency problems if other headers
> > rely on implict inclusion of linux/vmalloc.h which means that changes
> > there could break unrelated parts.
> >
> > Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
> > ---
> >  include/asm-generic/io.h | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> > index b4531e3b2120..d2d3bd163f5f 100644
> > --- a/include/asm-generic/io.h
> > +++ b/include/asm-generic/io.h
> > @@ -764,7 +764,6 @@ static inline void iowrite64_rep(volatile void __iomem 
> > *addr,
> >
> >  #ifdef __KERNEL__
> >
> > -#include 
> >  #define __io_virt(x) ((void __force *)(x))
> >
> >  #ifndef CONFIG_GENERIC_IOMAP
> 
> This seems like a good idea in principle, but I think it needs to be tested
> well before we apply it, to avoid breaking random drivers that forgot to
> add their own includes of that header.

Yes, this certainly needs extensive testing. I already did several
randconfig builds on multiple platforms locally. Also, I sent the same
patch a while ago to LKML already as a fix (which wasn't sufficient) [1]
in order to get the kbuild test bot to test it ;)

  [1] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1392578.html

And indeed, the kbuild test bot failed on multiple drivers as a result
of me submitting this patch back then and I successively sent patches to
fix the fallout. Now all of them are merged.

> I've added your patch to my testing queue, but not to the asm-generic
> tree now. We should see if it leads to any randconfig build regressions
> on the architectures I normally test.

Thanks!

> Did you run into a specific problem with the #include, or did it just occur
> to you that it might help in general?

See above. Sorry, I should have mentioned it in the original patch
submission but I forgot about the full history and only tried to
reconstruct it now that you asked ;)

Tobias


Re: [PATCH] asm-generic/io.h: remove unnecessary include of linux/vmalloc.h

2017-09-05 Thread Tobias Klauser
On 2017-09-05 at 17:11:50 +0200, Arnd Bergmann  wrote:
> On Tue, Sep 5, 2017 at 1:27 PM, Tobias Klauser  wrote:
> > Including linux/vmalloc.h in asm-generic/io.h isn't necessary since none
> > of the definitions are used in the header itself. Remove the include in
> > order to avoid potential header dependency problems if other headers
> > rely on implict inclusion of linux/vmalloc.h which means that changes
> > there could break unrelated parts.
> >
> > Signed-off-by: Tobias Klauser 
> > ---
> >  include/asm-generic/io.h | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> > index b4531e3b2120..d2d3bd163f5f 100644
> > --- a/include/asm-generic/io.h
> > +++ b/include/asm-generic/io.h
> > @@ -764,7 +764,6 @@ static inline void iowrite64_rep(volatile void __iomem 
> > *addr,
> >
> >  #ifdef __KERNEL__
> >
> > -#include 
> >  #define __io_virt(x) ((void __force *)(x))
> >
> >  #ifndef CONFIG_GENERIC_IOMAP
> 
> This seems like a good idea in principle, but I think it needs to be tested
> well before we apply it, to avoid breaking random drivers that forgot to
> add their own includes of that header.

Yes, this certainly needs extensive testing. I already did several
randconfig builds on multiple platforms locally. Also, I sent the same
patch a while ago to LKML already as a fix (which wasn't sufficient) [1]
in order to get the kbuild test bot to test it ;)

  [1] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1392578.html

And indeed, the kbuild test bot failed on multiple drivers as a result
of me submitting this patch back then and I successively sent patches to
fix the fallout. Now all of them are merged.

> I've added your patch to my testing queue, but not to the asm-generic
> tree now. We should see if it leads to any randconfig build regressions
> on the architectures I normally test.

Thanks!

> Did you run into a specific problem with the #include, or did it just occur
> to you that it might help in general?

See above. Sorry, I should have mentioned it in the original patch
submission but I forgot about the full history and only tried to
reconstruct it now that you asked ;)

Tobias


[PATCH] asm-generic/io.h: remove unnecessary include of linux/vmalloc.h

2017-09-05 Thread Tobias Klauser
Including linux/vmalloc.h in asm-generic/io.h isn't necessary since none
of the definitions are used in the header itself. Remove the include in
order to avoid potential header dependency problems if other headers
rely on implict inclusion of linux/vmalloc.h which means that changes
there could break unrelated parts.

Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---
 include/asm-generic/io.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index b4531e3b2120..d2d3bd163f5f 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -764,7 +764,6 @@ static inline void iowrite64_rep(volatile void __iomem 
*addr,
 
 #ifdef __KERNEL__
 
-#include 
 #define __io_virt(x) ((void __force *)(x))
 
 #ifndef CONFIG_GENERIC_IOMAP
-- 
2.13.0




[PATCH] asm-generic/io.h: remove unnecessary include of linux/vmalloc.h

2017-09-05 Thread Tobias Klauser
Including linux/vmalloc.h in asm-generic/io.h isn't necessary since none
of the definitions are used in the header itself. Remove the include in
order to avoid potential header dependency problems if other headers
rely on implict inclusion of linux/vmalloc.h which means that changes
there could break unrelated parts.

Signed-off-by: Tobias Klauser 
---
 include/asm-generic/io.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index b4531e3b2120..d2d3bd163f5f 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -764,7 +764,6 @@ static inline void iowrite64_rep(volatile void __iomem 
*addr,
 
 #ifdef __KERNEL__
 
-#include 
 #define __io_virt(x) ((void __force *)(x))
 
 #ifndef CONFIG_GENERIC_IOMAP
-- 
2.13.0




Re: [patch v6 3/3] Doccumentation: jtag: Add bindings for Aspeed SoC 24xx and 25xx families JTAG master driver

2017-08-28 Thread Tobias Klauser
On 2017-08-22 at 18:10:56 +0200, Oleksandr Shamray <oleksan...@mellanox.com> 
wrote:
> It has been tested on Mellanox system with BMC equipped with
> Aspeed 2520 SoC for programming CPLD devices.
> 
> Signed-off-by: Oleksandr Shamray <oleksan...@mellanox.com>
> Signed-off-by: Jiri Pirko <j...@mellanox.com>
> Acked-by: Rob Herring <r...@kernel.org>
> ---
> v5->v6
> Comments pointed by Tobias Klauser <tklau...@distanz.ch>
> - Small nit: s/doccumentation/Documentation/

There's still one 'c' too many in 'Doccumentation' in the subject (in
case you're doing another respin of the series).


Re: [patch v6 3/3] Doccumentation: jtag: Add bindings for Aspeed SoC 24xx and 25xx families JTAG master driver

2017-08-28 Thread Tobias Klauser
On 2017-08-22 at 18:10:56 +0200, Oleksandr Shamray  
wrote:
> It has been tested on Mellanox system with BMC equipped with
> Aspeed 2520 SoC for programming CPLD devices.
> 
> Signed-off-by: Oleksandr Shamray 
> Signed-off-by: Jiri Pirko 
> Acked-by: Rob Herring 
> ---
> v5->v6
> Comments pointed by Tobias Klauser 
> - Small nit: s/doccumentation/Documentation/

There's still one 'c' too many in 'Doccumentation' in the subject (in
case you're doing another respin of the series).


Re: [patch v5 3/3] doccumentation: jtag: Add bindings for Aspeed SoC 24xx and 25xx families JTAG master driver

2017-08-21 Thread Tobias Klauser
> Subject: Re: [patch v5 3/3] doccumentation: jtag: Add bindings for Aspeed SoC 
> 24xx and 25xx families JTAG master driver

Small nit: s/doccumentation/Documentation/


Re: [patch v5 3/3] doccumentation: jtag: Add bindings for Aspeed SoC 24xx and 25xx families JTAG master driver

2017-08-21 Thread Tobias Klauser
> Subject: Re: [patch v5 3/3] doccumentation: jtag: Add bindings for Aspeed SoC 
> 24xx and 25xx families JTAG master driver

Small nit: s/doccumentation/Documentation/


Re: [patch v1 1/2] drivers: jtag: Add JTAG core driver

2017-08-03 Thread Tobias Klauser
Nice work!

On 2017-08-02 at 15:18:37 +0200, Oleksandr Shamray  
wrote:
> --- /dev/null
> +++ b/drivers/jtag/jtag.c
[...]
> +static int jtag_run_test_idle(struct jtag *jtag,
> +   struct jtag_run_test_idle *idle)

Both the function and the struct it takes have the same name, which of
course is perfectly valid C. However, IMO it would be easier to grep for
the function/struct individually if they had different names.

> +{
> + if (jtag->ops->idle)
> + return jtag->ops->idle(jtag, idle);
> + else
> + return -EOPNOTSUPP;
> +}
[...]
> --- /dev/null
> +++ b/include/uapi/linux/jtag.h
> @@ -0,0 +1,133 @@
[...]
> +/**
> + * struct jtag_run_test_idle - forces JTAG sm to
> + * RUN_TEST/IDLE state *

I guess a newline is needed here to make this a valid kerneldoc comment
(the trailing '*' indicates that one was actually intended here ;)

Also, 'sm' should probably be spelled out as 'state machine'.

> + * @mode: access mode
> + * @reset: 0 - run IDEL/PAUSE from current state
> + * 1 - go trough TEST_LOGIC/RESET state before  IDEL/PAUSE

Typos: s/trough/through/ and s/IDEL/IDLE/

> + * @end: completion flag
> + * @tck: clock counter
> + *
> + * Structure represents interface to JTAG device for jtag idle
> + * execution.
> + */
> +struct jtag_run_test_idle {
> + enum jtag_xfer_mode mode;
> + unsigned char   reset;
> + enum jtag_endstate  endstate;
> + unsigned char   tck;
> +};


Re: [patch v1 1/2] drivers: jtag: Add JTAG core driver

2017-08-03 Thread Tobias Klauser
Nice work!

On 2017-08-02 at 15:18:37 +0200, Oleksandr Shamray  
wrote:
> --- /dev/null
> +++ b/drivers/jtag/jtag.c
[...]
> +static int jtag_run_test_idle(struct jtag *jtag,
> +   struct jtag_run_test_idle *idle)

Both the function and the struct it takes have the same name, which of
course is perfectly valid C. However, IMO it would be easier to grep for
the function/struct individually if they had different names.

> +{
> + if (jtag->ops->idle)
> + return jtag->ops->idle(jtag, idle);
> + else
> + return -EOPNOTSUPP;
> +}
[...]
> --- /dev/null
> +++ b/include/uapi/linux/jtag.h
> @@ -0,0 +1,133 @@
[...]
> +/**
> + * struct jtag_run_test_idle - forces JTAG sm to
> + * RUN_TEST/IDLE state *

I guess a newline is needed here to make this a valid kerneldoc comment
(the trailing '*' indicates that one was actually intended here ;)

Also, 'sm' should probably be spelled out as 'state machine'.

> + * @mode: access mode
> + * @reset: 0 - run IDEL/PAUSE from current state
> + * 1 - go trough TEST_LOGIC/RESET state before  IDEL/PAUSE

Typos: s/trough/through/ and s/IDEL/IDLE/

> + * @end: completion flag
> + * @tck: clock counter
> + *
> + * Structure represents interface to JTAG device for jtag idle
> + * execution.
> + */
> +struct jtag_run_test_idle {
> + enum jtag_xfer_mode mode;
> + unsigned char   reset;
> + enum jtag_endstate  endstate;
> + unsigned char   tck;
> +};


[PATCH] xtensa: remove wrapper header for asm/param.h

2017-07-21 Thread Tobias Klauser
xtensa's asm/device.h is a verbatim copy of asm-generic/device.h and
does not add any arch specific extensions. Thus, use the asm-generic
header directly.

Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---
 arch/xtensa/include/asm/Kbuild  |  1 +
 arch/xtensa/include/asm/param.h | 18 --
 2 files changed, 1 insertion(+), 18 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/param.h

diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index a2fdabfce43a..dff7cc39437c 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -18,6 +18,7 @@ generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
+generic-y += param.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += rwsem.h
diff --git a/arch/xtensa/include/asm/param.h b/arch/xtensa/include/asm/param.h
deleted file mode 100644
index 0a70e780ef2a..
--- a/arch/xtensa/include/asm/param.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * include/asm-xtensa/param.h
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
- */
-#ifndef _XTENSA_PARAM_H
-#define _XTENSA_PARAM_H
-
-#include 
-
-# define HZCONFIG_HZ   /* internal timer frequency */
-# define USER_HZ   100 /* for user interfaces in "ticks" */
-# define CLOCKS_PER_SEC (USER_HZ)  /* frequnzy at which times() counts */
-#endif /* _XTENSA_PARAM_H */
-- 
2.13.0




[PATCH] xtensa: remove wrapper header for asm/param.h

2017-07-21 Thread Tobias Klauser
xtensa's asm/device.h is a verbatim copy of asm-generic/device.h and
does not add any arch specific extensions. Thus, use the asm-generic
header directly.

Signed-off-by: Tobias Klauser 
---
 arch/xtensa/include/asm/Kbuild  |  1 +
 arch/xtensa/include/asm/param.h | 18 --
 2 files changed, 1 insertion(+), 18 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/param.h

diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index a2fdabfce43a..dff7cc39437c 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -18,6 +18,7 @@ generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
+generic-y += param.h
 generic-y += percpu.h
 generic-y += preempt.h
 generic-y += rwsem.h
diff --git a/arch/xtensa/include/asm/param.h b/arch/xtensa/include/asm/param.h
deleted file mode 100644
index 0a70e780ef2a..
--- a/arch/xtensa/include/asm/param.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * include/asm-xtensa/param.h
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
- */
-#ifndef _XTENSA_PARAM_H
-#define _XTENSA_PARAM_H
-
-#include 
-
-# define HZCONFIG_HZ   /* internal timer frequency */
-# define USER_HZ   100 /* for user interfaces in "ticks" */
-# define CLOCKS_PER_SEC (USER_HZ)  /* frequnzy at which times() counts */
-#endif /* _XTENSA_PARAM_H */
-- 
2.13.0




[PATCH v2] xtensa: remove wrapper header for asm/device.h

2017-07-21 Thread Tobias Klauser
xtensa's asm/device.h is a verbatim copy of asm-generic/device.h and
does not add any arch specific extensions. Thus, use the asm-generic
header directly.

Acked-by: Max Filippov <jcmvb...@gmail.com>
Signed-off-by: Tobias Klauser <tklau...@distanz.ch>
---
v2: rebased after Kbuild update, added Acked-by by Max

 arch/xtensa/include/asm/Kbuild   |  1 +
 arch/xtensa/include/asm/device.h | 15 ---
 2 files changed, 1 insertion(+), 15 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/device.h

diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 2d716ebc5a5e..a2fdabfce43a 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1,5 +1,6 @@
 generic-y += bug.h
 generic-y += clkdev.h
+generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
 generic-y += emergency-restart.h
diff --git a/arch/xtensa/include/asm/device.h b/arch/xtensa/include/asm/device.h
deleted file mode 100644
index 1deeb8ebbb1b..
--- a/arch/xtensa/include/asm/device.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Arch specific extensions to struct device
- *
- * This file is released under the GPLv2
- */
-#ifndef _ASM_XTENSA_DEVICE_H
-#define _ASM_XTENSA_DEVICE_H
-
-struct dev_archdata {
-};
-
-struct pdev_archdata {
-};
-
-#endif /* _ASM_XTENSA_DEVICE_H */
-- 
2.13.0




[PATCH v2] xtensa: remove wrapper header for asm/device.h

2017-07-21 Thread Tobias Klauser
xtensa's asm/device.h is a verbatim copy of asm-generic/device.h and
does not add any arch specific extensions. Thus, use the asm-generic
header directly.

Acked-by: Max Filippov 
Signed-off-by: Tobias Klauser 
---
v2: rebased after Kbuild update, added Acked-by by Max

 arch/xtensa/include/asm/Kbuild   |  1 +
 arch/xtensa/include/asm/device.h | 15 ---
 2 files changed, 1 insertion(+), 15 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/device.h

diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 2d716ebc5a5e..a2fdabfce43a 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1,5 +1,6 @@
 generic-y += bug.h
 generic-y += clkdev.h
+generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
 generic-y += emergency-restart.h
diff --git a/arch/xtensa/include/asm/device.h b/arch/xtensa/include/asm/device.h
deleted file mode 100644
index 1deeb8ebbb1b..
--- a/arch/xtensa/include/asm/device.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Arch specific extensions to struct device
- *
- * This file is released under the GPLv2
- */
-#ifndef _ASM_XTENSA_DEVICE_H
-#define _ASM_XTENSA_DEVICE_H
-
-struct dev_archdata {
-};
-
-struct pdev_archdata {
-};
-
-#endif /* _ASM_XTENSA_DEVICE_H */
-- 
2.13.0




Re: [PATCH v2 18/28] nios2: move generic-y of exported headers to uapi/asm/Kbuild

2017-07-11 Thread Tobias Klauser
On 2017-07-09 at 20:32:50 +0200, Masahiro Yamada 
<yamada.masah...@socionext.com> wrote:
> Since commit fcc8487d477a ("uapi: export all headers under uapi
> directories"), all (and only) headers under uapi directories are
> exported, but asm-generic wrappers are still exceptions.
> 
> To complete de-coupling the uapi from kernel headers, move generic-y
> of exported headers to uapi/asm/Kbuild.
> 
> With this change, "make headers_install" will just need to parse
> uapi/asm/Kbuild to build up exported headers.
> 
> Also, move "generic-y += kprobes.h" up in order to keep the entries
> sorted.
> 
> Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>

Looks good, thanks!


Re: [PATCH v2 18/28] nios2: move generic-y of exported headers to uapi/asm/Kbuild

2017-07-11 Thread Tobias Klauser
On 2017-07-09 at 20:32:50 +0200, Masahiro Yamada 
 wrote:
> Since commit fcc8487d477a ("uapi: export all headers under uapi
> directories"), all (and only) headers under uapi directories are
> exported, but asm-generic wrappers are still exceptions.
> 
> To complete de-coupling the uapi from kernel headers, move generic-y
> of exported headers to uapi/asm/Kbuild.
> 
> With this change, "make headers_install" will just need to parse
> uapi/asm/Kbuild to build up exported headers.
> 
> Also, move "generic-y += kprobes.h" up in order to keep the entries
> sorted.
> 
> Signed-off-by: Masahiro Yamada 

Reviewed-by: Tobias Klauser 

Looks good, thanks!


Re: [PATCH v2 17/28] nios2: remove unneeded arch/nios2/include/(generated/)asm/signal.h

2017-07-11 Thread Tobias Klauser
On 2017-07-09 at 20:32:49 +0200, Masahiro Yamada 
<yamada.masah...@socionext.com> wrote:
> Currently, NIOS2 has three signal.h files under arch/nios2/include:
> 
> [1] arch/nios2/include/asm/signal.h
> [2] arch/nios2/include/uapi/asm/signal.h
> [3] arch/nios2/include/generated/asm/signal.h
> 
> [3] is build-time generated by scripts/Makefile.asm-generic.
> However, -I$(srctree)/arch/$(hdr-arch)/include search path is listed
> before -I$(objtree)/arch/$(hdr-arch)/include/generated in LINUXINCLUDE.
> Therefore [1] is always included instead of [3].  Remove [3] which
> is never included.
> 
> If we look at [1], it just includes [2].  So, [1] can be removed
> as well.
> 
> Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>

Reviewed-by: Tobias Klauser <tklau...@distanz.ch>

Looks good, thanks!


Re: [PATCH v2 17/28] nios2: remove unneeded arch/nios2/include/(generated/)asm/signal.h

2017-07-11 Thread Tobias Klauser
On 2017-07-09 at 20:32:49 +0200, Masahiro Yamada 
 wrote:
> Currently, NIOS2 has three signal.h files under arch/nios2/include:
> 
> [1] arch/nios2/include/asm/signal.h
> [2] arch/nios2/include/uapi/asm/signal.h
> [3] arch/nios2/include/generated/asm/signal.h
> 
> [3] is build-time generated by scripts/Makefile.asm-generic.
> However, -I$(srctree)/arch/$(hdr-arch)/include search path is listed
> before -I$(objtree)/arch/$(hdr-arch)/include/generated in LINUXINCLUDE.
> Therefore [1] is always included instead of [3].  Remove [3] which
> is never included.
> 
> If we look at [1], it just includes [2].  So, [1] can be removed
> as well.
> 
> Signed-off-by: Masahiro Yamada 

Reviewed-by: Tobias Klauser 

Looks good, thanks!


Re: [PATCH 6/9] RISC-V: Device, timer, IRQs, and the SBI

2017-06-30 Thread Tobias Klauser
On 2017-06-30 at 00:52:44 +0200, Palmer Dabbelt  wrote:
> On Thu, 29 Jun 2017 01:39:25 PDT (-0700), tklau...@distanz.ch wrote:
> > On 2017-06-28 at 20:55:35 +0200, Palmer Dabbelt  wrote:
> > [...]
> >> diff --git a/arch/riscv/include/asm/device.h 
> >> b/arch/riscv/include/asm/device.h
> >> new file mode 100644
> >> index ..28975e528d2f
> >> --- /dev/null
> >> +++ b/arch/riscv/include/asm/device.h
> >> @@ -0,0 +1,27 @@
> >> +/*
> >> + * Copyright (C) 2016 SiFive
> >> + *
> >> + *   This program is free software; you can redistribute it and/or
> >> + *   modify it under the terms of the GNU General Public License
> >> + *   as published by the Free Software Foundation, version 2.
> >> + *
> >> + *   This program is distributed in the hope that it will be useful,
> >> + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >> + *   GNU General Public License for more details.
> >> + */
> >> +
> >> +
> >> +#ifndef _ASM_RISCV_DEVICE_H
> >> +#define _ASM_RISCV_DEVICE_H
> >> +
> >> +#include 
> >> +
> >> +struct dev_archdata {
> >> +  struct dma_map_ops *dma_ops;
> >> +};
> >
> > The dma_ops member isn't used in any arch code or driver from what I can
> > tell (I checked against your riscv-for-submission-v3 branch). Could
> > device.h from asm-generic be used instead, or did I miss something?
> 
> I think you're right.  I'll include this
> 
>   diff --git a/arch/riscv/include/asm/device.h 
> b/arch/riscv/include/asm/device.h
>   index 28975e528d2f..a310c2c26101 100644
>   --- a/arch/riscv/include/asm/device.h
>   +++ b/arch/riscv/include/asm/device.h
>   @@ -11,17 +11,9 @@
> *   GNU General Public License for more details.
> */
> 
>   -
>#ifndef _ASM_RISCV_DEVICE_H
>#define _ASM_RISCV_DEVICE_H
> 
>   -#include 
>   -
>   -struct dev_archdata {
>   -   struct dma_map_ops *dma_ops;
>   -};
>   -
>   -struct pdev_archdata {
>   -};
>   +#include 
> 
>#endif /* _ASM_RISCV_DEVICE_H */
> 
> in the v4

Better yet, remove arch/riscv/include/asm/device.h altogether and add device.h
to generic-y in the asm/Kbuild file, as follows:

diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild
index 710397395981..52b254e26378 100644
--- a/arch/riscv/include/asm/Kbuild
+++ b/arch/riscv/include/asm/Kbuild
@@ -3,6 +3,7 @@ generic-y += cacheflush.h
 generic-y += checksum.h
 generic-y += clkdev.h
 generic-y += cputime.h
+generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
 generic-y += dma-contiguous.h
diff --git a/arch/riscv/include/asm/device.h b/arch/riscv/include/asm/device.h
deleted file mode 100644
index 28975e528d2f..
--- a/arch/riscv/include/asm/device.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2016 SiFive
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation, version 2.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- */
-
-
-#ifndef _ASM_RISCV_DEVICE_H
-#define _ASM_RISCV_DEVICE_H
-
-#include 
-
-struct dev_archdata {
-   struct dma_map_ops *dma_ops;
-};
-
-struct pdev_archdata {
-};
-
-#endif /* _ASM_RISCV_DEVICE_H */

> 
> >
> >> +
> >> +struct pdev_archdata {
> >> +};
> >> +
> >> +#endif /* _ASM_RISCV_DEVICE_H */
> 
> Thanks!
> 


Re: [PATCH 6/9] RISC-V: Device, timer, IRQs, and the SBI

2017-06-30 Thread Tobias Klauser
On 2017-06-30 at 00:52:44 +0200, Palmer Dabbelt  wrote:
> On Thu, 29 Jun 2017 01:39:25 PDT (-0700), tklau...@distanz.ch wrote:
> > On 2017-06-28 at 20:55:35 +0200, Palmer Dabbelt  wrote:
> > [...]
> >> diff --git a/arch/riscv/include/asm/device.h 
> >> b/arch/riscv/include/asm/device.h
> >> new file mode 100644
> >> index ..28975e528d2f
> >> --- /dev/null
> >> +++ b/arch/riscv/include/asm/device.h
> >> @@ -0,0 +1,27 @@
> >> +/*
> >> + * Copyright (C) 2016 SiFive
> >> + *
> >> + *   This program is free software; you can redistribute it and/or
> >> + *   modify it under the terms of the GNU General Public License
> >> + *   as published by the Free Software Foundation, version 2.
> >> + *
> >> + *   This program is distributed in the hope that it will be useful,
> >> + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >> + *   GNU General Public License for more details.
> >> + */
> >> +
> >> +
> >> +#ifndef _ASM_RISCV_DEVICE_H
> >> +#define _ASM_RISCV_DEVICE_H
> >> +
> >> +#include 
> >> +
> >> +struct dev_archdata {
> >> +  struct dma_map_ops *dma_ops;
> >> +};
> >
> > The dma_ops member isn't used in any arch code or driver from what I can
> > tell (I checked against your riscv-for-submission-v3 branch). Could
> > device.h from asm-generic be used instead, or did I miss something?
> 
> I think you're right.  I'll include this
> 
>   diff --git a/arch/riscv/include/asm/device.h 
> b/arch/riscv/include/asm/device.h
>   index 28975e528d2f..a310c2c26101 100644
>   --- a/arch/riscv/include/asm/device.h
>   +++ b/arch/riscv/include/asm/device.h
>   @@ -11,17 +11,9 @@
> *   GNU General Public License for more details.
> */
> 
>   -
>#ifndef _ASM_RISCV_DEVICE_H
>#define _ASM_RISCV_DEVICE_H
> 
>   -#include 
>   -
>   -struct dev_archdata {
>   -   struct dma_map_ops *dma_ops;
>   -};
>   -
>   -struct pdev_archdata {
>   -};
>   +#include 
> 
>#endif /* _ASM_RISCV_DEVICE_H */
> 
> in the v4

Better yet, remove arch/riscv/include/asm/device.h altogether and add device.h
to generic-y in the asm/Kbuild file, as follows:

diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild
index 710397395981..52b254e26378 100644
--- a/arch/riscv/include/asm/Kbuild
+++ b/arch/riscv/include/asm/Kbuild
@@ -3,6 +3,7 @@ generic-y += cacheflush.h
 generic-y += checksum.h
 generic-y += clkdev.h
 generic-y += cputime.h
+generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
 generic-y += dma-contiguous.h
diff --git a/arch/riscv/include/asm/device.h b/arch/riscv/include/asm/device.h
deleted file mode 100644
index 28975e528d2f..
--- a/arch/riscv/include/asm/device.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2016 SiFive
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation, version 2.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- */
-
-
-#ifndef _ASM_RISCV_DEVICE_H
-#define _ASM_RISCV_DEVICE_H
-
-#include 
-
-struct dev_archdata {
-   struct dma_map_ops *dma_ops;
-};
-
-struct pdev_archdata {
-};
-
-#endif /* _ASM_RISCV_DEVICE_H */

> 
> >
> >> +
> >> +struct pdev_archdata {
> >> +};
> >> +
> >> +#endif /* _ASM_RISCV_DEVICE_H */
> 
> Thanks!
> 


Re: [PATCH 6/9] RISC-V: Device, timer, IRQs, and the SBI

2017-06-29 Thread Tobias Klauser
On 2017-06-28 at 20:55:35 +0200, Palmer Dabbelt  wrote:
[...]
> diff --git a/arch/riscv/include/asm/device.h b/arch/riscv/include/asm/device.h
> new file mode 100644
> index ..28975e528d2f
> --- /dev/null
> +++ b/arch/riscv/include/asm/device.h
> @@ -0,0 +1,27 @@
> +/*
> + * Copyright (C) 2016 SiFive
> + *
> + *   This program is free software; you can redistribute it and/or
> + *   modify it under the terms of the GNU General Public License
> + *   as published by the Free Software Foundation, version 2.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *   GNU General Public License for more details.
> + */
> +
> +
> +#ifndef _ASM_RISCV_DEVICE_H
> +#define _ASM_RISCV_DEVICE_H
> +
> +#include 
> +
> +struct dev_archdata {
> + struct dma_map_ops *dma_ops;
> +};

The dma_ops member isn't used in any arch code or driver from what I can
tell (I checked against your riscv-for-submission-v3 branch). Could
device.h from asm-generic be used instead, or did I miss something?

> +
> +struct pdev_archdata {
> +};
> +
> +#endif /* _ASM_RISCV_DEVICE_H */


Re: [PATCH 6/9] RISC-V: Device, timer, IRQs, and the SBI

2017-06-29 Thread Tobias Klauser
On 2017-06-28 at 20:55:35 +0200, Palmer Dabbelt  wrote:
[...]
> diff --git a/arch/riscv/include/asm/device.h b/arch/riscv/include/asm/device.h
> new file mode 100644
> index ..28975e528d2f
> --- /dev/null
> +++ b/arch/riscv/include/asm/device.h
> @@ -0,0 +1,27 @@
> +/*
> + * Copyright (C) 2016 SiFive
> + *
> + *   This program is free software; you can redistribute it and/or
> + *   modify it under the terms of the GNU General Public License
> + *   as published by the Free Software Foundation, version 2.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *   GNU General Public License for more details.
> + */
> +
> +
> +#ifndef _ASM_RISCV_DEVICE_H
> +#define _ASM_RISCV_DEVICE_H
> +
> +#include 
> +
> +struct dev_archdata {
> + struct dma_map_ops *dma_ops;
> +};

The dma_ops member isn't used in any arch code or driver from what I can
tell (I checked against your riscv-for-submission-v3 branch). Could
device.h from asm-generic be used instead, or did I miss something?

> +
> +struct pdev_archdata {
> +};
> +
> +#endif /* _ASM_RISCV_DEVICE_H */


Re: [PATCH 5/9] RISC-V: Task implementation

2017-06-29 Thread Tobias Klauser
On 2017-06-28 at 20:55:34 +0200, Palmer Dabbelt  wrote:
[...]
> diff --git a/arch/riscv/include/asm/kprobes.h 
> b/arch/riscv/include/asm/kprobes.h
> new file mode 100644
> index ..1190de7a0f74
> --- /dev/null
> +++ b/arch/riscv/include/asm/kprobes.h
> @@ -0,0 +1,22 @@
> +/*
> + * Copyright (C) 2017 SiFive
> + *
> + *   This program is free software; you can redistribute it and/or
> + *   modify it under the terms of the GNU General Public License
> + *   as published by the Free Software Foundation, version 2.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *   GNU General Public License for more details.
> + */
> +
> +
> +#ifndef ASM_RISCV_KPROBES_H
> +#define ASM_RISCV_KPROBES_H
> +
> +#ifdef CONFIG_KPROBES
> +#error "RISC-V doesn't skpport CONFIG_KPROBES"

Typo: s/skpport/support/

> +#endif
> +
> +#endif
> diff --git a/arch/riscv/include/asm/processor.h 
> b/arch/riscv/include/asm/processor.h
> new file mode 100644
> index ..65aa014db9b4
> --- /dev/null
> +++ b/arch/riscv/include/asm/processor.h
> @@ -0,0 +1,102 @@
> +/*
> + * Copyright (C) 2012 Regents of the University of California
> + *
> + *   This program is free software; you can redistribute it and/or
> + *   modify it under the terms of the GNU General Public License
> + *   as published by the Free Software Foundation, version 2.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *   GNU General Public License for more details.
> + */
> +
> +#ifndef _ASM_RISCV_PROCESSOR_H
> +#define _ASM_RISCV_PROCESSOR_H
> +
> +#include 
> +
> +#include 
> +
> +/*
> + * This decides where the kernel will search for a free chunk of vm
> + * space during mmap's.
> + */
> +#define TASK_UNMAPPED_BASE   PAGE_ALIGN(TASK_SIZE >> 1)
> +
> +#ifdef __KERNEL__
> +#define STACK_TOPTASK_SIZE
> +#define STACK_TOP_MAXSTACK_TOP
> +#define STACK_ALIGN  16
> +#endif /* __KERNEL__ */
> +
> +#ifndef __ASSEMBLY__
> +
> +struct task_struct;
> +struct pt_regs;
> +
> +/*
> + * Default implementation of macro that returns current
> + * instruction pointer ("program counter").
> + */
> +#define current_text_addr()  ({ __label__ _l; _l: &&_l; })
> +
> +/* CPU-specific state of a task */
> +struct thread_struct {
> + /* Callee-saved registers */
> + unsigned long ra;
> + unsigned long sp;   /* Kernel mode stack */
> + unsigned long s[12];/* s[0]: frame pointer */
> + struct __riscv_d_ext_state fstate;
> +};
> +
> +#define INIT_THREAD {\
> + .sp = sizeof(init_stack) + (long)_stack,   \
> +}
> +
> +/* Return saved (kernel) PC of a blocked thread. */
> +#define thread_saved_pc(t)   ((t)->thread.ra)
> +#define thread_saved_sp(t)   ((t)->thread.sp)
> +#define thread_saved_fp(t)   ((t)->thread.s[0])

These aren't needed outside of arch-specific code (anymore) and the
riscv port doesn't seem to be using them, so they can be omitted.


Re: [PATCH 5/9] RISC-V: Task implementation

2017-06-29 Thread Tobias Klauser
On 2017-06-28 at 20:55:34 +0200, Palmer Dabbelt  wrote:
[...]
> diff --git a/arch/riscv/include/asm/kprobes.h 
> b/arch/riscv/include/asm/kprobes.h
> new file mode 100644
> index ..1190de7a0f74
> --- /dev/null
> +++ b/arch/riscv/include/asm/kprobes.h
> @@ -0,0 +1,22 @@
> +/*
> + * Copyright (C) 2017 SiFive
> + *
> + *   This program is free software; you can redistribute it and/or
> + *   modify it under the terms of the GNU General Public License
> + *   as published by the Free Software Foundation, version 2.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *   GNU General Public License for more details.
> + */
> +
> +
> +#ifndef ASM_RISCV_KPROBES_H
> +#define ASM_RISCV_KPROBES_H
> +
> +#ifdef CONFIG_KPROBES
> +#error "RISC-V doesn't skpport CONFIG_KPROBES"

Typo: s/skpport/support/

> +#endif
> +
> +#endif
> diff --git a/arch/riscv/include/asm/processor.h 
> b/arch/riscv/include/asm/processor.h
> new file mode 100644
> index ..65aa014db9b4
> --- /dev/null
> +++ b/arch/riscv/include/asm/processor.h
> @@ -0,0 +1,102 @@
> +/*
> + * Copyright (C) 2012 Regents of the University of California
> + *
> + *   This program is free software; you can redistribute it and/or
> + *   modify it under the terms of the GNU General Public License
> + *   as published by the Free Software Foundation, version 2.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + *   GNU General Public License for more details.
> + */
> +
> +#ifndef _ASM_RISCV_PROCESSOR_H
> +#define _ASM_RISCV_PROCESSOR_H
> +
> +#include 
> +
> +#include 
> +
> +/*
> + * This decides where the kernel will search for a free chunk of vm
> + * space during mmap's.
> + */
> +#define TASK_UNMAPPED_BASE   PAGE_ALIGN(TASK_SIZE >> 1)
> +
> +#ifdef __KERNEL__
> +#define STACK_TOPTASK_SIZE
> +#define STACK_TOP_MAXSTACK_TOP
> +#define STACK_ALIGN  16
> +#endif /* __KERNEL__ */
> +
> +#ifndef __ASSEMBLY__
> +
> +struct task_struct;
> +struct pt_regs;
> +
> +/*
> + * Default implementation of macro that returns current
> + * instruction pointer ("program counter").
> + */
> +#define current_text_addr()  ({ __label__ _l; _l: &&_l; })
> +
> +/* CPU-specific state of a task */
> +struct thread_struct {
> + /* Callee-saved registers */
> + unsigned long ra;
> + unsigned long sp;   /* Kernel mode stack */
> + unsigned long s[12];/* s[0]: frame pointer */
> + struct __riscv_d_ext_state fstate;
> +};
> +
> +#define INIT_THREAD {\
> + .sp = sizeof(init_stack) + (long)_stack,   \
> +}
> +
> +/* Return saved (kernel) PC of a blocked thread. */
> +#define thread_saved_pc(t)   ((t)->thread.ra)
> +#define thread_saved_sp(t)   ((t)->thread.sp)
> +#define thread_saved_fp(t)   ((t)->thread.s[0])

These aren't needed outside of arch-specific code (anymore) and the
riscv port doesn't seem to be using them, so they can be omitted.


  1   2   3   4   5   >