mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
hw/xen: Pass grant ref to gnttab unmap operation
The previous commit introduced redirectable gnttab operations fairly much like-for-like, with the exception of the extra arguments to the ->open() call which were always NULL/0 anyway. This *changes* the arguments to the ->unmap() operation to include the original ref# that was mapped. Under real Xen it isn't necessary; all we need to do from QEMU is munmap(), then the kernel will release the grant, and Xen does the tracking/refcounting for the guest. When we have emulated grant tables though, we need to do all that for ourselves. So let's have the back ends keep track of what they mapped and pass it in to the ->unmap() method for us. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
parent
c412ba47b2
commit
f80fad16af
11 changed files with 50 additions and 26 deletions
|
@ -144,7 +144,8 @@ struct gnttab_backend_ops {
|
|||
int (*set_max_grants)(xengnttab_handle *xgt, uint32_t nr_grants);
|
||||
void *(*map_refs)(xengnttab_handle *xgt, uint32_t count, uint32_t domid,
|
||||
uint32_t *refs, int prot);
|
||||
int (*unmap)(xengnttab_handle *xgt, void *start_address, uint32_t count);
|
||||
int (*unmap)(xengnttab_handle *xgt, void *start_address, uint32_t *refs,
|
||||
uint32_t count);
|
||||
};
|
||||
|
||||
extern struct gnttab_backend_ops *xen_gnttab_ops;
|
||||
|
@ -204,13 +205,13 @@ static inline void *qemu_xen_gnttab_map_refs(xengnttab_handle *xgt,
|
|||
}
|
||||
|
||||
static inline int qemu_xen_gnttab_unmap(xengnttab_handle *xgt,
|
||||
void *start_address,
|
||||
void *start_address, uint32_t *refs,
|
||||
uint32_t count)
|
||||
{
|
||||
if (!xen_gnttab_ops) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
return xen_gnttab_ops->unmap(xgt, start_address, count);
|
||||
return xen_gnttab_ops->unmap(xgt, start_address, refs, count);
|
||||
}
|
||||
|
||||
void setup_xen_backend_ops(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue