* [PATCH] riscv: KVM: Fix compilation when CONFIG_RISCV_ISA_V=n
@ 2026-10-06 23:39 Charlie Jenkins
2026-10-06 23:42 ` Charlie Jenkins
0 siblings, 1 reply; 2+ messages in thread
From: Charlie Jenkins @ 2026-10-06 23:39 UTC (permalink / raw)
To: Anup Patel, Atish Patra, Paul Walmsley, Palmer Dabbelt,
Andy Chiu, Yong-Xuan Wang, Radim Krčmář
Cc: kvm, kvm-riscv, linux-riscv, linux-kernel, Charlie Jenkins
Fix the KVM code to use stubbed out versions of vector functions when
vector is not enabled instead of failing to compile. An alternative
approach would be to ifdef out the vector code but since a handful of
the vector code already just uses stubbed functions to tell the compiler
to drop the implementation, follow the same pattern.
Fixes: b5060a4aa33d ("RISC-V: KVM: fix vcpu vector context handling for kernel-mode vector")
Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
I was reviewing [1] and noticed that when I disabled FPU and tried to
compile that vector got disabled and the kernel failed to compile.
[1] https://lore.kernel.org/all/20261006075303.205216-1-radim.krcmar@oss.qualcomm.com/
---
arch/riscv/include/asm/kvm_vcpu_vector.h | 10 +++++++++-
1 file changed, 9 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..1c9efc6048bb 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,14 @@ static inline void kvm_riscv_v_exit(void)
struct kvm_cpu_context;
+static __always_inline void __kvm_riscv_vector_save(struct kvm_cpu_context *context)
+{
+}
+
+static __always_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: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
change-id: 20261006-vector_off_fix-938d61b1f906
Best regards,
--
- Charlie
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] riscv: KVM: Fix compilation when CONFIG_RISCV_ISA_V=n
2026-10-06 23:39 [PATCH] riscv: KVM: Fix compilation when CONFIG_RISCV_ISA_V=n Charlie Jenkins
@ 2026-10-06 23:42 ` Charlie Jenkins
0 siblings, 0 replies; 2+ messages in thread
From: Charlie Jenkins @ 2026-10-06 23:42 UTC (permalink / raw)
To: Anup Patel, Atish Patra, Paul Walmsley, Palmer Dabbelt,
Andy Chiu, Yong-Xuan Wang, Radim Krčmář
Cc: kvm, kvm-riscv, linux-riscv, linux-kernel
On Tue, Oct 06, 2026 at 04:39:03PM -0700, Charlie Jenkins wrote:
> Fix the KVM code to use stubbed out versions of vector functions when
> vector is not enabled instead of failing to compile. An alternative
> approach would be to ifdef out the vector code but since a handful of
> the vector code already just uses stubbed functions to tell the compiler
> to drop the implementation, follow the same pattern.
>
> Fixes: b5060a4aa33d ("RISC-V: KVM: fix vcpu vector context handling for kernel-mode vector")
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
Should have looked at the lists first, this wa already sent
https://lore.kernel.org/all/20260922021823.44251-2-zhangzhanpeng.jasper@bytedance.com/.
> ---
> I was reviewing [1] and noticed that when I disabled FPU and tried to
> compile that vector got disabled and the kernel failed to compile.
>
> [1] https://lore.kernel.org/all/20261006075303.205216-1-radim.krcmar@oss.qualcomm.com/
> ---
> arch/riscv/include/asm/kvm_vcpu_vector.h | 10 +++++++++-
> 1 file changed, 9 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..1c9efc6048bb 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,14 @@ static inline void kvm_riscv_v_exit(void)
>
> struct kvm_cpu_context;
>
> +static __always_inline void __kvm_riscv_vector_save(struct kvm_cpu_context *context)
> +{
> +}
> +
> +static __always_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: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
> change-id: 20261006-vector_off_fix-938d61b1f906
>
> Best regards,
> --
> - Charlie
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-06 23:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 23:39 [PATCH] riscv: KVM: Fix compilation when CONFIG_RISCV_ISA_V=n Charlie Jenkins
2026-10-06 23:42 ` Charlie Jenkins
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®