summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-06-19utils: Remove tinyfdt.cAtish Patra
tinyfdt.c was originally added to provide a minimal implementation of fdt parsing. However, we have already included libfdt in OpenSBI for more complicated operations. Remove tinfdt and replace its functiolity using libfdt. Signed-off-by: Atish Patra <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-06-19platform: Enable all drivers by default.Atish Patra
The drivers and libfdt are built as libsbiutils.a instead of libplatsbi.a. libsbiutils.a are not built per platform specific. Thus, enable all drivers by default. Signed-off-by: Atish Patra <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-06-19lib: Rename string.x to sbi_string.xAtish Patra
All string functions are part of libsbi. It makes more sense to rename them to sbi_string.x as the libsbi can be linked with external libraries that can have similar implementation. Signed-off-by: Atish Patra <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-06-19platform: Move platform common to lib/utils.Atish Patra
Currently, platform/common contains platform/non-platform specific common minimal drivers and libraries. This is helpful is all platforms are built within opensbi framework. Move them to lib/utils so that any external platform code also can reuse the minimalistic drivers or other common libraries. This patch doesn't introduce any functional changes. Signed-off-by: Atish Patra <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-06-19lib: Include helper libc functions directly in libsbi.Atish Patra
libsbi needs some of the custom libc functions. It should be directly included in libsbi instead of platform specific libraries. Signed-off-by: Atish Patra <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-06-19lib: Move sbi core library to lib/sbiAtish Patra
Signed-off-by: Atish Patra <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-06-17firmware: Handle overlapping load and link addresses in relocationXiang W
This patch extends relocation to handle overlapping load and link addresses. The updated relocation will work fine in most cases except when the relocate copy loop itself falls in overlapping load and link addresses. Signed-off-by: Xiang W <[email protected]> Signed-off-by: Anup Patel <[email protected]>
2019-06-12firmware: Relocate when load address is not equal to link addressAnup Patel
This patch extends fw_base to relocate to link address whenever firmware load address is not equal to link address. The relocation will not work when load start to load end overlap link start to link end. Signed-off-by: Anup Patel <[email protected]> Tested-by: Lukas Auer <[email protected]>
2019-06-12firmware: add missing linker sections to fw_base.ldSLukas Auer
The linker sections .sdata and .sbss are missing from the linker script fw_base.ldS. Add them to the .data and .bss sections. On current builds, most variables are in the .sbss section. They are not correctly initialized to zero, because they are not within the boundaries indicated by _bss_start and _bss_end. Currently, this does not cause any issues, however with relocation support lock-ups may occur due to incorrectly initialized lock variables. Signed-off-by: Lukas Auer <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-05-31docs: update CONTRIBUTORS.mdKarsten Merker
Add Andreas Schwab to the contributors list. Signed-off-by: Karsten Merker <[email protected]> Acked-by: Andreas Schwab <[email protected]>
2019-05-30docs: qemu/sifive_u: miscellaneous documentation fixesBin Meng
- OpenSBI build target should be: qemu/sifive_u - U-Boot config name should be: sifive_fu540_defconfig Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-30platform: qemu/sifive_u: Update the hart count to 4Bin Meng
Since QEMU commit 8b1d0714bfdd "riscv: sifive_u: Allow up to 4 CPUs to be created", the maximum number of hart for sifive_u is 4. Change our hart count to match that. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-24lib: Handle page/access fault caused by unpriv load/storeAnup Patel
The unpriv load/store instruction from M-mode can cause page/access fault to M-mode if S-mode page table did not have mappings OR it did not have PMP access permission. To tackle this, we redirect trap back to S-mode if unpriv load/store instruction traps in M-mode. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-24lib: Add per-HART trap info pointerAnup Patel
This patch adds per-HART trap info pointer which can be used to communicate trap information to sbi_trap_handler(). Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-24include: Make unprivilege load/store functions as non-inline functionsAnup Patel
Currently, the unprivilege load/store functions are inline functions. We will be extending these functions to track whether a page/access fault occurs when we execute unprivilege load/store instruction. To make things simpler and debugable, we reduce number of places which can potentially generate a page/access fault by making all unprivilege load/store functions as regular (non-inline) functions. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-24lib: Factor-out TLB management from IPI managementAnup Patel
This patch factor-out TLB management from IPI management to separate sources sbi_tlb.c and sbi_tlb.h. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-24lib: Add a simple brain-dead allocator to manage extra scratch spaceAnup Patel
We have extra space above scratch space (sbi_scratch) which we are currently using to manage per-HART IPI data and TLB request management. In future, more parts of OpenSBI will use the extra scratch space so it will become difficult to manage extra scratch space using just defines and macros. This patch adds a simple brain-dead allocator to manage extra scratch space. This allocator never expects anything to be free-ed hence it keeps incrementing to next allocation offset until it runs-out of space. In future, we can have more sophisticated allocator which will allow us to re-claim free-ed space and also allows us to track owner of allocated space. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-21lib: Flush everything when remote TLB flush range is too largeAnup Patel
On latest Linux kernel (i.e. 5.2-rc1), we get large TLB flush request for user space addresses (typically, start=x and end=-1). This is caused by Linux kernel commit a21344dfc6 ("riscv: fix sbi_remote_sfence_vma{,_asid}"). It's not practical to execute large number of sfence instructions for a large TLB flush range because it takes too much time and eventually causes CPU stall in Linux kernel. This patch addresses above issue by upgrading TLB flush range to TLB flush all whenever TLB flush range is greater than 1GB. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-10docs: Add documentation about dynamic firmwareAnup Patel
This patch adds documenation about dynamic firmware. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-10platform: Enable dynamic firmware for appropriate platformsAnup Patel
This patch enables FW_DYNAMIC option (i.e. dynamic firmware) for all appropriate/applicable platforms. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2019-05-10firmware: Add fw_dynamic firmwareAnup Patel
This patch provides first-cut implementation of fw_dynamic firmware. As compared to fw_jump and fw_payload, the fw_dynamic obtains next address, next mode and OpenSBI options from struct fw_dynamic_info. The previous booting stage can create struct fw_dynamic_info in memory and pass address of struct fw_dynamic_info in 'a2' register. Also, the struct fw_dynamic_info has versioning as well so changes to the struct fw_dynamic_info can be done in a backward compatible manner. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-10firmware: Allow firmwares to provide next mode and optionsAnup Patel
This patch extends existing firmwares (i.e. fw_jump and fw_payload) to explicitly provide next mode and options to fw_base. We also introduce fw_save_info() which is called by fw_base very early on boot HART. This function can be used by existing firmwares (i.e. fw_jump and fw_payload) to save information passed by previous booting stage. Overall, this is a preparatory patch for implementing fw_dynamic. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-06docs: update CONTRIBUTORS.md from git historyKarsten Merker
OpenSBI has recently gained a CONTRIBUTORS.md file as a way to make contributions to OpenSBI more visible. Add previous contributors from the git history who have acked their inclusion in the list to the file. Signed-off-by: Karsten Merker <[email protected]> Acked-by: Alistair Francis <[email protected]> Acked-by: Anup Patel <[email protected]> Acked-by: Atish Patra <[email protected]> Acked-by: Bin Meng <[email protected]> Acked-by: Damien Le Moal <[email protected]> Acked-by: Nick Kossifidis <[email protected]> Acked-by: Shawn Chang <[email protected]> Acked-by: Xiang Wang <[email protected]>
2019-05-06docs: miscellaneous documentation fixes and updatesKarsten Merker
- fix some broken hyperlinks - add additional hyperlinks to references to external documents - reformat some paragraphs to keep lines under 80 characters - unify the enumeration style between different parts of the documentation - fix spelling/grammar mistakes - extend the copyright notice in README.md to be the same as the one in COPYING.BSD Signed-off-by: Karsten Merker <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-05-06Update sifive_fu540.mdLoys Ollivier
Fix typo on parenthesis.
2019-04-30Makefile: explicitly disable PIEKarsten Merker
The various available RISC-V toolchains differ in their default configuration regarding PIE, e.g. the buildroot RISC-V toolchain has PIE disabled by default while the Debian toolchain has it enabled by default. OpenSBI currently doesn't support being built with PIE enabled, therefore disable it explicitly by passing "-fno-pie -no-pie" in CFLAGS. Signed-off-by: Karsten Merker <[email protected]> Acked-by: Anup Patel <[email protected]>
2019-04-25platform/common/libfdt: fix unnecessary multiple inclusionsXiang Wang
Signed-off-by: Xiang Wang <[email protected]>
2019-04-25docs: Add a payload section about coreboot support #116Shawn Chang
Signed-off-by: Shawn Chang <[email protected]>
2019-04-24all: run clang-format and update checked-in filesOlof Johansson
Noisy commit, no functional changes. Generated with an current upstream clang-format and: clang-format -i $(find . -name \*.[ch]) Signed-off-by: Olof Johansson <[email protected]>
2019-04-24all: Annotate some tables to have clang-format leave them aloneOlof Johansson
One of the shortcomings of clang-format is that it doesn't allow for aligned define tables, which is used for a number of constants. Add annotation to disable the automatic formatting where needed. Signed-off-by: Olof Johansson <[email protected]>
2019-04-24libfdt: don't try to clang-formatOlof Johansson
Add an empty clang-format to disable reformatting of imported code and make it easier to merge in upstream changes of that project over time. Signed-off-by: Olof Johansson <[email protected]>
2019-04-24top: add .clang-formatOlof Johansson
Add a clang-format to automate consistent code formatting. Automating coding style reformatting removes a lot of manual checkpatch-type fixups, and can easily be implemented as a linter in code review environments. Signed-off-by: Olof Johansson <[email protected]>
2019-04-22lib: Redirect unhandled traps from non-M modes to S modeNick Kossifidis
In case we didn't handle a trap with one of the available handlers, check if the trap comes from S or U mode and redirect it to S mode's trap handler. Signed-off-by: Nick Kossifidis <[email protected]>
2019-04-15doc: Update docs as per latest kernel/u-boot status.Atish Patra
All dependant patches are merged in U-Boot and Linux kernel now. Update the unleashed guide to reflect that and fix the documentation about tftp loading path as well. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Bin Meng <[email protected]>
2019-04-15top: Add CONTRIBUTORS.md fileAnup Pate
We add CONTRIBUTORS.md file to provide a list of individuals and organizations actively contributing to the OpenSBI project. Signed-off-by: Anup Patel <[email protected]>
2019-04-15docs: qemu/virt platform documentation fixes and updatesKarsten Merker
- Correct the payload address in the RV64 examples that use fw_jump.elf. - Change the qemu console configuration in the examples from "-display none -serial stdio" to "-nographic". This results in qemu handing down a CTRL-C on the emulated console to the VM instead of terminating the qemu process. - Provide examples for RV32. - Various text corrections. Signed-off-by: Karsten Merker <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2019-04-10lib: Optimize TLB flush IPIsAtish Patra
Simulatenous requests for tlbflush IPIs can have overlapping address ranges. Ignore if address range is same or within already existing fifo entries. Update the tlb flush info in fifo directly if the one of the existing entry lies within the new flush request. Delete all entries if flush all request is recieved for the vma. Signed-off-by: Atish Patra <[email protected]>
2019-04-10lib: Provide a lock enabled iteration of fifo.Atish Patra
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]>
2019-04-09TOP: Allow building platform out-of-treeAnup Patel
This patch extends our current build-system for building platform sources which are not part of OpenSBI sources. For example: Let's say we have out-of-tree ABC platform sources. We place these sources under <XYZ>/ABC directory along with its config.mk and objects.mk. To build out-of-tree ABC platform from OpenSBI directory: $ make PLATFORM_DIR=<XYZ>/ABC OR $ make PLATFORM_DIR=<XYZ> PLATFORM=ABC To build out-of-tree ABC platform from <XYZ>/ABC directory: $ make PLATFORM_DIR=<XYZ>/ABC -C <path_to_opensbi> OR $ make PLATFORM_DIR=<XYZ> PLATFORM=ABC -C <path_to_opensbi> Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Alistair Francis <[email protected]>
2019-04-06lib: Fix the ecall macro definitionsAlistair Francis
Fix the ECALL definitions to matc the latest information in the privlidge spec table 5.5. Signed-off-by: Alistair Francis <[email protected]>
2019-04-04firmware: Fix source fdt alignmentXiang Wang
When I tried to start opensbi with coreboot, I found that aligning to a 16-byte boundary would make a copy error. Corrected to align to an machine word length boundary. Signed-off-by: Xiang Wang <[email protected]>
2019-04-03lib: Pack struct sbi_fifoAnup Patel
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]>
2019-04-03lib: More improvements to sbi_fifoAnup Patel
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]>
2019-04-03docs: Update mailing list details in contributing.mdAnup Patel
We now have an OpenSBI mailing list available for development and discussiong so update contributing.md accordingly. The Github PR based review and issue tracking will also continue to exist. Signed-off-by: Anup Patel <[email protected]>
2019-04-03lib: Use a fifo to keep track of sfence related IPIs.Atish Patra
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]>
2019-04-03lib: Increase the scratch space to 512 bytes.Atish Patra
Currently scratch space per hart is 256 bytes. Increase it to 512 bytes to accomodate ipi queue. Signed-off-by: Atish Patra <[email protected]>
2019-04-03lib: Introduce a tlb info type.Atish Patra
Add a tlb info to distinguish between different type of tlb flush request pending. Signed-off-by: Atish Patra <[email protected]>
2019-04-03lib: Add a fifo implementation.Atish Patra
Implement a fifo to accomodate outstanding IPIs for a specific hart at the same time. Signed-off-by: Atish Patra <[email protected]>
2019-04-03kendryte/k210: Fix file headersDamien Le Moal
Add missing SPDX and copyright information. Signed-off-by: Damien Le Moal <[email protected]>
2019-04-03README: Update license informationDamien Le Moal
Add information regarding the Apache License Version 2.0 of some of the Kendryte/k210 platform files. Also repeat this information in a new ThirdPartyNotices.md file. Signed-off-by: Damien Le Moal <[email protected]>