<feed xmlns='http://www.w3.org/2005/Atom'>
<title>opensbi.git/lib/sbi/riscv_asm.c, branch v1.0</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/opensbi.git/atom/lib/sbi/riscv_asm.c?h=v1.0</id>
<link rel='self' href='http://cgit.235523.xyz/opensbi.git/atom/lib/sbi/riscv_asm.c?h=v1.0'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/'/>
<updated>2021-12-22T03:35:05Z</updated>
<entry>
<title>lib: sbi: simplify pmp_set(), pmp_get()</title>
<updated>2021-12-22T03:35:05Z</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2021-12-17T17:02:58Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=2082153fc90c54b98647b1fbaeb7511fd57b7d2b'/>
<id>urn:sha1:2082153fc90c54b98647b1fbaeb7511fd57b7d2b</id>
<content type='text'>
pmpcfg_csr and pmpcfg_shift are only negative for an unexpected value of
__riscv_xlen. We can immediately return in this case.

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Dong Du &lt;Dd_nirvana@sjtu.edu.cn&gt;
Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Improve fatal error handling</title>
<updated>2021-12-02T03:20:36Z</updated>
<author>
<name>Jessica Clarke</name>
<email>jrtc27@jrtc27.com</email>
</author>
<published>2021-11-21T17:30:22Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=14faee6916bc973b9fdb816c5f4a45096e3f645a'/>
<id>urn:sha1:14faee6916bc973b9fdb816c5f4a45096e3f645a</id>
<content type='text'>
BUG and BUG_ON are not informative and are rather lazy interfaces, only
telling the user that something went wrong in a given function, but not
what, requiring the user to find the sources corresponding to their
firmware (which may not be available) and figure out how that BUG(_ON)
was hit. Even SBI_ASSERT in its current form, which does include the
condition that triggered it in the output, isn't necessarily very
informative. In some cases, the error may be fixable by the user, but
they need to know the problem in order to have any hope of fixing it.
It's also a nuisance for developers, whose development trees may have
changed significantly since the release in question being used, and so
line numbers can make it harder for them to understand which error case
a user has hit.

This patch introduces a new sbi_panic function which is printf-like,
allowing detailed error messages to be printed to the console. BUG and
BUG_ON are removed, since the former is just a worse form of sbi_panic
and the latter is a worse version of SBI_ASSERT. Finally, SBI_ASSERT is
augmented to take a set of arguments to pass to sbi_panic on failure,
used like so (sbi_boot_print_hart's current error case, which currently
manually calls sbi_printf and sbi_hart_hang):

  SBI_ASSERT(xlen &gt;= 1, ("Error %d getting MISA XLEN\n", xlen));

The existing users of BUG are replaced with calls to sbi_panic along
with informative error messages. BUG_ON and SBI_ASSERT were unused (and,
in the case of SBI_ASSERT, remain unused).

Many existing users of sbi_hart_hang should be converted to use either
sbi_panic or SBI_ASSERT after this commit.

Signed-off-by: Jessica Clarke &lt;jrtc27@jrtc27.com&gt;
Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Reviewed-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Atish Patra &lt;atishp@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: clear pmpcfg.A before setting in pmp_set()</title>
<updated>2021-11-12T06:49:00Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2021-11-08T09:43:03Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=d335a178d8cfdf2ed13af70fe385f7e38162e171'/>
<id>urn:sha1:d335a178d8cfdf2ed13af70fe385f7e38162e171</id>
<content type='text'>
We should clear A bits in prot variable before enabling A_NA4 or A_NAPOT.

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Update csr_read/write_num for PMU</title>
<updated>2021-11-11T12:09:38Z</updated>
<author>
<name>Atish Patra</name>
<email>atish.patra@wdc.com</email>
</author>
<published>2021-11-08T18:52:57Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=7084ad9f4281eecd7a7f66cecfd7d9cff8d452ad'/>
<id>urn:sha1:7084ad9f4281eecd7a7f66cecfd7d9cff8d452ad</id>
<content type='text'>
The Sscofpmf extension introduces mhpmevent[h] csrs to handle filtering
/overflow bits in RV32. There is no way to read/write mcountinhibit
using mcountinhibit csr using a variable.

