| Age | Commit message (Collapse) | Author |
|
Implement a lock enabled iteration for fifo so that
caller can determine if next entry can be skipped or
any existing entries in fifo can be updated before enqueue.
Signed-off-by: Atish Patra <[email protected]>
|
|
Fix the ECALL definitions to matc the latest information in the
privlidge spec table 5.5.
Signed-off-by: Alistair Francis <[email protected]>
|
|
This patch reduces memory consumed by struct sbi_fifo by droping
redundant "head" member and using u16 in-place of "unsigned long".
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch does following improvements to sbi_fifo:
1. Use valid SBI_Exxxx error codes instead of -1
2. The sbi_fifo_is_full() and sbi_fifo_is_empty() did
not acquire qlock before accessing head and tail
hence fixed it
3. Added avail member for ease in debugging and simplifying
head/tail updates.
Due to above changes size of sbi_fifo changes from 48 bytes
to 56 bytes.
Signed-off-by: Anup Patel <[email protected]>
|
|
Currently, there is no provision for tracking multiple IPIs sent
to a single hart at the same time by different harts.
Use a fifo manage the outstanding requests. While dequeueing, read all
the entries once, because we have only 1 bit to track the type of IPI.
Once the queue is full, busy wait until the there is space available in
queue. This is not the most elegant approach. It should be changed in
favor of a wakeup event once available in opensbi.
Signed-off-by: Atish Patra <[email protected]>
|
|
Currently scratch space per hart is 256 bytes. Increase it to 512 bytes
to accomodate ipi queue.
Signed-off-by: Atish Patra <[email protected]>
|
|
Add a tlb info to distinguish between different type of tlb flush
request pending.
Signed-off-by: Atish Patra <[email protected]>
|
|
Implement a fifo to accomodate outstanding IPIs for a specific hart
at the same time.
Signed-off-by: Atish Patra <[email protected]>
|
|
The mstatus parameter of get_insn() is used to return MSTATUS CSR
value which get_insn() saw. Most of the get_insn() callers don't
use the value returned in mstatus so this patch makes mstatus
parameter optional for get_insn().
Signed-off-by: Anup Patel <[email protected]>
|
|
The sbi_unpriv.h has quite a few load_xyz() and store_xyz() helper
routines based on RISC-V inline assembly for unpriviledged accesses
from M-mode. These helper routines are similar to helper routines
present in riscv_locks.h, riscv_io.h, and riscv_atomic.h so let's
rename sbi_unpriv.h to riscv_unpriv.h.
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch removes unused mepc arg from load_xyz() and store_xyz()
unpriviledge access functions.
Signed-off-by: Anup Patel <[email protected]>
|
|
Use the newly introduced "options" in "struct sbi_scratch" to
conditionally disable the boot prints.
Signed-off-by: Bin Meng <[email protected]>
|
|
Introduce "options" in "struct sbi_scratch" and firmware can update
it based on optional compile time flags before calling sbi_init().
Signed-off-by: Bin Meng <[email protected]>
|
|
Currently, OpenSBI doesn't distinguish between sfence.vma
and sfence.vm asid calls. Moreover, it ignores the page
ranges and just flush entire TLB everytime.
Fix the sfence implementation by keeping all the tlb flush
info in scratch area.
The relevant Linux kernel code was added by
https://patchwork.kernel.org/project/linux-riscv/list/?series=89695
However, this patch is backward compatible with older version kernel
that doesn't have the above patches as well.
Fixes #87
Signed-off-by: Atish Patra <[email protected]>
|
|
Create a sbi_ipi_data structure that holds unpacked IPI information. At
the same time remove ipi_type from the sbi_scratch struct and use a
fixed offset to access it.
This structure fits in behind the sbi_scratch structure.
This fixes https://github.com/riscv/opensbi/issues/81
Signed-off-by: Alistair Francis <[email protected]>
|
|
platform should be a read-only variable, if it is placed in the data
segment, it may be exploited.
Signed-off-by: Xiang Wang <[email protected]>
|
|
As per the current SBI specification, sbi_getc should return
an int instead of char.
In case of FIFO is empty, return -1 as per the specification.
Reported-by: Sergi Granell <[email protected]>
Suggested-by:Thadeu Lima de Souza Cascardo <[email protected]>
Signed-off-by: Atish Patra <[email protected]>
|
|
This patch updates OpenSBI version to 0.3 as part of
release preparation.
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch increases OpenSBI version to 0.2.
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch extends our low-level trap handler in fw_base.S for
handling M-mode to M-mode traps without overwritting stack.
Signed-off-by: Anup Patel <[email protected]>
|
|
The unsigned long is always machine word size. This means it is
4 bytes on 32bit system and 8 bytes on 64bit system.
This patch adds PRILX define for sbi_printf() which will help us
print unsigned long without worrying whether it is 32bit or 64bit
system.
Signed-off-by: Anup Patel <[email protected]>
|
|
Some older toolchains may not have all the csr's defined. Update all
the csr functions to use the CSR_ #define values instead of the
toolchain defined values.
Suggested-by: Olof Johansson <[email protected]>
Signed-off-by: Atish Patra <[email protected]>
|
|
Signed-off-by: Alistair Francis <[email protected]>
|
|
Some toolchains might not have all the CSRs available (as seen with
GCC 7.2). So, instead use the defined CSR_ values.
Signed-off-by: Olof Johansson <[email protected]>
|
|
Currently, the OpenSBI version is in top-level Makefile so
firmware linking to OpenSBI static library have no-way to
know OpenSBI version.
This patch moves OpenSBI version from top-level Makefile to
sbi/sbi_version.h header which provides OPENSBI_VERSION_MAJOR
and OPENSBI_VERSION_MINOR defines.
NOTE: the SBI spec (or SBI ecall interface) version is
different. The SBI spec version is provided by functions
sbi_ecall_version_major() and sbi_ecall_version_minor().
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch updates copyright header in all files as follows:
1. Makes "SPDX-License-Identifier: BSD-2-Clause" as first line
2. Change copyright year to 2019 for Western Digital
Signed-off-by: Anup Patel <[email protected]>
|
|
The sbi_platform_hart_disabled() returns bool hence explicitly return
TRUE or FALSE instead of 1 or 0.
Signed-off-by: Anup Patel <[email protected]>
|
|
For better naming, we rename ipi_inject() to ipi_send() in
struct sbi_platform. We also replace term "inject" with
"send" in all related places.
Signed-off-by: Anup Patel <[email protected]>
|
|
It is not necessary that platform has MMIO-based timer value
register. It can also have some custom (implementation specific)
CSR for timer value.
This patch renames SBI_PLATFORM_HAS_MMIO_TIMER_VALUE to
SBI_PLATFORM_HAS_TIMER_VALUE to imply "platform timer value"
instead of "mmio timer value".
Signed-off-by: Anup Patel <[email protected]>
|
|
The prototypes of sbi_platform callbacks have changed hence we
update related documentation.
Signed-off-by: Anup Patel <[email protected]>
|
|
The target_hart and hartid paramter of TIMER callbacks is not
required because it always current hartid which can be obtained
using sbi_current_hartid() API.
Signed-off-by: Anup Patel <[email protected]>
|
|
The hartid parameter in IRQCHIP callbacks of sbi_platform
is not required because current hartid can be determined
using sbi_current_hartid() API.
Signed-off-by: Anup Patel <[email protected]>
|
|
The source_hart and hartid parameter is really not required in
IPI callbacks of sbi_platform because current hartid can always
be obtained by calling sbi_current_hartid() API.
Signed-off-by: Anup Patel <[email protected]>
|
|
We simplify early_init() and final_init() callbacks of sbi_platform
by removing "hartid" parameter.
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch adds doxygen style documenation for struct sbi_platform
and related functions/macros/defines.
Signed-off-by: Anup Patel <[email protected]>
|
|
Add addtional functionlities for set/clear bits
atomically.
Signed-off-by: Atish Patra <[email protected]>
|
|
Define sbi_ecall_console_puts() using sbi_ecall_console_putchar()
renamed as sbi_ecall_console_putc() and remove the hardcoded version
of the same funtion in the test payload code.
Signed-off-by: Damien Le Moal <[email protected]>
|
|
Some of the platform (i.e. SiFive FU540) requires Device
Tree modification before it is passed to higher stages.
Add libfdt support now to help this process. Libfdt should
only be included per platform basis.
Signed-off-by: Atish Patra <[email protected]>
|
|
This patch adds doxygen style documentation for struct sbi_trap_regs
and related macros/defines/functions.
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch adds __packed define for specifying packed
attribute of structures.
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch adds doxygen style documentation for struct sbi_scratch
and related helper macros/defines.
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch adds doxygen style documentation for sbi_init() API.
Signed-off-by: Anup Patel <[email protected]>
|
|
There are quite a few noreturn functions in OpenSBI hence
we add commong __noreturn define for noreturn functin attribute.
Signed-off-by: Anup Patel <[email protected]>
|
|
This patch adds hardware floating-point (hard FP) access
macros and defines.
Signed-off-by: Anup Patel <[email protected]>
|
|
The tmp0 member was added in struct sbi_scratch to assist
register save/restore at time of trap handling. This tmp0
is not unsed any more hence removing it.
Signed-off-by: Anup Patel <[email protected]>
|
|
The struct sbi_trap_regs related defines RISCV_TRAP_REGS_xyz should
be in sbi_trap.h so that we can keep these defines in-sync with changes
in struct sbi_trap_regs.
Signed-off-by: Anup Patel <[email protected]>
|
|
The struct sbi_platform related defines RISCV_PLATFORM_xyz should
be in sbi_platform.h so that we can keep these defines in-sync
with changes in struct sbi_platform.
Signed-off-by: Anup Patel <[email protected]>
|
|
The struct sbi_scratch related defines RISCV_SCRATCH_xyz should
be in sbi_scratch.h so that we can keep these defines in-sync
with changes in struct sbi_scratch.
Signed-off-by: Anup Patel <[email protected]>
|
|
We replace #csr with __ASM_STR(csr) in all csr_xyz() macros
so that we can pass CSR number instead of CSR name when GCC
is not aware of CSR name.
Signed-off-by: Anup Patel <[email protected]>
|
|
The patch removes redundant csr_read_n() and csr_write_n()
because same thing can be achieved by using __ASM_STR()
macro in csr_read() and csr_write() macros.
Signed-off-by: Anup Patel <[email protected]>
|