WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Help: Mapping a grant reference fails

To: Daniel Castro <evil.dani@xxxxxxxxx>
Subject: Re: [Xen-devel] Help: Mapping a grant reference fails
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Thu, 27 Oct 2011 11:19:14 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 27 Oct 2011 03:25:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <CAP2B859xHK8zzgqAAWt-WdxxBcwNTKK2TfbqejfFnEW2mgr7jA@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <CAP2B859xHK8zzgqAAWt-WdxxBcwNTKK2TfbqejfFnEW2mgr7jA@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>