Skip to content

[PW_SID:1083913] RISC-V: KVM: AIA: Convert HGEI management to fully per-HART#1803

Closed
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__fixesfrom
pw1083913
Closed

[PW_SID:1083913] RISC-V: KVM: AIA: Convert HGEI management to fully per-HART#1803
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__fixesfrom
pw1083913

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1083913 applied to workflow__riscv__fixes

Name: RISC-V: KVM: AIA: Convert HGEI management to fully per-HART
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1083913
Version: 1

Linux RISC-V bot and others added 4 commits April 5, 2026 01:35
Previously the number of Hypervisor Guest External Interrupt (HGEI)
lines was stored in a single global variable `kvm_riscv_aia_nr_hgei`
and assumed to be the same for all HARTs. This assumption does not
hold on heterogeneous RISC-V SoCs where different cores may expose
different HGEIE CSR widths.

Introduce `nr_hgei` field into the per-CPU `struct aia_hgei_control`
and probe the actual supported HGEI count for the current HART in
`kvm_riscv_aia_enable()` using the standard RISC-V CSR probe
technique:

    csr_write(CSR_HGEIE, -1UL);
    nr = fls_long(csr_read(CSR_HGEIE));
    if (nr)
        nr--;

All HGEI allocation, free and disable paths (`kvm_riscv_aia_free_hgei()`,
`kvm_riscv_aia_disable()`, etc.) now use the per-CPU value instead of
the global one.

The early global `kvm_riscv_aia_nr_hgei` is kept only for deciding
whether SGEI interrupt registration is needed; the real per-HART
initialization of lock and free_bitmap is moved to enable time.

This makes KVM AIA robust on big.LITTLE-style and multi-vendor
asymmetric platforms.

Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Now that HGEI line management is fully per-CPU (via struct
aia_hgei_control::nr_hgei), the global `kvm_riscv_aia_nr_hgei`
is no longer needed. Replace it with a simple `bool
kvm_riscv_aia_hgei_enabled` that only indicates whether HGEI
support is available at all.

Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…ART conversion

With the recent KVM AIA changes, HGEI line management is now fully
per-CPU (via struct aia_hgei_control::nr_hgei) and the global
kvm_riscv_aia_nr_hgei has been replaced by a simple enabled flag.
The IMSIC driver no longer needs to compute and enforce a global
minimum number of guest interrupt files across all HARTs.

Remove:
 - `u32 nr_guest_files` from `struct imsic_global_config`
 - the initial `BIT(global->guest_index_bits) - 1` assignment
 - the entire per-CPU MMIO-based min() calculation and its comment
   (which was specifically there to protect old KVM)

The per-HART guest file count is already handled locally in
`imsic_local_config` during the parent IRQ loop, so this global
field was redundant.

This completes the cleanup series, eliminates the last global
assumption about guest files, and improves support for heterogeneous
(big.LITTLE / multi-vendor) RISC-V platforms.

Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 137.74 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1036.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1403.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.17 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 83.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
kdoc
Desc: Detects for kdoc errors
Duration: 0.92 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
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: "[1/3] RISC-V: KVM: AIA: Make HGEI number and management fully per-CPU"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 137.00 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1062.02 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1427.17 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.36 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.43 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.43 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
kdoc
Desc: Detects for kdoc errors
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
module-param
Desc: Detect module_param changes
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] RISC-V: KVM: AIA: Replace global HGEI count with simple enabled bool"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 142.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1149.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1682.55 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
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 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 26.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.97 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.55 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
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 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
kdoc
Desc: Detects for kdoc errors
Duration: 0.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
module-param
Desc: Detect module_param changes
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] irqchip/riscv-imsic: Remove global nr_guest_files after KVM AIA per-HART conversion"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch from 506e7f6 to 01805bc Compare April 24, 2026 14:53
@linux-riscv-bot linux-riscv-bot deleted the pw1083913 branch April 25, 2026 04:22
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.

2 participants