xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: xen-devel@lists.xenproject.org
Cc: Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com
Subject: [V2 PATCH 4/4] PVH xen tools: xenstored changes
Date: Fri,  6 Sep 2013 17:28:37 -0700	[thread overview]
Message-ID: <1378513717-11525-5-git-send-email-mukesh.rathor@oracle.com> (raw)
In-Reply-To: <1378513717-11525-1-git-send-email-mukesh.rathor@oracle.com>

 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 <mukesh.rathor@oracle.com>
---
 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

      parent reply	other threads:[~2013-09-07  0:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-07  0:28 [V2 PATCH 0/5]: PVH xen tools: tools changes to create PVH guest Mukesh Rathor
2013-09-07  0:28 ` [V2 PATCH 1/4] PVH xen tools: In Elf code, add hvm callback vector Mukesh Rathor
2013-09-09  8:33   ` Ian Campbell
2013-09-07  0:28 ` [V2 PATCH 2/4] PVH xen tools: libxc changes to build a PVH guest Mukesh Rathor
2013-09-09  8:42   ` Ian Campbell
2013-09-10  1:40     ` Mukesh Rathor
2013-09-10  8:27       ` Ian Campbell
2013-09-07  0:28 ` [V2 PATCH 3/4] PVH xen tools: libxl changes to create " Mukesh Rathor
2013-09-09  8:49   ` Ian Campbell
2013-09-10  1:40     ` Mukesh Rathor
2013-09-10  8:28       ` Ian Campbell
2013-09-07  0:28 ` Mukesh Rathor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378513717-11525-5-git-send-email-mukesh.rathor@oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).