Signed-off-by: Jie Yang <yangjieyj.yang@huawei.com> (cherry picked from commit 6158eab66897bf7fb11ce7ae8c3b568f8de0e2dd)
31 lines
1.0 KiB
Diff
31 lines
1.0 KiB
Diff
From d0d7be6b637db9e3d1401905472d15082b7f2de6 Mon Sep 17 00:00:00 2001
|
|
From: Ming Yang <yangming73@huawei.com>
|
|
Date: Tue, 24 Aug 2021 19:31:05 +0800
|
|
Subject: [PATCH 04/10] machine: fix more than one pcie-root-ports with same
|
|
id.
|
|
|
|
Signed-off-by: Ming Yang <yangming73@huawei.com>
|
|
---
|
|
machine/src/lib.rs | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/machine/src/lib.rs b/machine/src/lib.rs
|
|
index 8ba0ba3..22aed89 100644
|
|
--- a/machine/src/lib.rs
|
|
+++ b/machine/src/lib.rs
|
|
@@ -508,6 +508,11 @@ pub trait MachineOps {
|
|
let bdf = get_pci_bdf(cfg_args)?;
|
|
let (devfn, parent_bus) = self.get_devfn_and_parent_bus(&bdf)?;
|
|
let device_cfg = parse_root_port(cfg_args)?;
|
|
+ let pci_host = self.get_pci_host()?;
|
|
+ let bus = pci_host.lock().unwrap().root_bus.clone();
|
|
+ if PciBus::find_bus_by_name(&bus, &device_cfg.id).is_some() {
|
|
+ bail!("ID {} already exists.");
|
|
+ }
|
|
let rootport = RootPort::new(device_cfg.id, devfn, device_cfg.port, parent_bus);
|
|
rootport
|
|
.realize()
|
|
--
|
|
2.25.1
|
|
|