[RFC 2/6] udmabuf: add ability to set access flags on udmabuf

Gurchetan Singh gurchetansingh at chromium.org
Fri Aug 2 16:45:15 UTC 2019


On Wed, Jul 31, 2019 at 11:40 PM Gerd Hoffmann <kraxel at redhat.com> wrote:
>
> On Wed, Jul 31, 2019 at 07:25:13PM -0700, Gurchetan Singh wrote:
> > The main use for udmabuf is sending guest memory pages
> > to the host.
> >
> > It's generally a bad idea to have to separate mappings with
> > different attributes. For example, a WC mapping the guest
> > kernel and cached mapping on the host is problematic.
> >
> > Add creation time flags so the user has responsibility for
> > the specific use case.
>
> > -#define UDMABUF_FLAGS_CLOEXEC        0x01
> > +#define UDMABUF_FLAGS_CLOEXEC    0x01
> > +#define UDMABUF_FLAGS_PROT_NONE  0x02
> > +#define UDMABUF_FLAGS_PROT_READ  0x04
> > +#define UDMABUF_FLAGS_PROT_WRITE 0x08
>
> [ didn't look at followup patches yet ]
>
> You can't have readonly/writeonly dmabufs.
> So that isn't going to fly.
>
> The commit message suggests this is for cache attributes not protection,
> so having the flags might make sense, but please don't name the flags
> PROT_* then.

Okay, I'll change the flags to CACHED / UNCACHED / WRITE_COMBINE (like
msm_drm.h).  And since the dma api doesn't work on x86 [1], we'll have
to call drm_cflush_pages in the guest.  Since caching is privileged on
ARM and not on x86, that *should* get us write-combine guest buffers.

[1] https://lists.freedesktop.org/archives/dri-devel/2019-August/229161.html

>
> cheers,
>   Gerd
>


More information about the dri-devel mailing list