Skip to contentSkip to conversation

KVM: arm64: Tidy up arch Kconfig and Makefiles

PATCH Superseded Fuad Tabba 2 participants 7 messages Apr 17, 2020

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Fuad Tabba

author
#0 lore raw

cover KVM: arm64: Tidy up arch Kconfig and Makefiles

Hi,

This small patch series tidies up the arm64 KVM build system by rejigging config options, removing some redundant help text, and consolidating some of the Makefile rules.

The changes are cosmetic, but it seemed worthwhile to send this out for consideration.

Cheers,
/fuad

Fuad Tabba (1):
KVM: arm64: Clean up kvm makefiles

Will Deacon (3):
KVM: arm64: Kill off CONFIG_KVM_ARM_HOST
KVM: arm64: Update help text
KVM: arm64: Change CONFIG_KVM to a menuconfig entry

 arch/arm64/kernel/asm-offsets.c |  2 +-
 arch/arm64/kernel/smp.c         |  2 +-
 arch/arm64/kvm/Kconfig          | 22 ++++++++--------
 arch/arm64/kvm/Makefile         | 45 +++++++++++++--------------------
 arch/arm64/kvm/hyp/Makefile     | 16 ++++--------
 5 files changed, 35 insertions(+), 52 deletions(-)

base-commit: 8f3d9f354286745c751374f5f1fcafee6b3f3136

Signature · 6 lines
2.26.0.110.g2183baf09c-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
author
#1 lore raw

PATCH 1/4 KVM: arm64: Kill off CONFIG_KVM_ARM_HOST

From: Will Deacon <[email protected]>

CONFIG_KVM_ARM_HOST is just a proxy for CONFIG_KVM, so remove it in favour of the latter.

---
 arch/arm64/kernel/asm-offsets.c |  2 +-
 arch/arm64/kernel/smp.c         |  2 +-
 arch/arm64/kvm/Kconfig          |  6 ----
 arch/arm64/kvm/Makefile         | 52 ++++++++++++++++-----------------
 arch/arm64/kvm/hyp/Makefile     | 22 +++++++-------
 5 files changed, 39 insertions(+), 45 deletions(-)
arch/arm64/kernel/asm-offsets.c +1 -1
index 9981a0a5a87f..a27e0cd731e9 100644
@@ -96,7 +96,7 @@ int main(void)
   DEFINE(CPU_BOOT_PTRAUTH_KEY,	offsetof(struct secondary_data, ptrauth_key));
 #endif
   BLANK();
-#ifdef CONFIG_KVM_ARM_HOST
+#ifdef CONFIG_KVM
   DEFINE(VCPU_CONTEXT,		offsetof(struct kvm_vcpu, arch.ctxt));
   DEFINE(VCPU_FAULT_DISR,	offsetof(struct kvm_vcpu, arch.fault.disr_el1));
   DEFINE(VCPU_WORKAROUND_FLAGS,	offsetof(struct kvm_vcpu, arch.workaround_flags));
arch/arm64/kernel/smp.c +1 -1
index 061f60fe452f..0a3045d9f33f 100644
@@ -430,7 +430,7 @@ static void __init hyp_mode_check(void)
 			   "CPU: CPUs started in inconsistent modes");
 	else
 		pr_info("CPU: All CPU(s) started at EL1\n");
-	if (IS_ENABLED(CONFIG_KVM_ARM_HOST))
+	if (IS_ENABLED(CONFIG_KVM))
 		kvm_compute_layout();
 }
 
arch/arm64/kvm/Kconfig +0 -6
index 449386d76441..ce724e526689 100644
@@ -28,7 +28,6 @@ config KVM
 	select HAVE_KVM_CPU_RELAX_INTERCEPT
 	select HAVE_KVM_ARCH_TLB_FLUSH_ALL
 	select KVM_MMIO
-	select KVM_ARM_HOST
 	select KVM_GENERIC_DIRTYLOG_READ_PROTECT
 	select SRCU
 	select KVM_VFIO
@@ -50,11 +49,6 @@ config KVM
 
 	  If unsure, say N.
 
-config KVM_ARM_HOST
-	bool
-	---help---
-	  Provides host support for ARM processors.
-
 config KVM_ARM_PMU
 	bool
 	---help---
arch/arm64/kvm/Makefile +26 -26

59 lines not on this page · raw message

arch/arm64/kvm/hyp/Makefile +11 -11
index ea710f674cb6..ad4c173ed036 100644
@@ -8,18 +8,18 @@ ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING \
 
 KVM=../../../../virt/kvm
 
-obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/vgic-v3-sr.o
-obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/timer-sr.o
-obj-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/hyp/aarch32.o
+obj-$(CONFIG_KVM) += $(KVM)/arm/hyp/vgic-v3-sr.o
+obj-$(CONFIG_KVM) += $(KVM)/arm/hyp/timer-sr.o
+obj-$(CONFIG_KVM) += $(KVM)/arm/hyp/aarch32.o
 
-obj-$(CONFIG_KVM_ARM_HOST) += vgic-v2-cpuif-proxy.o
-obj-$(CONFIG_KVM_ARM_HOST) += sysreg-sr.o
-obj-$(CONFIG_KVM_ARM_HOST) += debug-sr.o
-obj-$(CONFIG_KVM_ARM_HOST) += entry.o
-obj-$(CONFIG_KVM_ARM_HOST) += switch.o
-obj-$(CONFIG_KVM_ARM_HOST) += fpsimd.o
-obj-$(CONFIG_KVM_ARM_HOST) += tlb.o
-obj-$(CONFIG_KVM_ARM_HOST) += hyp-entry.o
+obj-$(CONFIG_KVM) += vgic-v2-cpuif-proxy.o
+obj-$(CONFIG_KVM) += sysreg-sr.o
+obj-$(CONFIG_KVM) += debug-sr.o
+obj-$(CONFIG_KVM) += entry.o
+obj-$(CONFIG_KVM) += switch.o
+obj-$(CONFIG_KVM) += fpsimd.o
+obj-$(CONFIG_KVM) += tlb.o
+obj-$(CONFIG_KVM) += hyp-entry.o
 
 # KVM code is run at a different exception code with a different map, so
 # compiler instrumentation that inserts callbacks or checks into the code may
Signature · 6 lines
2.26.0.110.g2183baf09c-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
author
#2 lore raw

PATCH 2/4 KVM: arm64: Update help text

In reply to Fuad Tabba

From: Will Deacon <[email protected]>

arm64 KVM supports 16k pages since commit 02e0b7600f83 ("arm64: kvm: Add support for 16K pages"), so update the Kconfig help text accordingly.

---
 arch/arm64/kvm/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/kvm/Kconfig +0 -2
index ce724e526689..d2cf4f099454 100644
@@ -44,8 +44,6 @@ config KVM
 	select TASK_DELAY_ACCT
 	---help---
 	  Support hosting virtualized guest machines.
-	  We don't support KVM with 16K page tables yet, due to the multiple
-	  levels of fake page tables.
 
 	  If unsure, say N.
 
Signature · 6 lines
2.26.0.110.g2183baf09c-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
author
#3 lore raw

PATCH 3/4 KVM: arm64: Change CONFIG_KVM to a menuconfig entry

In reply to Fuad Tabba

From: Will Deacon <[email protected]>

Changing CONFIG_KVM to be a 'menuconfig' entry in Kconfig mean that we can straightforwardly enumerate optional features, such as the virtual PMU device as dependent options.

---
 arch/arm64/kvm/Kconfig | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
arch/arm64/kvm/Kconfig +11 -5
index d2cf4f099454..f1c1f981482c 100644
@@ -3,7 +3,6 @@
 # KVM configuration
 #
 
-source "virt/kvm/Kconfig"
 source "virt/lib/Kconfig"
 
 menuconfig VIRTUALIZATION
@@ -18,7 +17,7 @@ menuconfig VIRTUALIZATION
 
 if VIRTUALIZATION
 
