<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/arch/riscv/kernel/Makefile, branch v5.12</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>riscv: syscall_table: Reduce W=1 compilation warnings noise</title>
<updated>2021-03-10T04:46:04+00:00</updated>
<author>
<name>Nanyong Sun</name>
<email>sunnanyong@huawei.com</email>
</author>
<published>2021-03-05T11:33:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a6a58ecf98c3f6d95123ee3e66ccb6f7672c6e68'/>
<id>a6a58ecf98c3f6d95123ee3e66ccb6f7672c6e68</id>
<content type='text'>
Building riscv syscall table with W=1 throws the warning as
following pattern:
arch/riscv/kernel/syscall_table.c:14:36: warning: initialized field overwritten [-Woverride-init]
   14 | #define __SYSCALL(nr, call) [nr] = (call),
      |                                    ^
./include/uapi/asm-generic/unistd.h:29:37: note: in expansion of macro ‘__SYSCALL’
   29 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
      |                                     ^~~~~~~~~
./include/uapi/asm-generic/unistd.h:34:1: note: in expansion of macro ‘__SC_COMP’
   34 | __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
      | ^~~~~~~~~
arch/riscv/kernel/syscall_table.c:14:36: note: (near initialization for ‘sys_call_table[0]’)
   14 | #define __SYSCALL(nr, call) [nr] = (call),
      |                                    ^
./include/uapi/asm-generic/unistd.h:29:37: note: in expansion of macro ‘__SYSCALL’
   29 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
      |                                     ^~~~~~~~~
./include/uapi/asm-generic/unistd.h:34:1: note: in expansion of macro ‘__SC_COMP’
   34 | __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
      | ^~~~~~~~~
arch/riscv/kernel/syscall_table.c:14:36: warning: initialized field overwritten [-Woverride-init]
...

Since we intentionally build the syscall tables this way,ignore the warning.

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Nanyong Sun &lt;sunnanyong@huawei.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Building riscv syscall table with W=1 throws the warning as
following pattern:
arch/riscv/kernel/syscall_table.c:14:36: warning: initialized field overwritten [-Woverride-init]
   14 | #define __SYSCALL(nr, call) [nr] = (call),
      |                                    ^
./include/uapi/asm-generic/unistd.h:29:37: note: in expansion of macro ‘__SYSCALL’
   29 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
      |                                     ^~~~~~~~~
./include/uapi/asm-generic/unistd.h:34:1: note: in expansion of macro ‘__SC_COMP’
   34 | __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
      | ^~~~~~~~~
arch/riscv/kernel/syscall_table.c:14:36: note: (near initialization for ‘sys_call_table[0]’)
   14 | #define __SYSCALL(nr, call) [nr] = (call),
      |                                    ^
./include/uapi/asm-generic/unistd.h:29:37: note: in expansion of macro ‘__SYSCALL’
   29 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
      |                                     ^~~~~~~~~
./include/uapi/asm-generic/unistd.h:34:1: note: in expansion of macro ‘__SC_COMP’
   34 | __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
      | ^~~~~~~~~
arch/riscv/kernel/syscall_table.c:14:36: warning: initialized field overwritten [-Woverride-init]
...

Since we intentionally build the syscall tables this way,ignore the warning.

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Nanyong Sun &lt;sunnanyong@huawei.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>riscv: Add kprobes supported</title>
<updated>2021-01-14T23:09:06+00:00</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2020-12-17T16:01:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c22b0bcb1dd024cb9caad9230e3a387d8b061df5'/>
<id>c22b0bcb1dd024cb9caad9230e3a387d8b061df5</id>
<content type='text'>
This patch enables "kprobe &amp; kretprobe" to work with ftrace
interface. It utilized software breakpoint as single-step
mechanism.

Some instructions which can't be single-step executed must be
simulated in kernel execution slot, such as: branch, jal, auipc,
la ...

Some instructions should be rejected for probing and we use a
blacklist to filter, such as: ecall, ebreak, ...

