Skip to content

Commit 888fd78

Browse files
committed
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 <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Reviewed-by: Oleksandr Tyshchenko <[email protected]> Tested-by: Oleksandr Tyshchenko <[email protected]> # Arm64 only Signed-off-by: Juergen Gross <[email protected]>
1 parent bd506c7 commit 888fd78

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

drivers/xen/xen-front-pgdir-shbuf.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@
2121

2222
#include <xen/xen-front-pgdir-shbuf.h>
2323

24-
#ifndef GRANT_INVALID_REF
25-
/*
26-
* FIXME: usage of grant reference 0 as invalid grant reference:
27-
* grant reference 0 is valid, but never exposed to a PV driver,
28-
* because of the fact it is already in use/reserved by the PV console.
29-
*/
30-
#define GRANT_INVALID_REF 0
31-
#endif
32-
3324
/**
3425
* This structure represents the structure of a shared page
3526
* that contains grant references to the pages of the shared
@@ -38,6 +29,7 @@
3829
*/
3930
struct xen_page_directory {
4031
grant_ref_t gref_dir_next_page;
32+
#define XEN_GREF_LIST_END 0
4133
grant_ref_t gref[1]; /* Variable length */
4234
};
4335

@@ -83,7 +75,7 @@ grant_ref_t
8375
xen_front_pgdir_shbuf_get_dir_start(struct xen_front_pgdir_shbuf *buf)
8476
{
8577
if (!buf->grefs)
86-
return GRANT_INVALID_REF;
78+
return INVALID_GRANT_REF;
8779

8880
return buf->grefs[0];
8981
}
@@ -142,7 +134,7 @@ void xen_front_pgdir_shbuf_free(struct xen_front_pgdir_shbuf *buf)
142134
int i;
143135

144136
for (i = 0; i < buf->num_grefs; i++)
145-
if (buf->grefs[i] != GRANT_INVALID_REF)
137+
if (buf->grefs[i] != INVALID_GRANT_REF)
146138
gnttab_end_foreign_access(buf->grefs[i], 0UL);
147139
}
148140
kfree(buf->grefs);
@@ -355,7 +347,7 @@ static void backend_fill_page_dir(struct xen_front_pgdir_shbuf *buf)
355347
}
356348
/* Last page must say there is no more pages. */
357349
page_dir = (struct xen_page_directory *)ptr;
358-
page_dir->gref_dir_next_page = GRANT_INVALID_REF;
350+
page_dir->gref_dir_next_page = XEN_GREF_LIST_END;
359351
}
360352

361353
/**
@@ -384,7 +376,7 @@ static void guest_fill_page_dir(struct xen_front_pgdir_shbuf *buf)
384376

385377
if (grefs_left <= XEN_NUM_GREFS_PER_PAGE) {
386378
to_copy = grefs_left;
387-
page_dir->gref_dir_next_page = GRANT_INVALID_REF;
379+
page_dir->gref_dir_next_page = XEN_GREF_LIST_END;
388380
} else {
389381
to_copy = XEN_NUM_GREFS_PER_PAGE;
390382
page_dir->gref_dir_next_page = buf->grefs[i + 1];

0 commit comments

Comments
 (0)