[WIP] [Deepin-Kernel-SIG] [linux 6.6.y] [Upstream] riscv: Add runtime constant support#1904
Draft
opsiff wants to merge 1 commit into
Draft
[WIP] [Deepin-Kernel-SIG] [linux 6.6.y] [Upstream] riscv: Add runtime constant support#1904opsiff wants to merge 1 commit into
opsiff wants to merge 1 commit into
Conversation
mainline inclusion from mainline-v6.15-rc1 category: performance Implement the runtime constant infrastructure for riscv. Use this infrastructure to generate constants to be used by the d_hash() function. This is the riscv variant of commit 94a2bc0 ("arm64: add 'runtime constant' support") and commit e3c92e8 ("runtime constants: add x86 architecture support"). [ alex: Remove trailing whitespace ] Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com> Link: https://lore.kernel.org/r/20250319-runtime_const_riscv-v10-2-745b31a11d65@rivosinc.com Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Conflicts: arch/riscv/Kconfig (cherry picked from commit a44fb57) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewer's GuideAdds RISC-V runtime constant infrastructure and wires it into the linker script, providing assembly helpers and fixup routines to materialize and patch pointer and shift-immediate constants at runtime, with optional use of Zba/Zbkb ISA extensions for optimized 64-bit constant formation. Flow diagram for RISC-V runtime constant initialization and fixupflowchart TD
Caller["caller of runtime_const_init(type,sym)"] --> runtime_const_init
runtime_const_init["runtime_const_init(type,sym)"] --> runtime_const_fixup
runtime_const_fixup["runtime_const_fixup(fn,val,start,end)"] --> Loop["[iterate runtime_* section entries]"]
Loop --> runtime_fixup_fn
runtime_fixup_fn["__runtime_fixup_ptr / __runtime_fixup_shift"] --> runtime_fixup_32
runtime_fixup_fn --> runtime_fixup_caches
runtime_fixup_32["__runtime_fixup_32(lui_parcel, addi_parcel, val)"] --> PatchedInsns["[patch lui/addi immediates]"]
PatchedInsns --> runtime_fixup_caches
runtime_fixup_caches["__runtime_fixup_caches(where,insns)"] --> Done["[runtime constants materialized in code]"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Member
|
/approve Link: #1902 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Avenger-285714 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mainline inclusion
from mainline-v6.15-rc1
category: performance
Implement the runtime constant infrastructure for riscv. Use this infrastructure to generate constants to be used by the d_hash() function.
This is the riscv variant of commit 94a2bc0 ("arm64: add 'runtime constant' support") and commit e3c92e8 ("runtime constants: add x86 architecture support").
[ alex: Remove trailing whitespace ]
Reviewed-by: Alexandre Ghiti alexghiti@rivosinc.com
Tested-by: Alexandre Ghiti alexghiti@rivosinc.com
Link: https://lore.kernel.org/r/20250319-runtime_const_riscv-v10-2-745b31a11d65@rivosinc.com
Conflicts:
arch/riscv/Kconfig
(cherry picked from commit a44fb57)
Summary by Sourcery
Add RISC-V runtime constant infrastructure and integrate it into the kernel image layout to support architecture-specific optimization of computed constants.
New Features:
Enhancements: