mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-08 16:07:39 -06:00
hw/xen: Add gnttab operations to allow redirection to internal emulation
Move the existing code using libxengnttab to xen-operations.c and allow the operations to be redirected so that we can add emulation of grant table mapping for backend drivers. In emulation, mapping more than one grant ref to be virtually contiguous would be fairly difficult. The best way to do it might be to make the ram_block mappings actually backed by a file (shmem or a deleted file, perhaps) so that we can have multiple *shared* mappings of it. But that would be fairly intrusive. Making the backend drivers cope with page *lists* instead of expecting the mapping to be contiguous is also non-trivial, since some structures would actually *cross* page boundaries (e.g. the 32-bit blkif responses which are 12 bytes). So for now, we'll support only single-page mappings in emulation. Add a XEN_GNTTAB_OP_FEATURE_MAP_MULTIPLE flag to indicate that the native Xen implementation *does* support multi-page maps, and a helper function to query it. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
parent
b6cacfea0b
commit
c412ba47b2
9 changed files with 280 additions and 272 deletions
|
@ -28,17 +28,6 @@ extern xc_interface *xen_xc;
|
|||
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40701
|
||||
|
||||
typedef xc_interface xenforeignmemory_handle;
|
||||
typedef xc_gnttab xengnttab_handle;
|
||||
|
||||
#define xengnttab_open(l, f) xc_gnttab_open(l, f)
|
||||
#define xengnttab_close(h) xc_gnttab_close(h)
|
||||
#define xengnttab_set_max_grants(h, n) xc_gnttab_set_max_grants(h, n)
|
||||
#define xengnttab_map_grant_ref(h, d, r, p) xc_gnttab_map_grant_ref(h, d, r, p)
|
||||
#define xengnttab_unmap(h, a, n) xc_gnttab_munmap(h, a, n)
|
||||
#define xengnttab_map_grant_refs(h, c, d, r, p) \
|
||||
xc_gnttab_map_grant_refs(h, c, d, r, p)
|
||||
#define xengnttab_map_domain_grant_refs(h, c, d, r, p) \
|
||||
xc_gnttab_map_domain_grant_refs(h, c, d, r, p)
|
||||
|
||||
#define xenforeignmemory_open(l, f) xen_xc
|
||||
#define xenforeignmemory_close(h)
|
||||
|
@ -58,7 +47,6 @@ static inline void *xenforeignmemory_map(xc_interface *h, uint32_t dom,
|
|||
|
||||
#else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 40701 */
|
||||
|
||||
#include <xengnttab.h>
|
||||
#include <xenforeignmemory.h>
|
||||
|
||||
#endif
|
||||
|
@ -648,31 +636,4 @@ static inline int xen_set_ioreq_server_state(domid_t dom,
|
|||
|
||||
#endif
|
||||
|
||||
/* Xen before 4.8 */
|
||||
|
||||
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 40800
|
||||
|
||||
struct xengnttab_grant_copy_segment {
|
||||
union xengnttab_copy_ptr {
|
||||
void *virt;
|
||||
struct {
|
||||
uint32_t ref;
|
||||
uint16_t offset;
|
||||
uint16_t domid;
|
||||
} foreign;
|
||||
} source, dest;
|
||||
uint16_t len;
|
||||
uint16_t flags;
|
||||
int16_t status;
|
||||
};
|
||||
|
||||
typedef struct xengnttab_grant_copy_segment xengnttab_grant_copy_segment_t;
|
||||
|
||||
static inline int xengnttab_grant_copy(xengnttab_handle *xgt, uint32_t count,
|
||||
xengnttab_grant_copy_segment_t *segs)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* QEMU_HW_XEN_COMMON_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue