diff mbox series

[v2] x86/hvm: add HVM-specific Kconfig

Message ID 20250313023822.2523270-1-dmukhin@ford.com (mailing list archive)
State Superseded
Headers show
Series [v2] x86/hvm: add HVM-specific Kconfig | expand

Commit Message

Denis Mukhin March 13, 2025, 2:39 a.m. UTC
Add a separate menu for configuring HVM build-time settings to better organize
HVM-specific options.

HVM options will now appear in a dedicated sub-menu in the menuconfig tool.

A new sub-menu, "Hardware Support for Virtualization" has been added for
selecting per-CPU vendor virtualization extensions on x86 systems.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes v1->v2:
- Added grouping for hardware virtualization extentions on x86
- Moved HVM options declarations as per review
- CI: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/1714049371
---
 xen/arch/x86/Kconfig     | 75 +--------------------------------------
 xen/arch/x86/hvm/Kconfig | 76 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 74 deletions(-)
 create mode 100644 xen/arch/x86/hvm/Kconfig

Comments

Andrew Cooper March 14, 2025, 8:20 p.m. UTC | #1
On 13/03/2025 2:39 am, dmkhn@proton.me wrote:
> diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
> new file mode 100644
> index 0000000000..2ca664f36f
> --- /dev/null
> +++ b/xen/arch/x86/hvm/Kconfig
> @@ -0,0 +1,76 @@
> +menuconfig HVM
> +	bool "HVM support"
> +	depends on !PV_SHIM_EXCLUSIVE
> +	default !PV_SHIM
> +	select COMPAT
> +	select IOREQ_SERVER
> +	select MEM_ACCESS_ALWAYS_ON
> +	help
> +	  Interfaces to support HVM domains.  HVM domains require hardware
> +	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
> +	  guests which have no specific Xen knowledge.
> +
> +	  This option is needed if you want to run HVM or PVH domains.
> +
> +	  If unsure, say Y.
> +
> +if HVM
> +
> +menu "Hardware Support for Virtualization"
> +
> +config AMD_SVM
> +	bool "AMD-V" if AMD && EXPERT
> +	default y
> +	help
> +	  Enables virtual machine extensions on platforms that implement the
> +	  AMD Virtualization Technology (AMD-V).
> +	  If your system includes a processor with AMD-V support, say Y.
> +	  If in doubt, say Y.
> +
> +config INTEL_VMX
> +	bool "Intel VT-x" if INTEL && EXPERT
> +	default y
> +	select ARCH_VCPU_IOREQ_COMPLETION
> +	help
> +	  Enables virtual machine extensions on platforms that implement the
> +	  Intel Virtualization Technology (Intel VT-x).
> +	  If your system includes a processor with Intel VT-x support, say Y.
> +	  If in doubt, say Y.
> +
> +endmenu

Looking at the end result, I'd suggest dropping the menu around SVM and VMX.

It would be nice to group them under a name called Vendor Support, but I
don't think the Kconfig language can express this, and the full menu
becomes empty if both AMD and INTEL are deselected.

Having them simply at the top of the HVM menu seems like the less bad
option.

There is a bunch of cleanup which should be done, but explicitly not in
this patch which is simply restructuring.  I'll do a patch in due course.

~Andrew
Denis Mukhin March 15, 2025, 1:22 a.m. UTC | #2
On Friday, March 14th, 2025 at 1:20 PM, Andrew Cooper <andrew.cooper3@citrix.com> wrote:

> 
> 
> On 13/03/2025 2:39 am, dmkhn@proton.me wrote:
> 
> > diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
> > new file mode 100644
> > index 0000000000..2ca664f36f
> > --- /dev/null
> > +++ b/xen/arch/x86/hvm/Kconfig
> > @@ -0,0 +1,76 @@
> > +menuconfig HVM
> > + bool "HVM support"
> > + depends on !PV_SHIM_EXCLUSIVE
> > + default !PV_SHIM
> > + select COMPAT
> > + select IOREQ_SERVER
> > + select MEM_ACCESS_ALWAYS_ON
> > + help
> > + Interfaces to support HVM domains. HVM domains require hardware
> > + virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
> > + guests which have no specific Xen knowledge.
> > +
> > + This option is needed if you want to run HVM or PVH domains.
> > +
> > + If unsure, say Y.
> > +
> > +if HVM
> > +
> > +menu "Hardware Support for Virtualization"
> > +
> > +config AMD_SVM
> > + bool "AMD-V" if AMD && EXPERT
> > + default y
> > + help
> > + Enables virtual machine extensions on platforms that implement the
> > + AMD Virtualization Technology (AMD-V).
> > + If your system includes a processor with AMD-V support, say Y.
> > + If in doubt, say Y.
> > +
> > +config INTEL_VMX
> > + bool "Intel VT-x" if INTEL && EXPERT
> > + default y
> > + select ARCH_VCPU_IOREQ_COMPLETION
> > + help
> > + Enables virtual machine extensions on platforms that implement the
> > + Intel Virtualization Technology (Intel VT-x).
> > + If your system includes a processor with Intel VT-x support, say Y.
> > + If in doubt, say Y.
> > +
> > +endmenu
> 
> 
> Looking at the end result, I'd suggest dropping the menu around SVM and VMX.
> 
> It would be nice to group them under a name called Vendor Support, but I
> don't think the Kconfig language can express this, and the full menu
> becomes empty if both AMD and INTEL are deselected.
> 
> Having them simply at the top of the HVM menu seems like the less bad
> option.
> 
> There is a bunch of cleanup which should be done, but explicitly not in
> this patch which is simply restructuring. I'll do a patch in due course.

Addressed:
  https://lore.kernel.org/xen-devel/20250315011945.2927542-1-dmukhin@ford.com

