x86/mm: add an extra command to HYPERVISOR_mmu_update...
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 30 Oct 2017 11:39:33 +0000 (11:39 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 3 Apr 2018 16:05:12 +0000 (17:05 +0100)
commitd3e69e89a2cb9229ff810cad1ea7b986640b8cc9
tree3bdb53169a903645505a0e05e03e6569d8eca62f
parent6e387461ed6d8952de43a2cc76a4e5e75043f3e7
x86/mm: add an extra command to HYPERVISOR_mmu_update...

...to allow the calling domain to prevent translation of specified l1e
value.

Despite what the comment in public/xen.h might imply, specifying a
command value of MMU_NORMAL_PT_UPDATE will not simply update an l1e with
the specified value. Instead, mod_l1_entry() tests whether foreign_dom
has PG_translate set in its paging mode and, if it does, assumes that the
the pfn value in the l1e is a gfn rather than an mfn.

To allow PV tools domain to map mfn values from a previously issued
HYPERVISOR_memory_op:XENMEM_acquire_resource, there needs to be a way
to tell HYPERVISOR_mmu_update that the specific l1e value does not
require translation regardless of the paging mode of foreign_dom. This
patch therefore defines a new command value, MMU_PT_UPDATE_NO_TRANSLATE,
which has the same semantics as MMU_NORMAL_PT_UPDATE except that the
paging mode of foreign_dom is ignored and the l1e value is used verbatim.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm.c
xen/include/public/xen.h