<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/riscv/kernel, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-10-04T14:33:12Z</updated>
<entry>
<title>riscv: Fix fp alignment bug in perf_callchain_user()</title>
<updated>2024-10-04T14:33:12Z</updated>
<author>
<name>Jinjie Ruan</name>
</author>
<published>2024-07-08T03:28:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=09210bb3a0f4b6d599c494017a38774b563bac4d'/>
<id>urn:sha1:09210bb3a0f4b6d599c494017a38774b563bac4d</id>
<content type='text'>
[ Upstream commit 22ab08955ea13be04a8efd20cc30890e0afaa49c ]

The standard RISC-V calling convention said:
	"The stack grows downward and the stack pointer is always
	kept 16-byte aligned".

So perf_callchain_user() should check whether 16-byte aligned for fp.

Link: https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf

Fixes: dbeb90b0c1eb ("riscv: Add perf callchain support")
Signed-off-by: Jinjie Ruan &lt;ruanjinjie@huawei.com&gt;
Cc: Björn Töpel &lt;bjorn@kernel.org&gt;
Link: https://lore.kernel.org/r/20240708032847.2998158-2-ruanjinjie@huawei.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: Fix RISCV_ALTERNATIVE_EARLY</title>
<updated>2024-09-12T09:13:12Z</updated>
<author>
<name>Alexandre Ghiti</name>
</author>
<published>2024-08-29T16:50:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=82f134ddd4f5da11c277bd1aa02e2a733179725a'/>
<id>urn:sha1:82f134ddd4f5da11c277bd1aa02e2a733179725a</id>
<content type='text'>
[ Upstream commit 1ff95eb2bebda50c4c5406caaf201e0fcb24cc8f ]

RISCV_ALTERNATIVE_EARLY will issue sbi_ecall() very early in the boot
process, before the first memory mapping is setup so we can't have any
instrumentation happening here.

In addition, when the kernel is relocatable, we must also not issue any
relocation this early since they would have been patched virtually only.

So, instead of disabling instrumentation for the whole kernel/sbi.c file
and compiling it with -fno-pie, simply move __sbi_ecall() and
__sbi_base_ecall() into their own file where this is fixed.

Reported-by: Conor Dooley &lt;conor.dooley@microchip.com&gt;
Closes: https://lore.kernel.org/linux-riscv/20240813-pony-truck-3e7a83e9759e@spud/
Reported-by: syzbot+cfbcb82adf6d7279fd35@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-riscv/00000000000065062c061fcec37b@google.com/
Fixes: 1745cfafebdf ("riscv: don't use global static vars to store alternative data")
Signed-off-by: Alexandre Ghiti &lt;alexghiti@rivosinc.com&gt;
Link: https://lore.kernel.org/r/20240829165048.49756-1-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: Improve sbi_ecall() code generation by reordering arguments</title>
<updated>2024-09-12T09:13:12Z</updated>
<author>
<name>Alexandre Ghiti</name>
</author>
<published>2024-03-22T11:26:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bb63fe4f5f31006ba544fd588234ce407ead93be'/>
<id>urn:sha1:bb63fe4f5f31006ba544fd588234ce407ead93be</id>
<content type='text'>
[ Upstream commit 16badacd8af48980c546839626d0329bab32b4c3 ]

The sbi_ecall() function arguments are not in the same order as the
ecall arguments, so we end up re-ordering the registers before the
ecall which is useless and costly.

So simply reorder the arguments in the same way as expected by ecall.
Instead of reordering directly the arguments of sbi_ecall(), use a proxy
macro since the current ordering is more natural.

Before:

Dump of assembler code for function sbi_ecall:
   0xffffffff800085e0 &lt;+0&gt;: add sp,sp,-32
   0xffffffff800085e2 &lt;+2&gt;: sd s0,24(sp)
   0xffffffff800085e4 &lt;+4&gt;: mv t1,a0
   0xffffffff800085e6 &lt;+6&gt;: add s0,sp,32
   0xffffffff800085e8 &lt;+8&gt;: mv t3,a1
   0xffffffff800085ea &lt;+10&gt;: mv a0,a2
   0xffffffff800085ec &lt;+12&gt;: mv a1,a3
   0xffffffff800085ee &lt;+14&gt;: mv a2,a4
   0xffffffff800085f0 &lt;+16&gt;: mv a3,a5
   0xffffffff800085f2 &lt;+18&gt;: mv a4,a6
   0xffffffff800085f4 &lt;+20&gt;: mv a5,a7
   0xffffffff800085f6 &lt;+22&gt;: mv a6,t3
   0xffffffff800085f8 &lt;+24&gt;: mv a7,t1
   0xffffffff800085fa &lt;+26&gt;: ecall
   0xffffffff800085fe &lt;+30&gt;: ld s0,24(sp)
   0xffffffff80008600 &lt;+32&gt;: add sp,sp,32
   0xffffffff80008602 &lt;+34&gt;: ret

