diff mbox series

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

Message ID 25d4ade03f22ae4eb260af3eae5f48528f2e3ca8.1717410850.git.Sergiy_Kibrik@epam.com (mailing list archive)
State New, archived
Headers show
Series x86: make cpu virtualization support configurable | expand

Commit Message

Sergiy Kibrik June 3, 2024, 11:20 a.m. UTC
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(-)

Comments

Jan Beulich June 7, 2024, 8:01 a.m. UTC | #1
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
Sergiy Kibrik June 10, 2024, 10:30 a.m. UTC | #2
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
diff mbox series

Patch

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 )