xen/shbuf: switch xen-front-pgdir-shbuf to use INVALID_GRANT_REF
Instead of using a private macro for an invalid grant reference use the common one. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Tested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> # Arm64 only Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
parent
bd506c7812
commit
888fd787f3
1 changed files with 5 additions and 13 deletions
|
@ -21,15 +21,6 @@
|
||||||
|
|
||||||
#include <xen/xen-front-pgdir-shbuf.h>
|
#include <xen/xen-front-pgdir-shbuf.h>
|
||||||
|
|
||||||
#ifndef GRANT_INVALID_REF
|
|
||||||
/*
|
|
||||||
* FIXME: usage of grant reference 0 as invalid grant reference:
|
|
||||||
* grant reference 0 is valid, but never exposed to a PV driver,
|
|
||||||
* because of the fact it is already in use/reserved by the PV console.
|
|
||||||
*/
|
|
||||||
#define GRANT_INVALID_REF 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This structure represents the structure of a shared page
|
* This structure represents the structure of a shared page
|
||||||
* that contains grant references to the pages of the shared
|
* that contains grant references to the pages of the shared
|
||||||
|
@ -38,6 +29,7 @@
|
||||||
*/
|
*/
|
||||||
struct xen_page_directory {
|
struct xen_page_directory {
|
||||||
grant_ref_t gref_dir_next_page;
|
grant_ref_t gref_dir_next_page;
|
||||||
|
#define XEN_GREF_LIST_END 0
|
||||||
grant_ref_t gref[1]; /* Variable length */
|
grant_ref_t gref[1]; /* Variable length */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,7 +75,7 @@ grant_ref_t
|
||||||
xen_front_pgdir_shbuf_get_dir_start(struct xen_front_pgdir_shbuf *buf)
|
xen_front_pgdir_shbuf_get_dir_start(struct xen_front_pgdir_shbuf *buf)
|
||||||
{
|
{
|
||||||
if (!buf->grefs)
|
if (!buf->grefs)
|
||||||
return GRANT_INVALID_REF;
|
return INVALID_GRANT_REF;
|
||||||
|
|
||||||
return buf->grefs[0];
|
return buf->grefs[0];
|
||||||
}
|
}
|
||||||
|
@ -142,7 +134,7 @@ void xen_front_pgdir_shbuf_free(struct xen_front_pgdir_shbuf *buf)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < buf->num_grefs; i++)
|
for (i = 0; i < buf->num_grefs; i++)
|
||||||
if (buf->grefs[i] != GRANT_INVALID_REF)
|
if (buf->grefs[i] != INVALID_GRANT_REF)
|
||||||
gnttab_end_foreign_access(buf->grefs[i], 0UL);
|
gnttab_end_foreign_access(buf->grefs[i], 0UL);
|
||||||
}
|
}
|
||||||
kfree(buf->grefs);
|
kfree(buf->grefs);
|
||||||
|
@ -355,7 +347,7 @@ static void backend_fill_page_dir(struct xen_front_pgdir_shbuf *buf)
|
||||||
}
|
}
|
||||||
/* Last page must say there is no more pages. */
|
/* Last page must say there is no more pages. */
|
||||||
page_dir = (struct xen_page_directory *)ptr;
|
page_dir = (struct xen_page_directory *)ptr;
|
||||||
page_dir->gref_dir_next_page = GRANT_INVALID_REF;
|
page_dir->gref_dir_next_page = XEN_GREF_LIST_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -384,7 +376,7 @@ static void guest_fill_page_dir(struct xen_front_pgdir_shbuf *buf)
|
||||||
|
|
||||||
if (grefs_left <= XEN_NUM_GREFS_PER_PAGE) {
|
if (grefs_left <= XEN_NUM_GREFS_PER_PAGE) {
|
||||||
to_copy = grefs_left;
|
to_copy = grefs_left;
|
||||||
page_dir->gref_dir_next_page = GRANT_INVALID_REF;
|
page_dir->gref_dir_next_page = XEN_GREF_LIST_END;
|
||||||
} else {
|
} else {
|
||||||
to_copy = XEN_NUM_GREFS_PER_PAGE;
|
to_copy = XEN_NUM_GREFS_PER_PAGE;
|
||||||
page_dir->gref_dir_next_page = buf->grefs[i + 1];
|
page_dir->gref_dir_next_page = buf->grefs[i + 1];
|
||||||
|
|
Loading…
Reference in a new issue