iPXE
|
Xen grant tables. More...
#include <stdint.h>
#include <strings.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/io.h>
#include <ipxe/xen.h>
#include <ipxe/xengrant.h>
Go to the source code of this file.
Macros | |
#define | XENGRANT_TRY_VERSION 1 |
Grant table version to try setting. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
int | xengrant_init (struct xen_hypervisor *xen) |
Initialise grant table. More... | |
int | xengrant_alloc (struct xen_hypervisor *xen, grant_ref_t *refs, unsigned int count) |
Allocate grant references. More... | |
void | xengrant_free (struct xen_hypervisor *xen, grant_ref_t *refs, unsigned int count) |
Free grant references. More... | |
Xen grant tables.
Definition in file xengrant.c.
#define XENGRANT_TRY_VERSION 1 |
Grant table version to try setting.
Using version 1 grant tables limits guests to using 16TB of grantable RAM, and prevents the use of subpage grants. Some versions of the Xen hypervisor refuse to allow the grant table version to be set after the first grant references have been created, so the loaded operating system may be stuck with whatever choice we make here. We therefore currently use version 2 grant tables, since they give the most flexibility to the loaded OS.
Current versions (7.2.0) of the Windows PV drivers have no support for version 2 grant tables, and will merrily create version 1 entries in what the hypervisor believes to be a version 2 table. This causes some confusion.
Avoid this problem by attempting to use version 1 tables, since otherwise we may render Windows unable to boot.
Play nicely with other potential bootloaders by accepting either version 1 or version 2 grant tables (if we are unable to set our requested version).
Definition at line 62 of file xengrant.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
int xengrant_init | ( | struct xen_hypervisor * | xen | ) |
Initialise grant table.
xen | Xen hypervisor |
rc | Return status code |
Definition at line 70 of file xengrant.c.
References DBGC, DOMID_SELF, ENOTSUP, EXEN, fls, xen_hypervisor::grant, xen_grant::len, PAGE_SIZE, rc, xen_grant::shift, size, strerror(), v1, v2, version, and XENGRANT_TRY_VERSION.
Referenced by hvm_map_grant().
int xengrant_alloc | ( | struct xen_hypervisor * | xen, |
grant_ref_t * | refs, | ||
unsigned int | count | ||
) |
Allocate grant references.
xen | Xen hypervisor |
refs | Grant references to fill in |
count | Number of references |
rc | Return status code |
Definition at line 148 of file xengrant.c.
References assert(), count, DBGC, DBGC2, DOMID_SELF, ENOBUFS, GNTTAB_NR_RESERVED_ENTRIES, xen_hypervisor::grant, GTF_type_mask, hdr, readw(), xen_grant::ref, ref, refs, xen_grant::used, writew, and xengrant_zero().
Referenced by netfront_probe().
void xengrant_free | ( | struct xen_hypervisor * | xen, |
grant_ref_t * | refs, | ||
unsigned int | count | ||
) |
Free grant references.
xen | Xen hypervisor |
refs | Grant references |
count | Number of references |
Definition at line 214 of file xengrant.c.
References assert(), count, DBGC2, hdr, ref, refs, and xengrant_zero().
Referenced by netfront_probe(), and netfront_remove().