qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-devel@nongnu.org, Tina Zhang <tina.zhang@intel.com>,
	intel-gvt-dev@lists.freedesktop.org,
	Kirti Wankhede <kwankhede@nvidia.com>
Subject: Re: [Qemu-devel] [RfC PATCH 5/6] vfio/display: adding region support
Date: Wed, 11 Oct 2017 12:47:20 +0200	[thread overview]
Message-ID: <1507718840.31518.9.camel@redhat.com> (raw)
In-Reply-To: <20171010142703.19e50e0d@t450s.home>

  Hi,

> > +    ret = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_QUERY_GFX_PLANE,
> > &plane);
> > +    if (ret < 0) {
> > +        fprintf(stderr, "ioctl VFIO_DEVICE_QUERY_GFX_PLANE: %s\n",
> > +                strerror(errno));
> 
> %m?

Oh, neat, didn't know this even exists.

man page says it is a glibc extension though.  So do we really want use
it in a portable code base?  In this specific case it would probably
not cause any trouble though as vfio is linux-only anyway.

> > +    if (vdev->region_mmap == NULL) {
> > +        /* mmap region */
> > +        ret = vfio_get_region_info(&vdev->vbasedev,
> > plane.region_index,
> > +                                   &region);
> > +        if (ret != 0) {
> > +            fprintf(stderr, "%s: vfio_get_region_info(%d): %s\n",
> > +                    __func__, plane.region_index, strerror(-ret));
> > +            return;
> > +        }
> > +        vdev->region_size = region->size;
> > +        vdev->region_mmap = mmap(NULL, region->size,
> > +                                 PROT_READ, MAP_SHARED,
> > +                                 vdev->vbasedev.fd,
> > +                                 region->offset);
> > +        if (vdev->region_mmap == MAP_FAILED) {
> > +            fprintf(stderr, "%s: mmap region %d: %s\n", __func__,
> > +                    plane.region_index, strerror(errno));
> > +            vdev->region_mmap = NULL;
> > +            g_free(region);
> > +            return;
> > +        }
> 
> Seems like we should really try to use a VFIORegion for this.

IIRC I checked this, but it didn't look straight forward as VFIORegion
is designed for guest access not host access.

cheers,
  Gerd

  reply	other threads:[~2017-10-11 10:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 14:03 [Qemu-devel] [RfC PATCH 0/6] vfio: add display support Gerd Hoffmann
2017-10-10 14:03 ` [Qemu-devel] [RfC PATCH 1/6] headers: update linux-headers/linux/vfio.h (intel-gvt kernel patches, v15) Gerd Hoffmann
2017-10-10 14:03 ` [Qemu-devel] [RfC PATCH 2/6] headers: add drm/drm_fourcc.h to standard-headers Gerd Hoffmann
2017-10-10 14:03 ` [Qemu-devel] [RfC PATCH 3/6] ui/pixman: add qemu_drm_format_to_pixman() Gerd Hoffmann
2017-10-10 14:03 ` [Qemu-devel] [RfC PATCH 4/6] vfio/display: core & wireup Gerd Hoffmann
2017-10-10 14:03 ` [Qemu-devel] [RfC PATCH 5/6] vfio/display: adding region support Gerd Hoffmann
2017-10-10 20:27   ` Alex Williamson
2017-10-11 10:47     ` Gerd Hoffmann [this message]
2017-10-11 16:55       ` Alex Williamson
2017-11-10 10:48         ` Gerd Hoffmann
2017-10-10 14:03 ` [Qemu-devel] [RfC PATCH 6/6] vfio/display: add dmabuf support (v15) Gerd Hoffmann
2017-10-10 20:27   ` Alex Williamson
2017-10-11  7:01     ` Gerd Hoffmann
2017-10-10 14:20 ` [Qemu-devel] [RfC PATCH 0/6] vfio: add display support no-reply
2017-10-10 14:23 ` no-reply

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=1507718840.31518.9.camel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=kwankhede@nvidia.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tina.zhang@intel.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).