-config KVM
+menuconfig KVM
 	bool "Kernel-based Virtual Machine (KVM) support"
 	depends on OF
 	# for TASKSTATS/TASK_DELAY_ACCT:
@@ -33,7 +32,6 @@ config KVM
 	select KVM_VFIO
 	select HAVE_KVM_EVENTFD
 	select HAVE_KVM_IRQFD
-	select KVM_ARM_PMU if HW_PERF_EVENTS
 	select HAVE_KVM_MSI
 	select HAVE_KVM_IRQCHIP
 	select HAVE_KVM_IRQ_ROUTING
@@ -47,13 +45,21 @@ config KVM
 
 	  If unsure, say N.
 
+if KVM
+
+source "virt/kvm/Kconfig"
+
 config KVM_ARM_PMU
-	bool
+	bool "Virtual Performance Monitoring Unit (PMU) support"
+	depends on HW_PERF_EVENTS
+	default y
 	---help---
 	  Adds support for a virtual Performance Monitoring Unit (PMU) in
 	  virtual machines.
 
 config KVM_INDIRECT_VECTORS
-       def_bool KVM && (HARDEN_BRANCH_PREDICTOR || HARDEN_EL2_VECTORS)
+	def_bool HARDEN_BRANCH_PREDICTOR || HARDEN_EL2_VECTORS
+
+endif # KVM
 
 endif # VIRTUALIZATION
Signature · 6 lines
2.26.0.110.g2183baf09c-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
author
#4 lore raw

PATCH 4/4 KVM: arm64: Clean up kvm makefiles

In reply to Fuad Tabba

Consolidate references to the CONFIG_KVM configuration item to encompass entire folders rather than per line.

---
 arch/arm64/kvm/Makefile     | 41 +++++++++++++++----------------------
 arch/arm64/kvm/hyp/Makefile | 16 +++++----------
 2 files changed, 21 insertions(+), 36 deletions(-)
arch/arm64/kvm/Makefile +16 -25
index 2d968e9ac792..a5eab7fe11a8 100644
@@ -10,30 +10,21 @@ KVM=../../../virt/kvm
 obj-$(CONFIG_KVM) += kvm.o
 obj-$(CONFIG_KVM) += hyp/
 
-kvm-$(CONFIG_KVM) += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o $(KVM)/eventfd.o $(KVM)/vfio.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/arm.o $(KVM)/arm/mmu.o $(KVM)/arm/mmio.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/psci.o $(KVM)/arm/perf.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/hypercalls.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/pvtime.o
+kvm-y := $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o $(KVM)/eventfd.o \
+	 $(KVM)/vfio.o \
+	 $(KVM)/arm/arm.o $(KVM)/arm/mmu.o $(KVM)/arm/mmio.o $(KVM)/arm/psci.o \
+	 $(KVM)/arm/perf.o $(KVM)/arm/hypercalls.o $(KVM)/arm/pvtime.o \
+	 inject_fault.o regmap.o va_layout.o hyp.o hyp-init.o handle_exit.o \
+	 guest.o debug.o reset.o sys_regs.o sys_regs_generic_v8.o \
+	 vgic-sys-reg-v3.o fpsimd.o pmu.o \
+	 $(KVM)/arm/aarch32.o \
+	 $(KVM)/arm/vgic/vgic.o $(KVM)/arm/vgic/vgic-init.o \
+	 $(KVM)/arm/vgic/vgic-irqfd.o $(KVM)/arm/vgic/vgic-v2.o \
+	 $(KVM)/arm/vgic/vgic-v3.o $(KVM)/arm/vgic/vgic-v4.o \
+	 $(KVM)/arm/vgic/vgic-mmio.o $(KVM)/arm/vgic/vgic-mmio-v2.o \
+	 $(KVM)/arm/vgic/vgic-mmio-v3.o $(KVM)/arm/vgic/vgic-kvm-device.o \
+	 $(KVM)/arm/vgic/vgic-its.o $(KVM)/arm/vgic/vgic-debug.o \
+	 $(KVM)/irqchip.o \
+	 $(KVM)/arm/arch_timer.o
 
