|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Help: Mapping a grant reference fails
On Wed, 2011-10-26 at 09:33 +0100, Daniel Castro wrote:
> Hello All,
>
> I need a little help, I am trying to map a grant reference, I know
> something is wrong because I have this in dmesg:
> (XEN) grant_table.c:304:d0 Bad flags (0) or dom (0). (expected dom 0)
> Also Xenstore reports this:
> error = ""
> backend = ""
> vbd = ""
> 18 = ""
> 832 = ""
> error = "1 mapping ring-ref 1 port 4"
> This happens when my Block Driver is trying to connect to the back end.
> I have traced the problem to the line where I am setting up
> gnttab_setup_table, the struct has a field XEN_GUEST_HANDLE(ulong)
> frame_list. Here is the problem, whatever type I assign it (void *,
> unsigned long ...etc) fails.
It should effectively be a "unsigned long *".
You should be using the set_xen_guest_handle macro to set it.
> According to documentation this is the
> address where the grant table begins. I I change the type of the
> parameter in the struct it does not work. I think I have to resolve
> the underlining issue on the XEN_GUEST_HANDLE...
> The compiler has this error:
> src/xen-blk.c:141:17: error: incompatible types when assigning to type
> ‘__guest_handle_ulong’ from type ‘struct grant_entry_v1 *’
The frame_list parameter is an array of unsigned longs which is filled
in with the gfn's of the pages containing the grant table. It is not the
actual grant table itself.
The pages are already mapped in SeaBIOS but if they weren't then you
would need to create page table mappings of those GFNs at the virtual
address you have chose. It is that virtual address which becomes the
"struct grant_entry_v1 *".
In Linux for example the function arch_gnttab_map_shared() does that
mapping step.
For an HVM guest GNTTABOP_setup_table just returns the same pages you
passed to XENMAPSPACE_grant_table. Since the pages you passed to
XENMAPSPACE_grant_table are already mapped you don't need to worry about
mapping them yourself so you can just provide an array of nr_grant_pages
* sizeof(unsigned long) and then ignore the result.
Ian.
>
> Thanks for the help,
>
> Daniel
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|