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 <erik.schilling@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Viresh Kumar 2023-07-03 16:22:52 +05:30 committed by Jiang Liu
parent 4029089f75
commit c63c9b3c83

View file

@ -421,6 +421,11 @@ impl<S: VhostUserSlaveReqHandler> SlaveReqHandler<S> {
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;