We use ebreak &amp; c.ebreak to replace origin instruction and the
kprobe handler prepares an executable memory slot for out-of-line
execution with a copy of the original instruction being probed.
In execution slot we add ebreak behind original instruction to
simulate a single-setp mechanism.

The patch is based on packi's work [1] and csky's work [2].
 - The kprobes_trampoline.S is all from packi's patch
 - The single-step mechanism is new designed for riscv without hw
   single-step trap
 - The simulation codes are from csky
 - Frankly, all codes refer to other archs' implementation

 [1] https://lore.kernel.org/linux-riscv/20181113195804.22825-1-me@packi.ch/
 [2] https://lore.kernel.org/linux-csky/20200403044150.20562-9-guoren@kernel.org/

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Co-developed-by: Patrick Stählin &lt;me@packi.ch&gt;
Signed-off-by: Patrick Stählin &lt;me@packi.ch&gt;
Acked-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Tested-by: Zong Li &lt;zong.li@sifive.com&gt;
Reviewed-by: Pekka Enberg &lt;penberg@kernel.org&gt;
Cc: Patrick Stählin &lt;me@packi.ch&gt;
Cc: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Cc: Björn Töpel &lt;bjorn.topel@gmail.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch enables "kprobe &amp; kretprobe" to work with ftrace
interface. It utilized software breakpoint as single-step
mechanism.

Some instructions which can't be single-step executed must be
simulated in kernel execution slot, such as: branch, jal, auipc,
la ...

Some instructions should be rejected for probing and we use a
blacklist to filter, such as: ecall, ebreak, ...

We use ebreak &amp; c.ebreak to replace origin instruction and the
kprobe handler prepares an executable memory slot for out-of-line
execution with a copy of the original instruction being probed.
In execution slot we add ebreak behind original instruction to
simulate a single-setp mechanism.

The patch is based on packi's work [1] and csky's work [2].
 - The kprobes_trampoline.S is all from packi's patch
 - The single-step mechanism is new designed for riscv without hw
   single-step trap
 - The simulation codes are from csky
 - Frankly, all codes refer to other archs' implementation

 [1] https://lore.kernel.org/linux-riscv/20181113195804.22825-1-me@packi.ch/
 [2] https://lore.kernel.org/linux-csky/20200403044150.20562-9-guoren@kernel.org/

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Co-developed-by: Patrick Stählin &lt;me@packi.ch&gt;
Signed-off-by: Patrick Stählin &lt;me@packi.ch&gt;
Acked-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Tested-by: Zong Li &lt;zong.li@sifive.com&gt;
Reviewed-by: Pekka Enberg &lt;penberg@kernel.org&gt;
Cc: Patrick Stählin &lt;me@packi.ch&gt;
Cc: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Cc: Björn Töpel &lt;bjorn.topel@gmail.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>riscv: Fixup patch_text panic in ftrace</title>
<updated>2021-01-14T23:09:04+00:00</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2020-12-17T16:01:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5ad84adf5456313e285734102367c861c436c5ed'/>
<id>5ad84adf5456313e285734102367c861c436c5ed</id>
<content type='text'>
Just like arm64, we can't trace the function in the patch_text path.

Here is the bug log:

