x86/pv: Export pv_hypercall_table[] rather than working around it in several ways
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 24 Jan 2018 12:01:55 +0000 (12:01 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 24 Jan 2018 18:22:44 +0000 (18:22 +0000)
commit1252e2823117346e1aad0c5f17cc76200194f808
tree0fefe92d4b82a583b4f152c163037ca2ebc8f7d9
parenta5579ee79ef8546dd47abe34d73dc9a69a14bbda
x86/pv: Export pv_hypercall_table[] rather than working around it in several ways

The functions in compat.c are thing wrappers around the main hypercalls,
massaging certain parameters.  However, they second-guess the content of
pv_hypercall_table[], which is problematic for the shim case.  Instead,
arrange for them to call via function pointer, which removes the need for
pv_get_hypercall_handler().

With pv_hypercall_table[] exported, there is no need for
pv_hypercall_table_replace(), so its single callsite gets modified to cope.
The backing code behind __va(__pa()) is substantial, and there is no need to
calculate it repeatedly (Xen's .rodata is also contiguous in the directmap).

While adjusting the declarations, guard content in arch/x86/pv with CONFIG_PV.

The net difference is:
  add/remove: 0/2 grow/shrink: 4/1 up/down: 176/-321 (-145)
  function                                     old     new   delta
  pv_shim_setup_dom                           1130    1266    +136
  do_sched_op_compat                           176     192     +16
  compat_physdev_op_compat                      90     106     +16
  do_physdev_op_compat                          98     106      +8
  do_event_channel_op_compat                   145     123     -22
  pv_get_hypercall_handler                      28       -     -28
  pv_hypercall_table_replace                   271       -    -271

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/compat.c
xen/arch/x86/pv/hypercall.c
xen/arch/x86/pv/shim.c
xen/include/asm-x86/hypercall.h