Skip to contentSkip to conversation

KVM: arm64: Clean up CONFIG_KVM vs CONFIG_HAVE_KVM

PATCH Applied Sean Christopherson 3 participants 6 messages Sep 21, 2021 – Oct 11, 2021

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

cover KVM: arm64: Clean up CONFIG_KVM vs CONFIG_HAVE_KVM

Fix an oddity where arm64 can end up with KVM=y and HAVE_KVM=n. This doesn't cause problems today as no generic code that supports arm64 uses HAVE_KVM, but that may not always be the case, e.g. I stumbled across this when exploring hiding perf's guest callbacks behind HAVE_KVM=y.

Sean Christopherson (2):
KVM: arm64: Unconditionally include generic KVM's Kconfig
KVM: arm64: Depend on HAVE_KVM => OF instead of directly on OF

 arch/arm64/Kconfig     | 1 +
 arch/arm64/kvm/Kconfig | 9 ++-------
 2 files changed, 3 insertions(+), 7 deletions(-)
Signature · 1 line
2.33.0.464.g1972c5931b-goog
#1 lore raw

PATCH 1/2 KVM: arm64: Unconditionally include generic KVM's Kconfig

Unconditionally "source" the generic KVM Kconfig instead of wrapping it with KVM=y. A future patch will select HAVE_KVM so that referencing HAVE_KVM in common kernel code doesn't break, and because KVM=y and HAVE_KVM=n is weird. Source the generic KVM Kconfig unconditionally so that HAVE_KVM and KVM don't end up with a circular dependency.

Note, all but one of generic KVM's "configs" are of the HAVE_XYZ nature, and the one outlier correctly takes a dependency on CONFIG_KVM, i.e. the generic Kconfig is intended to be included unconditionally.

No functional change intended.

---
 arch/arm64/kvm/Kconfig | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
arch/arm64/kvm/Kconfig +1 -6
index a4eba0908bfa..c50f75cf76fe 100644
@@ -4,6 +4,7 @@
 #
 
 source "virt/lib/Kconfig"
+source "virt/kvm/Kconfig"
 
 menuconfig VIRTUALIZATION
 	bool "Virtualization"
@@ -42,10 +43,4 @@ menuconfig KVM
 
 	  If unsure, say N.
 
-if KVM
-
-source "virt/kvm/Kconfig"
-
-endif # KVM
-
 endif # VIRTUALIZATION
Signature · 1 line
2.33.0.464.g1972c5931b-goog
#2 lore raw

PATCH 2/2 KVM: arm64: Depend on HAVE_KVM => OF instead of directly on OF

In reply to Sean Christopherson

Select HAVE_KVM if the KVM dependency is met (OF / Open Firmware), and make KVM depend on HAVE_KVM instead of directly on OF. This fixes the oddity where arm64 configs can end up with KVM=y and HAVE_KVM=n, and will hopefully prevent breakage if there are future users of HAVE_KVM.

Note, arm64 unconditionally selects OF, and has always done so (see commit 8c2c3df31e3b ("arm64: Build infrastructure"). Keep the somewhat pointless HAVE_KVM dependency on OF to document that KVM requires Open Firmware support.

No functional change intended.

---
 arch/arm64/Kconfig     | 1 +
 arch/arm64/kvm/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm64/Kconfig +1 -0
index b5b13a932561..38c0f36a5ed4 100644
@@ -187,6 +187,7 @@ config ARM64
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS
 	select HAVE_IRQ_TIME_ACCOUNTING
+	select HAVE_KVM if OF
 	select HAVE_NMI
 	select HAVE_PATA_PLATFORM
 	select HAVE_PERF_EVENTS
arch/arm64/kvm/Kconfig +1 -1
index c50f75cf76fe..e1e400bd8de5 100644
@@ -20,7 +20,7 @@ if VIRTUALIZATION
 
 menuconfig KVM
 	bool "Kernel-based Virtual Machine (KVM) support"
-	depends on OF
+	depends on HAVE_KVM
 	select MMU_NOTIFIER
 	select PREEMPT_NOTIFIERS
 	select HAVE_KVM_CPU_RELAX_INTERCEPT
Signature · 1 line
2.33.0.464.g1972c5931b-goog
maintainer Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] KVM: arm64: Depend on HAVE_KVM => OF instead of directly on OF

