mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio: pci: Expect an identifier upon device creation
This identifier is chosen from the DeviceManager so that it will manage all identifiers across the VM, which will ensure uniqueness. It is based off the name from the virtio device attached to this transport layer. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
eeb7e10d1f
commit
06487131f9
@@ -259,6 +259,8 @@ const VIRTIO_PCI_VENDOR_ID: u16 = 0x1af4;
|
||||
const VIRTIO_PCI_DEVICE_ID_BASE: u16 = 0x1040; // Add to device type to get device ID.
|
||||
|
||||
pub struct VirtioPciDevice {
|
||||
id: String,
|
||||
|
||||
// PCI configuration registers.
|
||||
configuration: PciConfiguration,
|
||||
|
||||
@@ -308,6 +310,7 @@ pub struct VirtioPciDevice {
|
||||
impl VirtioPciDevice {
|
||||
/// Constructs a new PCI transport for the given virtio device.
|
||||
pub fn new(
|
||||
id: String,
|
||||
memory: GuestMemoryAtomic<GuestMemoryMmap>,
|
||||
device: Arc<Mutex<dyn VirtioDevice>>,
|
||||
msix_num: u16,
|
||||
@@ -384,6 +387,7 @@ impl VirtioPciDevice {
|
||||
);
|
||||
|
||||
let mut virtio_pci_device = VirtioPciDevice {
|
||||
id,
|
||||
configuration,
|
||||
common_config: VirtioPciCommonConfig {
|
||||
driver_status: 0,
|
||||
@@ -962,6 +966,10 @@ impl Pausable for VirtioPciDevice {
|
||||
}
|
||||
}
|
||||
|
||||
impl Snapshottable for VirtioPciDevice {}
|
||||
impl Snapshottable for VirtioPciDevice {
|
||||
fn id(&self) -> String {
|
||||
self.id.clone()
|
||||
}
|
||||
}
|
||||
impl Transportable for VirtioPciDevice {}
|
||||
impl Migratable for VirtioPciDevice {}
|
||||
|
||||
Reference in New Issue
Block a user