<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/riscv, branch linux-5.7.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.7.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.7.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-08-26T09:42:12Z</updated>
<entry>
<title>riscv: Fixup static_obj() fail</title>
<updated>2020-08-26T09:42:12Z</updated>
<author>
<name>Guo Ren</name>
</author>
<published>2020-06-27T13:57:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b7df3f40fb7d58714821aae2e1c6848b46e4f799'/>
<id>urn:sha1:b7df3f40fb7d58714821aae2e1c6848b46e4f799</id>
<content type='text'>
[ Upstream commit 6184358da0004c8fd940afda6c0a0fa4027dc911 ]

When enable LOCKDEP, static_obj() will cause error. Because some
__initdata static variables is before _stext:

static int static_obj(const void *obj)
{
        unsigned long start = (unsigned long) &amp;_stext,
                      end   = (unsigned long) &amp;_end,
                      addr  = (unsigned long) obj;

        /*
         * static variable?
         */
        if ((addr &gt;= start) &amp;&amp; (addr &lt; end))
                return 1;

[    0.067192] INFO: trying to register non-static key.
[    0.067325] the code is fine but needs lockdep annotation.
[    0.067449] turning off the locking correctness validator.
[    0.067718] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.7.0-rc7-dirty #44
[    0.067945] Call Trace:
[    0.068369] [&lt;ffffffe00020323c&gt;] walk_stackframe+0x0/0xa4
[    0.068506] [&lt;ffffffe000203422&gt;] show_stack+0x2a/0x34
[    0.068631] [&lt;ffffffe000521e4e&gt;] dump_stack+0x94/0xca
[    0.068757] [&lt;ffffffe000255a4e&gt;] register_lock_class+0x5b8/0x5bc
[    0.068969] [&lt;ffffffe000255abe&gt;] __lock_acquire+0x6c/0x1d5c
[    0.069101] [&lt;ffffffe0002550fe&gt;] lock_acquire+0xae/0x312
[    0.069228] [&lt;ffffffe000989a8e&gt;] _raw_spin_lock_irqsave+0x40/0x5a
[    0.069357] [&lt;ffffffe000247c64&gt;] complete+0x1e/0x50
[    0.069479] [&lt;ffffffe000984c38&gt;] rest_init+0x1b0/0x28a
[    0.069660] [&lt;ffffffe0000016a2&gt;] 0xffffffe0000016a2
[    0.069779] [&lt;ffffffe000001b84&gt;] 0xffffffe000001b84
[    0.069953] [&lt;ffffffe000001092&gt;] 0xffffffe000001092

static __initdata DECLARE_COMPLETION(kthreadd_done);

noinline void __ref rest_init(void)
{
	...
	complete(&amp;kthreadd_done);

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: Parse all memory blocks to remove unusable memory</title>
<updated>2020-08-05T07:58:51Z</updated>
<author>
<name>Atish Patra</name>
</author>
<published>2020-07-15T23:30:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0c5a62853895ceb51c7990a272ade1121ed2a632'/>
<id>urn:sha1:0c5a62853895ceb51c7990a272ade1121ed2a632</id>
<content type='text'>
[ Upstream commit fa5a198359053c8e21dcc2b39c0e13871059bc9f ]

Currently, maximum physical memory allowed is equal to -PAGE_OFFSET.
That's why we remove any memory blocks spanning beyond that size. However,
it is done only for memblock containing linux kernel which will not work
if there are multiple memblocks.

Process all memory blocks to figure out how much memory needs to be removed
and remove at the end instead of updating the memblock list in place.

Signed-off-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Set maximum number of mapped pages correctly</title>
<updated>2020-08-05T07:58:50Z</updated>
<author>
<name>Atish Patra</name>
</author>
<published>2020-07-15T23:30:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fe1ab9c0f047d4a89d94d06842a3bb10a6b24978'/>
<id>urn:sha1:fe1ab9c0f047d4a89d94d06842a3bb10a6b24978</id>
<content type='text'>
[ Upstream commit d0d8aae64566b753c4330fbd5944b88af035f299 ]

Currently, maximum number of mapper pages are set to the pfn calculated
from the memblock size of the memblock containing kernel. This will work
until that memblock spans the entire memory. However, it will be set to
a wrong value if there are multiple memblocks defined in kernel
(e.g. with efi runtime services).

Set the the maximum value to the pfn calculated from dram size.

Signed-off-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: kasan: use local_tlb_flush_all() to avoid uninitialized __sbi_rfence</title>
<updated>2020-08-05T07:58:49Z</updated>
<author>
<name>Vincent Chen</name>
</author>
<published>2020-07-10T02:40:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4255c45aef23f960c8cb1f9ba8995b01e86a97e7'/>
<id>urn:sha1:4255c45aef23f960c8cb1f9ba8995b01e86a97e7</id>
<content type='text'>
[ Upstream commit 4cb699d0447be8e0906539f93cbe41e19598ee5a ]

It fails to boot the v5.8-rc4 kernel with CONFIG_KASAN because kasan_init
and kasan_early_init use uninitialized __sbi_rfence as executing the
tlb_flush_all(). Actually, at this moment, only the CPU which is
responsible for the system initialization enables the MMU. Other CPUs are
parking at the .Lsecondary_start. Hence the tlb_flush_all() is able to be
replaced by local_tlb_flush_all() to avoid using uninitialized
__sbi_rfence.

Signed-off-by: Vincent Chen &lt;vincent.chen@sifive.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw</title>
<updated>2020-07-29T08:19:54Z</updated>
<author>
<name>Palmer Dabbelt</name>
</author>
<published>2020-07-16T18:57:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fcf756c2d796ebd29f7f180a2f5e4b272e38890f'/>
<id>urn:sha1:fcf756c2d796ebd29f7f180a2f5e4b272e38890f</id>
<content type='text'>
[ Upstream commit 38b7c2a3ffb1fce8358ddc6006cfe5c038ff9963 ]

While digging through the recent mmiowb preemption issue it came up that
we aren't actually preventing IO from crossing a scheduling boundary.
While it's a bit ugly to overload smp_mb__after_spinlock() with this
behavior, it's what PowerPC is doing so there's some precedent.

Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Do not rely on initrd_start/end computed during early dt parsing</title>
<updated>2020-07-29T08:19:49Z</updated>
<author>
<name>Atish Patra</name>
</author>
<published>2020-07-15T23:30:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3205cda2501c3d505221cbed9f314095ad7925ca'/>
<id>urn:sha1:3205cda2501c3d505221cbed9f314095ad7925ca</id>
<content type='text'>
[ Upstream commit 4400231c8acc7e513204c8470c6d796ba47dc169 ]

Currently, initrd_start/end are computed during early_init_dt_scan
but used during arch_setup. We will get the following panic if initrd is used
and CONFIG_DEBUG_VIRTUAL is turned on.

[    0.000000] ------------[ cut here ]------------
[    0.000000] kernel BUG at arch/riscv/mm/physaddr.c:33!
[    0.000000] Kernel BUG [#1]
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.8.0-rc4-00015-ged0b226fed02 #886
[    0.000000] epc: ffffffe0002058d2 ra : ffffffe0000053f0 sp : ffffffe001001f40
[    0.000000]  gp : ffffffe00106e250 tp : ffffffe001009d40 t0 : ffffffe00107ee28
[    0.000000]  t1 : 0000000000000000 t2 : ffffffe000a2e880 s0 : ffffffe001001f50
[    0.000000]  s1 : ffffffe0001383e8 a0 : ffffffe00c087e00 a1 : 0000000080200000
[    0.000000]  a2 : 00000000010bf000 a3 : ffffffe00106f3c8 a4 : ffffffe0010bf000
[    0.000000]  a5 : ffffffe000000000 a6 : 0000000000000006 a7 : 0000000000000001
[    0.000000]  s2 : ffffffe00106f068 s3 : ffffffe00106f070 s4 : 0000000080200000
[    0.000000]  s5 : 0000000082200000 s6 : 0000000000000000 s7 : 0000000000000000
[    0.000000]  s8 : 0000000080011010 s9 : 0000000080012700 s10: 0000000000000000
[    0.000000]  s11: 0000000000000000 t3 : 000000000001fe30 t4 : 000000000001fe30
[    0.000000]  t5 : 0000000000000000 t6 : ffffffe00107c471
[    0.000000] status: 0000000000000100 badaddr: 0000000000000000 cause: 0000000000000003
[    0.000000] random: get_random_bytes called from print_oops_end_marker+0x22/0x46 with crng_init=0

To avoid the error, initrd_start/end can be computed from phys_initrd_start/size
in setup itself. It also improves the initrd placement by aligning the start
and size with the page size.

Fixes: 76d2a0493a17 ("RISC-V: Init and Halt Code")
Signed-off-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv: use 16KB kernel stack on 64-bit</title>
<updated>2020-07-22T07:34:23Z</updated>
<author>
<name>Andreas Schwab</name>
</author>
<published>2020-07-06T12:32:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=16c8af6d1be51cecc0ffbf4b6c969661949f1edb'/>
<id>urn:sha1:16c8af6d1be51cecc0ffbf4b6c969661949f1edb</id>
<content type='text'>
commit 0cac21b02ba5f3095fd2dcc77c26a25a0b2432ed upstream.

With the current 8KB stack size there are frequent overflows in a 64-bit
configuration.  We may split IRQ stacks off in the future, but this fixes a
number of issues right now.

Signed-off-by: Andreas Schwab &lt;schwab@suse.de&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
[Palmer: mention irqstack in the commit text]
Fixes: 7db91e57a0ac ("RISC-V: Task implementation")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>RISC-V: Don't allow write+exec only page mapping request in mmap</title>
<updated>2020-06-30T19:36:19Z</updated>
<author>
<name>Yash Shah</name>
</author>
<published>2020-06-16T14:03:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1c1549e363a1386c9a66f394dfda2cbeefbe3dfc'/>
<id>urn:sha1:1c1549e363a1386c9a66f394dfda2cbeefbe3dfc</id>
<content type='text'>
[ Upstream commit e0d17c842c0f824fd4df9f4688709fc6907201e1 ]

As per the table 4.4 of version "20190608-Priv-MSU-Ratified" of the
RISC-V instruction set manual[0], the PTE permission bit combination of
"write+exec only" is reserved for future use. Hence, don't allow such
mapping request in mmap call.

An issue is been reported by David Abdurachmanov, that while running
stress-ng with "sysbadaddr" argument, RCU stalls are observed on RISC-V
specific kernel.

This issue arises when the stress-sysbadaddr request for pages with
"write+exec only" permission bits and then passes the address obtain
from this mmap call to various system call. For the riscv kernel, the
mmap call should fail for this particular combination of permission bits
since it's not valid.

[0]: http://dabbelt.com/~palmer/keep/riscv-isa-manual/riscv-privileged-20190608-1.pdf

Signed-off-by: Yash Shah &lt;yash.shah@sifive.com&gt;
Reported-by: David Abdurachmanov &lt;david.abdurachmanov@gmail.com&gt;
[Palmer: Refer to the latest ISA specification at the only link I could
find, and update the terminology.]
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>riscv/atomic: Fix sign extension for RV64I</title>
<updated>2020-06-30T19:36:14Z</updated>
<author>
<name>Nathan Huckleberry</name>
</author>
<published>2020-06-11T18:32:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0974f9670e535cb9e66f3653c45d73607392b334'/>
<id>urn:sha1:0974f9670e535cb9e66f3653c45d73607392b334</id>
<content type='text'>
[ Upstream commit 6c58f25e6938c073198af8b1e1832f83f8f0df33 ]

The argument passed to cmpxchg is not guaranteed to be sign
extended, but lr.w sign extends on RV64I. This makes cmpxchg
fail on clang built kernels when __old is negative.

To fix this, we just cast __old to long which sign extends on
RV64I. With this fix, clang built RISC-V kernels now boot.

Link: https://github.com/ClangBuiltLinux/linux/issues/867
Signed-off-by: Nathan Huckleberry &lt;nhuck@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>RISC-V: Don't mark init section as non-executable</title>
<updated>2020-06-22T07:33:08Z</updated>
<author>
<name>Anup Patel</name>
</author>
<published>2020-06-01T05:06:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ccf0ff3530571237859110aac6b07eaf8dae5f3a'/>
<id>urn:sha1:ccf0ff3530571237859110aac6b07eaf8dae5f3a</id>
<content type='text'>
commit 4e0f9e3a6104261f25b16fcab02fc96f5666ba11 upstream.

The head text section (i.e. _start, secondary_start_sbi, etc) and the
init section fall under same page table level-1 mapping.

Currently, the runtime CPU hotplug is broken because we are marking
init section as non-executable which in-turn marks head text section
as non-executable.

Further investigating other architectures, it seems marking the init
section as non-executable is redundant because the init section pages
are anyway poisoned and freed.

To fix broken runtime CPU hotplug, we simply remove the code marking
the init section as non-executable.

Fixes: d27c3c90817e ("riscv: add STRICT_KERNEL_RWX support")
Cc: stable@vger.kernel.org
Signed-off-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Reviewed-by: Zong Li &lt;zong.li@sifive.com&gt;
Reviewed-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
