<feed xmlns='http://www.w3.org/2005/Atom'>
<title>opensbi.git/lib/sbi/riscv_locks.c, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/opensbi.git/atom/lib/sbi/riscv_locks.c?h=master</id>
<link rel='self' href='http://cgit.235523.xyz/opensbi.git/atom/lib/sbi/riscv_locks.c?h=master'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/'/>
<updated>2026-03-10T05:17:23Z</updated>
<entry>
<title>lib: Use proper add opcode on RV32 with Zalrsc</title>
<updated>2026-03-10T05:17:23Z</updated>
<author>
<name>Marti Alonso</name>
<email>martialonso11@gmail.com</email>
</author>
<published>2026-03-01T20:54:21Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=b5348006e98077076a0b1a690c3a9f63c7151a4b'/>
<id>urn:sha1:b5348006e98077076a0b1a690c3a9f63c7151a4b</id>
<content type='text'>
The addw opcode is only defined in RV64, which produces 32-bit results.
On RV32, the default add opcode already produces 32-bit results.

Fixes: 995f226f3f33 ("lib: Emit lr and sc instructions based on -march flags")
Signed-off-by: Marti Alonso &lt;martialonso11@gmail.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20260301205421.2074835-1-martialonso11@gmail.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: atomics: fix AMO test macros</title>
<updated>2025-12-28T15:14:03Z</updated>
<author>
<name>Vladimir Kondratiev</name>
<email>vladimir.kondratiev@mobileye.com</email>
</author>
<published>2025-12-28T07:33:21Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=f6fa62bd169e55f479b137da13ca83b27bb304a9'/>
<id>urn:sha1:f6fa62bd169e55f479b137da13ca83b27bb304a9</id>
<content type='text'>
The "RISC-V C API" [1] defines architecture extension test macros
says naming rule for the test macros is __riscv_&lt;ext_name&gt;, where
&lt;ext_name&gt; is all lower-case.

Three extensions dealing with atomics implementation are:
  "zaamo" consists of AMO instructions,
  "zalrsc" - LR/SC,
  "a" extension means both "zaamo" and "zalrsc"
Built-in test macros are __riscv_a, __riscv_zaamo and __riscv_zalrsc.
Alternative to the __riscv_a macro name, __riscv_atomic, is deprecated.

Use correct test macro __riscv_zaamo for the AMO variant of atomics.
It used to be __riscv_atomic that is both deprecated and incorrect
because it tests for the "a" extension; i.e. both "zaamo" and "zalrsc"
If ISA enables only zaamo but not zalrsc, code as it was would not compile.

Older toolchains may have neither __riscv_zaamo nor __riscv_zalrsc, so
query __riscv_atomic - it should be treated as both __riscv_zaamo and
__riscv_zalrsc, in all present cases __riscv_zaamo is more favorable
so take is as alternative for __riscv_zaamo

[1] https://github.com/riscv-non-isa/riscv-c-api-doc

Signed-off-by: Vladimir Kondratiev &lt;vladimir.kondratiev@mobileye.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20251228073321.1533844-1-vladimir.kondratiev@mobileye.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: Emit lr and sc instructions based on -march flags</title>
<updated>2025-03-28T13:22:05Z</updated>
<author>
<name>Chao-ying Fu</name>
<email>icebergfu@gmail.com</email>
</author>
<published>2025-02-26T01:47:27Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=995f226f3f335864d2fca6254af32fa7ab0162e6'/>
<id>urn:sha1:995f226f3f335864d2fca6254af32fa7ab0162e6</id>
<content type='text'>
When -march=rv64im_zalrsc_zicsr is used, provide atomic operations
and locks using lr and sc instructions only.

Signed-off-by: Chao-ying Fu &lt;cfu@mips.com&gt;
Reviewed-by: Anup Patel &lt;anup@brainfault.org&gt;
Link: https://lore.kernel.org/r/20250226014727.19710-1-cfu@mips.com
Signed-off-by: Anup Patel &lt;anup@brainfault.org&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Have spinlock checks return bool</title>
<updated>2021-05-14T11:35:20Z</updated>
<author>
<name>Daniel Schaefer</name>
<email>git@danielschaefer.me</email>
</author>
<published>2021-05-13T04:52:35Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=f90c4c2e0298a6a6e7ade87bf1b704a3a07aa7b9'/>
<id>urn:sha1:f90c4c2e0298a6a6e7ade87bf1b704a3a07aa7b9</id>
<content type='text'>
spin_lock_check already returned bool in the source file but not in the
header. With some toolchains that causes an error, as it should.

Because it and related functions all essentially return a bool, we can
use this opportunity to change them.

Signed-off-by: Daniel Schaefer &lt;git@danielschaefer.me&gt;
Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Replace test-and-set locks by ticket locks</title>
<updated>2021-04-09T13:18:50Z</updated>
<author>
<name>Christoph Muellner</name>
<email>cmuellner@linux.com</email>
</author>
<published>2021-04-06T01:53:54Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=4d8e2f135d659697337f8d4a33fec60cd475f0dc'/>
<id>urn:sha1:4d8e2f135d659697337f8d4a33fec60cd475f0dc</id>
<content type='text'>
Replace the test-and-set spinlock implementation with ticket locks
in order to get fairness (in form of FIFO order).

The implementation uses a 32-bit wide struct, which consists of
two 16-bit counters (owner and next). This is inspired by similar
spinlock implementations on other architectures.
This allows that the code works for both, RV32 and RV64.

Signed-off-by: Christoph Muellner &lt;cmuellner@linux.com&gt;
Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Reviewed-by: Xiang W &lt;wxjstz@126.com&gt;
</content>
</entry>
<entry>
<title>lib: Move sbi core library to lib/sbi</title>
<updated>2019-06-19T04:18:51Z</updated>
<author>
<name>Atish Patra</name>
<email>atish.patra@wdc.com</email>
</author>
<published>2019-06-18T21:54:01Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=749b0b093242a4c27f7c4f66121afd7852b2de48'/>
<id>urn:sha1:749b0b093242a4c27f7c4f66121afd7852b2de48</id>
<content type='text'>
Signed-off-by: Atish Patra &lt;atish.patra@wdc.com&gt;
Acked-by: Anup Patel &lt;anup.patel@wdc.com&gt;
</content>
</entry>
</feed>
