- Jun 24, 2022
-
-
Anup Patel authored
Now that SBI v1.0 specification is ratified, we change spec verion implemented by OpenSBI to v1.0. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
- Jun 22, 2022
-
-
Samuel Holland authored
The allwinner,sun20i-d1-clint compatible string is not documented in any official binding, so it should not be used by drivers. The MSWI in the D1 CLINT is compatible with the ACLINT specification, so it can take advantage of generic driver support. However, that is only possible if the MSWI and MTIMER are split into separate DT nodes. This means the final binding for this device is likely to be incompatible with what is implemented here. Remove this compatible string from the driver to prevent it from appearing in a stable version and causing future issues. Signed-off-by:
Samuel Holland <samuel@sholland.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Jan Remes authored
The second invocation of plic_context_init() incorrectly calls the function with m_cntx_id instead of s_cntx_id. This breaks systems which only have 1 external interrupt per hart. Fixes: 8c362e7d ("lib: irqchip/plic: Factor out a context init function") Signed-off-by:
Jan Remes <jan.remes@codasip.com> Reviewed-by:
Anup Patel <anup@brainfault.org> Reviewed-by:
Samuel Holland <samuel@sholland.org>
-
- Jun 21, 2022
-
-
Samuel Holland authored
The CLINT in the Allwinner D1 SoC apparently does not support 64-bit MMIO access. A property was added to support this quirk (and that property was copied to the ACLINT MTIMER code). However, since this difference in behavior makes the D1 CLINT incompatible with the SiFive CLINT's programming interface, a better solution is to use a separate compatible string. Signed-off-by:
Samuel Holland <samuel@sholland.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Anup Patel authored
Based on architecture review committee feedback, the [m|s|vs]seteienum, [m|s|vs]clreienum, [m|s|vs]seteipnum, and [m|s|vs]clreipnum CSRs are removed in the latest AIA draft v0.3.0 specification. (Refer, https://github.com/riscv/riscv-aia/releases/tag/0.3.0-draft.31 ) These CSRs were mostly for software convenience and software can always use [m|s|vs]iselect and [m|s|vs]ireg CSRs to update the IMSIC interrupt file bits. We update the IMSIC programming as-per above to match the latest AIA draft specification. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
dramforever authored
We should not change trap->tval to mepc because mtval already points to the faulting portion of the emulated instruction fetch, which is also what stval is expected to be. In addition, htinst is only allowed to be zero for instruction access faults or page faults, and is only allowed to be zero or a psuedoinstruction for instruction guest-page faults. Fix trap->tinst for these cases. Signed-off-by:
dramforever <dramforever@live.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
dramforever authored
If there is an exception while emulating a misaligned load/store, fixup uptrap.tinst before redirecting. Otherwise, HS-mode software may receive an htinst describing the lbu/sb instruction that faulted during emulation[1]. [1]: https://github.com/riscv-software-src/opensbi/issues/258 Signed-off-by:
dramforever <dramforever@live.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
dramforever authored
Add psuedoinstruction encodings written to mtinst/htinst for faults caused by implicit memory access for VS-stage address translation Signed-off-by:
dramforever <dramforever@live.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Jun 13, 2022
-
-
Samuel Holland authored
Allwinner D1 contains a "PPU" power domain controller which can automatically power down/up the CPU power domain. This power domain includes the C906 core along with its CLINT and PLIC. This HSM implementation supports non-retentive hart suspend by: 1) Saving/restoring state that is lost during hart suspend, 2) Performing cache maintenance before/after hart suspend, 3) Configuring wakeup sources before hart suspend, and 4) Asking the PPU to power down the hart when it enters WFI. Since this HSM implementation is for a single-core SoC, it does not need to worry about concurrency or saving multiple instances of state. Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
The delegation bit is lost along with the rest of the PLIC state when the CPU power domain in the Allwinner D1 is powered down, so the PLIC needs to be re-delegated to S-mode during the hart resume path. Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
These functions save/restore the state of the PLIC associated with the current hart. The context save/restore functions only manipulate a single context, since most likely the M-mode context is unused and does not need to be saved. Signed-off-by:
Samuel Holland <samuel@sholland.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Samuel Holland authored
These can be used by platform code to save the PLIC priority state, if it would otherwise be lost during non-retentive suspend. The platform is responsible for allocating all necessary storage. As a space optimization, store the saved priority values as 8-bit integers, since that is large enough to hold any priority value on the relevant platforms. Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
These can be used by platform code to save the PLIC context state, if it would otherwise be lost during non-retentive suspend. The platform is responsible for allocating all necessary storage. Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
This simplifies both the callers and the callees by removing duplicated code and consolidating the error handling. It also fixes two bugs in the process: 1) ie_words was one too large when plic->num_src was a multiple of 32. 2) plic_set_ie takes a 32-bit mask, not a Boolean value, so the FPGA platforms previously only enabled one out of every 32 interrupts. Reviewed-by:Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
None of the functions modify the passed-in plic_data, so mark it const. Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
The suspend code needs to know the resume address for two reasons: 1) Programming some hardware register or management firmware. Here we assume the hardware/firmware maintains its state between suspends, so it only needs to be programmed once at startup. 2) When a non-retentive suspend request ends up being retentive, due to lack of hardware support, pending interrupt, or for some other reason. However, the behavior here is not platform-dependent, and this can be handled in the generic hart suspend function. Since neither situation requires the platform-level suspend function to know the resume address, stop passing it to that function. Instead, handle the non-retentive to retentive situation generically. Reviewed-by:Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
Non-retentive suspend states may require platform-specific actions during resume. For example, firmware may need to save and restore the values of custom CSRs. Add a hook to support this. Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Mayuresh Chitale authored
Allow the vendor_ext_check and vendor_ext_provider APIs of the generic platform to be overridden by other platforms Signed-off-by:
Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
dramforever authored
HS-mode software can choose what exceptions to delegate to VS-mode using the hedeleg CSR. Synthetic VS/VU-mode exceptions should also honor hedeleg. They should be redirected to VS-mode if and only if delegated by HS-mode. Signed-off-by:
dramforever <dramforever@live.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- Jun 01, 2022
-
-
Samuel Holland authored
While OpenC906 appears to properly decode `fence.tso` as a fence instruction[1], the version of the C906 taped out in the Allwinner D1 does not, and raises illegal instruction. Handle this errata by emulating `fence.tso` as `fence rw, rw`. [1]: https://github.com/T-head-Semi/openc906/blob/30827e7f/C906_RTL_FACTORY/gen_rtl/idu/rtl/aq_idu_id_decd.v#L2097 Signed-off-by:
Samuel Holland <samuel@sholland.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- May 30, 2022
-
-
Samuel Holland authored
This table does not need to be modified at runtime. Signed-off-by:
Samuel Holland <samuel@sholland.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Samuel Holland authored
The device's timer_value callback is already the right prototype to use for the get_time_val function pointer. Signed-off-by:
Samuel Holland <samuel@sholland.org> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Samuel Holland authored
Match data stores hardware attributes which do not change at runtime, so it does not need to be mutable. Make it const. Reviewed-by:
Guo Ren <guoren@kernel.org> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org> Signed-off-by:
Samuel Holland <samuel@sholland.org>
-
Xiang W authored
If the csr's operation comes from M mode, it should not be forwarded to low-privilege processing, this patch fixes this problem. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- May 14, 2022
-
-
Jan Remes authored
The function returns the highest hart-id of the harts actually used in the system (enabled). Change the name to reflect this fact. Signed-off-by:
Jan Remes <jan.remes@codasip.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Jan Remes authored
Ignore CPU nodes in FDT which are not enabled. Signed-off-by:
Jan Remes <jan.remes@codasip.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Jan Remes authored
Ignore CPU nodes in FDT that are not enabled. Signed-off-by:
Jan Remes <jan.remes@codasip.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
Jan Remes authored
If an FDT node contains a "status" property and this property is not "ok" or "okay", this node should be ignored. Introduce a function that checks this. Signed-off-by:
Jan Remes <jan.remes@codasip.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup@brainfault.org>
-
- May 13, 2022
-
-
Jan Remes authored
Fix typo in irqchip_imsic_update_hartid_table() when checking for CPU node. Signed-off-by:
Jan Remes <jan.remes@codasip.com> Reviewed-by:
Anup Patel <anup@brainfault.org> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com>
-
Anup Patel authored
Let us move SiFive platform overrides for FU540 and FU740 into a separate directory so better maintainability. Other SoC vendors can also create their own directory under platform/generic. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Instead of having platform override module list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Instead of having FDT gpio driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Instead of having FDT i2c adapter driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Instead of having FDT ipi driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Instead of having FDT irqchip driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Instead of having FDT timer driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Instead of having FDT serial driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Instead of having FDT reset driver list hard-coded in the C source, we generate it using carray.sh at compile-time. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
Generating C array at compile time based on details provided by objects.mk is a very useful feature which will help us compile only a subset of drivers or modules. We add a bash script (carray.sh) which takes array details and object/variable list from command-line to generate a C source containing array of object/variable pointers. We also extend top-level makefile to use carray.sh whenever specified through objects.mk. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-
Anup Patel authored
The generated C source could be anywhere within build directory so let us update the make rule to comple generated C source accordingly. Signed-off-by:
Anup Patel <apatel@ventanamicro.com> Reviewed-by:
Atish Patra <atishp@rivosinc.com>
-