[Skiboot] [PATCH 1/3] pci: Track whether a PCI device is a virtual function

Russell Currey ruscur at russell.cc
Thu Aug 17 16:04:44 AEST 2017


This can be checked from config space, but we will need to know this when
restoring the PCI topology, and it is not always safe to access config
space during this period.

Signed-off-by: Russell Currey <ruscur at russell.cc>
---
 core/pci-iov.c | 1 +
 core/pci.c     | 1 +
 include/pci.h  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/core/pci-iov.c b/core/pci-iov.c
index 9d75b378..06fc4c6f 100644
--- a/core/pci-iov.c
+++ b/core/pci-iov.c
@@ -175,6 +175,7 @@ static void pci_iov_init_VF(struct pci_device *pd, struct pci_device *vf)
 {
 	vf->is_bridge		= false;
 	vf->is_multifunction	= false;
+	vf->is_vf		= true;
 	vf->dev_type		= PCIE_TYPE_ENDPOINT;
 	vf->scan_map		= -1;
 	vf->vdid		= pd->vdid;
diff --git a/core/pci.c b/core/pci.c
index 4296180a..32767db5 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -273,6 +273,7 @@ static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren
 	}
 	pd->is_multifunction = !!(htype & 0x80);
 	pd->is_bridge = (htype & 0x7f) != 0;
+	pd->is_vf = false;
 	pd->scan_map = 0xffffffff; /* Default */
 	pd->primary_bus = (bdfn >> 8);
 
diff --git a/include/pci.h b/include/pci.h
index 54a62fd1..884ce622 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -65,6 +65,7 @@ struct pci_device {
 	uint16_t		bdfn;
 	bool			is_bridge;
 	bool			is_multifunction;
+	bool			is_vf;
 	uint8_t			dev_type; /* PCIE */
 	uint8_t			primary_bus;
 	uint8_t			secondary_bus;
-- 
2.14.1



More information about the Skiboot mailing list