xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
	mukesh.rathor@oracle.com, Ian.Campbell@citrix.com,
	stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH 1/6] xen/pvh: Support ParaVirtualized Hardware extensions.
Date: Tue, 23 Oct 2012 10:46:14 -0400	[thread overview]
Message-ID: <20121023144614.GC1052@phenom.dumpdata.com> (raw)
In-Reply-To: <1350695882-12820-2-git-send-email-konrad.wilk@oracle.com>

> diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
> index b66d04c..8beebdb 100644
> --- a/include/xen/interface/memory.h
> +++ b/include/xen/interface/memory.h
> @@ -169,7 +169,13 @@ struct xen_add_to_physmap {
>      /* Source mapping space. */
>  #define XENMAPSPACE_shared_info 0 /* shared info page */
>  #define XENMAPSPACE_grant_table 1 /* grant table page */
> -    unsigned int space;
> +#define XENMAPSPACE_gmfn        2 /* GMFN */
> +#define XENMAPSPACE_gmfn_range  3 /* GMFN range */
> +#define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another guest */
> +    uint16_t space;
> +    domid_t foreign_domid;         /* IFF XENMAPSPACE_gmfn_foreign */
> +
> +#define XENMAPIDX_grant_table_status 0x80000000
>  
>      /* Index into source mapping space. */
>      xen_ulong_t idx;

And this breaks 32-bit PVHVM :-(

The reason being that in xen_hvm_init_shared_info we allocate the
structure on the stack, and do not clear the foreign_domid to zero.

This means we can (and do get) for the argument space, something
like this:
	xatp.space == 0xffff0001;
instead of
	xatp.space = 0x1;

This fixes it:

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index e3497f2..b679f86 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1509,6 +1509,7 @@ void __ref xen_hvm_init_shared_info(void)
 	xatp.domid = DOMID_SELF;
 	xatp.idx = 0;
 	xatp.space = XENMAPSPACE_shared_info;
+	xatp.foreign_domid = 0;
 	xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT;
 	if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
 		BUG();
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index b2b0a37..cbfd929 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -1044,6 +1044,7 @@ static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
 		do {
 			xatp.domid = DOMID_SELF;
 			xatp.idx = i;
+			xatp.foreign_domid = 0;
 			xatp.space = XENMAPSPACE_grant_table;
 			xatp.gpfn = (xen_hvm_resume_frames >> PAGE_SHIFT) + i;
 			rc = HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp);

  parent reply	other threads:[~2012-10-23 14:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20  1:17 (unknown), Konrad Rzeszutek Wilk
2012-10-20  1:17 ` [PATCH 1/6] xen/pvh: Support ParaVirtualized Hardware extensions Konrad Rzeszutek Wilk
2012-10-22 13:38   ` Stefano Stabellini
2012-10-23 14:07   ` Konrad Rzeszutek Wilk
2012-10-24  9:29     ` Ian Campbell
2012-10-23 14:46   ` Konrad Rzeszutek Wilk [this message]
2012-10-24  9:27     ` Ian Campbell
2012-10-20  1:17 ` [PATCH 2/6] xen/pvh: Extend vcpu_guest_context, p2m, event, and xenbus to support PVH Konrad Rzeszutek Wilk
2012-10-22 13:44   ` Stefano Stabellini
2012-10-22 15:40     ` Konrad Rzeszutek Wilk
2012-10-22 18:31     ` Mukesh Rathor
2012-10-22 20:14       ` Konrad Rzeszutek Wilk
2012-10-22 20:39         ` Mukesh Rathor
2012-10-23 12:25         ` Stefano Stabellini
2012-10-20  1:17 ` [PATCH 3/6] xen/pvh: Implements mmu changes for PVH Konrad Rzeszutek Wilk
2012-10-22 13:46   ` Stefano Stabellini
2012-10-20  1:18 ` [PATCH 4/6] xen/pvh: bootup and setup related changes Konrad Rzeszutek Wilk
2012-10-22 13:34   ` Stefano Stabellini
2012-10-22 15:57     ` Konrad Rzeszutek Wilk
2012-10-23 13:07       ` Stefano Stabellini
2012-10-23 23:47         ` Mukesh Rathor
2012-10-24  0:03           ` [Xen-devel] " Mukesh Rathor
2012-10-24  0:10             ` Mukesh Rathor
2012-10-25 12:38               ` Konrad Rzeszutek Wilk
2012-10-20  1:18 ` [PATCH 5/6] xen/pvh: balloon and grant changes Konrad Rzeszutek Wilk
2012-10-22 13:25   ` Stefano Stabellini
2012-10-22 16:04     ` Konrad Rzeszutek Wilk
2012-10-22 16:40       ` Stefano Stabellini
2012-10-20  1:18 ` [PATCH 6/6] xen/pvh: /dev/xen/privcmd changes Konrad Rzeszutek Wilk
2012-10-22 13:22   ` Stefano Stabellini

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=20121023144614.GC1052@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukesh.rathor@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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).