x86/pv: Implement pv_inject_{event,page_fault,hw_exception}()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 24 Nov 2016 18:18:36 +0000 (18:18 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 2 Dec 2016 17:23:01 +0000 (17:23 +0000)
commit9222b445e6a5bc25e1f6fff90ff5e2d5ed7f1116
tree61601deac87d04d5a67b86e2e3ef3288e7ceb13b
parent3a9c68ff0f65022e4424136f1cc6cb2b30294e50
x86/pv: Implement pv_inject_{event,page_fault,hw_exception}()

To help with event injection improvements for the PV uses of x86_emulate(),
implement a event injection API which matches its hvm counterpart.

This is started with taking do_guest_trap() and modifying its calling API to
pv_inject_event(), subsequentally implementing the former in terms of the
latter.

The existing propagate_page_fault() is fairly similar to
pv_inject_page_fault(), although it has a return value.  Only a single caller
makes use of the return value, and non-NULL is only returned if the passed cr2
is non-canonical.  Opencode this single case in
handle_gdt_ldt_mapping_fault(), allowing propagate_page_fault() to become
void.

The call to reserved_bit_page_fault() in propagate_page_fault() was
conceptually wrong to start with.  Complaining about reserved bits should be
part of handling the pagefault itself, not part of injecting a pagefault into
the guest.  It is therefore moved ahead of the injection call in
do_page_fault() to compensate.

The remaining #PF specific bits are moved into pv_inject_event(), and
pv_inject_page_fault() is implemented as a static inline wrapper.

No practical change from a guests point of view.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm.c
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/traps.c
xen/include/asm-x86/domain.h
xen/include/asm-x86/mm.h