- Dec 06, 2023
-
-
Yu Chien Peter Lin authored
Enable Andes PMU extension support for AE350 platforms. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com> Reviewed-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
Before the ratification of Sscofpmf, the Andes PMU extension was designed to support the sampling and filtering with hardware performance counters (zihpm), it works with the current SBI PMU extension and Linux SBI PMU driver. We implement 1) the PMU device callbacks that update the corresponding bits on custom CSRs, 2) extentions_init() to detect the hardware support of Andes PMU and initialize the per-hart PMU related CSR, and 3) pmu_init() to register PMU device and populate event mappings. Also define a andes_pmu_setup() function which is in preparation for adding default PMU mappings in andes_hpm.h 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
Add pmu_init() platform override, which will be used to register PMU device and populate event mappings. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com> Reviewed-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
Add CSR definitions for Andes PMU extension. 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> Reviewed-by:
Atish Patra <atishp@rivosinc.com> Reviewed-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
-
Yu Chien Peter Lin authored
Add support for custom PMU extensions to set inhibit bits on custom CSRs by introducing the PMU device callback hw_counter_filter_mode(). This allows the perf tool to restrict event counting under a specified privileged mode by appending a modifier, e.g. perf record -e event:k to count events only happening in kernel mode. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
Add the custom extension to hart extension list. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com> Reviewed-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yu Chien Peter Lin authored
This patch makes the following changes: - As sbi_platform_pmu_init() returns a negative error code on failure, let sbi_pmu_init() print out the error code with sbi_dprintf(). - In order to distinguish the SBI_EFAIL error returned by sbi_pmu_add_*_counter_map(), return SBI_ENOENT to indicate that fdt_pmu_setup() failed to locate "riscv,pmu" node, and generic_pmu_init() ignores such case. Signed-off-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Anup Patel <anup@brainfault.org> Reviewed-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Leo Yu-Chi Liang authored
The old scheme doesn't allow sending hart0 self-IPI as the corresponding bit on pending register is hardwired to 0, this could lead to unhandle IPIs on SMP systems, esp. on single-core. Furthermore, the limitation of old scheme is 8-core, instead of reserving source hart information, we assign bit (x + 1) as the enable and pending bit of hartx, this also expands the bootable hart number. The following diagram shows the enable bits of the new scheme on 32-core Andes platform. Pending regs: 0x1000 x---0---0---0---0------0---0 Pending hart ID: 0 1 2 3 ... 30 31 Interrupt ID: 0 1 2 3 4 ... 31 32 | | | | | | | Enable regs: 0x2000 x---1---0---0---0-...--0---0---> hart0 | | | | | | | 0x2080 x---0---1---0---0-...--0---0---> hart1 | | | | | | | 0x2100 x---0---0---1---0-...--0---0---> hart2 | | | | | | | 0x2180 x---0---0---0---1-...--0---0---> hart3 . . . . . . . . . . . . . . . . . . . . . 0x2f00 x---0---0---0---0-...--1---0---> hart30 | | | | | | | 0x2f80 x---0---0---0---0-...--0---1---> hart31 <-------- word 0 -------><--- word 1 ---> To send IPI to hart0, for example, another hart (including hart0 itself) will set bit 1 of first word on the pending register. We also fix indentation in andes_plicsw.h along with this patch. Fixes: ce7c4907 ("lib: utils/ipi: Add Andes fdt ipi driver support") Signed-off-by:Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by:
Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by:
Randolph <randolph@andestech.com> Reported-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005665.html Reviewed-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by:
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Nov 26, 2023
-
-
Anup Patel authored
Currently, there are no barriers before or after the ipi_clear() device callback which forces ipi_clear() device callback to always use non-relaxed MMIO writes. Instead of above, we use wmb() in after the ipi_clear() device callback which pairs with the wmb() done before the ipi_send() device callback. This also allows device ipi_clear() callback to use relaxed MMIO writes. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reported-by:
Bo Gan <ganboing@gmail.com>
-
Anup Patel authored
Currently, we have a smp_wmb() between atomic_raw_set_bit() and ipi_send() device callback whereas the MMIO writes done by the device ipi_send() callback will also include a barrier. We can avoid unnecessary/redundant barriers described above by allowing relaxed MMIO writes in device ipi_send() callback. To achieve this, we simply use wmb() instead of smp_wmb() before calling device ipi_send(). Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reported-by:
Bo Gan <ganboing@gmail.com>
-
- Nov 24, 2023
-
-
Anup Patel authored
Each APLIC CLRIE register allows disabling 32 interrupt sources at a time by writing -1 so no need to write CLRIE register separately for each interrupt source. Fixes: 99792653 ("lib: utils/irqchip: Add APLIC initialization library") Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
- Nov 22, 2023
-
-
Heinrich Schuchardt authored
total_ctrs is bounded by SBI_PMU_FW_CTR_MAX + SBI_PMU_HW_CTR_MAX) == 48 which exceeds BITS_PER_LONG on 32 bit systems. Iterating over the bits of &cmask results in a buffer overflow when looking for a bit >= BITS_PER_LONG. Adjust the iterators in sbi_pmu_ctr_start() and sbi_pmu_ctr_stop() accordingly. Signed-off-by:Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Anup Patel authored
The sbi_hart_map_saddr() must create PMP mapping of size greater than or equal to PMP granularity otherwise PMP mapping does not work when size parameter less than sbi_hart_pmp_granularity(scratch). Fixes: 6e44ef68 ("lib: sbi: Add functions to map/unmap shared memory") Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Samuel Holland <samuel.holland@sifive.com>
-
- Nov 17, 2023
-
-
Xiang W authored
For some debuggers that do not implement SYSWRITEC and SYSREADC operations, we have to use SYSWRITE and SYSREAD. Instead of implementing semihosting_putc() using SYSWRITE, let us simply remove semihosting_putc() because console_putc/console_puts are now interchangeable. Signed-off-by:
Chen Pei <cp0613@linux.alibaba.com> Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
console_puts/console_putc should replace each other, but the previous sbi_putc can only use console_putc. This patch addresses this problem. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
In the future there may be a lot of ISA extensions, a 'long' may not be able to accommodate, changed to an array for the future. Addresses-Coverity-ID: 1568357 Out-of-bounds access Fixes: 6259b2ec ("lib: utils/fdt: Fix fdt_parse_isa_extensions() implementation") Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Heinrich Schuchardt authored
If ISA extension Zkr is available, set mseccfg.sseed=1 mseccfg.useed=0 This enables access to the seed CSR in S-mode but not in U-mode. Signed-off-by:Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Heinrich Schuchardt authored
- Add Zkr as extension in sbi_hart_extensions enum - Return "zkr" string for Zkr extension from sbi_hart_extension_id2string Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Heinrich Schuchardt authored
Define macros to access the sseed and the useed bit in the machine security configuration register (mseccfg). Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Nov 16, 2023
-
-
Inochi Amaoto authored
Add Sophgo sg2042 soc support Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
As the domain will reject a new memory region which has a sub-regions already in the domain, even the new region is bigger and has the same flags. This problem can be solved by relaxing region restriction and rechecking when adding and sanitizing domains. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
Swapping domain region is a common operation when sorting domain region, so separate it as a function to make code clean. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
Like the mtimer of T-HEAD C9xx clint, the mswi also needs new compatible string to avoid misuse. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Link: https://lore.kernel.org/linux-riscv/1f6b82a1864477a51db33d3f295889ff985b497b.1696433229.git.unicorn_wang@outlook.com/ Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
T-HEAD allows soc vendor to map the mtimer and mswi of C9xx clint on different address, which may cause a misuse if use the same compatible string, add a new timer compatible string to avoid this. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Link: https://lore.kernel.org/linux-riscv/6e48cbe5e60f9ada2fd1fe58e803e127f1a678e5.1696433229.git.unicorn_wang@outlook.com/ Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
The quirks checking will cause ACLINT step into a CLINT code path, this is not expected when ACLINT needs custom quirks. Add a new quirk to identify custom ACLINT, and apply the general quirks after applying CLINT specific quirks. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Guo Ren authored
In the past, we used fdt_reset_thead to help customers with prototype verification. However, with the emergence of the Big-little SoC system, it can no longer meet the demand. Therefore, we use zero_stage_boot instead of fdt_reset_thead. It cleans up the opensbi code and ends the disputation of reset_sample's dts. This patch removes the fdt_reset_thead component and updates the related doc. Signed-off-by:
Guo Ren <guoren@linux.alibaba.com> Signed-off-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Guo Ren authored
It's wrong to put the fence after setting the boot status flag because all relocation operations must be finished before setting the status flag. So, this fence must be put before the setting status flag, and there is no use in putting a fence between _start_warm and setting status flag. Also, nop can't delay other harts too much, so use div instead, just like Linux cpu_relax. Current opensbi force enables “M” Standard Extension, and mul instructions have been used in the fw_base.S. After the above two fixes, the boot hart index param of the fw_dynamic_info could be guaranteed properly for all platforms. Signed-off-by:
Guo Ren <guoren@linux.alibaba.com> Signed-off-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Chen Pei authored
For some debuggers that do not implement SYSWRITEC and SYSREADC operations, we can use SYSWRITE and SYSREAD instead like the implementation of semihosting_getc(). Signed-off-by:
Chen Pei <cp0613@linux.alibaba.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
For platform with high number of harts, it is better to auto detect a suitable number of entries in tlb fifo. Since allocating tlb entry for all online harts can reduce the wait time significantly, using the number of the online harts can make most platforms happy. This auto detection can avoid most duplicate code for setting tlb fifo size. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Acked-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
Flushing the tlb entries can solve the thead tlb problem, but flushing it by address will miss something and lead to a exception in some rare cases, and this is more common for sg2042. To solve this problem, flush the tlb entries by asid in the custom trap handler to ensure it is refreshed. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Samuel Holland authored
Per the SBI specification, the effects of these functions are limited to a specific ASID and/or VMID. This applies even when flushing the entire address space. Signed-off-by:
Samuel Holland <samuel.holland@sifive.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Nov 15, 2023
-
-
Inochi Amaoto authored
Since all the SoC with thead c9xx cores need this initialization at now, initialize the c9xx pmu in the thead generic platform by default. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
Separate the implement of T-HEAD c9xx errata to allow any platform with bug related to c9xx cores can use it. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
Separate the implement of T-HEAD c9xx pmu to allow any platform with c9xx cores can use it. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Inochi Amaoto authored
The CSR encoding for t-head c9xx cores is shared across all the platforms with these cores. So move header thead_c9xx.h to the thead subdir. Signed-off-by:
Inochi Amaoto <inochiama@outlook.com> Acked-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Nov 14, 2023
-
-
Heinrich Schuchardt authored
Since commit 112daa2e ("lib: sbi: Maximize the use of HART index in sbi_domain") the platform parameter is unused. Fixes: 112daa2e ("lib: sbi: Maximize the use of HART index in sbi_domain") Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Oct 19, 2023
-
-
Anup Patel authored
Now that SBI v2.0 specification is frozen, we change spec version implemented by OpenSBI to v2.0. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
- Oct 09, 2023
-
-
Amanieu d'Antras authored
Unlike C.LWSP/C.LDSP, these encodings can be used with the zero register, so checking that the rs2 field is non-zero is unnecessary. Additionally, the previous check was incorrect since it was checking the immediate field of the instruction instead of the rs2 field. Signed-off-by:
Amanieu d'Antras <amanieu@gmail.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Oct 06, 2023
-
-
Yangjie Zhang authored
RISC-V privileged specification v1.12 introduced the mconfigptr CSR which will hold the physical address of a configuration data structure. Signed-off-by:
Yangjie Zhang <jay1273062855@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Yangjie Zhang authored
"Zicsr" isa extension has been separated from "I" extension. This patch add the isa requirement of "Zicsr" extension in platform requirements documentation. Signed-off-by:
Yangjie Zhang <jay1273062855@outlook.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-