- Sep 16, 2020
-
-
Anup Patel authored
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 << __riscv_xlen" size in a special case in sbi_hart_pmp_check_addr() implementation. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
The sbi_scratch already has provision to specify the next stage mode so we can leverage this to specify start mode to sbi_hsm_hart_start(). In future, this will be useful in providing SBI calls to U-mode on embedded cores where we M-mode and U-mode but no S-mode. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Sep 09, 2020
-
-
Anup Patel authored
We should allow M-mode to M-mode ECALLs because: 1. No other mode can handle M-mode ECALLs 2. In future, we can allow M-mode baremetal application (not linked to OpenSBI) running independently and cooperatively without corrupting OpenSBI M-mode state (CSRs and memory). Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
We rename CAUSE_HYPERVISOR_ECALL to CAUSE_SUPERVISOR_ECALL and CAUSE_SUPERVISOR_ECALL to CAUSE_VIRTUAL_SUPERVISOR_ECALL so that it matches latest RISC-V privilege spec. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
The VS-mode ecall is supposed to be handled by HS-mode so sbi_trap_handler() should fallback to default case for VS-mode ecall trap. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Sep 01, 2020
-
-
Anup Patel authored
We improve HPM CSR read/write emulation as follows: 1. Fail for unimplemented counters so that trap is redirected to S-mode which can further help debugging S-mode software. 2. Check permissions in both MCOUNTEREN and SCOUNTEREN for HS-mode and U-mode. 3. Don't check permissions for TIME CSR because we emulate TIME CSR for both Host (HS/U-mode) and Guest (VS/VU-mode). Also, faster TIME CSR read is very helpful for good performance of S-mode software. 4. Don't emulate S-mode CSR read/write to M-mode HPM CSRs because these should not be accessible to S-mode software. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
This patch does following cosmentic changes to riscv_encoding.h: 1. Re-organize CSR defines to match CSR listing in latest RISC-V privilege spec 2. Rename CSR_HCOUNTERNEN to CSR_HCOUNTEREN Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
A RISC-V platform can leave unimplemented MHPM counters hard-wired to zero. We extend hart_detect_features() to detect MHPM counters which are accessible and not hard-wired to zero. We also print number of available MHPM counters as part of boot prints. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
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 <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
The SBI_HART_HAS_PMP feature is redundant because we already have number of PMP regions returned by sbi_hart_pmp_count(). Checking whether PMP is supported for a HART can be simply done by checking non-zero value returned by sbi_hart_pmp_count(). Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Aug 21, 2020
-
-
Anup Patel authored
The Kendryte K210 follows RISC-V v1.9 spec so MTVAL has instruction address (instead of instruction encoding) on illegal instruction trap. To handle above case, we fix sbi_illegal_insn_handler() without any impact on RISC-V v1.10 (or higher) systems. This achieved by exploiting the fact that program counter (and instruction address) is always 2-byte aligned in RISC-V world. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Tested-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by:
Bin Meng <bin.meng@windriver.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Anup Patel authored
We can have thundering hurd problem with coldboot_lock where the boot HART can potentially starve trying to acquire coldboot_lock because some of the non-boot HARTs are continuously acquiring and releasing coldboot_lock. This can happen if MIP.MSIP bit is already set for some of the non-boot HARTs. To avoid thundering hurd problem for coldboot_lock, we use the __smp_load_acquire() and __smp_store_release() for coldboot_done flag and use coldboot_lock only for coldboot_wait_hmask. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Tested-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Bin Meng <bin.meng@windriver.com>
-
- Aug 20, 2020
-
-
Heinrich Schuchardt authored
When passing the device tree to the next stage we should apply necessary device tree fix-ups first. These include: * fix up the CPU node in the device tree * fix up the PLIC node in the device tree * fix up the reserved memory node in the device tree Signed-off-by:
Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Aug 17, 2020
-
-
Georg Kotheimer authored
When redirecting from VS/VU-mode to HS-mode, hstatus.SPVP was set to the value of mstatus.SPP, as according to the specification both flags should be set to the same value. However, the assignment of SPVP takes place before SPP itself is updated, which results in SPVP having an outdated value. Signed-off-by:
Georg Kotheimer <georg.kotheimer@tu-dresden.de> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Aug 14, 2020
-
-
Anup Patel authored
Currently, the low-level trap handler (i.e. _trap_handler()) uses branch instructions to conditionally setup exception stack based on which mode trap occured. This patch implements exception stack setup using xor instructions which is faster with same number of instructions due to lack of branch instructions. The new exception stack setup approach can be best described by the following pseudocode: Came_From_M_Mode = ((MSTATUS.MPP < PRV_M) ? 1 : 0) - 1; Exception_Stack = TP ^ (Came_From_M_Mode & (SP ^ TP)) Came_From_M_Mode = 0 ==> Exception_Stack = TP Came_From_M_Mode = -1 ==> Exception_Stack = SP Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Aug 04, 2020
-
-
Anup Patel authored
If MTINST[0:0] bit is 1 then we have transformed instruction encoding in MTINST CSR. For transformed instructions, if the MTINST[1:1] bit is Zero then original trapped instruction was a 16bit instruction which was converted to 32bit instruction at time of taking trap. We should use MTINST[1:1] bit to determine correct instruction length of transformed instruction. This patch updates misaligned load/store emulation as-per above. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Jul 29, 2020
-
-
Abner Chang authored
Use strncmp instead of using sbi_strcmp directly in fdt_parse_hart_id() to allow compiling fdt_helper.c by external firmware. Signed-off-by:
Abner Chang <abner.chang@hpe.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Abner Chang authored
This commit add a macro to replace strncmp with sbi_strncmp. Signed-off-by:
Abner Chang <abner.chang@hpe.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Abner Chang authored
This commit add an implementation of sbi_strncmp. Signed-off-by:
Abner Chang <abner.chang@hpe.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Jul 14, 2020
-
-
Tobias Klauser authored
The value assigned to x by the shift assignment in the last if block of ffs/fls is never read. Remove it. Signed-off-by:
Tobias Klauser <tklauser@distanz.ch> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Jul 06, 2020
-
-
Bin Meng authored
Currently 256 bytes is used for the FDT expand size when fixing up reserved memory node. Increase it to 1024 bytes with an estimated size of 64 bytes per PMP memory region by 16 regions in total. Signed-off-by:
Bin Meng <bin.meng@windriver.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Jul 04, 2020
-
-
Tobias Klauser authored
Consistently use reference-style markdown links in the README. This won't show the URL next to the linked text for the [Github] and [U-Boot] links and link the text "Bootlin toolchain repository" instead of showing it verbatim with the URL next to it. Signed-off-by:
Tobias Klauser <tklauser@distanz.ch> Reviewed-by:
Bin Meng <bin.meng@windriver.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Jun 29, 2020
-
-
Bin Meng authored
U-Boot v2020.07 release adds SPL support to SiFive HiFive Unleashed. Update the doc to mention that detailed build instructions are in the U-Boot doc. This also adds detailed command line description to show how to boot U-Boot v2020.07 S-mode payload in the QEMU chapter. Signed-off-by:
Bin Meng <bin.meng@windriver.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Bin Meng authored
Since QEMU v5.1, if there is no "-bios" option provided, the default OpenSBI firmware will be loaded by QEMU as the BIOS automatically, hence to load fw_payload type image, we should explicitly pass the "-bios" option to QEMU. Signed-off-by:
Bin Meng <bin.meng@windriver.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Bin Meng authored
Since QEMU v5.1, if there is no "-bios" option provided, the default OpenSBI firmware will be loaded by QEMU as the BIOS automatically, hence to load fw_payload type image, we should explicitly pass the "-bios" option to QEMU. Signed-off-by:
Bin Meng <bin.meng@windriver.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Jun 20, 2020
-
-
Anup Patel authored
This patch updates OpenSBI version to 0.8 as part of release preparation. Signed-off-by:Anup Patel <anup.patel@wdc.com>
-
Anup Patel authored
We should only return valid error codes from SBI ecalls as defined by the RISC-V SBI spec. To achieve this: 1. We use SBI_Exxxx defines for OpenSBI internal errors with error values starting from -1000 2. We use SBI_ERR_xxxx defines for errors defined by SBI spec 3. We map some of the SBI_Exxxx defines to SBI_ERR_xxxx defines which are semantically same 4. We throw a error print and force return error code to SBI_ERR_FAILED in sbi_ecall_handler() if we see an invalid error code being returned to S-mode Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
Liush authored
On RV64,"unsigned long" is 64bit and "unsigned int" is 32bit. So in function "pmp_get" and "pmp_set", if "pmpcfg_shift >= 32", "0xff << pmpcfg_shift" will go beyond "unsigned int" width. This patch tries to fix this issue. In function 'pmp_get': cfgmask = (0xff << pmpcfg_shift); --> cfgmask = (0xffUL << pmpcfg_shift); In function 'pmp_set': cfgmask = ~(0xff << pmpcfg_shift); --> cfgmask = ~(0xffUL << pmpcfg_shift); Signed-off-by:
Liush <liush.damon@gmail.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Jun 19, 2020
-
-
Vijai Kumar K authored
C-Class is a member of the SHAKTI family of processors from Indian Institute of Technology - Madras(IIT-M). It is an extremely configurable and commercial-grade 5-stage in-order core supporting the standard RV64GCSUN ISA extensions. https://gitlab.com/shaktiproject/cores/c-class/blob/master/README.md We add OpenSBI support for Shakti C-class SoC. Signed-off-by:
Vijai Kumar K <vijai@behindbytes.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Jun 18, 2020
-
-
Alistair Francis authored
Signed-off-by:
Alistair Francis <alistair.francis@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Alistair Francis authored
If the platform doesn't support S-Mode don't print the delegation registers. Signed-off-by:
Alistair Francis <alistair.francis@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Jun 17, 2020
-
-
Huaqi Fang authored
Changes are made to support our FPGA evaluation board, it has DDR memory(0xA0000000-0xB0000000). * Adapt the config.mk to match FPGA evaluation board DDR memory address * Since the RISC-V CPU core frequency of FPGA might change, so we use the fixed TIMER frequency to measure the real CPU core frequency. * And the UART baudrate has to set to 57600bps for Nuclei FPGA evaluation board when CPU core frequency is about 8MHz, otherwise the UART input will not work correctly. Signed-off-by:
Huaqi Fang <578567190@qq.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Jun 15, 2020
-
-
Alexandre Ghiti authored
This is achieved by removing the 'no-map' property from the 'reserved-memory' node when PMP is present, otherwise we keep it as it offers a small protection if the OS does not map this region at all. A new callback in platform_override is introduced and allows to fixup the device-tree. It is used here to override this new default behaviour on SiFive Fu540 platforms that has an erratum that prevents S-mode software to access a PMP protected region using 1GB page table mapping. If PMP is present, telling the OS not to map the reserved regions does not add much protection since it only avoids access to regions that are already protected by PMP. But by not allowing the OS to map those regions, it creates holes in the OS system memory map and prevents the use of hugepages which would generate, among other benefits, less TLB miss. Signed-off-by:
Alexandre Ghiti <alex@ghiti.fr> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Anup Patel authored
The arguments/parameters of __sbi_hfence_gvma_vmid_gpa() and __sbi_hfence_vvma_asid_va() functions are swapped so we fix it. Currently, we did not face any issues because QEMU does a full TLB flush for all HFENCE instructions. We also improve documentation of HFENCE.GVMA and HFENCE.VVMA instruction encoding. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Jun 10, 2020
-
-
Nylon Chen authored
This patch contains the following AE350 specific SBIs: - get mcache_ctl status - get mmisc_ctl status - set mcache_ctl status - set mmisc_ctl status - I-cache operation - D-cache operation - enable/disable L1-I-cache prefetch - enable/disable L1-D-cache prefetch - enable/disable non-blocking load store - enable/disable write-around Signed-off-by:
Nylon Chen <nylon7@andestech.com> Reviewed-by:
Anup Patel <Anup.Patel@wdc.com> Reviewed-by:
Atish Patra <Atish.Patra@wdc.com>
-
Nylon Chen authored
We add AE350 platform specific SBI handler to implement AE350 specific SBI calls. Signed-off-by:
Nylon Chen <nylon7@andestech.com> Reviewed-by:
Anup Patel <Anup.Patel@wdc.com> Reviewed-by:
Atish Patra <Atish.Patra@wdc.com>
-
- Jun 08, 2020
-
-
Atish Patra authored
U-Boot now supports loading Linux kernel image via network and storage media. Thus, we don't need to use a combined payload containing both U-Boot & Linux kernel image to boot Linux from U-Boot prompt. Remove the old documentation. Signed-off-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Atish Patra authored
The doxygen config option "USE_MDFILE_AS_MAINPAGE" can be used to set the main page in doxygen generated pdf. This allows us to remove the "#mainpage" from the README file which markdown doesn't parse. Signed-off-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Anup Patel authored
To support RISC-V hypervisor v0.6.1, we: 1. Don't need to explicitly forward WFI traps from VS/VU-mode 2. Have to delegate virtual instruction trap to HS-mode 3. Have to update trap redirection for changes in HSTATUS CSR Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-
- Jun 05, 2020
-
-
Anup Patel authored
Now that no platform is using FW_PAYLOAD_FDT mechanism, we remove related code from Makefile and related documentation. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com>
-