vmm_vhost: fix the VFIO implementation of set_nonblocking()

The set_nonblocking() implementation of the VFIO Listener was marked as
unimplemented and caused a crash. However, given that accept() on a VFIO
listener never blocks, it is just as safe to mark the operation as
successful, since the behavior of accept() won't be impacted and it will
behave properly both in blocking and non-blocking modes.

Removing this panic will allow us to safely use the Listener's interface
set_nonblocking() method in generic code.

BUG=b:229554679
TEST=vhost-user console device works.
TEST=vvu console device works.

Change-Id: Ibbde7bcd048505fc3a84eb4881a74285bae6bf54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3591111
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
Alexandre Courbot 2022-04-17 11:05:48 +09:00 committed by Chromeos LUCI
parent b524833ab8
commit 2532c07b39

View file

@ -88,7 +88,8 @@ impl<D: Device> ListenerTrait for Listener<D> {
}
fn set_nonblocking(&self, _block: bool) -> Result<()> {
unimplemented!("set_nonblocking");
// `accept` will never block on a VFIO connection.
Ok(())
}
}