Updated the support to read/write mhpmevent[h] and mcountinhibit csr.

Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
Signed-off-by: Atish Patra &lt;atish.patra@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Add BUG() macro for csr_read/write_num() and misa_string()</title>
<updated>2021-09-22T08:08:39Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2021-09-16T04:32:50Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=51113fe2a5ac6b5a712f2e5393347bf24194c09b'/>
<id>urn:sha1:51113fe2a5ac6b5a712f2e5393347bf24194c09b</id>
<content type='text'>
We use BUG() macro in csr_read_num(), csr_write_num(), and
misa_string() functions for unhandled cases.

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: fix ctz bug</title>
<updated>2021-09-22T07:56:23Z</updated>
<author>
<name>Xiang W</name>
<email>wxjstz@126.com</email>
</author>
<published>2021-09-15T06:50:52Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=3477f08b08da6bfd904218fdb76b3db592dd7ebd'/>
<id>urn:sha1:3477f08b08da6bfd904218fdb76b3db592dd7ebd</id>
<content type='text'>
The original version of ctz will cause an endless loop, if the parameter
passed in is 0. This commit fixes this bug.

Signed-off-by: Xiang W &lt;wxjstz@126.com&gt;
Reviewed-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Use csr_read/write_num to read/update PMU counters</title>
<updated>2021-07-11T04:50:44Z</updated>
<author>
<name>Atish Patra</name>
<email>atish.patra@wdc.com</email>
</author>
<published>2021-07-10T16:18:09Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=49966db30658a3d5070e1a10200bd8c73dab0851'/>
<id>urn:sha1:49966db30658a3d5070e1a10200bd8c73dab0851</id>
<content type='text'>
Currently, csr_read/write_num functions are used to read/write PMP related
CSRs where CSR value is decided at runtime. Expand this function to include
PMU related CSRs as well.

Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Reviewed-by: Xiang W &lt;wxjstz@126.com&gt;
Signed-off-by: Atish Patra &lt;atish.patra@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Allow specifying mode in sbi_hart_pmp_check_addr() API</title>
<updated>2020-09-16T03:35:25Z</updated>
<author>
<name>Anup Patel</name>
<email>anup.patel@wdc.com</email>
</author>
<published>2020-09-07T10:20:33Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=7ccf6bf54c2d7db6331f3fa319ef4e7019108c28'/>
<id>urn:sha1:7ccf6bf54c2d7db6331f3fa319ef4e7019108c28</id>
<content type='text'>
We extend sbi_hart_pmp_check_addr() API so that users can specify
privilege mode of the address for checking PMP access permissions.

To achieve this, we end-up converting "unsigned long *size" parameter
to "unsigned long *log2len" for pmp_get() implementation so that we
can deal with regions of "1UL &lt;&lt; __riscv_xlen" size in a special case
in sbi_hart_pmp_check_addr() implementation.

Signed-off-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Reviewed-by: Atish Patra &lt;atish.patra@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Improve PMP CSR detection and progamming</title>
<updated>2020-09-01T04:58:28Z</updated>
<author>
<name>Anup Patel</name>
<email>anup.patel@wdc.com</email>
</author>
<published>2020-08-18T07:58:08Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=74d1db706293f42f5a4e87c907978339b2d0993d'/>
<id>urn:sha1:74d1db706293f42f5a4e87c907978339b2d0993d</id>
<content type='text'>
As-per latest RISC-V privilege spec up to 64 PMP entries are supported.
Implementations may implement zero, 16, or 64 PMP CSRs. All PMP CSR
fields are WARL and may be hardwired to zero.

This patch improves PMP CSR detection and progamming considering
above facts.

Signed-off-by: Anup Patel &lt;anup.patel@wdc.com&gt;
Reviewed-by: Atish Patra &lt;atish.patra@wdc.com&gt;
</content>
</entry>
<entry>
<title>lib: sbi: Fix 32/64 bits variable compatibility</title>
<updated>2020-06-20T03:17:11Z</updated>
<author>
<name>Liush</name>
<email>liush.damon@gmail.com</email>
</author>
<published>2020-06-19T03:55:19Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/opensbi.git/commit/?id=9bd5f8f17d31f8989525643a04da87d090fe3033'/>
<id>urn:sha1:9bd5f8f17d31f8989525643a04da87d090fe3033</id>
<content type='text'>
On RV64,"unsigned long" is 64bit and "unsigned int" is 32bit. So in
function "pmp_get" and "pmp_set", if "pmpcfg_shift &gt;= 32", "0xff &lt;&lt; pmpcfg_shift"
will go beyond "unsigned int" width. This patch tries to fix this issue.

In function 'pmp_get':
	cfgmask = (0xff &lt;&lt; pmpcfg_shift);
			--&gt;
	cfgmask = (0xffUL &lt;&lt; pmpcfg_shift);
In function 'pmp_set':
	cfgmask = ~(0xff &lt;&lt; pmpcfg_shift);
			--&gt;
	cfgmask = ~(0xffUL &lt;&lt; pmpcfg_shift);

Signed-off-by: Liush &lt;liush.damon@gmail.com&gt;
Reviewed-by: Anup Patel &lt;anup.patel@wdc.com&gt;
</content>
</entry>
</feed>
