From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: [V2 PATCH 4/4] PVH xen tools: xenstored changes Date: Fri, 6 Sep 2013 17:28:37 -0700 Message-ID: <1378513717-11525-5-git-send-email-mukesh.rathor@oracle.com> References: <1378513717-11525-1-git-send-email-mukesh.rathor@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VI6OS-0005zK-OU for xen-devel@lists.xenproject.org; Sat, 07 Sep 2013 00:28:53 +0000 In-Reply-To: <1378513717-11525-1-git-send-email-mukesh.rathor@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Allow map_interface in xenstored to revert to the xc_map_foreign_range if xc_gnttab_map_grant_ref is unable to map the mfn because grant is not yet setup for a PVH guest. PVH sets it up during boot via HVM mechanism. Signed-off-by: Mukesh Rathor --- tools/xenstore/xenstored_domain.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index bf83d58..4a89831 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -168,13 +168,15 @@ static int readchn(struct connection *conn, void *data, unsigned int len) static void *map_interface(domid_t domid, unsigned long mfn) { if (*xcg_handle != NULL) { + void *addr; /* this is the preferred method */ - return xc_gnttab_map_grant_ref(*xcg_handle, domid, + addr = xc_gnttab_map_grant_ref(*xcg_handle, domid, GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE); - } else { - return xc_map_foreign_range(*xc_handle, domid, - getpagesize(), PROT_READ|PROT_WRITE, mfn); + if (addr) + return addr; } + return xc_map_foreign_range(*xc_handle, domid, + getpagesize(), PROT_READ|PROT_WRITE, mfn); } static void unmap_interface(void *interface) -- 1.7.2.3