- Oct 23, 2022
-
-
Yu Chien Peter Lin authored
Since we can get the PLMT base address and timer frequency from device tree, move plmt timer device to fdt timer framework. dts example (Quad-core AX45MP): cpus { ... timebase-frequency = <0x3938700>; ... } soc { ... plmt0@e6000000 { compatible = "andestech,plmt0"; reg = <0x00 0xe6000000 0x00 0x100000>; interrupts-extended = <&cpu0_intc 0x07 &cpu1_intc 0x07 &cpu2_intc 0x07 &cpu3_intc 0x07>; }; ... } Signed-off-by:Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
Andes UART is compatible with uart8250 driver. We can use fdt_serial_init() as platform console init hook. dts example: serial0: serial@f0300000 { compatible = "andestech,uart16550", "ns16550a"; reg = <0x00000000 0xf0300000 0x00000000 0x00001000>; interrupts = <9 4>; interrupt-parent = <&plic0>; clock-frequency = <19660800>; current-speed = <38400>; reg-shift = <2>; reg-offset = <32>; reg-io-width = <4>; no-loopback-test = <1>; }; Signed-off-by:Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
This patch makes andes platform name and version can be set in menuconfig interface. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
The boot-time cache operations have been handled by U-boot SPL, so we can drop duplicate code. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
This patch generalizes the logic to add a memory range with desired alignment and flags of consecutive regions to the root domain. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
Fix minor grammar issue in function description. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
%s/is is/is Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
%s/Priviledge/Privilege Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Oct 13, 2022
-
-
Heiko Stuebner authored
With the T-HEAD C9XX cores being designed before or during ratification of the SSCOFPMF extension, they implement a PMU extension that behaves very similar but not equal to it by providing overflow interrupts though in a slightly different registers format. The sun20i-d1 is using this core. So implement the necessary overrides to allow its pmu to be used via the standard sbi-pmu extension. For now it's also the only soc using this core, so keep the additional code in the d1-space for now. Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Heiko Stuebner <heiko@sntech.de>
-
Heiko Stuebner authored
Init of non-standard extensions is a platform-specific thing, so allow generic platforms to do this via a platform-override. Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Heiko Stuebner <heiko@sntech.de>
-
Heiko Stuebner authored
The platform-specific extension_init callback is supposed to set specific things for the platform opensbi is running on. So it's also the right place to override specific hart_features if needed - when it's know that autodetection has provided wrong results for example. Suggested-by:
Atish Patra <atishp@atishpatra.org> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Heiko Stuebner <heiko@sntech.de>
-
Heiko Stuebner authored
Platforms may need to override auto-detected hart features in their override functions. So move the hart_features struct to the sbi_hart.h header allowing us to pass it over to platform-handlers. Suggested-by:
Atish Patra <atishp@atishpatra.org> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Heiko Stuebner <heiko@sntech.de>
-
Heiko Stuebner authored
Don't spread checking for pmu extensions through the code but instead introduce a sbi-pmu function that other code can call to get the correct information about the existence of the pmu interrupt. Add a sbi_pmu_device override function to allow overridung this bit as well if needed. Reviewed-by:
Atish Patra <atishp@rivosinc.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Heiko Stuebner <heiko@sntech.de>
-
zhangdongdong authored
We fix few typos in documentation. Signed-off-by:
zhangdongdong <zhangdongdong@eswincomputing.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Nylon.Chen authored
Add a tip for OpenSBI's FW_JUMP which helps users avoid overwriting the kernel. Signed-off-by:
Nylon Chen <nylon.chen@sifive.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Sep 13, 2022
-
-
Kautuk Consul authored
We add RISC-V semihosting based serial console for JTAG based early debugging. The RISC-V semihosting specification is available at: https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Signed-off-by:
Kautuk Consul <kconsul@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Rahul Pathak authored
count(maxlen) should not be decremented here Fixes: 1901e8a2 ("platform: Add minimal libc support.") Signed-off-by:
Rahul Pathak <rpathak@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Anup Patel authored
This patch does following fixes in fdt_pmu_setup(): 1) If any of the event mapping DT property is absent or too small then don't skip parsing of other DT properties. 2) Return failure if sbi_pmu_add_hw_event_counter_map() fails. 3) Return failure if sbi_pmu_add_raw_event_counter_map() fails. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Vivian Wang authored
If a particular misaligned load or store cannot be emulated at all, for the redirected trap, trap.gva is set to 0, but it should be the same as mstatus[h].GVA of the original trap. Fix this so that if the trap is destined for HS-mode, hstatus.GVA is then set correctly. Fixes: 1c4ce74f ("lib: sbi: Set gva when creating sbi_trap_info") Signed-off-by:
Vivian Wang <dramforever@live.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Vivian Wang authored
The GVA bit is in mstatus on RV64, and in mstatush in RV32. Refactor code handling this in sbi_trap_handler into a helper function to extract GVA from sbi_trap_regs, so that future code accessing GVA can be XLEN-agnostic. Signed-off-by:
Vivian Wang <dramforever@live.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Nikita Shubin authored
Extend example for Unmatched board to provide SBI PMU bindings for generalized and cache event's where they are applicable. Signed-off-by:
Nikita Shubin <n.shubin@yadro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Nikita Shubin authored
bitmap for MHPMCOUNTERx should be 0x18 and not 0x0c, we check against SBI_PMU_FIXED_CTR_MASK which assumes than first 3 bits are dedicated to mcycle, mtime and minstret, u74 has 2 hardware counters. Reported-by:
Zhang Xin <zhangxin.xa@gmail.com> Signed-off-by:
Nikita Shubin <n.shubin@yadro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Sep 01, 2022
-
-
Anup Patel authored
The sbi_pmu.h should only include minimal required headers whereas sbi_pmu.c should include all required headers. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Let us print the platform PMU device name at the boot-time so that users know whether the underlying platform has custom per-HART PMU operations. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
We extend SBI PMU implementation to allow custom PMU device operations which a platform can use for platform specific quirks. The custom PMU device operations added by this patch include: 1) Operations to allow a platform implement custom firmware events. These custom firmware events can be SBI vendor extension related events or platform specific per-HART events are not possible to count through HPM CSRs. 2) Operations to allow a platform implement custom way for enabling (or disabling) an overflow interrupt (e.g. T-Head C9xx). Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Currently, we have 32 elements (i.e. SBI_PMU_FW_EVENT_MAX) array of "struct sbi_pmu_fw_event" for each of 128 possible HARTs (i.e. SBI_HARTMASK_MAX_BITS). To reduce memory usage of OpenSBI, we update FW counter implementation as follows: 1) Remove SBI_PMU_FW_EVENT_MAX 2) Remove "struct sbi_pmu_fw_event" 3) Create per-HART bitmap of XLEN bits to track FW counters which are started on each HART 4) Create per-HART uint64_t array to track values of FW counters on each HART. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
As-per SBI specification, all firmware counters are always 64 bits wide so let us update the SBI PMU implementation to reflect this fact. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
The "read a firmware counter" SBI call should only work for firmware counters so let us replace sbi_pmu_ctr_read() with sbi_pmu_ctr_fw_read() which works only on firmware counters. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
The "event_idx" member of struct sbi_pmu_fw_event is not used anywhere so let us remove it. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Rahul Pathak authored
sideleg and sedeleg csrs are not part of riscv isa spec anymore, these csrs were part of N extension which is removed from the riscv isa specification. These commits removed all traces of these csrs from riscv spec (https://github.com/riscv/riscv-isa-manual ) - commit f8d27f805b65 ("Remove or downgrade more references to N extension (#674)") commit b6cade07034d ("Remove N extension chapter for now") Signed-off-by:
Rahul Pathak <rpathak@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Aug 23, 2022
-
-
Jun Liang Tan authored
Add Cadence UART driver Signed-off-by:
Jun Liang Tan <junliang.tan@linux.starfivetech.com> Signed-off-by:
Wei Liang Lim <weiliang.lim@linux.starfivetech.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Aug 22, 2022
-
-
Anup Patel authored
The arch review of AIA spec is completed and we now have official extension names for AIA: Smaia (M-mode AIA CSRs) and Ssaia (S-mode AIA CSRs). Refer, section 1.6 of the latest AIA v0.3.1 stable specification at https://github.com/riscv/riscv-aia/releases/download/0.3.1-draft.32/riscv-interrupts-032.pdf ) Based on above, we update generic library to use "Smaia" extension name for AIA M-mode CSRs. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Rahul Pathak authored
In case of missing "FENCE.TSO" instruction implementation, opensbi can emulate the "FENCE.TSO" with "FENCE RW,RW", but mepc was not incremented to continue from the next instruction causing infinite trap. Fixes: cb8271c8 ("lib: sbi_illegal_insn: Add emulation for fence.tso") Signed-off-by:
Rahul Pathak <rpathak@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Samuel Holland <samuel@sholland.org>
-
Vivian Wang authored
The privileged spec specifies that on a trap to HS-mode, hstatus.GVA should be set to 1 if stval is written with a guest virtual address, and to 0 otherwise. Implement this by setting hstatus.GVA to trap->gva when redirecting traps to HS-mode. Signed-off-by:
Vivian Wang <dramforever@live.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Vivian Wang authored
The hypervisor CSRs hstatus, htval, htinst should always be set if the trap is to be taken in HS-mode, regardless of which mode it came from. Signed-off-by:
Vivian Wang <dramforever@live.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Vivian Wang authored
In some cases the sbi_trap_info argument passed to sbi_trap_redirect is created from scratch by filling its fields. Since we previously added a gva field to struct sbi_trap_info, initialize gva in these cases also. Suggested-by:
Andrew Jones <ajones@ventanamicro.com> Signed-off-by:
Vivian Wang <dramforever@live.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Vivian Wang authored
The machine mode GVA field is available if the hypervisor extension is implemented, and indicates if mtval is a guest virtual address. Add a gva field to sbi_trap_info for this, and in __sbi_expected_trap_hext, save mstatus[h].GVA to it, so that gva indicates if tval is a guest virtual address. If the hypervisor extension is not implemented, always set gva to 0. Signed-off-by:
Vivian Wang <dramforever@live.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Vivian Wang authored
The machine mode GVA field is in mstatus for RV64 and mstatush for RV32, and is available if the hypervisor extension is available. If an exception occurs, we may need to redirect the trap to HS-mode, in which case, hstatus.GVA should be set to same as the machine mode GVA bit. Add MSTATUS_GVA for RV64, MSTATUSH_GVA for RV32, and their SHIFT encodings. The SHIFT index is helpful in assembly code, since field extraction can be implemented in only one register. In pseudocode: - For RV32: gva = (mstatus >> MSTATUS_GVA_SHIFT) & 1; - For RV64: gva = (mstatush >> MSTATUSH_GVA_SHIFT) & 1; Signed-off-by:
Vivian Wang <dramforever@live.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Aug 08, 2022
-
-
Anup Patel authored
The "object.mk" name referred in top-level makefile should be "objects.mk". Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Tested-by:
Andrew Jones <ajones@ventanamicro.com> Acked-by:
Atish Patra <atishp@rivosinc.com> Tested-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
We update all documentation files to: 1) Remove references to platform specific config.mk file since it is has been removed. 2) Add details about platform specific configs/defconfig and Kconfig files mandatory for each platform. 3) Add required packages in top-level README.md 4) Fix typo releated to object.mk in docs/platform/platform.md Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Tested-by:
Andrew Jones <ajones@ventanamicro.com> Acked-by:
Atish Patra <atishp@rivosinc.com> Tested-by:
Atish Patra <atishp@rivosinc.com>
-