aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv
diff options
context:
space:
mode:
authorGavin Shan <shangw@linux.vnet.ibm.com>2012-08-19 23:49:15 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-09-17 02:35:13 -0400
commit7ebdf956df7961ae6b57b0328e03d33f95f1346f (patch)
tree6805625c08e697e3d1c2369ae3f9e0ee60a17904 /arch/powerpc/platforms/powernv
parentfb446ad075cfa5212b26c4f77751faefe574ad8b (diff)
powerpc/powernv: PE list based on creation order
The resource (I/O and MMIO) will be assigned on basis of PE from top to bottom so that we can implement the trick here: the resource that has been assigned to parent PE could be taken by child PE if necessary. The current implementation already has PE list per PHB basis, but the list doesn't meet our requirment: tracing PE based on their cration time from top to bottom. So the patch does rename for the DMA based PE list and introduces the list to trace the PEs sequentially based on their creation time. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Reviewed-by: Ram Pai <linuxram@us.ibm.com> Reviewed-by: Richard Yang <weiyang@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/powernv')
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c12
-rw-r--r--arch/powerpc/platforms/powernv/pci.h20
2 files changed, 21 insertions, 11 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 0ddc2e5235d6..7999da1e0b11 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -656,13 +656,13 @@ static void __devinit pnv_ioda_link_pe_by_weight(struct pnv_phb *phb,
656{ 656{
657 struct pnv_ioda_pe *lpe; 657 struct pnv_ioda_pe *lpe;
658 658
659 list_for_each_entry(lpe, &phb->ioda.pe_list, link) { 659 list_for_each_entry(lpe, &phb->ioda.pe_dma_list, dma_link) {
660 if (lpe->dma_weight < pe->dma_weight) { 660 if (lpe->dma_weight < pe->dma_weight) {
661 list_add_tail(&pe->link, &lpe->link); 661 list_add_tail(&pe->dma_link, &lpe->dma_link);
662 return; 662 return;
663 } 663 }
664 } 664 }
665 list_add_tail(&pe->link, &phb->ioda.pe_list); 665 list_add_tail(&pe->dma_link, &phb->ioda.pe_dma_list);
666} 666}
667 667
668static unsigned int pnv_ioda_dma_weight(struct pci_dev *dev) 668static unsigned int pnv_ioda_dma_weight(struct pci_dev *dev)
@@ -828,6 +828,9 @@ static void __devinit pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all)
828 /* Associate it with all child devices */ 828 /* Associate it with all child devices */
829 pnv_ioda_setup_same_PE(bus, pe); 829 pnv_ioda_setup_same_PE(bus, pe);
830 830
831 /* Put PE to the list */
832 list_add_tail(&pe->list, &phb->ioda.pe_list);
833
831 /* Account for one DMA PE if at least one DMA capable device exist 834 /* Account for one DMA PE if at least one DMA capable device exist
832 * below the bridge 835 * below the bridge
833 */ 836 */
@@ -1011,7 +1014,7 @@ static void __devinit pnv_ioda_setup_dma(struct pnv_phb *phb)
1011 remaining = phb->ioda.tce32_count; 1014 remaining = phb->ioda.tce32_count;
1012 tw = phb->ioda.dma_weight; 1015 tw = phb->ioda.dma_weight;
1013 base = 0; 1016 base = 0;
1014 list_for_each_entry(pe, &phb->ioda.pe_list, link) { 1017 list_for_each_entry(pe, &phb->ioda.pe_dma_list, dma_link) {
1015 if (!pe->dma_weight) 1018 if (!pe->dma_weight)
1016 continue; 1019 continue;
1017 if (!remaining) { 1020 if (!remaining) {
@@ -1305,6 +1308,7 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
1305 phb->ioda.pe_array = aux + pemap_off; 1308 phb->ioda.pe_array = aux + pemap_off;
1306 set_bit(0, phb->ioda.pe_alloc); 1309 set_bit(0, phb->ioda.pe_alloc);
1307 1310
1311 INIT_LIST_HEAD(&phb->ioda.pe_dma_list);
1308 INIT_LIST_HEAD(&phb->ioda.pe_list); 1312 INIT_LIST_HEAD(&phb->ioda.pe_list);
1309 1313
1310 /* Calculate how many 32-bit TCE segments we have */ 1314 /* Calculate how many 32-bit TCE segments we have */
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 8bc479634643..b70720bd9430 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -17,9 +17,14 @@ enum pnv_phb_model {
17}; 17};
18 18
19#define PNV_PCI_DIAG_BUF_SIZE 4096 19#define PNV_PCI_DIAG_BUF_SIZE 4096
20#define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */
21#define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */
22#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */
20 23
21/* Data associated with a PE, including IOMMU tracking etc.. */ 24/* Data associated with a PE, including IOMMU tracking etc.. */
22struct pnv_ioda_pe { 25struct pnv_ioda_pe {
26 unsigned long flags;
27
23 /* A PE can be associated with a single device or an 28 /* A PE can be associated with a single device or an
24 * entire bus (& children). In the former case, pdev 29 * entire bus (& children). In the former case, pdev
25 * is populated, in the later case, pbus is. 30 * is populated, in the later case, pbus is.
@@ -40,11 +45,6 @@ struct pnv_ioda_pe {
40 */ 45 */
41 unsigned int dma_weight; 46 unsigned int dma_weight;
42 47
43 /* This is a PCI-E -> PCI-X bridge, this points to the
44 * corresponding bus PE
45 */
46 struct pnv_ioda_pe *bus_pe;
47
48 /* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */ 48 /* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */
49 int tce32_seg; 49 int tce32_seg;
50 int tce32_segcount; 50 int tce32_segcount;
@@ -59,7 +59,8 @@ struct pnv_ioda_pe {
59 int mve_number; 59 int mve_number;
60 60
61 /* Link in list of PE#s */ 61 /* Link in list of PE#s */
62 struct list_head link; 62 struct list_head dma_link;
63 struct list_head list;
63}; 64};
64 65
65struct pnv_phb { 66struct pnv_phb {
@@ -107,6 +108,11 @@ struct pnv_phb {
107 unsigned int *io_segmap; 108 unsigned int *io_segmap;
108 struct pnv_ioda_pe *pe_array; 109 struct pnv_ioda_pe *pe_array;
109 110
111 /* Sorted list of used PE's based
112 * on the sequence of creation
113 */
114 struct list_head pe_list;
115
110 /* Reverse map of PEs, will have to extend if 116 /* Reverse map of PEs, will have to extend if
111 * we are to support more than 256 PEs, indexed 117 * we are to support more than 256 PEs, indexed
112 * bus { bus, devfn } 118 * bus { bus, devfn }
@@ -125,7 +131,7 @@ struct pnv_phb {
125 /* Sorted list of used PE's, sorted at 131 /* Sorted list of used PE's, sorted at
126 * boot for resource allocation purposes 132 * boot for resource allocation purposes
127 */ 133 */
128 struct list_head pe_list; 134 struct list_head pe_dma_list;
129 } ioda; 135 } ioda;
130 }; 136 };
131 137