Quoted 23 lines · Sean Christopherson

Select HAVE_KVM if the KVM dependency is met (OF / Open Firmware), and make KVM depend on HAVE_KVM instead of directly on OF. This fixes the oddity where arm64 configs can end up with KVM=y and HAVE_KVM=n, and will hopefully prevent breakage if there are future users of HAVE_KVM.

Note, arm64 unconditionally selects OF, and has always done so (see commit 8c2c3df31e3b ("arm64: Build infrastructure"). Keep the somewhat pointless HAVE_KVM dependency on OF to document that KVM requires Open Firmware support.

No functional change intended.

---
 arch/arm64/Kconfig     | 1 +
 arch/arm64/kvm/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm64/Kconfig +0 -0
index b5b13a932561..38c0f36a5ed4 100644

arch/arm64/Kconfig config ARM64 · line 190

Quoted 4 lines
arch/arm64/Kconfig +1 -0
@@ -187,6 +187,7 @@ config ARM64
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS
 	select HAVE_IRQ_TIME_ACCOUNTING
+	select HAVE_KVM if OF

Honestly, I'd just drop the 'if OF' here. We select it unconditionally a few lines below and so I think it's more confusing to have the check.

With that:

Will

#4 lore raw

Re: [PATCH 2/2] KVM: arm64: Depend on HAVE_KVM => OF instead of directly on OF

Quoted 19 lines · Will Deacon
Quoted 18 lines · Sean Christopherson

Select HAVE_KVM if the KVM dependency is met (OF / Open Firmware), and make KVM depend on HAVE_KVM instead of directly on OF. This fixes the oddity where arm64 configs can end up with KVM=y and HAVE_KVM=n, and will hopefully prevent breakage if there are future users of HAVE_KVM.

Note, arm64 unconditionally selects OF, and has always done so (see commit 8c2c3df31e3b ("arm64: Build infrastructure"). Keep the somewhat pointless HAVE_KVM dependency on OF to document that KVM requires Open Firmware support.

No functional change intended.

---
 arch/arm64/Kconfig     | 1 +
 arch/arm64/kvm/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines

arch/arm64/Kconfig config ARM64 · line 190

Quoted 9 lines
arch/arm64/Kconfig +1 -0
index b5b13a932561..38c0f36a5ed4 100644
@@ -187,6 +187,7 @@ config ARM64
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS
 	select HAVE_IRQ_TIME_ACCOUNTING
+	select HAVE_KVM if OF

Honestly, I'd just drop the 'if OF' here. We select it unconditionally a few lines below and so I think it's more confusing to have the check.

Work for me. I all but flipped a coin when deciding whether or not to keep the OF dependency.

Thanks!
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

maintainer Applied
#5 lore raw
In reply to Sean Christopherson
Quoted 10 lines · Sean Christopherson

Fix an oddity where arm64 can end up with KVM=y and HAVE_KVM=n. This doesn't cause problems today as no generic code that supports arm64 uses HAVE_KVM, but that may not always be the case, e.g. I stumbled across this when exploring hiding perf's guest callbacks behind HAVE_KVM=y.

Sean Christopherson (2):
KVM: arm64: Unconditionally include generic KVM's Kconfig
KVM: arm64: Depend on HAVE_KVM => OF instead of directly on OF

[...]

Applied to next, thanks!

[1/2] KVM: arm64: Unconditionally include generic KVM's Kconfig

      commit: c8f1e96734069c788b10545f4fd82bcbb6b55dfa
[2/2] KVM: arm64: Depend on HAVE_KVM => OF instead of directly on OF
      commit: e26bb75aa2f17fc079e6a24dff653b098e1f5d37

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.