Grant Table problem mapping dom0 mem to domU
I've been looking through some back-end drivers and I notice that grant tables are used to map domU memory into the privileged domain, is the opposite possible? Can I map dom0 memory into a domU?
I've written code grants foreign access to a page from dom0 (take the grant ref_id) then on domU I try to map it (basically the same way ex blkback does it, or just any other driver for that matter) and all I get from HYPERVISOR_grant_table_op() is a -1 return value, op.status is empty=0.
I'll send more information on the specific error, if I at least know that this can be done and I'm just not falling of a cliff. Also, if it is possible, can you point me to some example code?
thanks,
C. René
Hi Carlos,
The problem you are facing is that the grant_operation_permitted() test (in the GNTTABOP_map_grant_ref case of the do_grant_table_op function in xen/common/grant_table.c) is failing. At present, only domains with iomem permissions can map grant references: typically, the only such domain is dom0. This is due to a TLB flush issue which was addressed in a recent patchset from Kieran Mansley. You can either try giving some dummy iomem privileges to your domU, or change the definition of grant_operation_permitted(d) to 1, so that it always succeeds.
Regards,
Derek Murray.
Quoted 21 lines · Carlos Perez
I've been looking through some back-end drivers and I notice that grant tables are used to map domU memory into the privileged domain, is the opposite possible? Can I map dom0 memory into a domU?
I've written code grants foreign access to a page from dom0 (take the grant
ref_id) then on domU I try to map it (basically the same way ex blkback does it, or just any other driver for that matter) and all I get fromHYPERVISOR_grant_table_op()is a -1 return value, op.status is empty=0.I'll send more information on the specific error, if I at least know that this can be done and I'm just not falling of a cliff. Also, if it is possible, can you point me to some example code?
thanks,
C. René_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines · Derek Murray
This is due to a TLB flush issue which
was addressed in a recent patchset from Kieran Mansley.
To which I've just posted an updated version due to a bug I'd missed. The patch as it stands doesn't however change the definition of grant_operation_permitted(), so if using that patch you'd still need to make that change manually to get any benefit (other than correctness) from it.
Kieran
Thanks guys, that totally solved the problem.
Quoted 46 lines · Derek Murray
Hi Carlos,
The problem you are facing is that the
grant_operation_permitted()test (in theGNTTABOP_map_grant_refcase of thedo_grant_table_opfunction inxen/common/grant_table.c) is failing. At present, only domains with iomem permissions can map grant references: typically, the only such domain is dom0. This is due to a TLB flush issue which was addressed in a recent patchset from Kieran Mansley. You can either try giving some dummy iomem privileges to your domU, or change the definition ofgrant_operation_permitted(d)to 1, so that it always succeeds.Regards,
Derek Murray.
Quoted 14 lines · Carlos Perez
I've been looking through some back-end drivers and I notice that grant tables are used to map domU memory into the privileged domain, is the opposite possible? Can I map dom0 memory into a domU?
I've written code grants foreign access to a page from dom0 (take the grant
ref_id) then on domU I try to map it (basically the same way ex blkback does it, or just any other driver for that matter) and all I get fromHYPERVISOR_grant_table_op()is a -1 return value, op.status is empty=0.I'll send more information on the specific error, if I at least know that this can be done and I'm just not falling of a cliff. Also, if it is possible, can you point me to some example code?
Quoted 7 lines
thanks,
C. René_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
h