From fa673c93e243ba297d53b585cd2f51fa68380fc5 Mon Sep 17 00:00:00 2001 From: jiangpengfei Date: Tue, 18 Aug 2020 19:37:48 +0800 Subject: [PATCH 07/16] agent: using pcie-root-port driver to hotplug device reason: In original pci-bridge scheme, the "F" in the BDF is not used, and was written hard code "0" in the kata-agent. But the "function" is specified when switching to pcie-root-port scheme, so when should pass the "pci-bridge BDF" or "pcie-root-port BDF" from kata-runtime and use in kata-agent. Signed-off-by: jiangpengfei --- device.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/device.go b/device.go index 46a1b96..8e6950c 100644 --- a/device.go +++ b/device.go @@ -101,7 +101,12 @@ func getDevicePCIAddressImpl(pciID string) (string, error) { // Deduce the complete bridge address based on the bridge address identifier passed // and the fact that bridges are attached on the main bus with function 0. - pciBridgeAddr := fmt.Sprintf("0000:00:%s.0", bridgeID) + // Update: support pcie-root-port device + // In original pci-bridge scheme, the "F" in the BDF is not used, and was written + // hard code "0" in the kata-agent. But the "function" is specified when switching to + // pcie-root-port scheme, so when should pass the "pci-bridge BDF" or "pcie-root-port BDF" + // from kata-runtime and use in kata-agent. + pciBridgeAddr := fmt.Sprintf("0000:00:%s", bridgeID) // Find out the bus exposed by bridge bridgeBusPath := fmt.Sprintf(pciBusPathFormat, sysBusPrefix, pciBridgeAddr) -- 2.14.3 (Apple Git-98)