From: Owen Smith <owen.smith@citrix.com>
To: Stefano Stabellini <Stefano.Stabellini@citrix.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [Qemu-devel] [PATCH 2/3] xenfb: Add option to use grant ref for shared page.
Date: Thu, 11 Sep 2014 11:33:01 +0000 [thread overview]
Message-ID: <6624BC057AF4E240B6D036F5CC505B12041F0045@AMSPEX01CL02.citrite.net> (raw)
In-Reply-To: <alpine.DEB.2.02.1409110134570.8137@kaball.uk.xensource.com>
> -----Original Message-----
> From: Stefano Stabellini [mailto:stefano.stabellini@eu.citrix.com]
> Sent: 11 September 2014 02:01
> To: Owen Smith
> Cc: qemu-devel@nongnu.org; xen-devel@lists.xen.org; Stefano Stabellini
> Subject: Re: [PATCH 2/3] xenfb: Add option to use grant ref for shared page.
>
> On Wed, 10 Sep 2014, Owen smith wrote:
> > The vkbd device should be able to use a grant reference to map the
> > shared page.
> >
> > Signed-off-by: Owen smith <owen.smith@citrix.com>
> > ---
> > hw/display/xenfb.c | 39 +++++++++++++++++++++++++++++----------
> > 1 file changed, 29 insertions(+), 10 deletions(-)
> >
> > diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index
> > 2c39753..c4375c8 100644
> > --- a/hw/display/xenfb.c
> > +++ b/hw/display/xenfb.c
> > @@ -54,6 +54,7 @@
> > struct common {
> > struct XenDevice xendev; /* must be first */
> > void *page;
> > + int page_gref;
> > QemuConsole *con;
> > };
> >
> > @@ -96,22 +97,36 @@ static int common_bind(struct common *c) {
> > uint64_t mfn;
> >
> > - if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &mfn) == -1)
> > - return -1;
> > - assert(mfn == (xen_pfn_t)mfn);
> > -
> > if (xenstore_read_fe_int(&c->xendev, "event-channel", &c-
> >xendev.remote_port) == -1)
> > return -1;
> >
> > - c->page = xc_map_foreign_range(xen_xc, c->xendev.dom,
> > - XC_PAGE_SIZE,
> > - PROT_READ | PROT_WRITE, mfn);
> > + if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &mfn) == -1) {
> > + if (xenstore_read_fe_int(&c->xendev, "page-gref", &c->page_gref)
> == -1) {
> > + return -1;
> > + }
> > + c->page = xc_gnttab_map_grant_ref(c->xendev.gnttabdev,
> > + c->xendev.dom,
> > + c->page_gref,
> > + PROT_READ | PROT_WRITE);
> > + } else {
> > + assert(mfn == (xen_pfn_t)mfn);
> > +
> > + c->page = xc_map_foreign_range(xen_xc, c->xendev.dom,
> > + XC_PAGE_SIZE,
> > + PROT_READ | PROT_WRITE, mfn);
> > + }
>
> This is an extension of the protocol. It should be documented somewhere.
> At least in the commit message and somewhere under docs/misc or
> xen/include/public/io/fbif.h.
>
V2 will contain a better commit message, and I'll add a patch to the headers
to document the changes.
The same protocol extension docs should be in xen/include/public/io/fbif.h
and xen/include/public/io/kdbif.h, as this change covers the vfb and vkbd, or
would it be better to change the patch to only affect the vkbd?
>
> > if (c->page == NULL)
> > return -1;
> >
> > xen_be_bind_evtchn(&c->xendev);
> > - xen_be_printf(&c->xendev, 1, "ring mfn %"PRIx64", remote-port %d,
> local-port %d\n",
> > - mfn, c->xendev.remote_port, c->xendev.local_port);
> > +
> > + if (c->page_gref) {
> > + xen_be_printf(&c->xendev, 1, "ring gref %d, remote-port %d, local-
> port %d\n",
> > + c->page_gref, c->xendev.remote_port, c->xendev.local_port);
> > + } else {
> > + xen_be_printf(&c->xendev, 1, "ring mfn %"PRIx64", remote-port %d,
> local-port %d\n",
> > + mfn, c->xendev.remote_port, c->xendev.local_port);
> > + }
> >
> > return 0;
> > }
> > @@ -120,8 +135,13 @@ static void common_unbind(struct common *c) {
> > xen_be_unbind_evtchn(&c->xendev);
> > if (c->page) {
> > - munmap(c->page, XC_PAGE_SIZE);
> > + if (c->page_gref) {
> > + xc_gnttab_munmap(c->xendev.gnttabdev, c->page, 1);
> > + } else {
> > + munmap(c->page, XC_PAGE_SIZE);
> > + }
> > c->page = NULL;
> > + c->page_gref = 0;
> > }
> > }
> >
> > @@ -954,6 +974,7 @@ static void fb_event(struct XenDevice *xendev)
> >
> > struct XenDevOps xen_kbdmouse_ops = {
> > .size = sizeof(struct XenInput),
> > + .flags = DEVOPS_FLAG_NEED_GNTDEV,
> > .init = input_init,
> > .initialise = input_initialise,
> > .connected = input_connected,
> > --
> > 2.1.0
> >
next prev parent reply other threads:[~2014-09-11 11:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 13:42 [Qemu-devel] [PATCH 0/3] xenfb: Add support for Windows PV frontend Owen smith
2014-09-10 13:42 ` Owen smith
2014-09-10 13:42 ` [Qemu-devel] [PATCH 1/3] xenfb: Unregister keyboard event handler correctly Owen smith
2014-09-10 13:42 ` Owen smith
2014-09-11 0:33 ` Stefano Stabellini
2014-09-11 0:33 ` [Qemu-devel] " Stefano Stabellini
2014-09-11 11:32 ` Owen Smith
2014-09-11 11:32 ` [Qemu-devel] " Owen Smith
2014-09-10 13:42 ` [Qemu-devel] [PATCH 2/3] xenfb: Add option to use grant ref for shared page Owen smith
2014-09-10 13:42 ` Owen smith
2014-09-11 1:01 ` Stefano Stabellini
2014-09-11 1:01 ` [Qemu-devel] " Stefano Stabellini
2014-09-11 11:33 ` Owen Smith [this message]
2014-09-11 18:01 ` Stefano Stabellini
2014-09-11 18:01 ` [Qemu-devel] " Stefano Stabellini
2014-09-11 11:33 ` Owen Smith
2014-09-10 13:42 ` [Qemu-devel] [PATCH 3/3] xenfb: Add "feature-no-abs-rescale" for Windows PV frontend Owen smith
2014-09-10 13:42 ` Owen smith
2014-09-11 1:23 ` [Qemu-devel] " Stefano Stabellini
2014-09-11 11:34 ` Owen Smith
2014-09-11 11:34 ` [Qemu-devel] " Owen Smith
2014-09-11 18:04 ` Stefano Stabellini
2014-09-11 18:04 ` [Qemu-devel] " Stefano Stabellini
2014-09-29 12:20 ` [Qemu-devel] [Xen-devel] " Ian Campbell
2014-09-29 12:20 ` Ian Campbell
2014-09-11 1:23 ` 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=6624BC057AF4E240B6D036F5CC505B12041F0045@AMSPEX01CL02.citrite.net \
--to=owen.smith@citrix.com \
--cc=Stefano.Stabellini@citrix.com \
--cc=qemu-devel@nongnu.org \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.