Skip to content

[PW_SID:1100569] [v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support#2013

Open
linux-riscv-bot wants to merge 2 commits into
workflow__riscv__fixesfrom
pw1100569
Open

[PW_SID:1100569] [v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support#2013
linux-riscv-bot wants to merge 2 commits into
workflow__riscv__fixesfrom
pw1100569

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1100569 applied to workflow__riscv__fixes

Name: [v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1100569
Version: 7

Mr-Bossman and others added 2 commits May 25, 2026 18:33
ZICNTR allows the CPU time to be read using CSRs, which used to be the
default. If ZICNTR is supported prefer using CSRs over MMIO.
This may also be faster as CSRs are not emulated in M-mode.

Signed-off-by: Jesse Taube <jtaubepe@redhat.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
To use the T-HEAD C9xx clint in RISCV-M NOMMU env, we need to take
care two points:

1.The mtimecmp in T-Head C9xx clint only supports 32bit read/write,
implement such support.

2. As pointed out by commit ca7810aecdba ("lib: utils/timer: mtimer:
add a quirk for lacking mtime register") of opensbi:

"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 continuous 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."

So, we need to fall back to read time CSR instead of mtime register
using RISCV_ISA_EXT_ZICNTR.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: Jesse Taube <jtaubepe@redhat.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 139.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 2205.66 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 3024.43 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.05 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.12 seconds
Result: WARNING
Output:

CHECK: Alignment should match open parenthesis
#54: FILE: arch/riscv/include/asm/timex.h:53:
+	if (!riscv_has_extension_likely(RISCV_ISA_EXT_ZICNTR) &&
+	   (unlikely(clint_time_val == NULL)))

CHECK: Comparison to NULL could be written "!clint_time_val"
#54: FILE: arch/riscv/include/asm/timex.h:53:
+	   (unlikely(clint_time_val == NULL)))

CHECK: Alignment should match open parenthesis
#111: FILE: drivers/clocksource/timer-clint.c:136:
+static int csr_clock_next_event(unsigned long delta,
+				   struct clock_event_device *ce)

total: 0 errors, 0 warnings, 3 checks, 149 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 199209bf9e2a ("clocksource/drivers/timer-clint: Add ZICNTR support") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 3 checks, 149 lines checked
CHECK: Alignment should match open parenthesis
CHECK: Comparison to NULL could be written "!clint_time_val"


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 86.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
kdoc
Desc: Detects for kdoc errors
Duration: 1.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v7,1/2] clocksource/drivers/timer-clint: Add ZICNTR support"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.10 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1133.13 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1695.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.50 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.80 seconds
Result: WARNING
Output:

WARNING: Unknown commit id 'ca7810aecdba', maybe rebased or not pulled?
#12: 
2. As pointed out by commit ca7810aecdba ("lib: utils/timer: mtimer:

total: 0 errors, 1 warnings, 0 checks, 51 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 9b2515b307e0 ("clocksource/drivers/timer-clint: Add T-Head C9xx clint") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 1 warnings, 0 checks, 51 lines checked
WARNING: Unknown commit id 'ca7810aecdba', maybe rebased or not pulled?


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 87.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
kdoc
Desc: Detects for kdoc errors
Duration: 0.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
module-param
Desc: Detect module_param changes
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v7,2/2] clocksource/drivers/timer-clint: Add T-Head C9xx clint"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants