summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-09include: sbi: Fix BSWAPx() macros for big-endian hostAnup Patel1-10/+14
The BSWAPx() macros won't do any swapping for big-endian host because the EXTRACT_BYTE() macro will pickup bytes in reverse order. Also, the EXTRACT_BYTE() will generate compile error for constants. To fix this, we get remove the EXTRACT_BYTE() macro and re-write BSWAPx() using simple mask and shift operations. Fixes: 09b34d8cca51 ("include: Add support for byteorder/endianness conversion") Reported-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-02-08include: types: Add typedefs for endiannessRahul Pathak2-3/+10
If any variable/memory-location follows certain endianness then its important to annotate it properly so that proper conversion can be done before read/write from that variable/memory. Also, use these new typedefs in libfdt_env.h for deriving its own custom fdtX_t types Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-08lib: utils/fdt: Use byteorder conversion functions in libfdt_env.hRahul Pathak1-19/+10
FDT follows big-endian and CPU can be little or big endian as per the implementation. libfdt_env.h defines function for conversion between fdt and cpu byteorder according to the endianness. Currently, libfdt_env.h defines custom byte swapping macros and then undefines them. Instead, use the generic endianness conversion functions Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-08include: Add support for byteorder/endianness conversionRahul Pathak1-0/+57
Define macros general byteorder conversion Define functions for endianness conversion from general byteorder conversion macros Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Sergey Matyukevich <sergey.matyukevich@syntacore.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-08Makefile: Add missing .dep files for fw_*.elf.ldJessica Clarke1-0/+9
Since we don't currently create these, changes to fw_base.ldS do not cause the preprocessed fw_*.elf.ld files to be rebuilt, and thus incremental builds can end up failing with missing symbols if crossing the recent commits that introduced _fw_rw_offset and then replaced it with _fw_rw_start. Reported-by: Ben Dooks <ben.dooks@sifive.com> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-08lib: sbi: Ensure domidx_to_domain_table is null-terminatedAndrew Jones1-1/+5
sbi_domain_for_each() requires domidx_to_domain_table[] to be null-terminated. Allocate one extra element which will always be null. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-08lib: utils: Mark only the largest region as reserved in FDTHimanshu Chauhan1-4/+30
In commit 230278dcf, RX and RW regions were marked separately. When the RW region grows (e.g. with more harts) and it isn't a power-of-two, sbi_domain_memregion_init will upgrade the region to the next power-of-two. This will make RX and RW both start at the same base address, like so (with 64 harts): Domain0 Region01 : 0x0000000080000000-0x000000008001ffff M: (R,X) S/U: () Domain0 Region02 : 0x0000000080000000-0x00000000800fffff M: (R,W) S/U: () This doesn't break the permission enforcement because of static priorities in PMP but makes the kernel complain about the regions overlapping each other. Like so: [ 0.000000] OF: reserved mem: OVERLAP DETECTED! [ 0.000000] mmode_resv0@80000000 (0x0000000080000000--0x0000000080020000) \ overlaps with mmode_resv1@80000000 (0x0000000080000000--0x0000000080100000) To fix this warning, among the multiple regions having same base address but different sizes, add only the largest region as reserved region during fdt fixup. Fixes: 230278dcf (lib: sbi: Add separate entries for firmware RX and RW regions) Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-08lib: sbi_hsm: Use csr_set to restore the MIPNick Hu1-1/+1
If we use the csr_write to restore the MIP, we may clear the SEIP. In generic behavior of QEMU, if the pending bits of PLIC are set and we clear the SEIP, the QEMU may not set it back immediately. It may cause the interrupts won't be handled anymore until the new interrupts arrived and QEMU set the bits back. Signed-off-by: Nick Hu <nick.hu@sifive.com> Signed-off-by: Jim Shu <jim.shu@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-02-08firmware: Not to clear all the MIPNick Hu1-2/+8
In generic behavior of QEMU, if the pending bits of PLIC are still set and we clear the SEIP, the QEMU may not set the SEIP back immediately and the interrupt may not be handled anymore until the new interrupts arrived and QEMU set the SEIP back which is a generic behavior in QEMU. Signed-off-by: Nick Hu <nick.hu@sifive.com> Signed-off-by: Jim Shu <jim.shu@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-27firmware: Fix fw_rw_offset computation in fw_base.SJessica Clarke2-2/+2
It seems BFD just does totally nonsensical things for SHN_ABS symbols when producing position-independent outputs (both -pie and -shared) for various historical reasons, and so SHN_ABS symbols are still subject to relocation as far as BFD is concerned (except AArch64, which fixes it in limited cases that don’t apply here...). The above affects the _fw_rw_offset provided through fw_base.ldS linker script which results in OpenSBI firmware failing to boot when loaded at an address different from FW_TEXT_START. Fixes: c10e3fe5f9a1 ("firmware: Add RW section offset in scratch") Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com> Reported-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-01-24platform: generic: allwinner: Advertise nonretentive suspendSamuel Holland1-0/+20
Add D1's nonretentive suspend state to the devicetree so S-mode software knows about it and can use it. Latency and power measurements were taken on an Allwinner Nezha board: - Entry latency was measured from the beginning of sbi_ecall_handler() to before the call to wfi() in sun20i_d1_hart_suspend(). - Exit latency was measured from the beginning of sbi_init() to before the call to sbi_hart_switch_mode() in init_warmboot(). - There was a 17.5 mW benefit from non-retentive suspend compared to WFI, with a 170 mW cost during the 107 us entry/exit period. This provides a break-even point around 1040 us. Residency includes entry latency, so round this up to 1100 us. - The hardware power sequence latency (after the WFI) is assumed to be negligible, so set the wakeup latency to the exit latency. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-01-24lib: utils: Add fdt_add_cpu_idle_states() helper functionSamuel Holland2-0/+108
Since the availability and latency properties of CPU idle states depend on the specific SBI HSM implementation, it is appropriate that the idle states are added to the devicetree at runtime by that implementation. This helper function adds a platform-provided array of idle states to the devicetree, following the SBI idle state binding. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Samuel Holland <samuel@sholland.org>
2023-01-23platform: renesas/rzfive: Configure Local memory regions as part of root domainLad Prabhakar1-0/+20
Renesas RZ/Five RISC-V SoC has Instruction local memory and Data local memory (ILM & DLM) mapped between region 0x30000 - 0x4FFFF. When a virtual address falls within this range, the MMU doesn't trigger a page fault; it assumes the virtual address is a physical address which can cause undesired behaviours for statically linked applications/libraries. To avoid this, add the ILM/DLM memory regions to the root domain region of the PMPU with permissions set to 0x0 for S/U modes so that any access to these regions gets blocked and for M-mode we grant full access (R/W/X). Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-23lib: sbi: Add separate entries for firmware RX and RW regionsHimanshu Chauhan1-2/+22
Add two entries for firmware in the root domain: 1. TEXT: fw_start to _fw_rw_offset with RX permissions 2. DATA: _fw_rw_offset to fw_size with RW permissions These permissions are still not enforced from M-mode but lay the ground work for enforcing them for M-mode. SU-mode don't have any access to these regions. Sample output: Domain0 Region01 : 0x0000000080000000-0x000000008001ffff M: (R,X) S/U: () Domain0 Region02 : 0x0000000080020000-0x000000008003ffff M: (R,W) S/U: () Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-23lib: sbi: Print the RW section offsetHimanshu Chauhan1-0/+1
Print the RW section offset when firmware base and size is being printed. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-23firmware: Add RW section offset in scratchHimanshu Chauhan2-10/+22
Add the RW section offset, provided by _fw_rw_offset symbol, to the scratch structure. This will be used to program separate pmp entry for RW section. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-23firmware: Move dynsym and reladyn sections to RX sectionHimanshu Chauhan1-19/+22
Currently, the dynsym and reladyn sections are under RW data. They are moved to the Read-only/Executable region. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-23firmware: Split RO/RX and RW sectionsHimanshu Chauhan1-0/+8
Split the RO/RX and RW sections so that they can have independent pmp entries with required permissions. The split size is ensured to be a power-of-2 as required by pmp. _fw_rw_offset symbol marks the beginning of the data section. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-22lib: utils: Fix reserved memory node for firmware memoryMayuresh Chitale1-3/+3
The commit 9e0ba090 introduced more fine grained permissions for memory regions and did not update the fdt_reserved_memory_fixup() function. As a result, the fdt_reserved_memory_fixup continued to use the older coarse permissions which causes the reserved memory node to be not inserted into the DT. To fix the above issue, we correct the flags used for memory region permission checks in the fdt_reserved_memory_fixup() function. Fixes: 9e0ba090 ("include: sbi: Fine grain the permissions for M and SU modes") Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-22lib: reset/fdt_reset_atcwdt200: Use defined macros and function in atcsmu.hYu Chien Peter Lin2-13/+9
Reuse the smu related macros and function in atcsmu.h. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-22platform: andes/ae350: Implement hart hotplug using HSM extensionYu Chien Peter Lin4-1/+180
Add hart_start() and hart_stop() callbacks for the multi-core ae350 platform, it utilizes the ATCSMU to put the harts into power-gated deep sleep mode. The programming sequence is stated as below: 1. Set the wakeup events to PCSm_WE 2. Set the sleep command to PCSm_CTL 3. Set the reset vector to HARTm_RESET_VECTOR_{LO|HI} 4. Write back and invalidate D-cache by executing the CCTL command L1D_WBINVAL_ALL 5. Disable I/D-cache by clearing mcache_ctl.{I|D}C_EN 6. Disable D-cache coherency by clearing mcache_ctl_.DC_COHEN 7. Wait for mcache_ctl.DC_COHSTA to be cleared to ensure the previous step is completed 8. Execute WFI Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-22lib: utils: atcsmu: Add Andes System Management Unit supportYu Chien Peter Lin5-0/+157
This patch adds atcsmu support for Andes AE350 platforms. The SMU provides system management capabilities, including clock, reset and power control based on power domain partitions. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-22include: types: add always inline compiler attributeYu Chien Peter Lin1-0/+1
Provide __always_inline to sbi_types header. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-22lib: sbi_hsm: handle failure when hart_stop returns SBI_ENOTSUPPYu Chien Peter Lin2-6/+9
Make use of generic warm-boot path when platform hart_stop callback returns SBI_ENOTSUPP, in case certain hart can not turn off its power domain, or it detects some error occured in power management unit, it can fall through warm-boot flow and wait for interrupt in sbi_hsm_hart_wait(). Also improves comment in sbi_hsm_hart_wait(). Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-22docs: generic.md: fix typo of andes-ae350Yu Chien Peter Lin1-1/+1
Fix hyperlink due to the typo. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-13platform: generic: allwinner: Fix PLIC array boundsSamuel Holland1-3/+3
The two referenced commits passed incorrect bounds to the PLIC save/ restore functions, causing out-of-bounds memory access. The functions expect "num" to be the 1-based number of interrupt sources, equivalent to the "riscv,ndev" devicetree property. Thus, "num" must be strictly smaller than the 0-based size of the array storing the register values. However, the referenced commits incorrectly passed in the unmodified size of the array as "num". Fix this by reducing PLIC_SOURCES (matching "riscv,ndev" on this platform), while keeping the same array sizes. Addresses-Coverity-ID: 1530251 ("Out-of-bounds access") Addresses-Coverity-ID: 1530252 ("Out-of-bounds access") Fixes: 8509e46ca63a ("lib: utils/irqchip: plic: Ensure no out-of-bound access in priority save/restore helpers") Fixes: 9a2eeb4aaeac ("lib: utils/irqchip: plic: Ensure no out-of-bound access in context save/restore helpers") Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-09docs: Update domain's region permissions and requirementsHimanshu Chauhan1-2/+10
Updated the various permissions bits available for domains defined in DT node and restrictions on them. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09lib: utils: Add M-mode {R/W} flags to the MMIO regionsHimanshu Chauhan4-7/+24
Add the M-mode readable/writable flags to mmio regions of various drivers. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09lib: utils: Disallow non-root domains from adding M-mode regionsHimanshu Chauhan2-0/+19
The M-mode regions can only be added to the root domain. The non-root domains shouldn't be able to add them from FDT. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09lib: utils: Use SU-{R/W/X} flags for region permissions during parsingHimanshu Chauhan1-3/+3
Use the newer SU-{R/W/X} flags for checking and assigning region permissions. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09lib: sbi: Modify the boot time region flag printsHimanshu Chauhan1-5/+15
With the finer permission semantics, the region access permissions must be displayed separately for M and SU mode. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09lib: sbi: Use finer permission sematics to decide on PMP bitsHimanshu Chauhan1-5/+11
Use the fine grained permission bits to decide if the region permissions are to be enforced on all modes. Also use the new permission bits for deciding on R/W/X bits in pmpcfg register. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09lib: sbi: Add permissions for the firmware start till endHimanshu Chauhan1-1/+2
Change the zero flag to M-mode R/W/X flag for the firmware region. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09lib: sbi: Use finer permission semantics for address validationHimanshu Chauhan1-7/+17
Use the fine grained permisssion semantics for address validation of a given region. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09include: sbi: Fine grain the permissions for M and SU modesHimanshu Chauhan1-5/+42
Split the permissions for M-mode and SU-mode. This would help if different sections of OpenSBI need to be given different permissions and if M-mode has different permisssions than the SU-mode over a region. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2023-01-09docs: domain_support: Use capital letter for privilege modesBin Meng1-2/+2
The RISC-V convention for the privilege mode is capital letter, like 'M-mode', instead of 'm-mode'. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-09lib: sbi_hsm: Rename 'priv' argument to 'arg1'Bin Meng2-6/+6
'priv' argument of sbi_hsm_hart_start() and sbi_hsm_hart_suspend() may mislead people to think it stands for 'privilege mode', but it is not. Change it to 'arg1' to clearly indicate the a1 register. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Samuel Holland <samuel@sholland.org> Tested-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-07generic/starfive: Add Starfive JH7110 platform implementationWei Liang Lim4-0/+58
Add Starfive JH7110 platform implementation Signed-off-by: Wei Liang Lim <weiliang.lim@starfivetech.com> Reviewed-by: Chee Hong Ang <cheehong.ang@starfivetech.com> Reviewed-by: Jun Liang Tan <junliang.tan@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-07platform: generic: Allow platform_override to perform firmware initWei Liang Lim2-0/+4
We add a generic platform override callback to allow platform specific firmware init. Signed-off-by: Wei Liang Lim <weiliang.lim@starfivetech.com> Reviewed-by: Chee Hong Ang <cheehong.ang@starfivetech.com> Reviewed-by: Jun Liang Tan <junliang.tan@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-07platform: generic: Allow platform_override to select cold boot HARTAnup Patel2-0/+10
We add a generic platform override callback to allow platform specific selection of cold boot HART. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-01-07lib: sbi: Allow platform to influence cold boot HART selectionAnup Patel2-2/+25
We add an optional cold_boot_allowed() platform callback which allows platform support to decide which HARTs can do cold boot initialization. If this platform callback is not available then any HART can do cold boot initialization. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-01-06lib: utils/sys: Allow custom HTIF base address for RV32Bin Meng1-2/+2
commit 6dde43584f18 ("lib: utils/sys: Extend HTIF library to allow custom base address") forgot to update do_tohost_fromhost() codes for RV32, which still accesses the HTIF registers using the ELF symbol address directly. Fixes: 6dde43584f18 ("lib: utils/sys: Extend HTIF library to allow custom base address") Signed-off-by: Bin Meng <bmeng@tinylab.org> Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-01-06Makefile: Remove -N ldflag to prevent linker RWX warningRahul Pathak1-1/+1
-N option coalesce all sections into single LOAD segment which causes data and other sections to have executable permission causing warning with new binutils ld 2.39. New ld emits warning when any segment have all three permissions RWX. ld.bfd: warning: test.elf has a LOAD segment with RWX permissions ld.bfd: warning: fw_dynamic.elf has a LOAD segment with RWX permissions ld.bfd: warning: fw_jump.elf has a LOAD segment with RWX permissions ld.bfd: warning: fw_payload.elf has a LOAD segment with RWX permissions This option was added in below commit - commit: eeab92f2423e ("Makefile: Convert to a more standard format") Removing -N option allows to have text and rodata into one LOAD segment and other sections into separate LOAD segment which prevents RWX permissions on single LOAD segment. Here X == E Current LOAD 0x0000000000000120 0x0000000080000000 0x0000000080000000 0x000000000001d4d0 0x0000000000032ed8 RWE 0x10 -N removed LOAD 0x0000000000001000 0x0000000080000000 0x0000000080000000 0x00000000000198cc 0x00000000000198cc R E 0x1000 LOAD 0x000000000001b000 0x000000008001a000 0x000000008001a000 0x00000000000034d0 0x0000000000018ed8 RW 0x1000 Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Samuel Holland <samuel@sholland.org>
2023-01-06treewide: Replace TRUE/FALSE with true/falseBin Meng23-105/+103
C language standard uses true/false for the boolean type. Let's switch to that for better language compatibility. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Samuel Holland <samuel@sholland.org> Tested-by: Samuel Holland <samuel@sholland.org>
2022-12-24include: Bump-up version to 1.2Anup Patel1-1/+1
This patch updates OpenSBI version to 1.2 as part of release preparation. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2022-12-24docs: pmu: Update the pmu doc with removal of mcountinhbit restrictionAtish Patra1-3/+0
Since commit b28f070, it is possible for platforms to run perf monitoring even if mcountinhibit is not supported. Sampling still won't be possible though as it requires sscofpmf extension. Update the docs to remove the restriction. Signed-off-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2022-12-24docs: pmu: update a reference to a deprecated property nameConor Dooley1-1/+1
event-to-mhpmevent was deprecated and replaced by riscv,event-to-mhpmevent, but a reference remains to the old name. Replace it with the new one. Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2022-12-24docs: pmu: fix binding exampleConor Dooley1-3/+3
The first PMU binding example does not terminate properties with a ;, which is invalid. Noticed while converting the binding to yaml. Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2022-12-17lib: utils/timer: mtimer: add T-Head C9xx CLINT compatibleIcenowy Zheng1-0/+6
As we already added the quirk for lacking mtime register to MTIMER driver, add T-Head C9xx CLINT compatible to it and wire the quirk. Signed-off-by: Icenowy Zheng <uwu@icenowy.me> Reviewed-by: Anup Patel <anup@brainfault.org>
2022-12-17lib: utils/timer: mtimer: add a quirk for lacking mtime registerIcenowy Zheng2-13/+28
T-Head developers surely have a different understanding of time CSR and CLINT's mtime register with SiFive ones, that they did not implement the mtime register at all -- as shown in openC906 source code, their time CSR value is just exposed at the top of their processor IP block and expects an external continous counter, which makes it not overrideable, and thus mtime register is not implemented, even not for reading. However, if CLINTEE is not enabled in T-Head's MXSTATUS extended CSR, these systems still rely on the mtimecmp registers to generate timer interrupts. This makes it necessary to implement T-Head C9xx CLINT support in OpenSBI MTIMER driver, which skips implementing reading mtime register and falls back to default code that reads time CSR. Add a quirk into MTIMER driver, which represents a mtime register is lacking and time CSR value should be used instead. Signed-off-by: Icenowy Zheng <uwu@icenowy.me> Reviewed-by: Anup Patel <anup@brainfault.org>