[   45.234334] Unable to handle kernel paging request at virtual address ffffffd38ae80900
[   45.242313] Oops [#1]
[   45.244600] Modules linked in:
[   45.247678] CPU: 0 PID: 11 Comm: migration/0 Not tainted 5.9.0-00025-g9b7db83-dirty #215
[   45.255797] epc: ffffffe00021689a ra : ffffffe00021718e sp : ffffffe01afabb58
[   45.262955]  gp : ffffffe00136afa0 tp : ffffffe01af94d00 t0 : 0000000000000002
[   45.270200]  t1 : 0000000000000000 t2 : 0000000000000001 s0 : ffffffe01afabc08
[   45.277443]  s1 : ffffffe0013718a8 a0 : 0000000000000000 a1 : ffffffe01afabba8
[   45.284686]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : c4c16ad38ae80900
[   45.291929]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000052464e43
[   45.299173]  s2 : 0000000000000001 s3 : ffffffe000206a60 s4 : ffffffe000206a60
[   45.306415]  s5 : 00000000000009ec s6 : ffffffe0013718a8 s7 : c4c16ad38ae80900
[   45.313658]  s8 : 0000000000000004 s9 : 0000000000000001 s10: 0000000000000001
[   45.320902]  s11: 0000000000000003 t3 : 0000000000000001 t4 : ffffffffd192fe79
[   45.328144]  t5 : ffffffffb8f80000 t6 : 0000000000040000
[   45.333472] status: 0000000200000100 badaddr: ffffffd38ae80900 cause: 000000000000000f
[   45.341514] ---[ end trace d95102172248fdcf ]---
[   45.346176] note: migration/0[11] exited with preempt_count 1

(gdb) x /2i $pc
=&gt; 0xffffffe00021689a &lt;__do_proc_dointvec+196&gt;: sd      zero,0(s7)
   0xffffffe00021689e &lt;__do_proc_dointvec+200&gt;: li      s11,0

(gdb) bt
0  __do_proc_dointvec (tbl_data=0x0, table=0xffffffe01afabba8,
write=0, buffer=0x0, lenp=0x7bf897061f9a0800, ppos=0x4, conv=0x0,
data=0x52464e43) at kernel/sysctl.c:581
1  0xffffffe00021718e in do_proc_dointvec (data=&lt;optimized out&gt;,
conv=&lt;optimized out&gt;, ppos=&lt;optimized out&gt;, lenp=&lt;optimized out&gt;,
buffer=&lt;optimized out&gt;, write=&lt;optimized out&gt;, table=&lt;optimized out&gt;)
at kernel/sysctl.c:964
2  proc_dointvec_minmax (ppos=&lt;optimized out&gt;, lenp=&lt;optimized out&gt;,
buffer=&lt;optimized out&gt;, write=&lt;optimized out&gt;, table=&lt;optimized out&gt;)
at kernel/sysctl.c:964
3  proc_do_static_key (table=&lt;optimized out&gt;, write=1, buffer=0x0,
lenp=0x0, ppos=0x7bf897061f9a0800) at kernel/sysctl.c:1643
4  0xffffffe000206792 in ftrace_make_call (rec=&lt;optimized out&gt;,
addr=&lt;optimized out&gt;) at arch/riscv/kernel/ftrace.c:109
5  0xffffffe0002c9c04 in __ftrace_replace_code
(rec=0xffffffe01ae40c30, enable=3) at kernel/trace/ftrace.c:2503
6  0xffffffe0002ca0b2 in ftrace_replace_code (mod_flags=&lt;optimized
out&gt;) at kernel/trace/ftrace.c:2530
7  0xffffffe0002ca26a in ftrace_modify_all_code (command=5) at
kernel/trace/ftrace.c:2677
8  0xffffffe0002ca30e in __ftrace_modify_code (data=&lt;optimized out&gt;)
at kernel/trace/ftrace.c:2703
9  0xffffffe0002c13b0 in multi_cpu_stop (data=0x0) at kernel/stop_machine.c:224
10 0xffffffe0002c0fde in cpu_stopper_thread (cpu=&lt;optimized out&gt;) at
kernel/stop_machine.c:491
11 0xffffffe0002343de in smpboot_thread_fn (data=0x0) at kernel/smpboot.c:165
12 0xffffffe00022f8b4 in kthread (_create=0xffffffe01af0c040) at
kernel/kthread.c:292
13 0xffffffe000201fac in handle_exception () at arch/riscv/kernel/entry.S:236

   0xffffffe00020678a &lt;+114&gt;:   auipc   ra,0xffffe
   0xffffffe00020678e &lt;+118&gt;:   jalr    -118(ra) # 0xffffffe000204714 &lt;patch_text_nosync&gt;
   0xffffffe000206792 &lt;+122&gt;:   snez    a0,a0

(gdb) disassemble patch_text_nosync
Dump of assembler code for function patch_text_nosync:
   0xffffffe000204714 &lt;+0&gt;:     addi    sp,sp,-32
   0xffffffe000204716 &lt;+2&gt;:     sd      s0,16(sp)
   0xffffffe000204718 &lt;+4&gt;:     sd      ra,24(sp)
   0xffffffe00020471a &lt;+6&gt;:     addi    s0,sp,32
   0xffffffe00020471c &lt;+8&gt;:     auipc   ra,0x0
   0xffffffe000204720 &lt;+12&gt;:    jalr    -384(ra) # 0xffffffe00020459c &lt;patch_insn_write&gt;
   0xffffffe000204724 &lt;+16&gt;:    beqz    a0,0xffffffe00020472e &lt;patch_text_nosync+26&gt;
   0xffffffe000204726 &lt;+18&gt;:    ld      ra,24(sp)
   0xffffffe000204728 &lt;+20&gt;:    ld      s0,16(sp)
   0xffffffe00020472a &lt;+22&gt;:    addi    sp,sp,32
   0xffffffe00020472c &lt;+24&gt;:    ret
   0xffffffe00020472e &lt;+26&gt;:    sd      a0,-24(s0)
   0xffffffe000204732 &lt;+30&gt;:    auipc   ra,0x4
   0xffffffe000204736 &lt;+34&gt;:    jalr    -1464(ra) # 0xffffffe00020817a &lt;flush_icache_all&gt;
   0xffffffe00020473a &lt;+38&gt;:    ld      a0,-24(s0)
   0xffffffe00020473e &lt;+42&gt;:    ld      ra,24(sp)
   0xffffffe000204740 &lt;+44&gt;:    ld      s0,16(sp)
   0xffffffe000204742 &lt;+46&gt;:    addi    sp,sp,32
   0xffffffe000204744 &lt;+48&gt;:    ret

(gdb) disassemble flush_icache_all-4
Dump of assembler code for function flush_icache_all:
   0xffffffe00020817a &lt;+0&gt;:     addi    sp,sp,-8
   0xffffffe00020817c &lt;+2&gt;:     sd      ra,0(sp)
   0xffffffe00020817e &lt;+4&gt;:     auipc   ra,0xfffff
   0xffffffe000208182 &lt;+8&gt;:     jalr    -1822(ra) # 0xffffffe000206a60 &lt;ftrace_caller&gt;
   0xffffffe000208186 &lt;+12&gt;:    ld      ra,0(sp)
   0xffffffe000208188 &lt;+14&gt;:    addi    sp,sp,8
   0xffffffe00020818a &lt;+0&gt;:     addi    sp,sp,-16
   0xffffffe00020818c &lt;+2&gt;:     sd      s0,0(sp)
   0xffffffe00020818e &lt;+4&gt;:     sd      ra,8(sp)
   0xffffffe000208190 &lt;+6&gt;:     addi    s0,sp,16
   0xffffffe000208192 &lt;+8&gt;:     li      a0,0
   0xffffffe000208194 &lt;+10&gt;:    auipc   ra,0xfffff
   0xffffffe000208198 &lt;+14&gt;:    jalr    -410(ra) # 0xffffffe000206ffa &lt;sbi_remote_fence_i&gt;
   0xffffffe00020819c &lt;+18&gt;:    ld      s0,0(sp)
   0xffffffe00020819e &lt;+20&gt;:    ld      ra,8(sp)
   0xffffffe0002081a0 &lt;+22&gt;:    addi    sp,sp,16
   0xffffffe0002081a2 &lt;+24&gt;:    ret

(gdb) frame 5
(rec=0xffffffe01ae40c30, enable=3) at kernel/trace/ftrace.c:2503
2503                    return ftrace_make_call(rec, ftrace_addr);
(gdb) p /x rec-&gt;ip
$2 = 0xffffffe00020817a -&gt; flush_icache_all !

When we modified flush_icache_all's patchable-entry with ftrace_caller:
 - Insert ftrace_caller at flush_icache_all prologue.
 - Call flush_icache_all to sync I/Dcache, but flush_icache_all is
just we modified by half.

Link: https://lore.kernel.org/linux-riscv/CAJF2gTT=oDWesWe0JVWvTpGi60-gpbNhYLdFWN_5EbyeqoEDdw@mail.gmail.com/T/#t
Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Reviewed-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Just like arm64, we can't trace the function in the patch_text path.

Here is the bug log:

[   45.234334] Unable to handle kernel paging request at virtual address ffffffd38ae80900
[   45.242313] Oops [#1]
[   45.244600] Modules linked in:
[   45.247678] CPU: 0 PID: 11 Comm: migration/0 Not tainted 5.9.0-00025-g9b7db83-dirty #215
[   45.255797] epc: ffffffe00021689a ra : ffffffe00021718e sp : ffffffe01afabb58
[   45.262955]  gp : ffffffe00136afa0 tp : ffffffe01af94d00 t0 : 0000000000000002
[   45.270200]  t1 : 0000000000000000 t2 : 0000000000000001 s0 : ffffffe01afabc08
[   45.277443]  s1 : ffffffe0013718a8 a0 : 0000000000000000 a1 : ffffffe01afabba8
[   45.284686]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : c4c16ad38ae80900
[   45.291929]  a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000052464e43
[   45.299173]  s2 : 0000000000000001 s3 : ffffffe000206a60 s4 : ffffffe000206a60
[   45.306415]  s5 : 00000000000009ec s6 : ffffffe0013718a8 s7 : c4c16ad38ae80900
[   45.313658]  s8 : 0000000000000004 s9 : 0000000000000001 s10: 0000000000000001
[   45.320902]  s11: 0000000000000003 t3 : 0000000000000001 t4 : ffffffffd192fe79
[   45.328144]  t5 : ffffffffb8f80000 t6 : 0000000000040000
[   45.333472] status: 0000000200000100 badaddr: ffffffd38ae80900 cause: 000000000000000f
[   45.341514] ---[ end trace d95102172248fdcf ]---
[   45.346176] note: migration/0[11] exited with preempt_count 1

(gdb) x /2i $pc
=&gt; 0xffffffe00021689a &lt;__do_proc_dointvec+196&gt;: sd      zero,0(s7)
   0xffffffe00021689e &lt;__do_proc_dointvec+200&gt;: li      s11,0

(gdb) bt
0  __do_proc_dointvec (tbl_data=0x0, table=0xffffffe01afabba8,
write=0, buffer=0x0, lenp=0x7bf897061f9a0800, ppos=0x4, conv=0x0,
data=0x52464e43) at kernel/sysctl.c:581
1  0xffffffe00021718e in do_proc_dointvec (data=&lt;optimized out&gt;,
conv=&lt;optimized out&gt;, ppos=&lt;optimized out&gt;, lenp=&lt;optimized out&gt;,
buffer=&lt;optimized out&gt;, write=&lt;optimized out&gt;, table=&lt;optimized out&gt;)
at kernel/sysctl.c:964
2  proc_dointvec_minmax (ppos=&lt;optimized out&gt;, lenp=&lt;optimized out&gt;,
buffer=&lt;optimized out&gt;, write=&lt;optimized out&gt;, table=&lt;optimized out&gt;)
at kernel/sysctl.c:964
3  proc_do_static_key (table=&lt;optimized out&gt;, write=1, buffer=0x0,
lenp=0x0, ppos=0x7bf897061f9a0800) at kernel/sysctl.c:1643
4  0xffffffe000206792 in ftrace_make_call (rec=&lt;optimized out&gt;,
addr=&lt;optimized out&gt;) at arch/riscv/kernel/ftrace.c:109
5  0xffffffe0002c9c04 in __ftrace_replace_code
(rec=0xffffffe01ae40c30, enable=3) at kernel/trace/ftrace.c:2503
6  0xffffffe0002ca0b2 in ftrace_replace_code (mod_flags=&lt;optimized
out&gt;) at kernel/trace/ftrace.c:2530
7  0xffffffe0002ca26a in ftrace_modify_all_code (command=5) at
kernel/trace/ftrace.c:2677
8  0xffffffe0002ca30e in __ftrace_modify_code (data=&lt;optimized out&gt;)
at kernel/trace/ftrace.c:2703
9  0xffffffe0002c13b0 in multi_cpu_stop (data=0x0) at kernel/stop_machine.c:224
10 0xffffffe0002c0fde in cpu_stopper_thread (cpu=&lt;optimized out&gt;) at
kernel/stop_machine.c:491
11 0xffffffe0002343de in smpboot_thread_fn (data=0x0) at kernel/smpboot.c:165
12 0xffffffe00022f8b4 in kthread (_create=0xffffffe01af0c040) at
kernel/kthread.c:292
13 0xffffffe000201fac in handle_exception () at arch/riscv/kernel/entry.S:236

   0xffffffe00020678a &lt;+114&gt;:   auipc   ra,0xffffe
   0xffffffe00020678e &lt;+118&gt;:   jalr    -118(ra) # 0xffffffe000204714 &lt;patch_text_nosync&gt;
   0xffffffe000206792 &lt;+122&gt;:   snez    a0,a0

(gdb) disassemble patch_text_nosync
Dump of assembler code for function patch_text_nosync:
   0xffffffe000204714 &lt;+0&gt;:     addi    sp,sp,-32
   0xffffffe000204716 &lt;+2&gt;:     sd      s0,16(sp)
   0xffffffe000204718 &lt;+4&gt;:     sd      ra,24(sp)
   0xffffffe00020471a &lt;+6&gt;:     addi    s0,sp,32
   0xffffffe00020471c &lt;+8&gt;:     auipc   ra,0x0
   0xffffffe000204720 &lt;+12&gt;:    jalr    -384(ra) # 0xffffffe00020459c &lt;patch_insn_write&gt;
   0xffffffe000204724 &lt;+16&gt;:    beqz    a0,0xffffffe00020472e &lt;patch_text_nosync+26&gt;
   0xffffffe000204726 &lt;+18&gt;:    ld      ra,24(sp)
   0xffffffe000204728 &lt;+20&gt;:    ld      s0,16(sp)
   0xffffffe00020472a &lt;+22&gt;:    addi    sp,sp,32
   0xffffffe00020472c &lt;+24&gt;:    ret
   0xffffffe00020472e &lt;+26&gt;:    sd      a0,-24(s0)
   0xffffffe000204732 &lt;+30&gt;:    auipc   ra,0x4
   0xffffffe000204736 &lt;+34&gt;:    jalr    -1464(ra) # 0xffffffe00020817a &lt;flush_icache_all&gt;
   0xffffffe00020473a &lt;+38&gt;:    ld      a0,-24(s0)
   0xffffffe00020473e &lt;+42&gt;:    ld      ra,24(sp)
   0xffffffe000204740 &lt;+44&gt;:    ld      s0,16(sp)
   0xffffffe000204742 &lt;+46&gt;:    addi    sp,sp,32
   0xffffffe000204744 &lt;+48&gt;:    ret

(gdb) disassemble flush_icache_all-4
Dump of assembler code for function flush_icache_all:
   0xffffffe00020817a &lt;+0&gt;:     addi    sp,sp,-8
   0xffffffe00020817c &lt;+2&gt;:     sd      ra,0(sp)
   0xffffffe00020817e &lt;+4&gt;:     auipc   ra,0xfffff
   0xffffffe000208182 &lt;+8&gt;:     jalr    -1822(ra) # 0xffffffe000206a60 &lt;ftrace_caller&gt;
   0xffffffe000208186 &lt;+12&gt;:    ld      ra,0(sp)
   0xffffffe000208188 &lt;+14&gt;:    addi    sp,sp,8
   0xffffffe00020818a &lt;+0&gt;:     addi    sp,sp,-16
   0xffffffe00020818c &lt;+2&gt;:     sd      s0,0(sp)
   0xffffffe00020818e &lt;+4&gt;:     sd      ra,8(sp)
   0xffffffe000208190 &lt;+6&gt;:     addi    s0,sp,16
   0xffffffe000208192 &lt;+8&gt;:     li      a0,0
   0xffffffe000208194 &lt;+10&gt;:    auipc   ra,0xfffff
   0xffffffe000208198 &lt;+14&gt;:    jalr    -410(ra) # 0xffffffe000206ffa &lt;sbi_remote_fence_i&gt;
   0xffffffe00020819c &lt;+18&gt;:    ld      s0,0(sp)
   0xffffffe00020819e &lt;+20&gt;:    ld      ra,8(sp)
   0xffffffe0002081a0 &lt;+22&gt;:    addi    sp,sp,16
   0xffffffe0002081a2 &lt;+24&gt;:    ret

(gdb) frame 5
(rec=0xffffffe01ae40c30, enable=3) at kernel/trace/ftrace.c:2503
2503                    return ftrace_make_call(rec, ftrace_addr);
(gdb) p /x rec-&gt;ip
$2 = 0xffffffe00020817a -&gt; flush_icache_all !

When we modified flush_icache_all's patchable-entry with ftrace_caller:
 - Insert ftrace_caller at flush_icache_all prologue.
 - Call flush_icache_all to sync I/Dcache, but flush_icache_all is
just we modified by half.

Link: https://lore.kernel.org/linux-riscv/CAJF2gTT=oDWesWe0JVWvTpGi60-gpbNhYLdFWN_5EbyeqoEDdw@mail.gmail.com/T/#t
Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Reviewed-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>riscv: Fixup wrong ftrace remove cflag</title>
<updated>2021-01-14T23:09:03+00:00</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2020-12-17T16:01:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=67d945778099b14324811fe67c5aff2cda7a7ad5'/>
<id>67d945778099b14324811fe67c5aff2cda7a7ad5</id>
<content type='text'>
We must use $(CC_FLAGS_FTRACE) instead of directly using -pg. It
will cause -fpatchable-function-entry error.

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We must use $(CC_FLAGS_FTRACE) instead of directly using -pg. It
will cause -fpatchable-function-entry error.

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>riscv: kernel: Drop unused clean rule</title>
<updated>2020-12-11T01:42:34+00:00</updated>
<author>
<name>Kefeng Wang</name>
<email>wangkefeng.wang@huawei.com</email>
</author>
<published>2020-11-21T10:15:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=772e1b7c426762159e5150ecff5268e6e1f361d3'/>
<id>772e1b7c426762159e5150ecff5268e6e1f361d3</id>
<content type='text'>
Signed-off-by: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>RISC-V: Add EFI runtime services</title>
<updated>2020-10-02T21:31:28+00:00</updated>
<author>
<name>Atish Patra</name>
<email>atish.patra@wdc.com</email>
</author>
<published>2020-09-17T22:37:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b91540d52a08b65eb6a2b09132e1bd54fa82754c'/>
<id>b91540d52a08b65eb6a2b09132e1bd54fa82754c</id>
<content type='text'>
This patch adds EFI runtime service support for RISC-V.

Signed-off-by: Atish Patra &lt;atish.patra@wdc.com&gt;
[ardb: - Remove the page check]
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Acked-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds EFI runtime service support for RISC-V.

Signed-off-by: Atish Patra &lt;atish.patra@wdc.com&gt;
[ardb: - Remove the page check]
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Acked-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>RISC-V: Remove CLINT related code from timer and arch</title>
<updated>2020-08-20T17:58:13+00:00</updated>
<author>
<name>Anup Patel</name>
<email>anup.patel@wdc.com</email>
</author>
<published>2020-08-17T12:42:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2bc3fc877aa9c4c8b80cc49f66dfcb7e4857a128'/>
<id>2bc3fc877aa9c4c8b80cc49f66dfcb7e4857a128</id>
<content type='text'>
Right now the RISC-V timer driver is convoluted to support:
1. Linux RISC-V S-mode (with MMU) where it will use TIME CSR for
   clocksource and SBI timer calls for clockevent device.
2. Linux RISC-V M-mode (without MMU) where it will use CLINT MMIO
   counter register for clocksource and CLINT MMIO compare register
   for clockevent device.

We now have a separate CLINT timer driver which also provide CLINT
based IPI operations so let's remove CLINT MMIO related code from
arch/riscv directory and RISC-V timer driver.

Signed-off-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Tested-by: Emil Renner Berhing &lt;kernel@esmil.dk&gt;
Acked-by: Daniel Lezcano &lt;daniel.lezcano@linaro.org&gt;
Reviewed-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Reviewed-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Right now the RISC-V timer driver is convoluted to support:
1. Linux RISC-V S-mode (with MMU) where it will use TIME CSR for
   clocksource and SBI timer calls for clockevent device.
2. Linux RISC-V M-mode (without MMU) where it will use CLINT MMIO
   counter register for clocksource and CLINT MMIO compare register
   for clockevent device.

We now have a separate CLINT timer driver which also provide CLINT
based IPI operations so let's remove CLINT MMIO related code from
arch/riscv directory and RISC-V timer driver.

Signed-off-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Tested-by: Emil Renner Berhing &lt;kernel@esmil.dk&gt;
Acked-by: Daniel Lezcano &lt;daniel.lezcano@linaro.org&gt;
Reviewed-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Reviewed-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>riscv: Add jump-label implementation</title>
<updated>2020-07-30T18:37:43+00:00</updated>
<author>
<name>Emil Renner Berthing</name>
<email>kernel@esmil.dk</email>
</author>
<published>2020-07-14T07:40:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=ebc00dde8a975a543f5e1a7cdac93fef89fefe58'/>
<id>ebc00dde8a975a543f5e1a7cdac93fef89fefe58</id>
<content type='text'>
Add jump-label implementation based on the ARM64 version
and add CONFIG_JUMP_LABEL=y to the defconfigs.

Signed-off-by: Emil Renner Berthing &lt;kernel@esmil.dk&gt;
Reviewed-by: Björn Töpel &lt;bjorn.topel@gmail.com&gt;
Tested-by: Björn Töpel &lt;bjorn.topel@gmail.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add jump-label implementation based on the ARM64 version
and add CONFIG_JUMP_LABEL=y to the defconfigs.

Signed-off-by: Emil Renner Berthing &lt;kernel@esmil.dk&gt;
Reviewed-by: Björn Töpel &lt;bjorn.topel@gmail.com&gt;
Tested-by: Björn Töpel &lt;bjorn.topel@gmail.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>riscv: Add KGDB support</title>
<updated>2020-05-18T18:38:10+00:00</updated>
<author>
<name>Vincent Chen</name>
<email>vincent.chen@sifive.com</email>
</author>
<published>2020-04-16T02:38:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=fe89bd2be8667d4d876329dd534dd59158e33b1f'/>
<id>fe89bd2be8667d4d876329dd534dd59158e33b1f</id>
<content type='text'>
The skeleton of RISC-V KGDB port.

Signed-off-by: Vincent Chen &lt;vincent.chen@sifive.com&gt;
Reviewed-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The skeleton of RISC-V KGDB port.

Signed-off-by: Vincent Chen &lt;vincent.chen@sifive.com&gt;
Reviewed-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>riscv: perf: RISCV_BASE_PMU should be independent</title>
<updated>2020-05-12T23:21:46+00:00</updated>
<author>
<name>Kefeng Wang</name>
<email>wangkefeng.wang@huawei.com</email>
</author>
<published>2020-05-07T15:04:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=48084c3595cb7429f6ba734cfea1313573b9a7fa'/>
<id>48084c3595cb7429f6ba734cfea1313573b9a7fa</id>
<content type='text'>
Selecting PERF_EVENTS without selecting RISCV_BASE_PMU results in a build
error.

Signed-off-by: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
[Palmer: commit text]
Fixes: 178e9fc47aae("perf: riscv: preliminary RISC-V support")
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Selecting PERF_EVENTS without selecting RISCV_BASE_PMU results in a build
error.

Signed-off-by: Kefeng Wang &lt;wangkefeng.wang@huawei.com&gt;
[Palmer: commit text]
Fixes: 178e9fc47aae("perf: riscv: preliminary RISC-V support")
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
