diff options
Diffstat (limited to 'pkgs/applications/virtualization/cloud-hypervisor/vhost/0002-devices-vhost-user-add-protocol-flag-for-shmem.patch')
-rw-r--r-- | pkgs/applications/virtualization/cloud-hypervisor/vhost/0002-devices-vhost-user-add-protocol-flag-for-shmem.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/applications/virtualization/cloud-hypervisor/vhost/0002-devices-vhost-user-add-protocol-flag-for-shmem.patch b/pkgs/applications/virtualization/cloud-hypervisor/vhost/0002-devices-vhost-user-add-protocol-flag-for-shmem.patch new file mode 100644 index 00000000000..87e29939715 --- /dev/null +++ b/pkgs/applications/virtualization/cloud-hypervisor/vhost/0002-devices-vhost-user-add-protocol-flag-for-shmem.patch @@ -0,0 +1,55 @@ +From ee17b58f30e65a37a0526a4df60f9810fa19b138 Mon Sep 17 00:00:00 2001 +From: David Stevens <stevensd@chromium.org> +Date: Thu, 13 Oct 2022 10:37:47 +0900 +Subject: [PATCH 2/2] devices: vhost-user: add protocol flag for shmem + +Add a vhost protocol feature flag for shared memory region support. This +is necessary to avoid sending the GET_SHARED_MEMORY_REGIONS message to +backends which don't support it. + +BUG=b:252901073 +TEST=crosvm device wl + +Change-Id: I044926e982526c3c76063b5386cab0db72524707 +Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3951472 +Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> +Commit-Queue: David Stevens <stevensd@chromium.org> +(cherry-picked from commit 60aa43629ae9be2cc3df37c648ab7e0e5ff2172c) +Signed-off-by: Alyssa Ross <hi@alyssa.is> +--- + src/vhost_user/master.rs | 5 +++++ + src/vhost_user/message.rs | 2 ++ + 2 files changed, 7 insertions(+) + +diff --git a/src/vhost_user/master.rs b/src/vhost_user/master.rs +index deab6a7..2bbf8d6 100644 +--- a/src/vhost_user/master.rs ++++ b/src/vhost_user/master.rs +@@ -357,6 +357,11 @@ impl VhostUserMaster for Master { + fn set_protocol_features(&mut self, features: VhostUserProtocolFeatures) -> Result<()> { + let mut node = self.node(); + node.check_feature(VhostUserVirtioFeatures::PROTOCOL_FEATURES)?; ++ if features.contains(VhostUserProtocolFeatures::SHARED_MEMORY_REGIONS) ++ && !features.contains(VhostUserProtocolFeatures::SLAVE_REQ) ++ { ++ return error_code(VhostUserError::FeatureMismatch); ++ } + let val = VhostUserU64::new(features.bits()); + let hdr = node.send_request_with_body(MasterReq::SET_PROTOCOL_FEATURES, &val, None)?; + // Don't wait for ACK here because the protocol feature negotiation process hasn't been +diff --git a/src/vhost_user/message.rs b/src/vhost_user/message.rs +index adb485b..09362fb 100644 +--- a/src/vhost_user/message.rs ++++ b/src/vhost_user/message.rs +@@ -417,6 +417,8 @@ bitflags! { + const CONFIGURE_MEM_SLOTS = 0x0000_8000; + /// Support reporting status. + const STATUS = 0x0001_0000; ++ /// Support shared memory regions. ++ const SHARED_MEMORY_REGIONS = 0x0002_0000; + } + } + +-- +2.37.1 + |