[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V7] x86/altp2m: Hypercall to set altp2m view visibility
- To: "Tian, Kevin" <kevin.tian@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Isaila Alexandru <aisaila@xxxxxxxxxxxxxxx>
- Date: Fri, 10 Apr 2020 09:44:07 +0300
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bitdefender.com; dmarc=pass action=none header.from=bitdefender.com; dkim=pass header.d=bitdefender.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g4Qrqahw16njwMMCAjAlS5t+9HBXe7nEJBv3Kid+mrE=; b=bd7vl3NMBpPFGZu/Y+VDejVTbzyPKLL+7lLgU/sjrcgahmMNxek4pElyf4gcAR93tTJ/wWIRjz8zsiSgrGS7kPkAgHdsVjuQErbfd+xkUp0AEE55MMiEkyJnQFYE5on4fI/jy6d7Qd2dOdfX2uPnLv+HPkX1qqGKUrpfp/kJ+Fp1AZ2QFzK6oahTOBEJjEjFTJSKS/GNpLS9SJcao22fkPNxhwqb4FrFqT6WkUWN33RctZ9gTyoCkt4Uivmc9BgViJLyCF4s0GYqO59kop78+EnoYP63hC48WZI4PbtULUQZ36398fja0OvkHRqFcwf65Dqf3m650ooejiG5ma328w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OT78v4F2Dlj3todmwRp4v7a8w6SP3gqgeHl5rwXihVjOP8FOsj0dEYy0yYGevY96MYQ/vfM1F49afpzppDCqiGFiiYPJ0oU8zVeRc6+bZgzXiFoyEr/jrXyi0yqUKrV/DjLr8Up6C/QK0UnwMDoJWFTpuy+Ge6Fig3sN32P7OPM7UcC/RbIFjMtebm17qd73uWdJQu2rgz89ijtBaHqfSW/3jCLxMJrta3LtUd+UdhBFxItvWSSVZ5f/VYMHa3wCE/QSvNFIsEIsvqOj4bcYkrhgyRVbYANJ/ehjpCqdGMPG0JoRmApyS5EaTw52hHhrvs+horxelaHysQ5QPZB3Bg==
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisaila@xxxxxxxxxxxxxxx;
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Fri, 10 Apr 2020 06:44:20 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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.tian@xxxxxxxxx>
Thanks for the review,
Alex
|