Skip to contentSkip to conversation

RISC-V: KVM: Require HAVE_KVM

PATCH In review Andrew Jones 5 participants 5 messages Jan 4, 2024 – Jan 19, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 RISC-V: KVM: Require HAVE_KVM

KVM requires EVENTFD, which is selected by HAVE_KVM. Other KVM supporting architectures select HAVE_KVM and then their KVM Kconfigs ensure its there with a depends on HAVE_KVM. Make RISCV consistent with that approach which fixes configs which have KVM but not EVENTFD, as was discovered with a randconfig test.

Fixes 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support")

---

v2:
- Added Fixes tag and -fixes prefix [Alexandre/Anup]

 arch/riscv/Kconfig     | 1 +
 arch/riscv/kvm/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index a935a5f736b9..daba06a3b76f 100644
@@ -128,6 +128,7 @@ config RISCV
 	select HAVE_KPROBES if !XIP_KERNEL
 	select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
 	select HAVE_KRETPROBES if !XIP_KERNEL
+	select HAVE_KVM
 	# https://github.com/ClangBuiltLinux/linux/issues/1881
 	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
 	select HAVE_MOVE_PMD
arch/riscv/kvm/Kconfig +1 -1
index 1fd76aee3b71..36fa8ec9e5ba 100644
@@ -19,7 +19,7 @@ if VIRTUALIZATION
 
 config KVM
 	tristate "Kernel-based Virtual Machine (KVM) support (EXPERIMENTAL)"
-	depends on RISCV_SBI && MMU
+	depends on HAVE_KVM && RISCV_SBI && MMU
 	select HAVE_KVM_IRQCHIP
 	select HAVE_KVM_IRQ_ROUTING
 	select HAVE_KVM_MSI
Signature · 1 line
2.43.0
Reviewed-by Tested-by on v2 1/1
#1 lore raw
Quoted 10 lines · Andrew Jones

KVM requires EVENTFD, which is selected by HAVE_KVM. Other KVM supporting architectures select HAVE_KVM and then their KVM Kconfigs ensure its there with a depends on HAVE_KVM. Make RISCV consistent with that approach which fixes configs which have KVM but not EVENTFD, as was discovered with a randconfig test.

Fixes 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support")

Thanks.

Quoted 34 lines

---

v2:
- Added Fixes tag and -fixes prefix [Alexandre/Anup]

 arch/riscv/Kconfig     | 1 +
 arch/riscv/kvm/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index a935a5f736b9..daba06a3b76f 100644
@@ -128,6 +128,7 @@ config RISCV
 	select HAVE_KPROBES if !XIP_KERNEL
 	select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
 	select HAVE_KRETPROBES if !XIP_KERNEL
+	select HAVE_KVM
 	# https://github.com/ClangBuiltLinux/linux/issues/1881
 	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
 	select HAVE_MOVE_PMD
arch/riscv/kvm/Kconfig +1 -1
index 1fd76aee3b71..36fa8ec9e5ba 100644
@@ -19,7 +19,7 @@ if VIRTUALIZATION
 
 config KVM
 	tristate "Kernel-based Virtual Machine (KVM) support (EXPERIMENTAL)"
-	depends on RISCV_SBI && MMU
+	depends on HAVE_KVM && RISCV_SBI && MMU
 	select HAVE_KVM_IRQCHIP
 	select HAVE_KVM_IRQ_ROUTING
 	select HAVE_KVM_MSI
Signature · 1 line
#Randy
maintainer
#2 lore raw
In reply to Andrew Jones
Quoted 11 lines · On Thu, Jan 4, 2024 at 6:07?PM Andrew Jones <[email protected]> wrote:

KVM requires EVENTFD, which is selected by HAVE_KVM. Other KVM supporting architectures select HAVE_KVM and then their KVM Kconfigs ensure its there with a depends on HAVE_KVM. Make RISCV consistent with that approach which fixes configs which have KVM but not EVENTFD, as was discovered with a randconfig test.

Fixes 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support")

Queued this patch for Linux-6.8

Regards,
Anup

Quoted 37 lines

---

v2:
- Added Fixes tag and -fixes prefix [Alexandre/Anup]

 arch/riscv/Kconfig     | 1 +
 arch/riscv/kvm/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +1 -0
index a935a5f736b9..daba06a3b76f 100644
@@ -128,6 +128,7 @@ config RISCV
        select HAVE_KPROBES if !XIP_KERNEL
        select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
        select HAVE_KRETPROBES if !XIP_KERNEL
+       select HAVE_KVM
        # https://github.com/ClangBuiltLinux/linux/issues/1881
        select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
        select HAVE_MOVE_PMD
arch/riscv/kvm/Kconfig +1 -2
index 1fd76aee3b71..36fa8ec9e5ba 100644
@@ -19,7 +19,7 @@ if VIRTUALIZATION
 
 config KVM
        tristate "Kernel-based Virtual Machine (KVM) support (EXPERIMENTAL)"
-       depends on RISCV_SBI && MMU
+       depends on HAVE_KVM && RISCV_SBI && MMU
        select HAVE_KVM_IRQCHIP
        select HAVE_KVM_IRQ_ROUTING
        select HAVE_KVM_MSI
--

2.43.0

#3 lore raw
Quoted 8 lines · Anup Patel
Quoted 7 lines · On Thu, Jan 4, 2024 at 6:07?PM Andrew Jones <[email protected]> wrote:

KVM requires EVENTFD, which is selected by HAVE_KVM. Other KVM supporting architectures select HAVE_KVM and then their KVM Kconfigs ensure its there with a depends on HAVE_KVM. Make RISCV consistent with that approach which fixes configs which have KVM but not EVENTFD, as was discovered with a randconfig test.

Quoted 6 lines
Quoted 4 lines
Fixes 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support")

Queued this patch for Linux-6.8

That should be unnecessary. Commit caadf876bb74 ("KVM: introduce CONFIG_KVM_COMMON"), which is in Paolo's pull request for 6.8, addresses the EVENTFD issue. And the rest of Paolo's series[*], which presumably will get queued for 6.9, eliminates HAVE_KVM entirely.

[*] https://lore.kernel.org/all/20240108124740.114453-6-pbonzini at redhat.com

#4 lore raw
Quoted 15 lines · On Thu, Jan 18, 2024 at 11:10?PM Sean Christopherson <[email protected]> wrote:
Quoted 13 lines · Anup Patel
Quoted 11 lines · On Thu, Jan 4, 2024 at 6:07?PM Andrew Jones <[email protected]> wrote:

KVM requires EVENTFD, which is selected by HAVE_KVM. Other KVM supporting architectures select HAVE_KVM and then their KVM Kconfigs ensure its there with a depends on HAVE_KVM. Make RISCV consistent with that approach which fixes configs which have KVM but not EVENTFD, as was discovered with a randconfig test.

Fixes 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support")
Quoted 8 lines
Quoted 1 line

Queued this patch for Linux-6.8

That should be unnecessary. Commit caadf876bb74 ("KVM: introduce CONFIG_KVM_COMMON"), which is in Paolo's pull request for 6.8, addresses the EVENTFD issue. And the rest of Paolo's series[*], which presumably will get queued for 6.9, eliminates HAVE_KVM entirely.

[*] https://lore.kernel.org/all/20240108124740.114453-6-pbonzini at redhat.com

I was not sure about the timeline of when Paolo's series would be merged hence thought of taking this patch as a fix.

For now, I will drop this patch from my queue. If required we can have it as a 6.8-rc fix.

Regards,
Anup