[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
guest / host buffer sharing ...
|
From: |
Gerd Hoffmann |
|
Subject: |
guest / host buffer sharing ... |
|
Date: |
Tue, 5 Nov 2019 11:54:56 +0100 |
|
User-agent: |
NeoMutt/20180716 |
Hi folks,
The issue of sharing buffers between guests and hosts keeps poping
up again and again in different contexts. Most recently here:
https://www.mail-archive.com/address@hidden/msg656685.html
So, I'm grabbing the recipient list of the virtio-vdec thread and some
more people I know might be interested in this, hoping to have everyone
included.
Reason is: Meanwhile I'm wondering whenever "just use virtio-gpu
resources" is really a good answer for all the different use cases
we have collected over time. Maybe it is better to have a dedicated
buffer sharing virtio device? Here is the rough idea:
(1) The virtio device
=====================
Has a single virtio queue, so the guest can send commands to register
and unregister buffers. Buffers are allocated in guest ram. Each buffer
has a list of memory ranges for the data. Each buffer also has some
properties to carry metadata, some fixed (id, size, application), but
also allow free form (name = value, framebuffers would have
width/height/stride/format for example).
(2) The linux guest implementation
==================================
I guess I'd try to make it a drm driver, so we can re-use drm
infrastructure (shmem helpers for example). Buffers are dumb drm
buffers. dma-buf import and export is supported (shmem helpers
get us that for free). Some device-specific ioctls to get/set
properties and to register/unregister the buffers on the host.
(3) The qemu host implementation
================================
qemu (likewise other vmms) can use the udmabuf driver to create
host-side dma-bufs for the buffers. The dma-bufs can be passed to
anyone interested, inside and outside qemu. We'll need some protocol
for communication between qemu and external users interested in those
buffers, to receive dma-bufs (via unix file descriptor passing) and
update notifications. Dispatching updates could be done based on the
application property, which could be "virtio-vdec" or "wayland-proxy"
for example.
commments?
cheers,
Gerd