From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH 2/2] libxc: enabling emulated MSI injection Date: Thu, 26 May 2011 20:56:09 +0800 Message-ID: References: <20110526123452.GA3386@dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20110526123452.GA3386@dumpdata.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Konrad Rzeszutek Wilk Cc: xen-devel@lists.xensource.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, May 26, 2011 at 8:34 PM, Konrad Rzeszutek Wilk wrote: > On Thu, May 26, 2011 at 11:09:43AM +0800, Wei Liu wrote: >> commit 67038b5b18096b3bdcda7fe393d1be6a91dc75a6 >> Author: Wei Liu >> Date: =C2=A0 Thu May 26 10:27:41 2011 +0800 >> >> =C2=A0 =C2=A0 libxc: add new operation in HVMOP to deliver emulated MSI. > > What is the purpose of this call? >> >> =C2=A0 =C2=A0 Signed-off-by: Wei Liu >> >> diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c >> index b87bbc0..38af397 100644 >> --- a/tools/libxc/xc_misc.c >> +++ b/tools/libxc/xc_misc.c >> @@ -417,6 +417,35 @@ int xc_hvm_set_pci_link_route( >> =C2=A0 =C2=A0 =C2=A0return rc; >> =C2=A0} >> >> +int xc_hvm_inj_msi( >> + =C2=A0 =C2=A0xc_interface *xch, domid_t dom, uint64_t addr, uint32_t d= ata) >> +{ >> + =C2=A0 =C2=A0DECLARE_HYPERCALL; >> + =C2=A0 =C2=A0DECLARE_HYPERCALL_BUFFER(struct xen_hvm_inj_msi, arg); >> + =C2=A0 =C2=A0int rc; >> + >> + =C2=A0 =C2=A0arg =3D xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg))= ; >> + =C2=A0 =C2=A0if ( arg =3D=3D NULL ) >> + =C2=A0 =C2=A0{ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0PERROR("Could not allocate memory for xc_hv= m_inj_msi hypercall"); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1; >> + =C2=A0 =C2=A0} >> + >> + =C2=A0 =C2=A0hypercall.op =C2=A0 =C2=A0 =3D __HYPERVISOR_hvm_op; >> + =C2=A0 =C2=A0hypercall.arg[0] =3D HVMOP_inj_msi; >> + =C2=A0 =C2=A0hypercall.arg[1] =3D HYPERCALL_BUFFER_AS_ARG(arg); >> + >> + =C2=A0 =C2=A0arg->domid =3D dom; >> + =C2=A0 =C2=A0arg->addr =C2=A0=3D addr; >> + =C2=A0 =C2=A0arg->data =C2=A0=3D data; > > Shouldn't those be done before you make the HYPERCALL_BUFFER_AS_ARG > in case they get bounced? > Hmm... I didn't think that far. I just copy-and-edit from a previous hypercall. I think that should be OK t= hen. >> + >> + =C2=A0 =C2=A0rc =3D do_xen_hypercall(xch, &hypercall); >> + >> + =C2=A0 =C2=A0xc_hypercall_buffer_free(xch, arg); >> + >> + =C2=A0 =C2=A0return rc; >> +} >> + >> =C2=A0int xc_hvm_track_dirty_vram( >> =C2=A0 =C2=A0 =C2=A0xc_interface *xch, domid_t dom, >> =C2=A0 =C2=A0 =C2=A0uint64_t first_pfn, uint64_t nr, >> diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h >> index 9a4355f..2442c84 100644 >> --- a/tools/libxc/xenctrl.h >> +++ b/tools/libxc/xenctrl.h >> @@ -1387,6 +1387,8 @@ int xc_hvm_set_isa_irq_level( >> =C2=A0int xc_hvm_set_pci_link_route( >> =C2=A0 =C2=A0 =C2=A0xc_interface *xch, domid_t dom, uint8_t link, uint8_= t isa_irq); >> >> +int xc_hvm_inj_msi( >> + =C2=A0 =C2=A0xc_interface *xch, domid_t dom, uint64_t addr, uint32_t d= ata); >> >> =C2=A0/* >> =C2=A0 * Track dirty bit changes in the VRAM area >> >> -- >> Best regards >> Wei Liu >> Twitter: @iliuw >> Site: http://liuw.name >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel > --=20 Best regards Wei Liu Twitter: @iliuw Site: http://liuw.name