-kvm-$(CONFIG_KVM) += inject_fault.o regmap.o va_layout.o
-kvm-$(CONFIG_KVM) += hyp.o hyp-init.o handle_exit.o
-kvm-$(CONFIG_KVM) += guest.o debug.o reset.o sys_regs.o sys_regs_generic_v8.o
-kvm-$(CONFIG_KVM) += vgic-sys-reg-v3.o fpsimd.o pmu.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/aarch32.o
-
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-init.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-irqfd.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-v2.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-v3.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-v4.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-mmio.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-mmio-v2.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-mmio-v3.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-kvm-device.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-its.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/vgic/vgic-debug.o
-kvm-$(CONFIG_KVM) += $(KVM)/irqchip.o
-kvm-$(CONFIG_KVM) += $(KVM)/arm/arch_timer.o
 kvm-$(CONFIG_KVM_ARM_PMU) += $(KVM)/arm/pmu.o
arch/arm64/kvm/hyp/Makefile +5 -11
index ad4c173ed036..9358fbd123c0 100644
@@ -8,18 +8,12 @@ ccflags-y += -fno-stack-protector -DDISABLE_BRANCH_PROFILING \
 
 KVM=../../../../virt/kvm
 
-obj-$(CONFIG_KVM) += $(KVM)/arm/hyp/vgic-v3-sr.o
-obj-$(CONFIG_KVM) += $(KVM)/arm/hyp/timer-sr.o
-obj-$(CONFIG_KVM) += $(KVM)/arm/hyp/aarch32.o
+obj-$(CONFIG_KVM) += hyp.o
 
-obj-$(CONFIG_KVM) += vgic-v2-cpuif-proxy.o
-obj-$(CONFIG_KVM) += sysreg-sr.o
-obj-$(CONFIG_KVM) += debug-sr.o
-obj-$(CONFIG_KVM) += entry.o
-obj-$(CONFIG_KVM) += switch.o
-obj-$(CONFIG_KVM) += fpsimd.o
-obj-$(CONFIG_KVM) += tlb.o
-obj-$(CONFIG_KVM) += hyp-entry.o
+hyp-y := $(KVM)/arm/hyp/vgic-v3-sr.o $(KVM)/arm/hyp/timer-sr.o \
+	 $(KVM)/arm/hyp/aarch32.o \
+	 vgic-v2-cpuif-proxy.o sysreg-sr.o debug-sr.o entry.o switch.o \
+	 fpsimd.o tlb.o hyp-entry.o
 
 # KVM code is run at a different exception code with a different map, so
 # compiler instrumentation that inserts callbacks or checks into the code may
Signature · 6 lines
2.26.0.110.g2183baf09c-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
maintainer
#5 lore raw
In reply to Fuad Tabba

Hi Fuad,

Thanks for this.

Quoted 8 lines · Fuad Tabba

Hi,

This small patch series tidies up the arm64 KVM build system by rejigging config options, removing some redundant help text, and consolidating some of the Makefile rules.

The changes are cosmetic, but it seemed worthwhile to send this out for consideration.

Happy to take these patches for 5.8. Could you please rebase them on top of [1], which moves all of the (now arm64-specific) code where it belongs?

Cheers,

        M.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm64/welcome-home

Signature · 5 lines
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
author
#6 lore raw

Thanks for the review Marc. I'll post v2 shortly.

Cheers,
/fuad

Quoted 20 lines · Marc Zyngier

Hi Fuad,

Thanks for this.

Quoted 8 lines · Fuad Tabba

Hi,

This small patch series tidies up the arm64 KVM build system by rejigging config options, removing some redundant help text, and consolidating some of the Makefile rules.

The changes are cosmetic, but it seemed worthwhile to send this out for consideration.

Happy to take these patches for 5.8. Could you please rebase them on top of [1], which moves all of the (now arm64-specific) code where it belongs?

Cheers,

Quoted 8 lines
         M.

[1]

https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm64/welcome-home
--
Jazz is not dead. It just smells funny...

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