- May 13, 2024
-
-
Xiang W authored
The inline function can simplify the code by setting some call restrictions. This ensures logical smoothness Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
Modify the return value of the sbi_dbtr_shmem_disabled function to bool to make the semantics clearer. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
The previous code detected shmem_phys_hi and shmem_phys_lo as two addresses. fix this bug Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Himanshu Chauhan <hchauhan@ventanamicro.com>
-
Xiang W authored
Obtaining a 64-bit address under rv64 does not require combining 32-bit registers Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Himanshu Chauhan <hchauhan@ventanamicro.com>
-
Xiang W authored
After getting hart_shmem_base, dbtr_thishart_state_ptr cannot be empty. So remove check code. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Himanshu Chauhan <hchauhan@ventanamicro.com>
-
Xiang W authored
When only phys_hi is equal to SBI_DBTR_SHMEM_INVALID_ADDR, it may be a legal address. The old code would modify the legal address. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Himanshu Chauhan <hchauhan@ventanamicro.com>
-
- May 09, 2024
-
-
Yangyu Chen authored
Canaan Kendryte K230 SoC has T-Head C908 cores inside. The dt-binding has been merged into the linux kernel [1]. However, it has early version of C908 core which does not have Sscofpmf and need to use T-Head PMU extension. Thus, we add a K230 compatible string to thead_generic_match and set quirk for T-Head PMU. [1] https://lore.kernel.org/linux-riscv/tencent_4D85743622F39109466913393EE2F6C5980A@qq.com/ Signed-off-by:
Yangyu Chen <cyy@cyyself.name> Reviewed-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yangyu Chen authored
As Guo Ren said from the kernel mailing list [1], future T-Head CPUs, including the newer versions of T-Head C908, will feature standard Sscofpmf extension. For these CPUs, T-Head's implementation of PMU Overflow Interrupts may not needed anymore. In this case, we shouldn't apply T-Head PMU for all T-Head CPUs. Thus, this patch separated T-Head PMU errata. [1] https://lore.kernel.org/linux-riscv/Zh9sUUUT09LZb0MO@gmail.com/ Signed-off-by:
Yangyu Chen <cyy@cyyself.name> Reviewed-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Ben Zong-You Xie authored
To make the framework suit all Andes CPUs, change all occurrences of andes45 to andes. In addition, we fix some coding style problems and remove an unused macro in andes.h. Signed-off-by:
Ben Zong-You Xie <ben717@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Ben Zong-You Xie authored
Rename files with the prefix andes45 to andes. Signed-off-by:
Ben Zong-You Xie <ben717@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- May 07, 2024
-
-
Alvin Chang authored
Add spinlock protection to avoid race condition on assigned_harts during domain context switching. Also, rename/add variables for accessing the corresponding domain of target/current context. Signed-off-by:
Alvin Chang <alvinga@andestech.com> Reviewed-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Pope B.Lei authored
Although Mstatus.MPV is set, before executing mret, access to VS mode registers should use the actual register addresses, not the pseudonyms of S registers. Signed-off-by:
Pope B.Lei <popeblei@gmail.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
When registering an SSE event, check for the handler_entry_pc to belong to supervisor mode domain using sbi_domain_check_addr_range(). Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reported-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
Rather then passing 1 to sbi_domain_check_addr_range() for supervisor mode, use PRV_S. Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
Move the enable callback call before sending the IPI. Even though the event is locked and no race condition can happen, this is more logical. Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reported-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
The list loop below that check is actually not looping if the list is empty so there was no need for this check. Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reported-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
Rather than checking 32bits overflow with some absolute value, check the value to be different from the cast itself. Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reported-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
There was a naming incoherency between enabled events list lock/unlock. Rename sse_hart_unlock() to sse_enabled_event_unlock() to be coherent and reword comments above lock()/unlock() functions. Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
Fix some errors spotted by Samuel while reviewing the SSE implementation. Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reported-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Ivan Orlov authored
Implement the test which covers some of the functions from the `riscv_locks.h` file. This test consists of 3 test cases: 1) For lock/unlock functions 2) Unsuccessful trylock (the lock was previously taken) 3) Successful trylock (the lock is free and can be taken) Signed-off-by:
Ivan Orlov <ivan.orlov0322@gmail.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Ivan Orlov authored
Implement the test which covers some of the functions from the `riscv_atomic.h` header file. The test contains 9 test cases: 1) atomic read/write test 2) add/return test 3) sub/return test 4) cmpxchg test 5) atomic_xchg test 6) atomic_raw_set_bit test 7) atomic_raw_clear_bit test 8) atomic_set_bit test 9) atomic_clear_bit test Some of the test cases operate on the `test_atomic` variable. It gets initialized in the suite init function. Signed-off-by:
Ivan Orlov <ivan.orlov0322@gmail.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Ivan Orlov authored
Allow to define an init function for the test suite. It could help us to initialize global variable once, and use them in multiple test cases after the initialization. For instance, if multiple test cases use the same atomic_t var, it could be helpful to call ATOMIC_INIT once during the suite initialization. Signed-off-by:
Ivan Orlov <ivan.orlov0322@gmail.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Apr 10, 2024
-
-
Xiang W authored
Now opensbi can run at any address via dynamic relocation. We can remove FW_TEXT_START. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org> Tested-by:
Anup Patel <anup@brainfault.org>
-
Heinrich Schuchardt authored
After calling fdt_node_offset_by_compatible() we must check its return value and not an unrelated value. Addresses-Coverity-ID: 1584993 Logically dead code Fixes: 67ce5a76 ("platform: generic: Add support for specify coldboot harts in DT") Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Heinrich Schuchardt authored
sse_event_get() may return NULL. We should not dereference the return value in sbi_sse_exit() without checking. Fixes: c8cdf01d ("lib: sbi: Add support for Supervisor Software Events extension") Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
The sbi_hart_ext[] array is missing these two extensions ids. It is expected that this array contains all the extensions declaration at the same index of the SBI_HART_EXT_* define. Without this, when adding a new extension, there is a mismatch between ids and extension names and it can even display corrupted extension names. Addresses-Coverity-ID: 1584994 Out-of-bounds read Fixes: 6bb6b61c ("lib: sbi: Add support for smcsrind and smcdeleg") Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reviewed-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Apr 08, 2024
-
-
Samuel Holland authored
The rule included from auto.conf.cmd adds a dependency on every Kconfig file, so these two Kconfig files do not need to be specified again here. Signed-off-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org> Tested-by:
Anup Patel <anup@brainfault.org>
-
- Apr 07, 2024
-
-
Samuel Holland authored
The .config file may be manually edited or copied from another location. Since genconfig.py is responsible for generating auto.conf (the Makefile fragment) and autoconf.h (the C header) from .config, it must be run any time .config changes, not just when running menuconfig. Fixes: 662e631c ("Makefile: Add initial kconfig support for each platform") Signed-off-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org> Tested-by:
Anup Patel <anup@brainfault.org>
-
- Apr 05, 2024
-
-
Yu Chien Peter Lin authored
SCOUNTEREN and SENVCFG may not be supported on certain RISC-V core, so check the existence of these CSRs via privilege spec version to prevent illegal instructions. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Signed-off-by:
Alvin Chang <alvinga@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Anup Patel authored
Currently, all non-coldboot HARTs busy spin in wait_for_coldboot() until the entire coldboot init sequence is completed. This means: 1) On QEMU, all non-coldboot HARTs will eat host CPU time and also slow down the coldboot HART until the entire coldboot init sequence is completed. 2) On real HW, all non-coldboot HARTs will consume more CPU power until the entire coldboot init sequence is completed. To address this, wake up all non-coldboot HARTs as early as possible in the coldboot init sequence. Signed-off-by:Anup Patel <apatel@ventanamicro.com>
-
Anup Patel authored
On QEMU virt machine with large number of HARTs, some of the HARTs randomly fail to come out of wait_for_coldboot() due to one of the following race-conditions: 1) Failing HARTs are not able to acquire the coldboot_lock and update the coldboot_hartmask in wait_for_coldboot() before the coldboot HART acquires the coldboot_lock and sends IPI in wake_coldboot_harts() hence the failing HARTs never receive IPI from the coldboot HART. 2) Failing HARTs acquire the coldbood_lock and update the coldboot_hartmask before coldboot HART does sbi_scratch_init() so the sbi_hartmask_set_hartid() does not update the coldboot_hartmask on the failing HARTs hence they never receive IPI from the coldboot HART. To address this, use a simple busy-loop in wait_for_coldboot() for polling on coldboot_done flag. Signed-off-by:Anup Patel <apatel@ventanamicro.com>
-
Samuel Holland authored
The address of the local scratch area is stored in each hart's mscratch CSR. It is more efficient to read the CSR than to compute the address from the hart ID. Signed-off-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Samuel Holland authored
The address of the local scratch area is stored in each hart's mscratch CSR. It is more efficient to read the CSR than to compute the address from the hart ID. Signed-off-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Vivian Wang authored
Avoid using C types and casts if sbi/sbi_byteorder.h is included in assembly code Signed-off-by:
Vivian Wang <dramforever@live.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
Add SSE callbacks registration to PMU driver in order to disable interrupt delegation for PMU interrupts. When interrupts are undelegated send the PMU SSE event upon LCOFIP IRQ. Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
The SBI SSE extension defines a set of function that can be called to register and handle supervisor sofwtare events. This patch implements all of the functionality defined in the specification. Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reviewed-by:
Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Clément Léger authored
This extension [1] allows to deliver events from SBI to supervisor via a software mechanism. This extension defines events (either local or global) which are signaled by the SBI on specific signal sources (IRQ, exceptions, etc) and are injected to be executed in supervisor mode. [1] https://lists.riscv.org/g/tech-prs/message/798 Signed-off-by:
Clément Léger <cleger@rivosinc.com> Reviewed-by:
Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
Remove copy-base relocations that are no longer needed. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Samuel Holland <samuel.holland@sifive.com> Tested-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Mar 20, 2024
-
-
Christoph Müllner authored
All T-Head CSRs are already defined in thead/c9xx_encoding.h. Let's reuse the values from there instead of redefining them with a slightly different name. Signed-off-by:
Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Ivan Orlov authored
We should store test object files list in the `libsbi-objs-y` Makefile variable, not in `libsbitests-objs-y`. Update the documentation correspondingly. Since we don't use the `console_dev` static variable directly in the `sbi_console_test` unit test anymore, remove the paragraph which says that we do. Fixes: 86224ec3 ("docs/writing_tests: Update tests paths") Signed-off-by:
Ivan Orlov <ivan.orlov0322@gmail.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-