Thanks!

> 
> ~Andrew
diff mbox series

Patch

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 6e41bc0fb4..18efdb2e31 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -107,42 +107,7 @@  config PV_LINEAR_PT
 
          If unsure, say Y.
 
-config HVM
-	bool "HVM support"
-	depends on !PV_SHIM_EXCLUSIVE
-	default !PV_SHIM
-	select COMPAT
-	select IOREQ_SERVER
-	select MEM_ACCESS_ALWAYS_ON
-	help
-	  Interfaces to support HVM domains.  HVM domains require hardware
-	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
-	  guests which have no specific Xen knowledge.
-
-	  This option is needed if you want to run HVM or PVH domains.
-
-	  If unsure, say Y.
-
-config AMD_SVM
-	bool "AMD-V" if EXPERT
-	depends on HVM
-	default y
-	help
-	  Enables virtual machine extensions on platforms that implement the
-	  AMD Virtualization Technology (AMD-V).
-	  If your system includes a processor with AMD-V support, say Y.
-	  If in doubt, say Y.
-
-config INTEL_VMX
-	bool "Intel VT-x" if EXPERT
-	depends on HVM
-	default y
-	select ARCH_VCPU_IOREQ_COMPLETION
-	help
-	  Enables virtual machine extensions on platforms that implement the
-	  Intel Virtualization Technology (Intel VT-x).
-	  If your system includes a processor with Intel VT-x support, say Y.
-	  If in doubt, say Y.
+source "arch/x86/hvm/Kconfig"
 
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
@@ -201,25 +166,6 @@  config BIGMEM
 
 	  If unsure, say N.
 
-config HVM_FEP
-	bool "HVM Forced Emulation Prefix support (UNSUPPORTED)" if UNSUPPORTED
-	default DEBUG
-	depends on HVM
-	help
-
-	  Compiles in a feature that allows HVM guest to arbitrarily
-	  exercise the instruction emulator.
-
-	  This feature can only be enabled during boot time with
-	  appropriate hypervisor command line option. Please read
-	  hypervisor command line documentation before trying to use
-	  this feature.
-
-	  This is strictly for testing purposes, and not appropriate
-	  for use in production.
-
-	  If unsure, say N.
-
 config TBOOT
 	bool "Xen tboot support (UNSUPPORTED)"
 	depends on INTEL && UNSUPPORTED
@@ -348,14 +294,6 @@  config HYPERV_GUEST
 
 endif
 
-config MEM_PAGING
-	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
-	depends on HVM
-
-config MEM_SHARING
-	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
-	depends on HVM
-
 config REQUIRE_NX
 	bool "Require NX (No eXecute) support"
 	help
@@ -372,17 +310,6 @@  config REQUIRE_NX
 	  was unavailable. However, if enabled, Xen will no longer boot on
 	  any CPU which is lacking NX support.
 
-config ALTP2M
-	bool "Alternate P2M support" if EXPERT
-	depends on INTEL_VMX
-	default y
-	help
-	  Alternate-p2m allows a guest to manage multiple p2m guest physical
-	  "memory views" (as opposed to a single p2m).
-	  Useful for memory introspection.
-
-	  If unsure, stay with defaults.
-
 config UCODE_SCAN_DEFAULT
 	bool "Scan for microcode by default"
 	help
diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
new file mode 100644
index 0000000000..2ca664f36f
--- /dev/null
+++ b/xen/arch/x86/hvm/Kconfig
@@ -0,0 +1,76 @@ 
+menuconfig HVM
+	bool "HVM support"
+	depends on !PV_SHIM_EXCLUSIVE
+	default !PV_SHIM
+	select COMPAT
+	select IOREQ_SERVER
+	select MEM_ACCESS_ALWAYS_ON
+	help
+	  Interfaces to support HVM domains.  HVM domains require hardware
+	  virtualisation extensions (e.g. Intel VT-x, AMD SVM), but can boot
+	  guests which have no specific Xen knowledge.
+
+	  This option is needed if you want to run HVM or PVH domains.
+
+	  If unsure, say Y.
+
+if HVM
+
+menu "Hardware Support for Virtualization"
+
+config AMD_SVM
+	bool "AMD-V" if AMD && EXPERT
+	default y
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  AMD Virtualization Technology (AMD-V).
+	  If your system includes a processor with AMD-V support, say Y.
+	  If in doubt, say Y.
+
+config INTEL_VMX
+	bool "Intel VT-x" if INTEL && EXPERT
+	default y
+	select ARCH_VCPU_IOREQ_COMPLETION
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  Intel Virtualization Technology (Intel VT-x).
+	  If your system includes a processor with Intel VT-x support, say Y.
+	  If in doubt, say Y.
+
+endmenu
+
+config HVM_FEP
+	bool "HVM Forced Emulation Prefix support (UNSUPPORTED)" if UNSUPPORTED
+	default DEBUG
+	help
+	  Compiles in a feature that allows HVM guest to arbitrarily
+	  exercise the instruction emulator.
+
+	  This feature can only be enabled during boot time with
+	  appropriate hypervisor command line option. Please read
+	  hypervisor command line documentation before trying to use
+	  this feature.
+
+	  This is strictly for testing purposes, and not appropriate
+	  for use in production.
+
+	  If unsure, say N.
+
+config ALTP2M
+	bool "Alternate P2M support" if EXPERT
+	depends on INTEL_VMX
+	default y
+	help
+	  Alternate-p2m allows a guest to manage multiple p2m guest physical
+	  "memory views" (as opposed to a single p2m).
+	  Useful for memory introspection.
+
+	  If unsure, stay with defaults.
+
+config MEM_PAGING
+	bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED
+
+config MEM_SHARING
+	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
+
+endif