From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tamas K Lengyel Subject: Re: Followup: HVMOP_altp2m_vcpu_enable_notify code example usage Date: Fri, 28 Oct 2016 12:56:25 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7192305783602149897==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c04pp-0006fr-CD for xen-devel@lists.xenproject.org; Fri, 28 Oct 2016 10:56:29 +0000 Received: by mail-wm0-f66.google.com with SMTP id m83so6894119wmc.0 for ; Fri, 28 Oct 2016 03:56:27 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Andrew Cooper Cc: matt@starlab.io, Xen-devel List-Id: xen-devel@lists.xenproject.org --===============7192305783602149897== Content-Type: multipart/alternative; boundary=089e01161dfaaeabb3053feab5b4 --089e01161dfaaeabb3053feab5b4 Content-Type: text/plain; charset=UTF-8 On Thu, Oct 27, 2016 at 12:45 AM, Andrew Cooper wrote: > On 26/10/2016 20:37, Matt Leinhos wrote: > > A while ago there was a thread by the same name in this group (see > > https://lists.xen.org/archives/html/xen-devel/2016-08/msg02591.html). > > > > I've looked through the thread and did not see a resolution: do we have > > an example handler for #VE - preferably on x86_64? I haven't found such > > a handler in the xen code or through searches. > > > > I am attempting to use the altp2m API from a domU and need to handle #VE. > > A #VE handler is only interesting for a domU, knowing it is running > under an altp2m-capable hypervisor. > > The hypervisor itself won't ever receive #VE from real hardware, which > is why there is no example code in Xen. > Well, unless Xen is running in a nested setting ;) > > I don't know if there is any public example code, but a #VE handler in > domU is intended to work very similarly to a plain #PF handler. #VE > specifically means "there is an EPT translation but the access failed > for permission reasons, and the guest has elected to handle this fault > itself". It is then up to the domU kernel to decide what to do; whether > to terminate the process/thread which cause the violation, or to alter > the permissions and rerun the instruction. > Correct. The guest itself needs to issue the appropriate HVMOP hypercalls to enable #VE and register the memory location where the trap info should be stored at. The only caveat is that only permission faults in altp2m view 1-10 will generate a #VE in the domU, view 0 won't (at least when it is emulated on hw without real #VE support). Tamas --089e01161dfaaeabb3053feab5b4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Thu, Oct 27, 2016 at 12:45 AM, Andrew Cooper <= ;andrew.coo= per3@citrix.com> wrote:
<= span class=3D"">On 26/10/2016 20:37, Matt Leinhos wrote:
> A while ago there was a thread by the same name in this group (see > https://lists.xen.org/archives/html/xen-devel/2016-08/msg02591.html).
>
> I've looked through the thread and did not see a resolution: do w= e have
> an example handler for #VE - preferably on x86_64? I haven't foun= d such
> a handler in the xen code or through searches.
>
> I am attempting to use the altp2m API from a domU and need to handle = #VE.

A #VE handler is only interesting for a domU, knowing it is running=
under an altp2m-capable hypervisor.

The hypervisor itself won't ever receive #VE from real hardware, which=
is why there is no example code in Xen.

Well, unless Xen is running in a nested setting ;)
=C2=A0<= /div>

I don't know if there is any public example code, but a #VE handler in=
domU is intended to work very similarly to a plain #PF handler.=C2=A0 #VE<= br> specifically means "there is an EPT translation but the access failed=
for permission reasons, and the guest has elected to handle this fault
= itself".=C2=A0 It is then up to the domU kernel to decide what to do;= whether
to terminate the process/thread which cause the violation, or to alter
= the permissions and rerun the instruction.

Correct. Th= e guest itself needs to issue the appropriate HVMOP hypercalls to enable #= VE and register the memory location where the trap info should be stored a= t. The only caveat is that only permission faults in altp2m view 1-10 will= generate a #VE in the domU, view 0 won't (at least when it is emulate= d on hw without real #VE support).

Tamas
--089e01161dfaaeabb3053feab5b4-- --===============7192305783602149897== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============7192305783602149897==--