From c63c9b3c830350b9ff4111f41f0d37b5224b2ef3 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Mon, 3 Jul 2023 16:22:52 +0530 Subject: [PATCH] vhost: Enable XEN_MMAP protocol feature for xen Automatically enable the VhostUserProtocolFeatures::XEN_MMAP feature for backends for Xen specific builds. With these the backends don't need to enable this feature and can directly support Xen. Suggested-by: Erik Schilling Signed-off-by: Viresh Kumar --- crates/vhost/src/vhost_user/slave_req_handler.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/vhost/src/vhost_user/slave_req_handler.rs b/crates/vhost/src/vhost_user/slave_req_handler.rs index 0b5c215..e998339 100644 --- a/crates/vhost/src/vhost_user/slave_req_handler.rs +++ b/crates/vhost/src/vhost_user/slave_req_handler.rs @@ -421,6 +421,11 @@ impl SlaveReqHandler { Ok(MasterReq::GET_PROTOCOL_FEATURES) => { self.check_request_size(&hdr, size, 0)?; let features = self.backend.get_protocol_features()?; + + // Enable the `XEN_MMAP` protocol feature for backends if xen feature is enabled. + #[cfg(feature = "xen")] + let features = features | VhostUserProtocolFeatures::XEN_MMAP; + let msg = VhostUserU64::new(features.bits()); self.send_reply_message(&hdr, &msg)?; self.protocol_features = features;