Mailing List Archive

[XEN PATCH v1 01/15] x86: introduce AMD-V and Intel VT-x Kconfig options
From: Xenia Ragiadakou <burzalodowa@gmail.com>

Introduce two new Kconfig options, SVM and VMX, to allow code
specific to each virtualization technology to be separated and, when not
required, stripped.
CONFIG_SVM will be used to enable virtual machine extensions on platforms that
implement the AMD Virtualization Technology (AMD-V).
CONFIG_VMX will be used to enable virtual machine extensions on platforms that
implement the Intel Virtualization Technology (Intel VT-x).

Both features depend on HVM support.

Since, at this point, disabling any of them would cause Xen to not compile,
the options are enabled by default if HVM and are not selectable by the user.

No functional change intended.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
---
xen/arch/x86/Kconfig | 6 ++++++
xen/arch/x86/hvm/Makefile | 4 ++--
xen/arch/x86/mm/Makefile | 3 ++-
xen/arch/x86/mm/hap/Makefile | 2 +-
4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index d6f3128588..6f06d3baa5 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -120,6 +120,12 @@ config HVM

If unsure, say Y.

+config SVM
+ def_bool y if HVM
+
+config VMX
+ def_bool y if HVM
+
config XEN_SHSTK
bool "Supervisor Shadow Stacks"
depends on HAS_AS_CET_SS
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 3464191544..8434badc64 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,5 +1,5 @@
-obj-y += svm/
-obj-y += vmx/
+obj-$(CONFIG_SVM) += svm/
+obj-$(CONFIG_VMX) += vmx/
obj-y += viridian/

obj-y += asid.o
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 0803ac9297..92168290a8 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
obj-$(CONFIG_HVM) += nested.o
obj-$(CONFIG_HVM) += p2m.o
obj-y += p2m-basic.o
-obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o
+obj-$(CONFIG_HVM) += p2m-pod.o p2m-pt.o
+obj-$(CONFIG_VMX) += p2m-ept.o
obj-y += paging.o
obj-y += physmap.o
diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile
index 8ef54b1faa..98c8a87819 100644
--- a/xen/arch/x86/mm/hap/Makefile
+++ b/xen/arch/x86/mm/hap/Makefile
@@ -3,4 +3,4 @@ obj-y += guest_walk_2.o
obj-y += guest_walk_3.o
obj-y += guest_walk_4.o
obj-y += nested_hap.o
-obj-y += nested_ept.o
+obj-$(CONFIG_VMX) += nested_ept.o
--
2.25.1
Re: [XEN PATCH v1 01/15] x86: introduce AMD-V and Intel VT-x Kconfig options [ In reply to ]
On 16.04.2024 08:20, Sergiy Kibrik wrote:
> From: Xenia Ragiadakou <burzalodowa@gmail.com>
>
> Introduce two new Kconfig options, SVM and VMX, to allow code
> specific to each virtualization technology to be separated and, when not
> required, stripped.
> CONFIG_SVM will be used to enable virtual machine extensions on platforms that
> implement the AMD Virtualization Technology (AMD-V).
> CONFIG_VMX will be used to enable virtual machine extensions on platforms that
> implement the Intel Virtualization Technology (Intel VT-x).
>
> Both features depend on HVM support.
>
> Since, at this point, disabling any of them would cause Xen to not compile,
> the options are enabled by default if HVM and are not selectable by the user.
>
> No functional change intended.
>
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>

In the subject tag you say v1, but I think this is a re-post? In which
case and with it having been a long time since then it would be even
more so important that a proper revision log is present in each individual
patch.

> --- a/xen/arch/x86/Kconfig
> +++ b/xen/arch/x86/Kconfig
> @@ -120,6 +120,12 @@ config HVM
>
> If unsure, say Y.
>
> +config SVM
> + def_bool y if HVM
> +
> +config VMX
> + def_bool y if HVM

It was probably me to have requested this form, but meanwhile I've learned
(on the Linux side) that newer kconfig is capable to dealing with

config SVM
def_bool HVM

config VMX
def_bool HVM

quite fine (i.e. no longer leaving around useless "# CONFIG_... is not set"
when (in this case) HVM=n. Please double check with the kconfig we use
whether that's the case there, too, and simplify if so.

> --- a/xen/arch/x86/mm/Makefile
> +++ b/xen/arch/x86/mm/Makefile
> @@ -10,6 +10,7 @@ obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
> obj-$(CONFIG_HVM) += nested.o
> obj-$(CONFIG_HVM) += p2m.o
> obj-y += p2m-basic.o
> -obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o
> +obj-$(CONFIG_HVM) += p2m-pod.o p2m-pt.o
> +obj-$(CONFIG_VMX) += p2m-ept.o

Please can these be kept in alphabetical order?

Jan
Re: [XEN PATCH v1 01/15] x86: introduce AMD-V and Intel VT-x Kconfig options [ In reply to ]
18.04.24 14:16, Jan Beulich:
> On 16.04.2024 08:20, Sergiy Kibrik wrote:
>> From: Xenia Ragiadakou <burzalodowa@gmail.com>
>>
>> Introduce two new Kconfig options, SVM and VMX, to allow code
>> specific to each virtualization technology to be separated and, when not
>> required, stripped.
>> CONFIG_SVM will be used to enable virtual machine extensions on platforms that
>> implement the AMD Virtualization Technology (AMD-V).
>> CONFIG_VMX will be used to enable virtual machine extensions on platforms that
>> implement the Intel Virtualization Technology (Intel VT-x).
>>
>> Both features depend on HVM support.
>>
>> Since, at this point, disabling any of them would cause Xen to not compile,
>> the options are enabled by default if HVM and are not selectable by the user.
>>
>> No functional change intended.
>>
>> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
>> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
>
> In the subject tag you say v1, but I think this is a re-post? In which
> case and with it having been a long time since then it would be even
> more so important that a proper revision log is present in each individual
> patch.
>

well, this patch isn't plain resend, it does have changes since rfc
version (actually all of them do, hence V1 tag). Anyway, individual
change log per patch would make things easier a bit, I agree.

>> --- a/xen/arch/x86/Kconfig
>> +++ b/xen/arch/x86/Kconfig
>> @@ -120,6 +120,12 @@ config HVM
>>
>> If unsure, say Y.
>>
>> +config SVM
>> + def_bool y if HVM
>> +
>> +config VMX
>> + def_bool y if HVM
>
> It was probably me to have requested this form, but meanwhile I've learned
> (on the Linux side) that newer kconfig is capable to dealing with
>
> config SVM
> def_bool HVM
>
> config VMX
> def_bool HVM
>
> quite fine (i.e. no longer leaving around useless "# CONFIG_... is not set"
> when (in this case) HVM=n. Please double check with the kconfig we use
> whether that's the case there, too, and simplify if so.
>

seems to work, thanks for pointing this out

>> --- a/xen/arch/x86/mm/Makefile
>> +++ b/xen/arch/x86/mm/Makefile
>> @@ -10,6 +10,7 @@ obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
>> obj-$(CONFIG_HVM) += nested.o
>> obj-$(CONFIG_HVM) += p2m.o
>> obj-y += p2m-basic.o
>> -obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o
>> +obj-$(CONFIG_HVM) += p2m-pod.o p2m-pt.o
>> +obj-$(CONFIG_VMX) += p2m-ept.o
>
> Please can these be kept in alphabetical order?
>

yes, sure

-Sergiy