diff options
author | Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> | 2020-10-15 19:44:31 +0300 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2020-10-23 16:06:19 +0100 |
commit | b45368e1c8bd471025198b2f16bb279e672f762b (patch) | |
tree | bf60fdf5520afe70c0e1657fd489bf254b538bd1 | |
parent | 9631786dd6dd6ed56f8ad727f8c50d3efb79d352 (diff) |
xen/ioreq: Make x86's send_invalidate_req() common
As the IOREQ is a common feature now and we also need to
invalidate qemu/demu mapcache on Arm when the required condition
occurs this patch moves this function to the common code
(and remames it to send_invalidate_ioreq).
This patch also moves per-domain qemu_mapcache_invalidate
variable out of the arch sub-struct.
The subsequent patch will add mapcache invalidation handling on Arm.
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
CC: Julien Grall <julien.grall@arm.com>
Message-Id: <1602780274-29141-21-git-send-email-olekstysh@gmail.com>
-rw-r--r-- | xen/arch/x86/hvm/hypercall.c | 4 | ||||
-rw-r--r-- | xen/arch/x86/hvm/io.c | 14 | ||||
-rw-r--r-- | xen/common/ioreq.c | 14 | ||||
-rw-r--r-- | xen/include/asm-x86/hvm/domain.h | 1 | ||||
-rw-r--r-- | xen/include/asm-x86/hvm/io.h | 1 | ||||
-rw-r--r-- | xen/include/xen/ioreq.h | 1 | ||||
-rw-r--r-- | xen/include/xen/sched.h | 2 |
7 files changed, 21 insertions, 16 deletions
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index af3ef58ef9..8ea5eb2c23 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -20,6 +20,7 @@ */ #include <xen/lib.h> #include <xen/hypercall.h> +#include <xen/ioreq.h> #include <xen/nospec.h> #include <asm/hvm/emulate.h> @@ -45,6 +46,9 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) else rc = compat_memory_op(cmd, arg); + if ( (cmd & MEMOP_CMD_MASK) == XENMEM_decrease_reservation ) + curr->domain->qemu_mapcache_invalidate = true; + return rc; } diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index 2d03ffe91a..e51304cd81 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -64,20 +64,6 @@ void send_timeoffset_req(unsigned long timeoff) gprintk(XENLOG_ERR, "Unsuccessful timeoffset update\n"); } -/* Ask ioemu mapcache to invalidate mappings. */ -void send_invalidate_req(void) -{ - ioreq_t p = { - .type = IOREQ_TYPE_INVALIDATE, - .size = 4, - .dir = IOREQ_WRITE, - .data = ~0UL, /* flush all */ - }; - - if ( broadcast_ioreq(&p, false) != 0 ) - gprintk(XENLOG_ERR, "Unsuccessful map-cache invalidate\n"); -} - bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate, const char *descr) { struct hvm_emulate_ctxt ctxt; diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c index a72bc0e819..2203cf00e9 100644 --- a/xen/common/ioreq.c +++ b/xen/common/ioreq.c @@ -35,6 +35,20 @@ #include <public/hvm/ioreq.h> #include <public/hvm/params.h> +/* Ask ioemu mapcache to invalidate mappings. */ +void send_invalidate_ioreq(void) +{ + ioreq_t p = { + .type = IOREQ_TYPE_INVALIDATE, + .size = 4, + .dir = IOREQ_WRITE, + .data = ~0UL, /* flush all */ + }; + + if ( broadcast_ioreq(&p, false) != 0 ) + gprintk(XENLOG_ERR, "Unsuccessful map-cache invalidate\n"); +} + static void set_ioreq_server(struct domain *d, unsigned int id, struct ioreq_server *s) { diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h index c3af33951a..caab3a97d8 100644 --- a/xen/include/asm-x86/hvm/domain.h +++ b/xen/include/asm-x86/hvm/domain.h @@ -117,7 +117,6 @@ struct hvm_domain { struct viridian_domain *viridian; - bool_t qemu_mapcache_invalidate; bool_t is_s3_suspended; /* diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h index fb64294157..3da0136159 100644 --- a/xen/include/asm-x86/hvm/io.h +++ b/xen/include/asm-x86/hvm/io.h @@ -97,7 +97,6 @@ bool relocate_portio_handler( unsigned int size); void send_timeoffset_req(unsigned long timeoff); -void send_invalidate_req(void); bool handle_mmio_with_translation(unsigned long gla, unsigned long gpfn, struct npfec); bool handle_pio(uint16_t port, unsigned int size, int dir); diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h index 0679fef9af..aad682f4de 100644 --- a/xen/include/xen/ioreq.h +++ b/xen/include/xen/ioreq.h @@ -126,6 +126,7 @@ struct ioreq_server *select_ioreq_server(struct domain *d, int send_ioreq(struct ioreq_server *s, ioreq_t *proto_p, bool buffered); unsigned int broadcast_ioreq(ioreq_t *p, bool buffered); +void send_invalidate_ioreq(void); void ioreq_init(struct domain *d); diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 290cddb25a..1b8c6ebcd1 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -555,6 +555,8 @@ struct domain struct ioreq_server *server[MAX_NR_IOREQ_SERVERS]; unsigned int nr_servers; } ioreq_server; + + bool qemu_mapcache_invalidate; #endif }; |