These allow a domain A which has been granted access on a page of
domain B's memory to issue domain C with a copy-grant on the same
page. This is useful e.g. for forwarding packets between domains.
Signed-off-by: Steven Smith <steven.smith@xxxxxxxxxx>
---
drivers/xen/grant-table.c | 33 +++++++++++++++++++++++++++++++++
include/xen/grant_table.h | 8 ++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 76ec844..3a437a0 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -205,6 +205,39 @@ int gnttab_grant_foreign_access(domid_t domid, unsigned
long frame,
}
EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access);
+int gnttab_grant_foreign_access_trans(domid_t domid, int flags,
+ domid_t trans_domid,
+ grant_ref_t trans_gref)
+{
+ int ref;
+
+ ref = get_free_entries(1);
+ if (unlikely(ref < 0))
+ return -ENOSPC;
+
+ gnttab_grant_foreign_access_ref_trans(ref, domid, flags,
+ trans_domid, trans_gref);
+
+ return ref;
+}
+EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access_trans);
+
+void gnttab_grant_foreign_access_ref_trans(grant_ref_t ref, domid_t domid,
+ int flags,
+ domid_t trans_domid,
+ grant_ref_t trans_gref)
+{
+ BUG_ON(flags & (GTF_accept_transfer | GTF_reading |
+ GTF_writing | GTF_sub_page | GTF_permit_access));
+ BUG_ON(grant_table_version == 1);
+ shared.v2[ref].transitive.trans_domid = trans_domid;
+ shared.v2[ref].transitive.gref = trans_gref;
+ shared.v2[ref].hdr.domid = domid;
+ wmb();
+ shared.v2[ref].hdr.flags = GTF_permit_access | GTF_transitive | flags;
+}
+EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access_ref_trans);
+
int gnttab_query_foreign_access(grant_ref_t ref)
{
u16 nflags;
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index de1cb2b..b04026d 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -69,6 +69,10 @@ int gnttab_grant_foreign_access_subpage(domid_t domid,
unsigned long frame,
int flags, unsigned page_off,
unsigned length);
+void gnttab_grant_foreign_access_ref_trans(grant_ref_t ref, domid_t domid,
+ int flags,
+ domid_t trans_domid,
+ grant_ref_t trans_gref);
/*
* Are sub-page grants available on this version of Xen? Returns 1 if
@@ -128,6 +132,10 @@ void gnttab_grant_foreign_access_ref_subpage(grant_ref_t
ref, domid_t domid,
unsigned long frame, int flags,
unsigned page_off,
unsigned length);
+void gnttab_grant_foreign_access_ref_trans(grant_ref_t ref, domid_t domid,
+ int flags,
+ domid_t trans_domid,
+ grant_ref_t trans_gref);
void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
unsigned long pfn);
--
1.6.3.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|