Skip to contentSkip to conversation

x86/hvm: add HVM-specific Kconfig

PATCH Superseded [email protected] 2 participants 4 messages Feb 7, 2025 – Mar 13, 2025

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: add HVM-specific Kconfig

Add separate menu for configuring HVM build-time settings to help organizing HVM-specific options.

---
Link to the original patch:
https://lore.kernel.org/xen-devel/[email protected]/
---

---
 xen/arch/x86/Kconfig     | 76 +---------------------------------------
 xen/arch/x86/hvm/Kconfig | 73 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 75 deletions(-)
 create mode 100644 xen/arch/x86/hvm/Kconfig
xen/arch/x86/Kconfig +1 -75
index 9cdd04721a..37362c205d 100644
@@ -30,7 +30,6 @@ config X86
 	select HAS_SCHED_GRANULARITY
 	select HAS_UBSAN
 	select HAS_VMAP
-	select HAS_VPCI if HVM
 	select NEEDS_LIBELF
 
 config ARCH_DEFCONFIG
@@ -107,42 +106,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 +165,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 +293,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 +309,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.
-
 endmenu
 
 source "common/Kconfig"
xen/arch/x86/hvm/Kconfig new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · On Friday, February 7th, 2025 at 2:03 PM, [email protected] <[email protected]>…

Add separate menu for configuring HVM build-time settings to help organizing HVM-specific options.

Can I get a review please?

Quoted 208 lines

---
Link to the original patch:
https://lore.kernel.org/xen-devel/[email protected]/
---
---
xen/arch/x86/Kconfig | 76 +--------------------------------------- xen/arch/x86/hvm/Kconfig | 73 ++++++++++++++++++++++++++++++++++++++

2 files changed, 74 insertions(+), 75 deletions(-)

create mode 100644 xen/arch/x86/hvm/Kconfig

xen/arch/x86/Kconfig +0 -0
index 9cdd04721a..37362c205d 100644
@@ -30,7 +30,6 @@ config X86

select HAS_SCHED_GRANULARITY
select HAS_UBSAN
select HAS_VMAP
- select HAS_VPCI if HVM
select NEEDS_LIBELF

config ARCH_DEFCONFIG

xen/arch/x86/Kconfig +0 -0
@@ -107,42 +106,7 @@ config PV_LINEAR_PT
 

If unsure, say Y.

xen/arch/x86/Kconfig +1 -36
-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"

xen/arch/x86/Kconfig +0 -0
@@ -201,25 +165,6 @@ config BIGMEM
 

If unsure, say N.

xen/arch/x86/Kconfig +0 -19
-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

xen/arch/x86/Kconfig +0 -0
@@ -348,14 +293,6 @@ config HYPERV_GUEST
 

endif

xen/arch/x86/Kconfig +0 -8
-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

xen/arch/x86/Kconfig +0 -0
@@ -372,17 +309,6 @@ config REQUIRE_NX

was unavailable. However, if enabled, Xen will no longer boot on any CPU which is lacking NX support.

xen/arch/x86/Kconfig +0 -11
-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.
-

endmenu

source "common/Kconfig"

xen/arch/x86/hvm/Kconfig new file +73 -1
new file mode 100644
index 0000000000..cbfeb5e4f4
@@ -0,0 +1,73 @@
+menuconfig HVM
+ bool "HVM support"
+ depends on !PV_SHIM_EXCLUSIVE
+ default !PV_SHIM
+ select COMPAT
+ select HAS_VPCI
+ 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
+
+config AMD_SVM
+ bool "AMD-V" if 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 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.
+
+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
+
+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.
+
+endif
--

2.34.1

#2 lore raw
In reply to [email protected]
Quoted 4 lines · On 07.02.2025 23:03, [email protected] wrote:

Add separate menu for configuring HVM build-time settings to help organizing HVM-specific options.

I think it would be nice if "organizing" was further qualified, to really see _why_ the change is being made. A particular benefit that Roger points out is that this way all HVM-dependent options moved here will then appear in a sub- menu like fashion in the tool.

xen/arch/x86/Kconfig config X86 · line 33