After:

Dump of assembler code for function __sbi_ecall:
   0xffffffff8000b6b2 &lt;+0&gt;:	add	sp,sp,-32
   0xffffffff8000b6b4 &lt;+2&gt;:	sd	s0,24(sp)
   0xffffffff8000b6b6 &lt;+4&gt;:	add	s0,sp,32
   0xffffffff8000b6b8 &lt;+6&gt;:	ecall
   0xffffffff8000b6bc &lt;+10&gt;:	ld	s0,24(sp)
   0xffffffff8000b6be &lt;+12&gt;:	add	sp,sp,32
   0xffffffff8000b6c0 &lt;+14&gt;:	ret

Signed-off-by: Alexandre Ghiti &lt;alexghiti@rivosinc.com&gt;
Reviewed-by: Atish Patra &lt;atishp@rivosinc.com&gt;
Reviewed-by: Yunhui Cui &lt;cuiyunhui@bytedance.com&gt;
Link: https://lore.kernel.org/r/20240322112629.68170-1-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Stable-dep-of: 1ff95eb2bebd ("riscv: Fix RISCV_ALTERNATIVE_EARLY")
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: Add tracepoints for SBI calls and returns</title>
<updated>2024-09-12T09:13:12Z</updated>
<author>
<name>Samuel Holland</name>
</author>
<published>2024-03-21T23:01:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3445b6ccc792268119a9f415a51c9a21129205bf'/>
<id>urn:sha1:3445b6ccc792268119a9f415a51c9a21129205bf</id>
<content type='text'>
[ Upstream commit 56c1c1a09ab93c7b7c957860f01f8600d6c03143 ]

These are useful for measuring the latency of SBI calls. The SBI HSM
extension is excluded because those functions are called from contexts
such as cpuidle where instrumentation is not allowed.

Reviewed-by: Andrew Jones &lt;ajones@ventanamicro.com&gt;
Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Link: https://lore.kernel.org/r/20240321230131.1838105-1-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Stable-dep-of: 1ff95eb2bebd ("riscv: Fix RISCV_ALTERNATIVE_EARLY")
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: set trap vector earlier</title>
<updated>2024-09-12T09:13:02Z</updated>
<author>
<name>yang.zhang</name>
</author>
<published>2024-05-08T02:24:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6ffa0fb4f842b5eea1d9e4e5b71401d6556040cf'/>
<id>urn:sha1:6ffa0fb4f842b5eea1d9e4e5b71401d6556040cf</id>
<content type='text'>
[ Upstream commit 6ad8735994b854b23c824dd6b1dd2126e893a3b4 ]

The exception vector of the booting hart is not set before enabling
the mmu and then still points to the value of the previous firmware,
typically _start. That makes it hard to debug setup_vm() when bad
things happen. So fix that by setting the exception vector earlier.

Reviewed-by: Alexandre Ghiti &lt;alexghiti@rivosinc.com&gt;
Signed-off-by: yang.zhang &lt;yang.zhang@hexintek.com&gt;
Link: https://lore.kernel.org/r/20240508022445.6131-1-gaoshanliukou@163.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: kprobes: Use patch_text_nosync() for insn slots</title>
<updated>2024-09-12T09:12:51Z</updated>
<author>
<name>Samuel Holland</name>
</author>
<published>2024-03-27T16:04:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f80c65d1e9a69a66baff82765b74c6c6d934e2f4'/>
<id>urn:sha1:f80c65d1e9a69a66baff82765b74c6c6d934e2f4</id>
<content type='text'>
[ Upstream commit b1756750a397f36ddc857989d31887c3f5081fb0 ]

These instructions are not yet visible to the rest of the system,
so there is no need to do the whole stop_machine() dance.

Reviewed-by: Björn Töpel &lt;bjorn@rivosinc.com&gt;
Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Link: https://lore.kernel.org/r/20240327160520.791322-4-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: misaligned: Restrict user access to kernel memory</title>
<updated>2024-09-12T09:12:45Z</updated>
<author>
<name>Samuel Holland</name>
</author>
<published>2024-08-15T00:57:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a3b6ff6c896aee5ef9b581e40d0045ff04fcbc8c'/>
<id>urn:sha1:a3b6ff6c896aee5ef9b581e40d0045ff04fcbc8c</id>
<content type='text'>
commit b686ecdeacf6658e1348c1a32a08e2e72f7c0f00 upstream.

