[XEN PATCH v3 07/16] x86/hvm: guard AMD-V and Intel VT-x hvm_function_table initializers

Sergiy Kibrik posted 16 patches 5 months, 3 weeks ago
[XEN PATCH v3 07/16] x86/hvm: guard AMD-V and Intel VT-x hvm_function_table initializers
Posted by Sergiy Kibrik 5 months, 3 weeks ago
From: Xenia Ragiadakou <burzalodowa@gmail.com>

Since start_svm() is AMD-V specific while start_vmx() is Intel VT-x specific,
any of them can potentially be excluded from build completely with CONFIG_SVM
or CONFIG_VMX options respectively, hence we have to explicitly check if
they're available and use specific macros using_{svm,vmx} for that.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
---
changes in v3:
 - use using_{svm,vmx} macro instead of IS_ENABLED(CONFIG_{SVM,VMX})
 - updated description
---
 xen/arch/x86/hvm/hvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 8334ab1711..7b8679bcd8 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -155,9 +155,9 @@ static int __init cf_check hvm_enable(void)
 {
     const struct hvm_function_table *fns = NULL;
 
-    if ( cpu_has_vmx )
+    if ( using_vmx )
         fns = start_vmx();
-    else if ( cpu_has_svm )
+    else if ( using_svm )
         fns = start_svm();
 
     if ( fns == NULL )
-- 
2.25.1
Re: [XEN PATCH v3 07/16] x86/hvm: guard AMD-V and Intel VT-x hvm_function_table initializers
Posted by Jan Beulich 5 months, 2 weeks ago
On 03.06.2024 13:20, Sergiy Kibrik wrote:
> From: Xenia Ragiadakou <burzalodowa@gmail.com>
> 
> Since start_svm() is AMD-V specific while start_vmx() is Intel VT-x specific,
> any of them can potentially be excluded from build completely with CONFIG_SVM
> or CONFIG_VMX options respectively, hence we have to explicitly check if
> they're available and use specific macros using_{svm,vmx} for that.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
yet again I think this could sensibly be folded with the earlier
two patches.

Jan
Re: [XEN PATCH v3 07/16] x86/hvm: guard AMD-V and Intel VT-x hvm_function_table initializers
Posted by Sergiy Kibrik 5 months, 2 weeks ago
07.06.24 11:01, Jan Beulich:
> On 03.06.2024 13:20, Sergiy Kibrik wrote:
>> From: Xenia Ragiadakou <burzalodowa@gmail.com>
>>
>> Since start_svm() is AMD-V specific while start_vmx() is Intel VT-x specific,
>> any of them can potentially be excluded from build completely with CONFIG_SVM
>> or CONFIG_VMX options respectively, hence we have to explicitly check if
>> they're available and use specific macros using_{svm,vmx} for that.
>>
>> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
>> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>
> yet again I think this could sensibly be folded with the earlier
> two patches.
> 

sure, I'll squash together patches 5,6,7

   -Sergiy