mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 23:41:15 +00:00
virtio-devices: vhost_user: Set features once acknowledged by guest
Make sure the virtio features are set upon device activation. At the time the device is activated, we know the guest acknowledged the features, which mean it's safe to set them back to the backend. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
8c73af048a
commit
cdaa4d3ad7
@ -233,6 +233,8 @@ impl VirtioDevice for Blk {
|
|||||||
queues,
|
queues,
|
||||||
queue_evts,
|
queue_evts,
|
||||||
&interrupt_cb,
|
&interrupt_cb,
|
||||||
|
self.common.acked_features
|
||||||
|
| (self.common.avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits()),
|
||||||
)
|
)
|
||||||
.map_err(ActivateError::VhostUserBlkSetup)?;
|
.map_err(ActivateError::VhostUserBlkSetup)?;
|
||||||
|
|
||||||
|
@ -474,6 +474,8 @@ impl VirtioDevice for Fs {
|
|||||||
queues,
|
queues,
|
||||||
queue_evts,
|
queue_evts,
|
||||||
&interrupt_cb,
|
&interrupt_cb,
|
||||||
|
self.common.acked_features
|
||||||
|
| (self.common.avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits()),
|
||||||
)
|
)
|
||||||
.map_err(ActivateError::VhostUserFsSetup)?;
|
.map_err(ActivateError::VhostUserFsSetup)?;
|
||||||
|
|
||||||
|
@ -226,6 +226,8 @@ impl VirtioDevice for Net {
|
|||||||
queues,
|
queues,
|
||||||
queue_evts,
|
queue_evts,
|
||||||
&interrupt_cb,
|
&interrupt_cb,
|
||||||
|
self.common.acked_features
|
||||||
|
| (self.common.avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits()),
|
||||||
)
|
)
|
||||||
.map_err(ActivateError::VhostUserNetSetup)?;
|
.map_err(ActivateError::VhostUserNetSetup)?;
|
||||||
|
|
||||||
|
@ -74,7 +74,11 @@ pub fn setup_vhost_user(
|
|||||||
queues: Vec<Queue>,
|
queues: Vec<Queue>,
|
||||||
queue_evts: Vec<EventFd>,
|
queue_evts: Vec<EventFd>,
|
||||||
virtio_interrupt: &Arc<dyn VirtioInterrupt>,
|
virtio_interrupt: &Arc<dyn VirtioInterrupt>,
|
||||||
|
acked_features: u64,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
vu.set_features(acked_features)
|
||||||
|
.map_err(Error::VhostUserSetFeatures)?;
|
||||||
|
|
||||||
// Let's first provide the memory table to the backend.
|
// Let's first provide the memory table to the backend.
|
||||||
update_mem_table(vu, mem)?;
|
update_mem_table(vu, mem)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user