From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH v4 28/31] libxc/xen: introduce HVM_PARAM_CMDLINE_PFN Date: Fri, 7 Aug 2015 13:32:05 +0100 Message-ID: <20150807123205.GP6005@zion.uk.xensource.com> References: <1438942688-7610-1-git-send-email-roger.pau@citrix.com> <1438942688-7610-29-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZNgol-0005hf-3t for xen-devel@lists.xenproject.org; Fri, 07 Aug 2015 12:32:11 +0000 Content-Disposition: inline In-Reply-To: <1438942688-7610-29-git-send-email-roger.pau@citrix.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: Roger Pau Monne Cc: Wei Liu , Ian Campbell , Stefano Stabellini , Andrew Cooper , Ian Jackson , Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Fri, Aug 07, 2015 at 12:18:05PM +0200, Roger Pau Monne wrote: > This HVM parameter returns a PFN that contains the address of the memory > page where the guest command line has been placed. > = > Signed-off-by: Roger Pau Monn=E9 > Cc: Ian Jackson > Cc: Stefano Stabellini > Cc: Ian Campbell > Cc: Wei Liu > Cc: Jan Beulich > Cc: Andrew Cooper > --- > tools/libxc/xc_dom_x86.c | 17 +++++++++++++++++ > xen/arch/x86/hvm/hvm.c | 2 ++ > xen/include/public/hvm/params.h | 5 ++++- > 3 files changed, 23 insertions(+), 1 deletion(-) > = > diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c > index 87bce6e..369745d 100644 > --- a/tools/libxc/xc_dom_x86.c > +++ b/tools/libxc/xc_dom_x86.c > @@ -562,6 +562,23 @@ static int alloc_magic_pages_hvm(struct xc_dom_image= *dom) > xc_hvm_param_set(xch, domid, HVM_PARAM_SHARING_RING_PFN, > special_pfn(SPECIALPAGE_SHARING)); > = > + if ( dom->cmdline ) > + { > + xen_pfn_t cmdline_pfn =3D xc_dom_alloc_page(dom, "command line"); > + char *cmdline =3D xc_map_foreign_range(xch, domid, PAGE_SIZE, > + PROT_READ | PROT_WRITE, > + cmdline_pfn); > + if ( cmdline =3D=3D NULL ) { > + DOMPRINTF("Unable to map command line page"); > + goto error_out; > + } > + > + strncpy(cmdline, dom->cmdline, MAX_GUEST_CMDLINE); > + cmdline[MAX_GUEST_CMDLINE - 1] =3D '\0'; > + munmap(cmdline, PAGE_SIZE); > + xc_hvm_param_set(xch, domid, HVM_PARAM_CMDLINE_PFN, cmdline_pfn); > + } > + FWIW this change looks correct. This bit: Acked-by: Wei Liu > if ( dom->emulation ) > { > /* > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c > index 15ea5e2..615ea30 100644 > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -5866,6 +5866,7 @@ static int hvm_allow_set_param(struct domain *d, > case HVM_PARAM_VM_GENERATION_ID_ADDR: > case HVM_PARAM_STORE_EVTCHN: > case HVM_PARAM_CONSOLE_EVTCHN: > + case HVM_PARAM_CMDLINE_PFN: > break; > /* > * The following parameters must not be set by the guest > @@ -6097,6 +6098,7 @@ static int hvm_allow_get_param(struct domain *d, > case HVM_PARAM_CONSOLE_PFN: > case HVM_PARAM_CONSOLE_EVTCHN: > case HVM_PARAM_ALTP2M: > + case HVM_PARAM_CMDLINE_PFN: > break; > /* > * The following parameters must not be read by the guest > diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/par= ams.h > index 147d9b8..aa926d4 100644 > --- a/xen/include/public/hvm/params.h > +++ b/xen/include/public/hvm/params.h > @@ -190,6 +190,9 @@ > /* Boolean: Enable altp2m */ > #define HVM_PARAM_ALTP2M 35 > = > -#define HVM_NR_PARAMS 36 > +/* PFN of the command line. */ > +#define HVM_PARAM_CMDLINE_PFN 36 > + > +#define HVM_NR_PARAMS 37 > = > #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ > -- = > 1.9.5 (Apple Git-50.3)