xen/arm: atomic: Allow read_atomic() to be used in more cases
authorJulien Grall <jgrall@amazon.com>
Sat, 2 May 2020 14:06:22 +0000 (15:06 +0100)
committerJulien Grall <jgrall@amazon.com>
Mon, 11 May 2020 09:47:57 +0000 (10:47 +0100)
commit9efda0281b29ac8ac5793457b8f71e6ff35f898c
tree0b5a327fe3698e4c1dffe2724fbb3d3a8356c7c9
parent3748c81fa1ff5e67c0442978c583e722820b1690
xen/arm: atomic: Allow read_atomic() to be used in more cases

The current implementation of read_atomic() on Arm will not allow to:
    1) Read a value from a pointer to const because the temporary
    variable will be const and therefore it is not possible to assign
    any value. This can be solved by using a union between the type and
    a char[0].
    2) Read a pointer value (e.g void *) because the switch contains
    cast from other type than the size of a pointer. This can be solved by
    by introducing a static inline for the switch and use void * for the
    pointer.

Reported-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/include/asm-arm/atomic.h