diff options
| author | David Woodhouse <dwmw@amazon.co.uk> | 2023-01-02 01:13:46 +0000 |
|---|---|---|
| committer | David Woodhouse <dwmw@amazon.co.uk> | 2023-03-07 17:04:30 +0000 |
| commit | 15e283c5b684c2e502e9327186eb89eb69c68812 (patch) | |
| tree | 6b60dc50964407859bd048adf923a590f8e89abb /include/hw/xen/xen_backend_ops.h | |
| parent | f80fad16afa5aebb8cce919e87f6c58fa03d16e6 (diff) | |
| download | focaccia-qemu-15e283c5b684c2e502e9327186eb89eb69c68812.tar.gz focaccia-qemu-15e283c5b684c2e502e9327186eb89eb69c68812.zip | |
hw/xen: Add foreignmem operations to allow redirection to internal emulation
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
Diffstat (limited to 'include/hw/xen/xen_backend_ops.h')
| -rw-r--r-- | include/hw/xen/xen_backend_ops.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/hw/xen/xen_backend_ops.h b/include/hw/xen/xen_backend_ops.h index 6f9d8e2c62..0dff06bbde 100644 --- a/include/hw/xen/xen_backend_ops.h +++ b/include/hw/xen/xen_backend_ops.h @@ -214,6 +214,32 @@ static inline int qemu_xen_gnttab_unmap(xengnttab_handle *xgt, return xen_gnttab_ops->unmap(xgt, start_address, refs, count); } +struct foreignmem_backend_ops { + void *(*map)(uint32_t dom, void *addr, int prot, size_t pages, + xen_pfn_t *pfns, int *errs); + int (*unmap)(void *addr, size_t pages); +}; + +extern struct foreignmem_backend_ops *xen_foreignmem_ops; + +static inline void *qemu_xen_foreignmem_map(uint32_t dom, void *addr, int prot, + size_t pages, xen_pfn_t *pfns, + int *errs) +{ + if (!xen_foreignmem_ops) { + return NULL; + } + return xen_foreignmem_ops->map(dom, addr, prot, pages, pfns, errs); +} + +static inline int qemu_xen_foreignmem_unmap(void *addr, size_t pages) +{ + if (!xen_foreignmem_ops) { + return -ENOSYS; + } + return xen_foreignmem_ops->unmap(addr, pages); +} + void setup_xen_backend_ops(void); #endif /* QEMU_XEN_BACKEND_OPS_H */ |