From 7e8d64b3c21f606dd0b030f324b098444d489bc3 Mon Sep 17 00:00:00 2001
From: Yan Wang <wangyan122@huawei.com>
Date: Fri, 1 Sep 2023 17:19:26 +0800
Subject: [PATCH] vsock: diable VIRTIO_F_ACCESS_PLATFORM feature

Currently, we don't support VIRTIO_F_ACCESS_PLATFORM feature.
So, disable it.

Signed-off-by: Yan Wang <wangyan122@huawei.com>
---
 virtio/src/vhost/kernel/vsock.rs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/virtio/src/vhost/kernel/vsock.rs b/virtio/src/vhost/kernel/vsock.rs
index 17bc342..2b05fd0 100644
--- a/virtio/src/vhost/kernel/vsock.rs
+++ b/virtio/src/vhost/kernel/vsock.rs
@@ -30,7 +30,8 @@ use crate::VirtioError;
 use anyhow::{anyhow, bail, Context, Result};
 
 use super::super::super::{
-    Queue, VirtioDevice, VirtioInterrupt, VirtioInterruptType, VIRTIO_TYPE_VSOCK,
+    Queue, VirtioDevice, VirtioInterrupt, VirtioInterruptType, VIRTIO_F_ACCESS_PLATFORM,
+    VIRTIO_TYPE_VSOCK,
 };
 use super::super::{VhostNotify, VhostOps};
 use super::{VhostBackend, VhostIoHandler, VHOST_VSOCK_SET_GUEST_CID, VHOST_VSOCK_SET_RUNNING};
@@ -174,9 +175,10 @@ impl VirtioDevice for Vsock {
         backend
             .set_owner()
             .with_context(|| "Failed to set owner for vsock")?;
-        self.state.device_features = backend
+        let features = backend
             .get_features()
             .with_context(|| "Failed to get features for vsock")?;
+        self.state.device_features = features & !(1_u64 << VIRTIO_F_ACCESS_PLATFORM);
         self.backend = Some(backend);
 
         Ok(())
-- 
2.34.1

