On 10.04.2020 06:10, Tian, Kevin wrote:

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a3d115b650..375e9cf368 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4511,6 +4511,7 @@ static int do_altp2m_op(
      case HVMOP_altp2m_get_mem_access:
      case HVMOP_altp2m_change_gfn:
      case HVMOP_altp2m_get_p2m_idx:
+    case HVMOP_altp2m_set_visibility:
          break;

      default:
@@ -4788,6 +4789,19 @@ static int do_altp2m_op(
          break;
      }

+    case HVMOP_altp2m_set_visibility:
+    {
+        unsigned int idx = a.u.set_visibility.altp2m_idx;
+
+        if ( a.u.set_visibility.pad )
+            rc = -EINVAL;
+        else if ( !altp2m_active(d) )
+            rc = -EOPNOTSUPP;
+        else
+            rc = p2m_set_altp2m_view_visibility(d, idx,
+                                                a.u.set_visibility.visible);
+    }
+
      default:
          ASSERT_UNREACHABLE();
      }
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d265ed46ad..bb44ef39a1 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2140,7 +2140,7 @@ static void vmx_vcpu_update_vmfunc_ve(struct
vcpu *v)
      {
          v->arch.hvm.vmx.secondary_exec_control |= mask;
          __vmwrite(VM_FUNCTION_CONTROL,
VMX_VMFUNC_EPTP_SWITCHING);
-        __vmwrite(EPTP_LIST_ADDR, virt_to_maddr(d->arch.altp2m_eptp));
+        __vmwrite(EPTP_LIST_ADDR, virt_to_maddr(d-
arch.altp2m_working_eptp));

Is "altp2m_visible_eptp" more accurate here? 'working' is a bit misleading
since even invisible eptp could still work but just not directly togged by
vmfunc...

Yes, you are right and I can change this before it is commited.


otherwise,
        Reviewed-by: Kevin Tian <kevin.t...@intel.com>

Thanks for the review,

Alex

Reply via email to