xen/ioreq: Make x86's IOREQ related dm-op handling common
authorJulien Grall <julien.grall@arm.com>
Fri, 29 Jan 2021 01:48:37 +0000 (03:48 +0200)
committerJulien Grall <jgrall@amazon.com>
Fri, 29 Jan 2021 16:55:23 +0000 (16:55 +0000)
commite6ddac90a098ca012754e11804dd9202cdabcdff
tree88cf16c8ba5f405fe365cfd1c58a2904a9868e80
parent1d9c45bd6382a0e823a3f2411c988df12921f2fb
xen/ioreq: Make x86's IOREQ related dm-op handling common

As a lot of x86 code can be re-used on Arm later on, this patch
moves the IOREQ related dm-op handling to the common code.

The idea is to have the top level dm-op handling arch-specific
and call into ioreq_server_dm_op() for otherwise unhandled ops.
Pros:
- More natural than doing it other way around (top level dm-op
handling common).
- Leave compat_dm_op() in x86 code.
Cons:
- Code duplication. Both arches have to duplicate dm_op(), etc.

Make the corresponding functions static and rename them according
to the new naming scheme (including dropping the "hvm" prefixes).

Introduce common dm.c file as a resting place for the do_dm_op()
(which is identical for both Arm and x86) to minimize code duplication.
The common DM feature is supposed to be built with IOREQ_SERVER
option enabled (as well as the IOREQ feature), which is selected
for x86's config HVM for now.

Also update XSM code a bit to let dm-op be used on Arm.

This support is going to be used on Arm to be able run device
emulator outside of Xen hypervisor.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
[On Arm only]
Tested-by: Wei Chen <Wei.Chen@arm.com>
xen/arch/x86/hvm/dm.c
xen/common/Makefile
xen/common/dm.c [new file with mode: 0644]
xen/common/ioreq.c
xen/include/xen/dm.h [new file with mode: 0644]
xen/include/xen/ioreq.h
xen/include/xsm/dummy.h
xen/include/xsm/xsm.h
xen/xsm/dummy.c
xen/xsm/flask/hooks.c