raw_copy_{to,from}_user() do not call access_ok(), so this code allowed
userspace to access any virtual memory address.

Cc: stable@vger.kernel.org
Fixes: 7c83232161f6 ("riscv: add support for misaligned trap handling in S-mode")
Fixes: 441381506ba7 ("riscv: misaligned: remove CONFIG_RISCV_M_MODE specific code")
Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Reviewed-by: Alexandre Ghiti &lt;alexghiti@rivosinc.com&gt;
Link: https://lore.kernel.org/r/20240815005714.1163136-1-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>riscv: entry: always initialize regs-&gt;a0 to -ENOSYS</title>
<updated>2024-08-29T15:35:37Z</updated>
<author>
<name>Celeste Liu</name>
</author>
<published>2024-06-27T14:23:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1e1670cadfad3a854e3e2cec7b93a01deef278f5'/>
<id>urn:sha1:1e1670cadfad3a854e3e2cec7b93a01deef278f5</id>
<content type='text'>
commit 61119394631f219e23ce98bcc3eb993a64a8ea64 upstream.

Otherwise when the tracer changes syscall number to -1, the kernel fails
to initialize a0 with -ENOSYS and subsequently fails to return the error
code of the failed syscall to userspace. For example, it will break
strace syscall tampering.

Fixes: 52449c17bdd1 ("riscv: entry: set a0 = -ENOSYS only when syscall != -1")
Reported-by: "Dmitry V. Levin" &lt;ldv@strace.io&gt;
Reviewed-by: Björn Töpel &lt;bjorn@rivosinc.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Celeste Liu &lt;CoelacanthusHex@gmail.com&gt;
Link: https://lore.kernel.org/r/20240627142338.5114-2-CoelacanthusHex@gmail.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Enable the IPI before workqueue_online_cpu()</title>
<updated>2024-08-11T10:57:56Z</updated>
<author>
<name>Nick Hu</name>
</author>
<published>2024-07-17T03:17:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fd7df98c2a760eb3bdec2dd765ba4641f352f709'/>
<id>urn:sha1:fd7df98c2a760eb3bdec2dd765ba4641f352f709</id>
<content type='text'>
[ Upstream commit 3908ba2e0b2476e2ec13e15967bf6a37e449f2af ]

Sometimes the hotplug cpu stalls at the arch_cpu_idle() for a while after
workqueue_online_cpu(). When cpu stalls at the idle loop, the reschedule
IPI is pending. However the enable bit is not enabled yet so the cpu stalls
at WFI until watchdog timeout. Therefore enable the IPI before the
workqueue_online_cpu() to fix the issue.

Fixes: 63c5484e7495 ("workqueue: Add multiple affinity scopes and interface to select them")
Signed-off-by: Nick Hu &lt;nick.hu@sifive.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20240717031714.1946036-1-nick.hu@sifive.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: smp: fail booting up smp if inconsistent vlen is detected</title>
<updated>2024-08-03T07:00:06Z</updated>
<author>
<name>Andy Chiu</name>
</author>
<published>2024-05-09T16:26:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1911fd52a37a294f08457892aea001f7c811c8de'/>
<id>urn:sha1:1911fd52a37a294f08457892aea001f7c811c8de</id>
<content type='text'>
[ Upstream commit 38a94c46660f5612c6ef37ec9754ec1543b038cd ]

Currently we only support Vector for SMP platforms, that is, all SMP
cores have the same vlenb. If we happen to detect a mismatching vlen, it
is better to just fail bootting it up to prevent further race/scheduling
issues.

Also, move .Lsecondary_park forward and chage `tail smp_callin` into a
regular call in the early assembly. So a core would be parked right
after a return from smp_callin. Note that a successful smp_callin
does not return.

Fixes: 7017858eb2d7 ("riscv: Introduce riscv_v_vsize to record size of Vector context")
Reported-by: Conor Dooley &lt;conor.dooley@microchip.com&gt;
Closes: https://lore.kernel.org/linux-riscv/20240228-vicinity-cornstalk-4b8eb5fe5730@spud/
Signed-off-by: Andy Chiu &lt;andy.chiu@sifive.com&gt;
Reviewed-by: Conor Dooley &lt;conor.dooley@microchip.com&gt;
Reviewed-by: Yunhui Cui &lt;cuiyunhui@bytedance.com&gt;
Link: https://lore.kernel.org/r/20240510-zve-detection-v5-2-0711bdd26c12@sifive.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
</feed>
