xen/guest_access: Consolidate guest access helpers in xen/guest_access.h
authorJulien Grall <jgrall@amazon.com>
Sat, 4 Apr 2020 11:33:16 +0000 (12:33 +0100)
committerJulien Grall <jgrall@amazon.com>
Mon, 21 Sep 2020 16:09:11 +0000 (17:09 +0100)
commit5b619481becfc4681804ea7193a2ee42a50fd468
tree9beab852279421ab2a53c10615d15c9a6481f8a1
parent6edcdb4e5716626b2206f2b627e57a38ad2c3f59
xen/guest_access: Consolidate guest access helpers in xen/guest_access.h

Most of the helpers to access guest memory are implemented the same way
on Arm and x86. The only differences are:
    - guest_handle_to_param(): while on x86 XEN_GUEST_HANDLE()
      and XEN_GUEST_HANDLE_PARAM() are the same, they are not on Arm. It
      is still fine to use the Arm implementation on x86.
    - __clear_guest_offset(): Interestingly the prototype does not match
      between the x86 and Arm. However, the Arm one is bogus. So the x86
      implementation can be used.
    - guest_handle{,_subrange}_okay(): They are validly differing
      because Arm is only supporting auto-translated guest and therefore
      handles are always valid.

In the past, the ia64 and ppc64 port use a different model to access
guest parameter. They have been long gone now.

Given Xen currently only support 2 archictures, it is too soon to have a
directory asm-generic as it is not possible to differentiate it with the
existing directory xen/. If/When there is a 3rd port, we can decide to
create the new directory if that new port decide to use a different way
to access guest parameter.

For now, consolidate it in xen/guest_access.h.

While it would be possible to adjust the coding style at the same, this
is left for a follow-up patch so 'diff' can be used to check the
consolidation was done correctly.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sttabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/include/asm-arm/guest_access.h
xen/include/asm-x86/guest_access.h
xen/include/xen/guest_access.h