mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-31 18:15:20 +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,
|
||||
queue_evts,
|
||||
&interrupt_cb,
|
||||
self.common.acked_features
|
||||
| (self.common.avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits()),
|
||||
)
|
||||
.map_err(ActivateError::VhostUserBlkSetup)?;
|
||||
|
||||
|
@ -474,6 +474,8 @@ impl VirtioDevice for Fs {
|
||||
queues,
|
||||
queue_evts,
|
||||
&interrupt_cb,
|
||||
self.common.acked_features
|
||||
| (self.common.avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits()),
|
||||
)
|
||||
.map_err(ActivateError::VhostUserFsSetup)?;
|
||||
|
||||
|
@ -226,6 +226,8 @@ impl VirtioDevice for Net {
|
||||
queues,
|
||||
queue_evts,
|
||||
&interrupt_cb,
|
||||
self.common.acked_features
|
||||
| (self.common.avail_features & VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits()),
|
||||
)
|
||||
.map_err(ActivateError::VhostUserNetSetup)?;
|
||||
|
||||
|
@ -74,7 +74,11 @@ pub fn setup_vhost_user(
|
||||
queues: Vec<Queue>,
|
||||
queue_evts: Vec<EventFd>,
|
||||
virtio_interrupt: &Arc<dyn VirtioInterrupt>,
|
||||
acked_features: u64,
|
||||
) -> Result<()> {
|
||||
vu.set_features(acked_features)
|
||||
.map_err(Error::VhostUserSetFeatures)?;
|
||||
|
||||
// Let's first provide the memory table to the backend.
|
||||
update_mem_table(vu, mem)?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user