- Jan 07, 2020
-
-
Anup Patel authored
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 <anup@brainfault.org> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
We should zero-out memory allocated from extra scratch space using sbi_scratch_alloc_offset() API hence this patch. This will not impact performance because we mostly allocate from extra scratch space only at cold boot time. Signed-off-by:
Anup Patel <anup@brainfault.org> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
Instead of doing sbi_hang() we should do sbi_exit() upon halt IPI. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
Currently, sbi_hart_wait_for_coldboot() leaves MIE.MSIP bit set when it returns which is not correct because MIE.MSIP should be left enabled only by sbi_ipi_init(). This patch does save/restore of MIE CSR to ensure that MIE CSR is in original state after sbi_hart_wait_for_coldboot() returns. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
We add an optional platform irqchip exit hook for exit path handling in sbi_exit() implementation. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
We add sbi_ipi_exit() API for exit path handling in sbi_exit() implementation. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
We add sbi_timer_exit() API for OpenSBI exit path handling in sbi_exit() implementation. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
We remove unnecessary checks related to hart hotplug and disabled hart in coldboot and warmboot init path. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Jan 02, 2020
-
-
Liu Yibin authored
This commit provides basic support for the Thead/C910 platform. Signed-off-by:
Liu Yibin <yibin_liu@c-sky.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish <Patra<atish.patra@wdc.com> Reviewed-by:
Zong Li <zong.li@sifive.com>
-
- Dec 30, 2019
-
-
Liu Yibin authored
This patch updates FW_JUMP and FW_PAYLOAD documentation for the case where FW_xyz_FDT_ADDR is not specified. Signed-off-by:
Liu Yibin <yibin_liu@c-sky.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Dec 27, 2019
-
-
Anup Patel authored
The state of a0, a1, and a2 registers in fw_prev_arg1() and fw_next_arg1() is same as passed by previous booting stage so we add this info in comments for both these functions. Signed-off-by:Anup Patel <anup.patel@wdc.com>
-
Liu Yibin authored
Function fw_next_arg1 in firmware/fw_jump.S:59 and firmware/fw_payload.S:63 should return real dtb address(if specified in a1) in a0, in case we don't want to specify FW_xyz_FDT_ADDR when compiling. Signed-off-by:
Liu Yibin <yibin_liu@c-sky.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Dec 23, 2019
-
-
Atish Patra authored
This patch adds RFENCE extension support in OpenSBI. Signed-off-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Atish Patra authored
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 <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Atish Patra authored
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 <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Atish Patra authored
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 <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Atish Patra authored
This patch adds support for TIME extension which replaces v0.1 timer extension. Signed-off-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Atish Patra authored
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 <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Atish Patra authored
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 <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Dec 16, 2019
-
-
Anup Patel authored
We should use MTINST CSR in misaligned load/store emulation whenever possible to avoid unpriv read in getting trapped instruction. This will improve preformance on HW having proper implementation of MTINST CSR. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com>
-
Anup Patel authored
We should treat load guest page fault in sbi_get_insn() as fetch guest patch fault. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com>
-
Anup Patel authored
As-per RISC-V hypervisor v0.5 spec, we have new guest page faults which need to be delegated to HS-mode. Also, we can have bits in in MIDELEG and MEDELEG hardwired to 1 which means we need to fix the sainty check on these CSRs at the end of delegate_traps() function. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com>
-
- Dec 06, 2019
-
-
Martin Pietryka authored
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 <martin@pietryka.at> Reviewed-by:
Anup Patel <anup.patel@wdc.com> Tested-by:
David Abdurachmanov <david.abdurachmanov@sifive.com>
-
- Nov 27, 2019
-
-
Xiang W authored
Add assertions for misa_extension to prevent incoming illegal characters. Signed-off-by:
Xiang Wang <merle@hardenedlinux.org> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Nov 26, 2019
-
-
Atish Patra authored
The break statement is missing in base extension function handling. Fix the typo. Signed-off-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Xiang Wang <merle@hardenedlinux.org> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Xiang Wang authored
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 <merle@hardenedlinux.org> Signed-off-by:
Anup Patel <anup.patel@wdc.com>
-
- Nov 21, 2019
-
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Nov 15, 2019
-
-
Alistair Francis authored
Building the date and time into the binary means the OpenSBI isn't reproducible. We don't really need the time so let's remove it. Signed-off-by:
Alistair Francis <alistair.francis@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Nov 06, 2019
-
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-