Quoted 8 lines
xen/arch/x86/Kconfig +0 -1
@@ -30,7 +30,6 @@ config X86
 	select HAS_SCHED_GRANULARITY
 	select HAS_UBSAN
 	select HAS_VMAP
-	select HAS_VPCI if HVM
 	select NEEDS_LIBELF

As said before, personally I'd prefer if this didn't move.

Quoted 30 lines
xen/arch/x86/hvm/Kconfig new file +27 -0
@@ -0,0 +1,73 @@
+menuconfig HVM
+	bool "HVM support"
+	depends on !PV_SHIM_EXCLUSIVE
+	default !PV_SHIM
+	select COMPAT
+	select HAS_VPCI
+	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
+
+config AMD_SVM
+	bool "AMD-V" if 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.

xen/arch/x86/hvm/Kconfig line 37

Quoted 10 lines
xen/arch/x86/hvm/Kconfig new file +10 -0
+
+config INTEL_VMX
+	bool "Intel VT-x" if 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.

Perhaps not to be done right here, but still: I guess the "default" of these want to change to use AMD / INTEL respectively. While we permit enabling the virt extension support separately, generally there's little point doing so by default when the corresponding CPU support code was disabled.

Quoted 23 lines
xen/arch/x86/hvm/Kconfig new file +23 -0
+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
+
+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.

xen/arch/x86/hvm/Kconfig line 71

Quoted 10 lines
xen/arch/x86/hvm/Kconfig new file +10 -0
+
+	  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.

Please can this move ahead of at least the two MEM_* ones, maybe even ahead of ALTP2M?

Jan

#3 lore raw
Quoted 15 lines · Jan Beulich
Quoted 4 lines · On 07.02.2025 23:03, [email protected] wrote:

Add separate menu for configuring HVM build-time settings to help organizing HVM-specific options.

I think it would be nice if "organizing" was further qualified, to really see why the change is being made. A particular benefit that Roger points out is that this way all HVM-dependent options moved here will then appear in a sub- menu like fashion in the tool.

Quoted 11 lines
Quoted 8 lines
xen/arch/x86/Kconfig +0 -0
@@ -30,7 +30,6 @@ config X86

select HAS_SCHED_GRANULARITY
select HAS_UBSAN
select HAS_VMAP
- select HAS_VPCI if HVM
select NEEDS_LIBELF

As said before, personally I'd prefer if this didn't move.

Fixed in v2, sorry overlooked that.

Quoted 39 lines
Quoted 39 lines
xen/arch/x86/hvm/Kconfig new file +35 -0
@@ -0,0 +1,73 @@
+menuconfig HVM
+ bool "HVM support"
+ depends on !PV_SHIM_EXCLUSIVE
+ default !PV_SHIM
+ select COMPAT
+ select HAS_VPCI
+ 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
+
+config AMD_SVM
+ bool "AMD-V" if 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 EXPERT
+ default y
+ select ARCH_VCPU_IOREQ_COMPLETION
+ help
+ Enables virtual machine extensions on platforms that implement the
+ Intel Virtualization Technology (Intel VT-x).
Quoted 8 lines

xen/arch/x86/hvm/Kconfig line 37

Quoted 2 lines
xen/arch/x86/hvm/Kconfig new file +2 -0
+ If your system includes a processor with Intel VT-x support, say Y.
+ If in doubt, say Y.

Perhaps not to be done right here, but still: I guess the "default" of these want to change to use AMD / INTEL respectively. While we permit enabling the virt extension support separately, generally there's little point doing so by default when the corresponding CPU support code was disabled.

Addressed.

Quoted 30 lines
Quoted 30 lines
xen/arch/x86/hvm/Kconfig new file +29 -0
+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
+
+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.
+
Quoted 8 lines

xen/arch/x86/hvm/Kconfig line 71

Quoted 4 lines
xen/arch/x86/hvm/Kconfig new file +4 -0
+ This is strictly for testing purposes, and not appropriate
+ for use in production.
+
+ If unsure, say N.

Please can this move ahead of at least the two MEM_* ones, maybe even ahead of ALTP2M?

Done.

Quoted 2 lines

Jan