|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Share memory with foreign domains and map foreign grants. More...
Files | |
| file | gnttab.h |
| Xen grant table helpers. | |
Functions | |
| grant_ref_t | gnttab_grant_access (domid_t domid, unsigned long gfn, bool readonly) |
| Grant another domain access to a guest frame. | |
| int | gnttab_end_access (grant_ref_t gref) |
| Release a grant reference created by gnttab_grant_access(). | |
| int32_t | gnttab_alloc_and_grant (void **map, bool readonly) |
| Allocate a page and immediately grant access to it. | |
| void * | gnttab_get_pages (unsigned int npages) |
| Allocate pages that can host grant mappings. | |
| int | gnttab_put_pages (void *start_addr, unsigned int npages) |
| Release pages allocated by gnttab_get_pages(). | |
| int | gnttab_map_refs (struct gnttab_map_grant_ref *map_ops, unsigned int count) |
| Map one or more foreign grant references. | |
| int | gnttab_unmap_refs (struct gnttab_unmap_grant_ref *unmap_ops, unsigned int count) |
| Unmap one or more foreign grant references. | |
| const char * | gnttabop_error (int16_t status) |
| Convert a Xen grant-table status into readable text. | |
Share memory with foreign domains and map foreign grants.
#include <zephyr/xen/gnttab.h>
Allocate a page and immediately grant access to it.
The caller must release the grant and then k_free() the buffer returned in map once it is no longer needed.
CONFIG_XEN_GRANT_TABLE.| [out] | map | Buffer that receives the page base address. |
| readonly | Set to true to grant read-only access. |
| -ENOMEM | Page allocation fails. |
| int gnttab_end_access | ( | grant_ref_t | gref | ) |
#include <zephyr/xen/gnttab.h>
Release a grant reference created by gnttab_grant_access().
This does NOT free memory that was previously allocated by gnttab_alloc_and_grant().
CONFIG_XEN_GRANT_TABLE.| gref | Grant reference to release. |
| 0 | on success. |
| void * gnttab_get_pages | ( | unsigned int | npages | ) |
#include <zephyr/xen/gnttab.h>
Allocate pages that can host grant mappings.
The returned range is suitable for use as host_addr in struct gnttab_map_grant_ref entries. Release it with gnttab_put_pages() after use.
CONFIG_XEN_GRANT_TABLE.| npages | Number of pages to allocate. |
| grant_ref_t gnttab_grant_access | ( | domid_t | domid, |
| unsigned long | gfn, | ||
| bool | readonly ) |
#include <zephyr/xen/gnttab.h>
Grant another domain access to a guest frame.
CONFIG_XEN_GRANT_TABLE.| domid | Foreign domain that receives access to the frame. |
| gfn | Guest frame number to expose. |
| readonly | Set to true to grant read-only access. |
| int gnttab_map_refs | ( | struct gnttab_map_grant_ref * | map_ops, |
| unsigned int | count ) |
#include <zephyr/xen/gnttab.h>
Map one or more foreign grant references.
The host_addr pages referenced by map_ops must be 4K-aligned and should be obtained from gnttab_get_pages().
CONFIG_XEN_GRANT_TABLE.| [in,out] | map_ops | Array of prepared map operations. |
| count | Number of entries in map_ops. |
| -EFAULT | Xen extended regions are enabled and a host address is outside them. |
Xen also stores a per-entry status code in each map_ops[i].status field.
| int gnttab_put_pages | ( | void * | start_addr, |
| unsigned int | npages ) |
#include <zephyr/xen/gnttab.h>
Release pages allocated by gnttab_get_pages().
CONFIG_XEN_GRANT_TABLE.| start_addr | Base address returned by gnttab_get_pages(). |
| npages | Number of pages to release. |
| int gnttab_unmap_refs | ( | struct gnttab_unmap_grant_ref * | unmap_ops, |
| unsigned int | count ) |
#include <zephyr/xen/gnttab.h>
Unmap one or more foreign grant references.
Use gnttab_put_pages() afterwards for the pages that were successfully unmapped.
CONFIG_XEN_GRANT_TABLE.| [in,out] | unmap_ops | Array of prepared unmap operations. |
| count | Number of entries in unmap_ops. |
| -EFAULT | Xen extended regions are enabled and a host address is outside them. |
Xen also stores a per-entry status code in each unmap_ops[i].status field.
| const char * gnttabop_error | ( | int16_t | status | ) |
#include <zephyr/xen/gnttab.h>
Convert a Xen grant-table status into readable text.
CONFIG_XEN_GRANT_TABLE.| status | Negative GNTST_* status code. |