summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-03-18libfdt: Compile fdt_addresses.cBin Meng
Pull fdt_addresses.o in for fdt_address_cells() & fdt_size_cells(). Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-18lib: sbi: Update pmp_get() to return decoded size directlyBin Meng
Currently pmp_get() returns the log2 length of the PMP memory region size. The caller has to calculate the size based on that and the same codes are duplicated. Update this function to return decoded size directly. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-17scripts: Cover sifive/fu540 in the 32-bit buildBin Meng
We now support building sifive/fu540 as a 32-bit platform. Add it in the 32-bit platform list of binary archive script. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-14platform: Use one unified per-HART stack size macro for all platformsBin Meng
As of today all platforms use 8KB of per-HART stack hence there is no need for each platform to define its own macro or use the magic number. Create one macro for all platforms. Platform still can use its own version if needed. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-14platform: Set per-HART stack size to 8KB in the template platform codesBin Meng
The template platform codes should set per-HART stack size to 8KB to avoid possible mistakes of future platform ports. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-14platform: ariane-fpga: Set per-HART stack size to 8KBBin Meng
Recent commit 4a603eb ("platform: kendryte/k210: Set per-HART stack size to 8KB") forgot to update ariane-fpga codes, and the following commit 678c3c3 ("include: sbi_scratch: Set per-HART scratch size to 4KB") changed the per-HART scratch size to 4KB, which potentially breaks ariane-fpga platform. This patch set per-HART stack size of ariane-fpga to 8KB for consistency. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-13Makefile: Fix distclean make targetAnup Patel
The default install directory is not being removed correctly by distclean make target due to recent changes. This patch fixes distclean make target to fix default install directory removal. Fixes: 82ae8e8fe2a3 ("makefile: Do setup of the install target more flexible") Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-13include: Make sbi_current_hartid() as macro in riscv_asm.hAnup Patel
The sbi_current_hartid() being a regular function is quite expensive because for callers it is a function call instead of a direct CSR read. This patch converts sbi_current_hartid() into a macro in riscv_asm.h. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-13lib: sbi_hsm: Optimize sbi_hsm_hart_get_state() implementationAnup Patel
Now that sbi_hart_id_to_scratch() is optimized, we don't need the "if ()" statement. Also, the hstate local variable is redundant so we remove that as well. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-13firmware: fw_base: Optimize _hartid_to_scratch() implementationAnup Patel
This patch optimizes _hartid_to_scratch() in following ways: 1. Use caller saved registers instead of callee saved registers so that we don't need to save/restore registers on stack 2. Remove second redundant mul instruction by re-arranging instructions Overall, we reduce 9 instructions in _hartid_to_scratch() implementation. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-13include: Make sbi_hart_id_to_scratch() as macroAnup Patel
The sbi_hart_id_to_scratch() just forwards call to firmware specific hartid_to_scratch() callback so we make sbi_hart_id_to_scratch() as macro in sbi_scratch.h instead of regular function in sbi_hart.c. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-13libfdt: Upgrade to v1.5.1 releaseBin Meng
Sync with latest libfdt v1.5.1 release source codes. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-13libfdt: Add INT32_MAX and UINT32_MAX in libfdt_env.hBin Meng
Add two macros in preparation to sync libfdt codes to latest v1.5.1 release from upstream. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-13sbi: Add definitions for true/falseBin Meng
We currently have TRUE/FALSE, but it could be convenient to have true/false as well. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-13platform: ariane-fpga: Change license for ariane-fpga from GPL-2.0 to BSD-2Panagiotis Peristerakis
Signed-off-by: Panagiotis Peristerakis <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-13lib: sbi: Fix misaligned trap handlingDamien Le Moal
Compile time checks of __riscv_compressed can only check if OpenSBI is being compiled using compressed instructions or not. Checking this macro does not indicate if an instruction that generated a misaligned trap is a compressed instruction or not. Since the misaligned trap handling code inspects instructions _C_ bits to detect compressed instructions, we can remove all static checks on __riscv_compressed and dissociate hanlding of misaligned traps and OpenSBI compilation. Signed-off-by: Damien Le Moal <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-11docs: Remove out-of-date documentationAtish Patra
Upstream U-Boot now have SMP support and doesn't require any additional patches for HiFive Unleashed. Update the documentation. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-11lib: sbi_hart: Remove HART available mask and related APIsAnup Patel
The HART available mask and related APIs are now totally redundant because of more extensive HART state machine implemented by sbi_hsm. Due to above, we remove HART available mask and related APIs. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-11lib: sbi_ipi: Use sbi_hsm_hart_started_mask() APIAnup Patel
This patch replaces use of sbi_hart_available_mask() API with sbi_hsm_hart_started_mask() API. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-11lib: sbi_system: Use sbi_hsm_hart_started_mask() APIAnup Patel
This patch replaces use of sbi_hart_available_mask() API with sbi_hsm_hart_started_mask() API. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-11lib: sbi_ecall_legacy: Use sbi_hsm_hart_started_mask() APIAnup Patel
This patch replaces use of sbi_hart_available_mask() API with sbi_hsm_hart_started_mask API. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-11lib: Introduce sbi_hsm_hart_started_mask() APIAnup Patel
This patch introduce sbi_hsm_hart_started_mask() API as a replacement of sbi_hart_available_mask() API. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-11include: Remove disabled_hart_mask from sbi_platformAnup Patel
The disabled_hard_mask in sbi_platform is only 64bits wide so we cannot disable a HART with HARTID > 63. To tackle this, we remove disabled_hart_mask and replace it with hart_disabled() platform callback. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-11lib: sbi_init: Use hartmask for coldboot waitAnup Patel
The coldboot_wait_bitmap is of fixed size and has __riscv_xlen bits. This limits us to scale beyond __riscv_xlen HARTs hence we replace coldboot_wait_bitmap with coldboot_wait_hmask which is of type struct sbi_hartmask. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-11lib: Move all coldboot wait APIs to sbi_init.cAnup Patel
The coldboot wait APIs are only used by sbi_init.c so no point in having coldboot related code in sbi_hart.c. As per-above rationale, we move all coldboot wait related APIs to sbi_init.c as static/local functions. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-11lib: sbi_tlb: Use sbi_hartmask in sbi_tlb_infoAnup Patel
Instead of using single ulong as source mask for sbi_tlb_info, we use sbi_hartmask. This way sbi_tlb_info can easily scale for large number of HARTs. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-11lib: Introduce SBI_TLB_INFO_INIT() helper macroAnup Patel
We introduce SBI_TLB_INFO_INIT() helper macro to help easy initialization of struct sbi_tlb_info which is passed to the sbi_tlb_request() API. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-11lib: sbi_init: Don't allow HARTID greater than SBI_HARTMASK_MAX_BITSAnup Patel
We only allow HARTs with HARTID less than SBI_HARTMASK_MAX_BITS in sbi_init() function so that sbi_hartmask can safely used across OpenSBI sources. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-11include: Simple hartmask libraryAnup Patel
We add a simple hartmask library to create and maintain HART mask in different parts of OpenSBI sources. This new library is build as wrapper library on-top-of bitmap library. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-11lib: Simple bitmap libraryAnup Patel
We add simple bitmap library which will help us create and maintain bitmaps. It will also help us create a simple HART mask library. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-10lib: serial: Fix coding style issuesBin Meng
This fixes various coding style issues found in the serial codes. No functional changes. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-10lib: sbi: Fix coding style issuesBin Meng
This fixes various coding style issues found in the SBI codes. No functional changes. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-10platform: ae350: Sort build objects in alphabetical orderBin Meng
Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-10lib: Sort build objects in alphabetical orderBin Meng
Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-08include: sbi_scratch: Set per-HART scratch size to 4KBAnup Patel
Currently, the per-HART scratch size is 256 bytes on RV32 and 512 bytes on RV64. This patch set per-HART scratch size to 4KB (4096 bytes) for both RV32 and RV64 so that we don't run-out of scratch space anytime soon. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-08platform: kendryte/k210: Set per-HART stack size to 8KBAnup Patel
All platform except kendryte/k210 use 8KB of per-HART stack hence this patch set per-HART stack size of kendryte/k210 to 8KB for consistency. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-08include: sbi_bitops: More useful bit operationsAnup Patel
This patch extends our bit operation library with mechanism to: 1. Iteratively traverse bits 2. Set bit 3. Clear bit 4. Change bit 5. ... other helpful functions ... Most the above is adopted from Xvisor sources. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-08include: Move bits related defines and macros to sbi_bitops.hAnup Patel
The right location for all bits related defines and macros is sbi_bitops.h hence this patch. With this patch, the sbi_bits.h is redundant so we remove it. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-08lib: Fix return type of sbi_hsm_hart_started()Anup Patel
The return type of sbi_hsm_hart_started() should be bool. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-03-08platform: sifive: fu540: allow sv32 as an mmu-typeSören Tempel
There has already been a commit to master which added 32-bit specific fdt/payload addresses for the sifive/fu540 platform [0]. This commit introduces another change for using sifive/fu540 as a 32-bit platform. On 32-bit platforms, cores with the SV32 MMU type should not be disabled. For this reason, this commit also allows using this MMU type on the sifive/fu540 platform. Alternatively it would also be possible to only allow SV39 and SV48 if `__riscv_xlen == 64` and SV32 if `__riscv_xlen == 32`. Removing the check entirely would also be an option. [0]: 66fb729a1e46a9a46e809f3b7867fef91477e494 Signed-off-by: Sören Tempel <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2020-03-08makefile: Do setup of the install target more flexibleNikita Ermakov
- Add possibility to setup include, libs, firmware and docs paths. - Change the default installation paths for include, libs, firmware and docs to meet FHS [1]. [1] https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html Signed-off-by: Nikita Ermakov <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-07lib: Check MSIP bit after returning from WFIAtish Patra
As per the RISC-V privilege specification, WFI can be implemented as a NOP. Software should ensure that relevant interrupt pending bits are set. Otherwise, loop back to WFI. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-02-24lib: Implement Hart State Management (HSM) SBI extensionAtish Patra
This patch adds support HSM extension. The specification is available at https://github.com/riscv/riscv-sbi-doc. It allows to implement hart hotplug and fixed ordered hart booting in supervisor. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-02-24lib: Add possible hart status valuesAtish Patra
SBI HSM extension defines possible hart status values in the specification. Define all possible status values. Add a helper function to convert hart state to status because hart states are internal to OpenSBI only and may not match the status values defined in the specification. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-02-24lib: Implement hart hotplugAtish Patra
This patch adds support for hart hotplug in OpenSBI using a generic WFI based approach. Hart hotplug can be achieved via SBI HSM extension which allows supervisor mode software to start or stop any harts anytime. Any platform wishes to implement platform specific hart hotplug must implement both hart_start and hart_stop in addition to enable platform feature SBI_PLATFORM_HAS_HART_HOTPLUG. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-02-24lib: Add a new platform feature to bringup secondary hartsAtish Patra
A platform may have a specific method to bring-up secondary harts for the first time but may rely on generic WFI based approach for hart hotplug in absence of a platform specific hart hotplug method. Define a platform feature flag for such platforms. The platform needs to implement platform specific bring-up method in hart_start and not define hart_stop method in this case. They must only define SBI_PLATFORM_HAS_HART_SECONDARY_BOOT. SBI_PLATFORM_HAS_HART_HOTPLUG should only be defined when the platform intend to support both hart_start and hart_stop and do not intend to rely on generic WFI based approach. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
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-24lib: Simplify the for-loop in sbi_ipi_send_many()Anup Patel
We don't need to separately call sbi_ipi_send() for current HART in sbi_ipi_send_many(). Instead, we can simplify the for-loop in sbi_ipi_send_many() and call sbi_ipi_send() for all HARTs in the for-loop itself. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2020-02-22lib: Use available hart mask for correct hbase valueAtish Patra
As per the latest SBI specification, all online harts should receive IPI if hbase is set to -1. Set the target mask to all available hart mask if hbase is -1. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-02-22lib: Fix typo in atomic exchange functionsAtish Patra
There is a typo in atomic operations code which prevents the usage of riscv atomic instructions even if it is supported. Fix the typo. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>