Skip to content

Register Zicntr in FDT when emulating is possible

Yao Zi opensbi 4 versions – Applied

Status from this message: Applied this patch to the riscv/opensbi repo.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesApplied
  2. v32 patches 2 repliesSuperseded
  3. v22 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v10 of 2 patches0 repliesSuperseded

Changes in v4 from the cover letter

- Zicntr detection
- Adjust sbi_timer.c to detect time CSR with SBI_HART_CSR_TIME instead of SBI_HART_CSR_ZICNTR. This change was wrongly dropped in v2.
- Link to v3: https://lore.kernel.org/all/[email protected]

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/2lib: sbi: hart: Detect existence of cycle and instret CSRs for Zicntrinclude/sbi/sbi_hart.h lib/sbi/sbi_hart.c lib/sbi/sbi_timer.c+39 -81 reply
2/2lib: utils: fdt: Claim Zicntr if time CSR emulation is possiblelib/utils/fdt/fdt_fixup.c+32 -11 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchAnup Patel
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/2] Register Zicntr in FDT when emulating is possible

OpenSBI is capable of emulating time CSR on HARTs without a full Zicntr extension. Previously, we hardcoded Zicntr extension in the devicetree for these cores, like JH7110 in mainline Linux[1]. This doesn't reflect the hardware and may confuse pre-SBI bootloaders, like U-Boot running in M-Mode.

To solve the issue, let's register Zicntr in FDT dynamically for cores supporting it by SBI emulation, allowing pre-SBI stages to detect Zicntr availability reliably with riscv,isa-extensions.

[1]: https://elixir.bootlin.com/linux/v6.14-rc3/source/arch/riscv/boot/dts/starfive/jh7110.dtsi#L61

Changed from v3
- Zicntr detection
- Adjust sbi_timer.c to detect time CSR with SBI_HART_CSR_TIME instead of SBI_HART_CSR_ZICNTR. This change was wrongly dropped in v2.
- Link to v3: https://lore.kernel.org/all/[email protected]

Changed from v2
- Zicntr detection
- Introduce SBI_HART_CSR_MAX
- Make sbi_hart_features.csrs an array for flexibillity
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changed from v1
- Zicntr detection
- Introduce a bitmap to sbi_hart_features instead of using pseudo- extensions to represent availability of CSRs
- Change possibly misleading abbreviation "RO" to "read-only" in commit message
- FDT fixup
- Don't register zicntr to (legacy) devicetrees where harts don't come with a riscv,isa-extensions property
- Link to v1: https://lore.kernel.org/opensbi/[email protected]/

Yao Zi (2):
lib: sbi: hart: Detect existence of cycle and instret CSRs for Zicntr
lib: utils: fdt: Claim Zicntr if time CSR emulation is possible

 include/sbi/sbi_hart.h    | 10 ++++++++++
 lib/sbi/sbi_hart.c        | 35 ++++++++++++++++++++++++++++-------
 lib/sbi/sbi_timer.c       |  2 +-
 lib/utils/fdt/fdt_fixup.c | 33 ++++++++++++++++++++++++++++++++-
 4 files changed, 71 insertions(+), 9 deletions(-)
Signature · 7 lines
2.49.0


-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi