virtio-devices: fix vhost-user GPU feature negotiation
The GPU frontend only offered transport-level features (DEFAULT_VIRTIO_FEATURES) during vhost-user negotiation, causing all GPU device feature bits (VIRGL, EDID, RESOURCE_BLOB, etc.) to be zeroed out when intersected with the backend's features. The guest driver never saw any GPU capabilities. Add the virtio-gpu feature bit constants and include them in avail_features, matching the pattern used by the blk and net frontends. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7e071e5c68
commit
04311414b6
1 changed files with 17 additions and 1 deletions
|
|
@ -34,6 +34,15 @@ use crate::{
|
|||
const DEFAULT_QUEUE_NUMBER: usize = 2;
|
||||
const DEFAULT_QUEUE_SIZE: u16 = 256;
|
||||
|
||||
// Virtio GPU feature bits (virtio spec 5.7.4)
|
||||
const VIRTIO_GPU_F_VIRGL: u32 = 0;
|
||||
const VIRTIO_GPU_F_EDID: u32 = 1;
|
||||
const VIRTIO_GPU_F_RESOURCE_UUID: u32 = 2;
|
||||
const VIRTIO_GPU_F_RESOURCE_BLOB: u32 = 3;
|
||||
const VIRTIO_GPU_F_CONTEXT_INIT: u32 = 4;
|
||||
const VIRTIO_GPU_F_FENCE_PASSING: u32 = 5;
|
||||
const VIRTIO_GPU_F_CREATE_GUEST_HANDLE: u32 = 6;
|
||||
|
||||
struct BackendReqHandler {
|
||||
mapping: Arc<MmapRegion>,
|
||||
}
|
||||
|
|
@ -163,7 +172,14 @@ impl Gpu {
|
|||
VhostUserHandle::connect_vhost_user(false, path, num_queues as u64, false)?;
|
||||
|
||||
// Filling device and vring features VMM supports.
|
||||
let avail_features = DEFAULT_VIRTIO_FEATURES;
|
||||
let avail_features = DEFAULT_VIRTIO_FEATURES
|
||||
| (1u64 << VIRTIO_GPU_F_VIRGL)
|
||||
| (1u64 << VIRTIO_GPU_F_EDID)
|
||||
| (1u64 << VIRTIO_GPU_F_RESOURCE_UUID)
|
||||
| (1u64 << VIRTIO_GPU_F_RESOURCE_BLOB)
|
||||
| (1u64 << VIRTIO_GPU_F_CONTEXT_INIT)
|
||||
| (1u64 << VIRTIO_GPU_F_FENCE_PASSING)
|
||||
| (1u64 << VIRTIO_GPU_F_CREATE_GUEST_HANDLE);
|
||||
|
||||
let avail_protocol_features = VhostUserProtocolFeatures::CONFIG
|
||||
| VhostUserProtocolFeatures::BACKEND_REQ
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue