mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio: vhost-user-blk: Add support for reset
If we expect the vhost-user-blk device to be used for booting a VMM along with the firmware, then need the device to support being reset. In the vhost-user context, this means the backend needs to be informed the vrings are disabled and stopped, and the owner needs to be reset too. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
0a229ef4f5
commit
d723b7dae8
@@ -106,3 +106,18 @@ pub fn setup_vhost_user(
|
||||
|
||||
setup_vhost_user_vring(vu, mem, queues, queue_evts)
|
||||
}
|
||||
|
||||
pub fn reset_vhost_user(vu: &mut Master, num_queues: usize) -> Result<()> {
|
||||
for queue_index in 0..num_queues {
|
||||
// Disable the vrings.
|
||||
vu.set_vring_enable(queue_index, false)
|
||||
.map_err(Error::VhostUserSetVringEnable)?;
|
||||
|
||||
// Stop the vrings.
|
||||
vu.get_vring_base(queue_index)
|
||||
.map_err(Error::VhostUserSetFeatures)?;
|
||||
}
|
||||
|
||||
// Reset the owner.
|
||||
vu.reset_owner().map_err(Error::VhostUserResetOwner)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user