- Jun 05, 2023
-
-
Anup Patel authored
The imsic_map_hartid_to_data() already checks hartid before using so we don't need to check in imsic_update_hartid_table(). Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Instead of using a global array indexed by hartid, we should use scratch space to save per-HART PLIC pointer and PLIC context numbers. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Instead of using a global array indexed by hartid, we should use scratch space to save per-HART MTIMER pointer. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Instead of using a global array indexed by hartid, we should use scratch space to save per-HART MSWI pointer. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Let's use heap allocation in FDT domain parsing instead of using a fixed size global array. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Let's use heap allocation in ACLINT MTIMER driver instead of using a fixed size global array. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Let's use heap allocation in PLIC, APLIC, and IMSIC irqchip drivers instead of using a fixed size global array. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Let's use heap allocation in ACLINT MSWI driver instead of using a fixed size global array. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Let's use heap allocation in DesignWare and SiFive I2C drivers instead of using a fixed size global array. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Let's use heap allocation in SiFive and Starfive GPIO drivers instead of using a fixed size global array. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Instead of using a global array indexed by hartid, we should use scratch space to save per-HART domain pointer. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Let's use heap allocation in root domain creation instead of using a fixed size global array. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Instead of using a global array for per-HART PMU state, we should use heap to on-demand allocate per-HART PMU state when the HART is initialized in cold boot or warm boot path. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
The scratch space being a scarce resource so let us print it's size and usage at boot time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
We provide simple heap allocator to manage the heap space provided by OpenSBI firmware and platform. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
We extend struct sbi_platform and struct sbi_scratch to allow platforms specify the heap size to the OpenSBI firmwares. The OpenSBI firmwares will use this information to determine the location of heap and provide heap base address in per-HART scratch space. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com>
-
Anup Patel authored
Reading and writing a data type in scratch space is a very common use-case so let us add related helper macros in sbi_scratch.h. Signed-off-by:Anup Patel <apatel@ventanamicro.com>
-
- Jun 04, 2023
-
-
Andrew Jones authored
The spec says sbi_system_suspend() will return SBI_ERR_INVALID_PARAM when "sleep_type is reserved or is platform-specific and unimplemented" and SBI_ERR_NOT_SUPPORTED when sleep_type "is not reserved and is implemented, but the platform does not support it due to one or more missing dependencies." Ensure SBI_ERR_INVALID_PARAM is returned for reserved sleep types and that the system suspend driver can choose which of the two error types to return itself by returning an error from its check function rather than a boolean. Signed-off-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Heinrich Schuchardt authored
The parameter checks in aclint_mswi_cold_init() don't guard against a buffer overrun. mswi_hartid2data is defined as an array of SBI_HARTMASK_MAX_BITS entries. The current check allows mswi->hart_count = ACLINT_MSWI_MAX_HARTS mswi->first_hartid = SBI_HARTMASK_MAX_BITS - 1. With these values mswi_hartid2data will be accessed at index SBI_HARTMASK_MAX_BITS + SBI_HARTMASK_MAX_BITS - 2. We have to check the sum of mswi->first_hartid and mswi->hart_count. Furthermore mswi->hart_count = 0 would not make much sense. Addresses-Coverity-ID: 1529705 ("Out-of-bounds write") Fixes: 5a049fe1 ("lib: utils/ipi: Add ACLINT MSWI library") Signed-off-by:Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- May 26, 2023
-
-
Xiang W authored
Remove dummy driver. Optimize fdt_timer_cold_init to exit the loop early. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
Remove dummy driver. Optimize fdt_ipi_cold_init to exit the loop early. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
A final check of all DT nodes does not necessarily find a match, so SBI_ENODEV needs to be returned. Optimize removal of current_driver. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
console is not a required peripheral. So it should return success when the console does not exist. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- May 22, 2023
-
-
Filip Filmar authored
Adds the `-L` flag (follow symlinks) to the `cp` commands used to install `libsbi.a` and `include/sbi/*`. This should make no difference in regular compilation. However, it does make a difference when compiling with bazel. Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with `cp` the destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks. The resulting include files will be unusable due to the dangling symlink issues. Adding `-L` when copying ensures that the files obtained by executing the `install` targets are always dereferenced to files, rather than symlinks, eliminating this issue. Signed-off-by:
Filip Filmar <fmil@google.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- May 21, 2023
-
-
Andrew Jones authored
With the introduction of the register_extensions callback the range members (extid_start and extid_end) may now change and it has become a bit subtle as to when a probe function should be implemented. Document all the members and their relationship to the register_extensions callback. Signed-off-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Andrew Jones authored
When a probe implementation just returns zero for not available and one for available then we don't need it, as the extension won't be registered at all if it would return zero and the Base extension probe function will already set out_val to 1 if not probe function is implemented. Currently all probe functions only return zero or one, so remove them all. Signed-off-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
No need to do a fully comprehensive count, just find a supported reset or suspend type Signed-off-by:
Xiang W <wxjstz@126.com> Signed-off-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Andrew Jones authored
When an extension implements a probe function it means there's a chance that the extension is not available. Use this function in the register_extensions callback to determine if the extension should be registered at all. Where the probe implementation is simple, just open code the check. Signed-off-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Andrew Jones authored
The absence of a probe implementation means that the extension is always available. Remove the implementation for the PMU extension, which does no checking, and indeed even has a comment saying it's always available. Signed-off-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Andrew Jones authored
The vendor extension ID range is large, but at runtime at most a single ID will be available. Narrow the range in the register_extensions callback. After narrowing, we no longer need to check that the extension ID is correct in the other callbacks, as those callbacks will never be invoked with anything other than the single ID. Signed-off-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Andrew Jones authored
Rather than registering all extensions on their behalf in sbi_ecall_init(), introduce another extension callback and invoke that instead. For now, implement each callback by simply registering the extension, which means this patch has no intended functional change. In later patches, extension callbacks will be modified to choose when to register and to possibly narrow the extension ID range prior to registering. When an extension range needs to remove IDs, leaving gaps, then multiple invocations of sbi_ecall_register_extension() may be used. In summary, later patches for current extensions and the introductions of future extensions will use the new callback to ensure that only valid extension IDs from the initial range, which are also available, will be registered. Signed-off-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- May 11, 2023
-
-
Xiang W authored
No need to use #elif ladder when defining BITS_PER_LONG. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Andrew Jones <ajones@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
Simplify sbi_ipi_process() by removing goto statement. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Xiang W authored
We have redundant semicolon at quite a few places so let's remove it. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Apr 20, 2023
-
-
Tan En De authored
Since sbi_pmu_init is called after sbi_console_init, the sbi_printf can be called when sbi_pmu_init fails. Signed-off-by:
Tan En De <ende.tan@starfivetech.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
- Apr 17, 2023
-
-
Anup Patel authored
The legacy console getchar SBI call returns character value in the sbiret.error field so the "SBI_SUCCESS < ret" check in sbi_ecall_handler() results in unwanted error prints for the legacy console getchar SBI call. Let's suppress these unwanted error prints. Fixes: 67b2a408 ("lib: sbi: sbi_ecall: Check the range of SBI error") Signed-off-by:
Anup Patel <apatel@ventanamicro.com>
-
Alexandre Ghiti authored
As per the SBI specification, we should "unconditionally select the first counter from the set of counters specified by the counter_idx_base and counter_idx_mask", so implement this behaviour. Suggested-by:
Atish Patra <atishp@atishpatra.org> Signed-off-by:
Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Alexandre Ghiti authored
Those events are enabled by default and should not be reset afterwards since when using SBI_PMU_CFG_FLAG_SKIP_MATCH, it leads to unaccessible counters after the first use. Signed-off-by:
Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Bin Meng authored
The codes currently skip the very first relocation entry, but later reference the elements in the relocation entry using minus offsets. Change to use positive offsets so that there is no need to skip the first relocation entry. Signed-off-by:
Bin Meng <bmeng@tinylab.org> Reviewed-by:
Anup Patel <anup@brainfault.org> Reviewed-by:
Xiang W <wxjstz@126.com>
-
Bin Meng authored
't5' already contains relocation type so don't bother reloading it. Signed-off-by:
Bin Meng <bmeng@tinylab.org> Reviewed-by:
Anup Patel <anup@brainfault.org> Reviewed-by:
Xiang W <wxjstz@126.com>
-