mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-20 15:01:16 +00:00
vm-virtio: vhost-user: Vring should be enabled after initialization
As mentioned in the vhost-user specification, each ring is initialized in a stopped state. This means each ring should be enabled only after it has been correctly initialized. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
a4ebcf486d
commit
97699a521f
@ -77,8 +77,6 @@ pub enum Error {
|
|||||||
VhostUserSetVringKick(VhostError),
|
VhostUserSetVringKick(VhostError),
|
||||||
/// Set vring enable failed.
|
/// Set vring enable failed.
|
||||||
VhostUserSetVringEnable(VhostError),
|
VhostUserSetVringEnable(VhostError),
|
||||||
/// Vhost-user setup vring failed.
|
|
||||||
VhostUserSetupVringFailed,
|
|
||||||
/// Failed to create vhost eventfd.
|
/// Failed to create vhost eventfd.
|
||||||
VhostIrqCreate(io::Error),
|
VhostIrqCreate(io::Error),
|
||||||
/// Failed to read vhost eventfd.
|
/// Failed to read vhost eventfd.
|
||||||
|
@ -85,6 +85,9 @@ pub fn setup_vhost_user_vring(
|
|||||||
|
|
||||||
vu.set_vring_kick(queue_index, &queue_evts[queue_index])
|
vu.set_vring_kick(queue_index, &queue_evts[queue_index])
|
||||||
.map_err(Error::VhostUserSetVringKick)?;
|
.map_err(Error::VhostUserSetVringKick)?;
|
||||||
|
|
||||||
|
vu.set_vring_enable(queue_index, true)
|
||||||
|
.map_err(Error::VhostUserSetVringEnable)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(vu_interrupt_list)
|
Ok(vu_interrupt_list)
|
||||||
@ -97,17 +100,9 @@ pub fn setup_vhost_user(
|
|||||||
queue_evts: Vec<EventFd>,
|
queue_evts: Vec<EventFd>,
|
||||||
acked_features: u64,
|
acked_features: u64,
|
||||||
) -> Result<Vec<(EventFd, Queue)>> {
|
) -> Result<Vec<(EventFd, Queue)>> {
|
||||||
for i in 0..queues.len() {
|
|
||||||
vu.set_vring_enable(i, true)
|
|
||||||
.map_err(Error::VhostUserSetVringEnable)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
let backend_features = vu.get_features().unwrap();
|
let backend_features = vu.get_features().unwrap();
|
||||||
vu.set_features(acked_features & backend_features)
|
vu.set_features(acked_features & backend_features)
|
||||||
.map_err(Error::VhostUserSetFeatures)?;
|
.map_err(Error::VhostUserSetFeatures)?;
|
||||||
|
|
||||||
match setup_vhost_user_vring(vu, mem, queues, queue_evts) {
|
setup_vhost_user_vring(vu, mem, queues, queue_evts)
|
||||||
Ok(vu_interrupt_list) => Ok(vu_interrupt_list),
|
|
||||||
Err(_) => Err(Error::VhostUserSetupVringFailed),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user