[test][vmbase] Check VirtIO socket device in integration test

This cl checks the existence and number of VirtIO socket devices
in the vmbase integration test.

Bug: 284462758
Test: atest vmbase_example.integration_test
Change-Id: I69981f32964741a4258e621fb2254176cfeaae07
diff --git a/vmbase/example/src/pci.rs b/vmbase/example/src/pci.rs
index 7188cde..6d33215 100644
--- a/vmbase/example/src/pci.rs
+++ b/vmbase/example/src/pci.rs
@@ -38,6 +38,7 @@
 pub fn check_pci(pci_root: &mut PciRoot) {
     let mut checked_virtio_device_count = 0;
     let mut block_device_count = 0;
+    let mut socket_device_count = 0;
     for mut transport in PciTransportIterator::<HalImpl>::new(pci_root) {
         info!(
             "Detected virtio PCI device with device type {:?}, features {:#018x}",
@@ -54,12 +55,18 @@
                 check_virtio_console_device(transport);
                 checked_virtio_device_count += 1;
             }
+            DeviceType::Socket => {
+                check_virtio_socket_device(transport);
+                socket_device_count += 1;
+                checked_virtio_device_count += 1;
+            }
             _ => {}
         }
     }
 
-    assert_eq!(checked_virtio_device_count, 5);
+    assert_eq!(checked_virtio_device_count, 6);
     assert_eq!(block_device_count, 2);
+    assert_eq!(socket_device_count, 1);
 }
 
 /// Checks the given VirtIO block device.
@@ -88,6 +95,13 @@
     }
 }
 
+/// Checks the given VirtIO socket device.
+fn check_virtio_socket_device(transport: PciTransport) {
+    let socket = pci::VirtIOSocket::<HalImpl>::new(transport)
+        .expect("Failed to create VirtIO socket driver");
+    info!("Found socket device: guest_cid={}", socket.guest_cid());
+}
+
 /// Checks the given VirtIO console device.
 fn check_virtio_console_device(transport: PciTransport) {
     let mut console = VirtIOConsole::<HalImpl, PciTransport>::new(transport)
diff --git a/vmbase/src/virtio/pci.rs b/vmbase/src/virtio/pci.rs
index a75f0e2..1d05c18 100644
--- a/vmbase/src/virtio/pci.rs
+++ b/vmbase/src/virtio/pci.rs
@@ -22,7 +22,7 @@
 use log::debug;
 use once_cell::race::OnceBox;
 use virtio_drivers::{
-    device::blk,
+    device::{blk, socket},
     transport::pci::{
         bus::{BusDeviceIterator, PciRoot},
         virtio_device_type, PciTransport,
@@ -79,6 +79,11 @@
 /// Virtio Block device.
 pub type VirtIOBlk<T> = blk::VirtIOBlk<T, PciTransport>;
 
+/// Virtio Socket device.
+///
+/// Spec: https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html 5.10
+pub type VirtIOSocket<T> = socket::VirtIOSocket<T, PciTransport>;
+
 /// An iterator that iterates over the PCI transport for each device.
 pub struct PciTransportIterator<'a, T: Hal> {
     pci_root: &'a mut PciRoot,