diff mbox

[v2,3/3] x86/hvm: check HAP before enabling nested VMX

Message ID 20170223094117.7212-3-haozhong.zhang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Haozhong Zhang Feb. 23, 2017, 9:41 a.m. UTC
The current implementation of nested VMX cannot work without HAP.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Beulich Feb. 24, 2017, 3:27 p.m. UTC | #1
>>> On 23.02.17 at 10:41, <haozhong.zhang@intel.com> wrote:
> The current implementation of nested VMX cannot work without HAP.

Of course the better route would be to fix the actual problem,
the more that - according to other feedback you've got elsewhere -
this apparently is a regression. Nevertheless I can see you perhaps
not having the time to do so, so as a band aid it's likely fine.
However ...

> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -4123,7 +4123,7 @@ static int hvmop_set_param(
>           * Remove the check below once we have
>           * shadow-on-shadow.
>           */
> -        if ( cpu_has_svm && !paging_mode_hap(d) && a.value )
> +        if ( (cpu_has_svm || cpu_has_vmx) && !paging_mode_hap(d) && a.value )

... you want to simply drop the cpu_has_svm check here instead of
adding to it, as with neither SVM nor VMX available execution will
never come here.

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 6621d62..b8db808 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4123,7 +4123,7 @@  static int hvmop_set_param(
          * Remove the check below once we have
          * shadow-on-shadow.
          */
-        if ( cpu_has_svm && !paging_mode_hap(d) && a.value )
+        if ( (cpu_has_svm || cpu_has_vmx) && !paging_mode_hap(d) && a.value )
             rc = -EINVAL;
         if ( a.value &&
              d->arch.hvm_domain.params[HVM_PARAM_ALTP2M] )