summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2020-02-24include: Bump-up version to 0.6v0.6Anup Patel
This patch updates OpenSBI version to 0.6 as part of release preparation. Signed-off-by: Anup Patel <[email protected]>
2020-02-19lib: Print interrupt and exception delegation in boot printsAnup Patel
We print MIDELEG and MEDELEG CSRs as part of boot prints so that boot log shows the interrupts and exceptions delegated to S-mode. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-02-17platform: Add Spike initial supportJames Clarke
This patch adds initial platform support Spike emulator. Signed-off-by: James Clarke <[email protected]> Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-02-05platform: Add an platform ops to return platform specific tlb flush limitAtish Patra
If a platform requires to perform a tlb full flush, they should set the tlb_range_flush_limit value to zero. However, corresponding platform API ignore the value and continue to return the default value. Add a platform ops to retrieve platform specific tlb range flush limit. The platform variable becomes redundant in presence of the platform ops. Take this opportunity to remove the variable as well. The default is still set to smallest page size in RISC-V (4KB), as there is no way to figure out a best value for all platforms. Individual platform should set it to the optimal value for their platform. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-01-22lib: Factor-out SBI base extensionAnup Patel
This patch factor-out SBI base extension into its own source for better modularity of SBI implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Factor-out SBI vendor extensionAnup Patel
This patch factor-out SBI vendor extension into its own source for better modularity of SBI implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Factor-out SBI replacement extensionsAnup Patel
This patch factor-out SBI replacement extensions (such as RFENCE, IPI, and TIME) into its own source for better modularity of SBI implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Factor-out SBI legacy extensionAnup Patel
This patch factor-out SBI legacy extension into its own source for better modularity of SBI implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Add dynamic registration of SBI extensionsAnup Patel
This patch extends our SBI ecall implementation to allow dynamic registration of various SBI extensions. Using this dynamic registration we can break-up SBI ecall implementation into multiple files and even register experimental/custom SBI extensions from platform code. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22include: Add generic and simple list handling APIsAnup Patel
This patch adds generic and simple list handling APIs adapted from Xvisor sources. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Drop _fifo from the name of various sbi_tlb_fifo_xyz() functionsAnup Patel
This patch drops _fifo from the name of various sbi_tlb_fifo_xyz() functions because all these functions deal with remote TLB managment and FIFO is the per-HART data structure used internally by remote TLB implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Introduce sbi_ipi_event_create/destroy() APIsAnup Patel
This patch introduces sbi_ipi_event_create/destroy() APIs and struct sbi_ipi_event_ops for creating/destroying IPI events at runtime based of event operations. This new APIs will help platform code and utils code to create custom IPI events which are not part of generic OpenSBI library. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Introduce sbi_tlb_fifo_request() APIAnup Patel
Instead of directly calling sbi_ipi_send_many(), we introduce sbi_tlb_fifo_request() for halting a set of HARTs. This way in future we can assign any IPI event number for remote FENCE within sbi_tlb.c only. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Introduce sbi_ipi_send_halt() APIAnup Patel
Instead of directly calling sbi_ipi_send_many(), we introduce sbi_ipi_send_halt() for halting a set of HARTs. This way in future we can assign any IPI event number for HART halting within sbi_ipi.c only. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Introduce sbi_ipi_send_smode() APIAnup Patel
Instead of directly calling sbi_ipi_send_many(), we introduce sbi_ipi_send_smode() for injecting S-mode software interrupts. This way in future we can assign any IPI event number for S-mode IPIs within sbi_ipi.c only. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22lib: Move struct sbi_ipi_data definition to sbi_ipi.cAnup Patel
The struct sbi_ipi_data is only used in sbi_ipi.c so move it to sbi_ipi.c from sbi_ipi.h. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-22include: Typo fix in comment for SBI_SCRATCH_SIZE defineAnup Patel
This patch fixes a minor typo in comment for SBI_SCRATCH_SIZE define. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-09include: Add OPENSBI_EXTERNAL_SBI_TYPES in sbi_types.hAbner Chang
Add OPENSBI_EXTERNAL_SBI_TYPES macro to allow external definitions of data types and common macros. Also move some common definitions from sbi_bits.h to sbi_types.h. Signed-off-by: Abner Chang <[email protected]> Cc: Leif Lindholm <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-01-07lib: Add sbi_init_count() APIAnup Patel
We add sbi_init_count() API which provides number of times a given HART completed init sequence (warmboot/coldboot). This will be very useful in debugging. With upcoming SBI HSM extension, it will also help in implementing one-time init code for each HART. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-07lib: improve system reboot and shutdown implementationAnup Patel
We improve sbi_system_reboot() an sbi_system_shutdown() by: 1. Calling halt IPI to all harts (except current HART) before calling platform reboot/shutdown hook. 2. Calling sbi_exit() instead of sbi_hang() in-case platform reboot/shutdown hook failed. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-07lib: Add irqchip exit APIAnup Patel
We add an optional platform irqchip exit hook for exit path handling in sbi_exit() implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-07lib: Add ipi exit APIAnup Patel
We add sbi_ipi_exit() API for exit path handling in sbi_exit() implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-07lib: Add timer exit APIAnup Patel
We add sbi_timer_exit() API for OpenSBI exit path handling in sbi_exit() implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-07lib: Add system early_exit and final_exit APIsAnup Patel
This patch adds system-level early_exit and final_exit APIs with corresponding platform hooks. These new APIs will be primarily used by sbi_exit() in OpenSBI exit path. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-07lib: Add initial sbi_exit() APIAnup Patel
This patch adds initial implementation of sbi_exit() API which can be used to perform OpenSBI exit sequence for current HART. The sbi_exit() implementation will be further extended by subsequent patches. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-02lib: utils: Support CLINT with 32bit MMIO access on RV64 systemAnup Patel
It is possible to have a CLINT implementation which supports only 32bit MMIO accesses on RV64 system so this patch extends our CLINT driver such that platform code can specify whether CLINT supports 64bit MMIO access. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra<[email protected]> Reviewed-by: Zong Li <[email protected]>
2019-12-23lib: Support stage1 and stage2 tlb flushingAtish Patra
The hypervisor specification support hfence calls which can be used issue tlb flush requests at both level of address translation. Currently, these requests are issued only via SBI which are defined in v0.2. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-12-23lib: Add hfence instruction encodingAtish Patra
Currently, the toolchains do not have support for hfence instruction. Hence, the instruction are hardcode until we have toolchain support. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-12-23lib: Add IPI extension in SBIAtish Patra
This patch adds new IPI extension which replaces ipi related v0.1 extensions. This also adds a new API for ipi sending as trap handling is not necessary in v0.2 SBI IPI related extensions. It also modifies the IPI sending code which now accepts hart mask as a value instead of S-mode virtual address. Thus, the caller should set it to exact hart mask value everytime. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-12-23lib: Remove redundant IPI typesAtish Patra
We just need to distinguish only between FENCE and non FENCE related IPIs as all of the fence related requests are handled via fifo now. Remove the unnecessary IPI types related to individual fence types. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-12-23lib: Add replacement extension and function idsAtish Patra
Take this opportunity to move the enums to macros as enums make sbi_ecall_interface.h unusable in assembly files. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-12-16lib: Extend trap redirection for hypervisor v0.5 specAnup Patel
The hypervisor v0.5 spec introduces two new CSRs for both M-mode and HS-mode which need to be considered when redirecting traps hence this patch. Signed-off-by: Anup Patel <[email protected]>
2019-12-16include: Extend struct sbi_trap_info for mtval2 and mtinstAnup Patel
We have two new trap CSRs namely mtval2 and mtinst when RISC-V hypervisor extension is available hence we extend struct sbi_trap_info accordingly. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2019-12-16include: Add guest external interrupt related definesAnup Patel
With RISC-V H-extension v0.5 draft, we have special support for guest external interrupts so this patch adds related defines which were missed-out previously. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2019-12-06include: sbi_platform: fix compilation for GCC-9Martin Pietryka
GCC-9 will throw a warning when using the %s format specifier with a possible NULL parameter and since -Werror is used, the compilation breaks for GCC-9. In function 'sbi_boot_prints', inlined from 'init_coldboot' at <redacted>/opensbi/lib/sbi/sbi_init.c:107:3, inlined from 'sbi_init' at <redacted>/opensbi/lib/sbi/sbi_init.c:189:3: <redacted>/opensbi/lib/sbi/sbi_init.c:56:2: error: '%s' directive argument is null [-Werror=format-overflow=] 56 | sbi_printf("Platform Name : %s\n", sbi_platform_name(plat)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors This is one way to fix this, currently there is nothing in the tree checking for `sbi_platfrom_name() == NULL` so we can just return "Unknown" instead of NULL on failure. Signed-off-by: Martin Pietryka <[email protected]> Reviewed-by: Anup Patel <[email protected]> Tested-by: David Abdurachmanov <[email protected]>
2019-11-27lib: Add error detection for misa_extensionXiang W
Add assertions for misa_extension to prevent incoming illegal characters. Signed-off-by: Xiang Wang <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-11-26lib: Fix CPU capabilities detection functionXiang Wang
On some platforms, misa may not be implemented. On such a platform, reading misa will get 0. At this time, platform is required to implement a non-standard function to detect the CPU's capabilities. Therefore, this modification add interfaces for non-standard function. The MXL field of misa is always at the highest two bits, whether it is a 32-bit 64-bit or a 128-bit machine. Therefore, this modification fixes the use of a fixed offset to detect the machine length. Signed-off-by: Xiang Wang <[email protected]> Signed-off-by: Anup Patel <[email protected]>
2019-11-21lib: Simplify trap parameters in sbi_ecall functionsAnup Patel
The out_tcause and out_tval parameters are not sufficient for most sbi_ecall functions because this will grow in-future when we support RISC-V hypervisor v0.5 draft. We replace these parameters with out_trap which is a pointer to struct sbi_trap_info. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-11-21lib: Better naming of unpriv APIs for wider useAnup Patel
The unpriv APIs can be useful to external firmware and out-of-tree platform support code. This patch adds "sbi_" prefix to unpriv load/store APIs and rename struct riscv_unpriv to struct sbi_trap_info everywhere. We also place struct sbi_trap_info in sbi/sbi_trap.h so that we can use it for sbi_trap_redirect() as well. Overall, this patch will make naming of unpriv APIs consistent with other OpenSBI APIs. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-11-21lib: No need to set VSSTATUS.MXR bit in get_insn()Anup Patel
We don't need to set VSSTATUS.MXR bit in get_insn() for unpriv instruction read because MSTATUS.MXR bit applies to both "Stage1" and "Stage2" page tables. This also allows us to remove the "virt" parameter of get_insn() function. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-11-21include: Remove ilen member of struct unpriv_trapAnup Patel
We simplify struct unpriv_trap by removing ilen member. This can be achieved by ensuring that at all unpriv load/store instructions are 4 bytes long using GCC assembler option. Additionally, this also reduces few instructions from unpriv load/store functions. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-11-15firmware: Add preferred boot HART field in struct fw_dynamic_infoAnup Patel
It has been reported that link address range of previous booting stage (such as U-Boot SPL) can overlap the link address rage of FW_DYNAMIC. This means self-relocation in FW_DYNAMIC can potentially corrupt previous booting stage if any of the secondary HART enter FW_DYNAMIC before primary HART. To tackle this, we add preferred boot HART field (i.e boot_hart) in struct fw_dyanmic_info. We use this field to force secondary HARTs into relocation wait loop till preferred/primary boot HART enters FW_DYNAMIC completes self-relocation. If preferred boot HART is not available then we fall back to relocation lottery approach. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-11-06include: Use _UL() and _ULL() for defines in riscv_encoding.hAnup Patel
The riscv_encoding.h is shared with assembly sources so we use _UL() and _ULL() for register fields related defines. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-11-06include: Sync-up encoding with priv v1.12-draft and hypervisor v0.5-draftAnup Patel
This patch sync-up encoding header with the latest privilege specifications draft v1.12 and hypervisor specifications draft v0.5. The MSTATUS.MTL and HSTATUS.STL bits are not present anymore and will be removed by another patch series for hypervisor v0.5-draft. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-10-09include: Bump-up version to 0.5v0.5Anup Patel
This patch updates OpenSBI version to 0.5 as part of release preparation. Signed-off-by: Anup Patel <[email protected]>
2019-10-03lib: Provide a platform hook to implement vendor specific SBI extensions.Atish Patra
SBI v0.2 specification allows vendor extensions and it should be implemented in a independent of the core sbi library. Introduce a single platform callback that will let platforms handle all vendor extensions in platform specific code if they want. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-10-03lib: Implement SBI v0.2Atish Patra
SBI v0.2 introduces a base specification which is mandatory to implement for any SBI implementations that is not legacy. Add support for the base extension. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-10-03lib: Rename existing SBI implementation as 0.1.Atish Patra
Current SBI implementation is now considered as version 0.1 and will be removed/replaced with newer extension/functions in future. Rename the existing implementations accordingly to be in sync with the specification. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Zong Li <[email protected]>
2019-10-03lib: Align error codes as per SBI specification.Atish Patra
Follow the SBI specification for error codes. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-10-03Test: Move test payload related code out of interface headerAtish Patra
Test payload uses an SBI call and uses the macros defined in interface header which is not the correct place to have these definitions. The interface header file should be used to keep SBI specification related macros. Keep all the test payload related code in test itself. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>