[Skiboot] [PATCH v2 2/4] core/pci: Detach IOV from capability descriptor

Gavin Shan gwshan at linux.vnet.ibm.com
Mon Jun 19 16:46:47 AEST 2017


The IOV struct is associated with the capability descriptor, but
it's never used. This detachs IOV struct from the capability
descriptor, binds IOV struct with PCI device instead.

Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 core/pci-iov.c |  3 ++-
 core/pci.c     |  6 +++---
 include/pci.h  | 15 ++-------------
 3 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/core/pci-iov.c b/core/pci-iov.c
index 9d75b37..627f300 100644
--- a/core/pci-iov.c
+++ b/core/pci-iov.c
@@ -252,6 +252,7 @@ void pci_init_iov_cap(struct phb *phb, struct pci_device *pd)
 	iov->pd = pd;
 	iov->pos = pos;
 	iov->enabled = false;
+	pd->iov = iov;
 	pci_iov_update_parameters(iov);
-	pci_set_cap(pd, PCIECAP_ID_SRIOV, pos, iov, true);
+	pci_set_cap(pd, PCIECAP_ID_SRIOV, pos, true);
 }
diff --git a/core/pci.c b/core/pci.c
index 7cd29fd..1aa906a 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -162,7 +162,7 @@ static void pci_init_pcie_cap(struct phb *phb, struct pci_device *pd)
 		return;
 	}
 
-	pci_set_cap(pd, PCI_CFG_CAP_ID_EXP, ecap, NULL, false);
+	pci_set_cap(pd, PCI_CFG_CAP_ID_EXP, ecap, false);
 
 	/*
 	 * XXX We observe a problem on some PLX switches where one
@@ -198,7 +198,7 @@ static void pci_init_aer_cap(struct phb *phb, struct pci_device *pd)
 
 	pos = pci_find_ecap(phb, pd->bdfn, PCIECAP_ID_AER, NULL);
 	if (pos > 0)
-		pci_set_cap(pd, PCIECAP_ID_AER, pos, NULL, true);
+		pci_set_cap(pd, PCIECAP_ID_AER, pos, true);
 }
 
 static void pci_init_pm_cap(struct phb *phb, struct pci_device *pd)
@@ -207,7 +207,7 @@ static void pci_init_pm_cap(struct phb *phb, struct pci_device *pd)
 
 	pos = pci_find_cap(phb, pd->bdfn, PCI_CFG_CAP_ID_PM);
 	if (pos > 0)
-		pci_set_cap(pd, PCI_CFG_CAP_ID_PM, pos, NULL, false);
+		pci_set_cap(pd, PCI_CFG_CAP_ID_PM, pos, false);
 }
 
 void pci_init_capabilities(struct phb *phb, struct pci_device *pd)
diff --git a/include/pci.h b/include/pci.h
index f216594..a26a0ea 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -79,7 +79,6 @@ struct pci_device {
 	uint64_t		cap_list;
 	struct {
 		uint32_t	pos;
-		void		*data;
 	} cap[64];
 	uint32_t		mps;		/* Max payload size capability */
 
@@ -87,6 +86,7 @@ struct pci_device {
 	uint32_t		pcrf_end;
 	struct list_head	pcrf;
 
+	struct pci_iov		*iov;
 	struct dt_node		*dn;
 	struct pci_slot		*slot;
 	struct pci_device	*parent;
@@ -95,17 +95,14 @@ struct pci_device {
 	struct list_node	link;
 };
 
-static inline void pci_set_cap(struct pci_device *pd, int id,
-			       int pos, void *data, bool ext)
+static inline void pci_set_cap(struct pci_device *pd, int id, int pos, bool ext)
 {
 	if (!ext) {
 		pd->cap_list |= (0x1ul << id);
 		pd->cap[id].pos = pos;
-		pd->cap[id].data = data;
 	} else {
 		pd->cap_list |= (0x1ul << (id + 32));
 		pd->cap[id + 32].pos = pos;
-		pd->cap[id + 32].data = data;
 	}
 }
 
@@ -127,14 +124,6 @@ static inline int pci_cap(struct pci_device *pd,
 		return pd->cap[id + 32].pos;
 }
 
-static inline void *pci_cap_data(struct pci_device *pd, int id, bool ext)
-{
-	if (!ext)
-		return pd->cap[id].data;
-	else
-		return pd->cap[id + 32].data;
-}
-
 /*
  * When generating the device-tree, we need to keep track of
  * the LSI mapping & swizzle it. This state structure is
-- 
2.7.4



More information about the Skiboot mailing list