* [PATCH] RISC-V: KVM: Fix builds without CONFIG_RISCV_ISA_V
@ 2026-10-21 17:31 slack up
2026-10-23 15:31 ` Ze Huang
0 siblings, 1 reply; 2+ messages in thread
From: slack up @ 2026-10-21 17:31 UTC (permalink / raw)
To: Anup Patel, Atish Patra, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Andy Chiu, Yong-Xuan Wang
Cc: kvm, kvm-riscv, linux-riscv, linux-kernel, stable, Xiaochun Yu
From: Xiaochun Yu <yxcnew@outlook.com>
Commit b5060a4aa33d ("RISC-V: KVM: fix vcpu vector context
handling for kernel-mode vector") made the KVM vCPU load and put paths
call get_cpu_vector_context() and put_cpu_vector_context()
unconditionally. It also added an unconditional call to
__kvm_riscv_vector_restore() on the guest entry path.
The no-op definitions of the first two helpers live in <asm/vector.h>,
but <asm/kvm_vcpu_vector.h> includes that header only when
CONFIG_RISCV_ISA_V is enabled. The KVM header also does not provide a
no-op __kvm_riscv_vector_restore() in its disabled branch. As a result,
a KVM build without CONFIG_RISCV_ISA_V fails with missing helper
declarations.
Include <asm/vector.h> unconditionally to reuse its existing no-op
helpers, and provide the missing KVM restore stub when Vector support is
disabled. This does not change the Vector-enabled path.
Fixes: b5060a4aa33d ("RISC-V: KVM: fix vcpu vector context handling for kernel-mode vector")
Cc: stable@vger.kernel.org
Signed-off-by: Xiaochun Yu <yxcnew@outlook.com>
---
This single patch fixes a build regression when KVM is enabled without the
RISC-V Vector extension.
Tested on base a804c5742bff (Torvalds master):
- CONFIG_RISCV_ISA_V=n, CONFIG_KVM=m: full Image modules build passed.
- CONFIG_RISCV_ISA_V=y, CONFIG_KVM=m: vcpu.o and vcpu_vector.o rebuilt.
---
arch/riscv/include/asm/kvm_vcpu_vector.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/include/asm/kvm_vcpu_vector.h b/arch/riscv/include/asm/kvm_vcpu_vector.h
index 6371d5ea5392..ebc619ed67dd 100644
--- a/arch/riscv/include/asm/kvm_vcpu_vector.h
+++ b/arch/riscv/include/asm/kvm_vcpu_vector.h
@@ -11,9 +11,9 @@
#define __KVM_VCPU_RISCV_VECTOR_H
#include <linux/types.h>
+#include <asm/vector.h>
#ifdef CONFIG_RISCV_ISA_V
-#include <asm/vector.h>
#include <asm/kvm_host.h>
static __always_inline void __kvm_riscv_vector_save(struct kvm_cpu_context *context)
@@ -55,6 +55,10 @@ static inline void kvm_riscv_v_exit(void)
struct kvm_cpu_context;
+static inline void __kvm_riscv_vector_restore(struct kvm_cpu_context *context)
+{
+}
+
static inline void kvm_riscv_vcpu_vector_reset(struct kvm_vcpu *vcpu)
{
}
---
base-commit: a804c5742bff224d4cb4d25dd383554d598be32b
change-id: 20261021-ospp-c1-b4-submit-e22dc09faf5a
Best regards,
--
slack up <yxcnew@outlook.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] RISC-V: KVM: Fix builds without CONFIG_RISCV_ISA_V
2026-10-21 17:31 [PATCH] RISC-V: KVM: Fix builds without CONFIG_RISCV_ISA_V slack up
@ 2026-10-23 15:31 ` Ze Huang
0 siblings, 0 replies; 2+ messages in thread
From: Ze Huang @ 2026-10-23 15:31 UTC (permalink / raw)
To: slack up, Anup Patel, Atish Patra, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Andy Chiu, Yong-Xuan Wang
Cc: kvm, kvm-riscv, linux-riscv, linux-kernel, stable, linux-riscv
On Thu Oct 22, 2026 at 1:31 AM CST, slack up wrote:
> From: Xiaochun Yu <yxcnew@outlook.com>
>
> Commit b5060a4aa33d ("RISC-V: KVM: fix vcpu vector context
> handling for kernel-mode vector") made the KVM vCPU load and put paths
> call get_cpu_vector_context() and put_cpu_vector_context()
> unconditionally. It also added an unconditional call to
> __kvm_riscv_vector_restore() on the guest entry path.
>
> The no-op definitions of the first two helpers live in <asm/vector.h>,
> but <asm/kvm_vcpu_vector.h> includes that header only when
> CONFIG_RISCV_ISA_V is enabled. The KVM header also does not provide a
> no-op __kvm_riscv_vector_restore() in its disabled branch. As a result,
> a KVM build without CONFIG_RISCV_ISA_V fails with missing helper
> declarations.
>
> Include <asm/vector.h> unconditionally to reuse its existing no-op
> helpers, and provide the missing KVM restore stub when Vector support is
> disabled. This does not change the Vector-enabled path.
>
> Fixes: b5060a4aa33d ("RISC-V: KVM: fix vcpu vector context handling for kernel-mode vector")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xiaochun Yu <yxcnew@outlook.com>
> ---
> This single patch fixes a build regression when KVM is enabled without the
> RISC-V Vector extension.
>
> Tested on base a804c5742bff (Torvalds master):
>
> - CONFIG_RISCV_ISA_V=n, CONFIG_KVM=m: full Image modules build passed.
> - CONFIG_RISCV_ISA_V=y, CONFIG_KVM=m: vcpu.o and vcpu_vector.o rebuilt.
Tested-by: Ze Huang <ze.huang@oss.qualcomm.com>
Tested on commit a804c5742bff with gcc 16.2.1 and clang 23.1.3:
CONFIG_RISCV_ISA_V=n, CONFIG_KVM=m: full Image + modules build passes
(before the patch: 3 implicit-declaration errors with gcc, 5 with clang)
> ---
> arch/riscv/include/asm/kvm_vcpu_vector.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/include/asm/kvm_vcpu_vector.h b/arch/riscv/include/asm/kvm_vcpu_vector.h
> index 6371d5ea5392..ebc619ed67dd 100644
> --- a/arch/riscv/include/asm/kvm_vcpu_vector.h
> +++ b/arch/riscv/include/asm/kvm_vcpu_vector.h
> @@ -11,9 +11,9 @@
> #define __KVM_VCPU_RISCV_VECTOR_H
>
> #include <linux/types.h>
> +#include <asm/vector.h>
>
> #ifdef CONFIG_RISCV_ISA_V
> -#include <asm/vector.h>
> #include <asm/kvm_host.h>
>
> static __always_inline void __kvm_riscv_vector_save(struct kvm_cpu_context *context)
> @@ -55,6 +55,10 @@ static inline void kvm_riscv_v_exit(void)
>
> struct kvm_cpu_context;
>
> +static inline void __kvm_riscv_vector_restore(struct kvm_cpu_context *context)
> +{
> +}
> +
> static inline void kvm_riscv_vcpu_vector_reset(struct kvm_vcpu *vcpu)
> {
> }
>
> ---
> base-commit: a804c5742bff224d4cb4d25dd383554d598be32b
> change-id: 20261021-ospp-c1-b4-submit-e22dc09faf5a
>
> Best regards,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-23 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 17:31 [PATCH] RISC-V: KVM: Fix builds without CONFIG_RISCV_ISA_V slack up
2026-10-23 15:31 ` Ze Huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®