Re: [PATCH v5 08/42] powerpc/powernv: DMA32 cleanup
On Wed, Jun 10, 2015 at 02:17:26PM +1000, Alexey Kardashevskiy wrote: >On 06/04/2015 04:41 PM, Gavin Shan wrote: >>The patch cleans up DMA32 in pci-ioda.c. It shouldn't introduce >>behavioural changes: >> >>* Rename various fields in "struct pnv_phb" and "struct pnv_ioda_pe" >> as 32-bits DMA should be related to "DMA", not "TCE", and move >> them around to reflect their relationship and their relative >> importance. >>* Removed struct pnv_ioda_pe::tce32_segcount. >> >>Signed-off-by: Gavin Shan >>--- >>v5: >> * Split from PATCH[v4 5/21] >>--- >> arch/powerpc/platforms/powernv/pci-ioda.c | 48 >> +++ >> arch/powerpc/platforms/powernv/pci.h | 13 +++-- >> 2 files changed, 28 insertions(+), 33 deletions(-) >> >>diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c >>b/arch/powerpc/platforms/powernv/pci-ioda.c >>index d9ff739..4af3d06 100644 >>--- a/arch/powerpc/platforms/powernv/pci-ioda.c >>+++ b/arch/powerpc/platforms/powernv/pci-ioda.c >>@@ -971,7 +971,7 @@ static void pnv_ioda_link_pe_by_weight(struct pnv_phb >>*phb, >> struct pnv_ioda_pe *lpe; >> >> list_for_each_entry(lpe, &phb->ioda.pe_dma_list, dma_link) { >>- if (lpe->dma_weight < pe->dma_weight) { >>+ if (lpe->dma32_weight < pe->dma32_weight) { >> list_add_tail(&pe->dma_link, &lpe->dma_link); >> return; >> } >>@@ -996,14 +996,14 @@ static unsigned int pnv_ioda_dev_dma_weight(struct >>pci_dev *dev) >> if (dev->class == PCI_CLASS_SERIAL_USB_UHCI || >> dev->class == PCI_CLASS_SERIAL_USB_OHCI || >> dev->class == PCI_CLASS_SERIAL_USB_EHCI) >>- return 3 * phb->ioda.tce32_count; >>+ return 3 * phb->ioda.dma32_segcount; >> >> /* Increase the weight of RAID (includes Obsidian) */ >> if ((dev->class >> 8) == PCI_CLASS_STORAGE_RAID) >>- return 15 * phb->ioda.tce32_count; >>+ return 15 * phb->ioda.dma32_segcount; >> >> /* Default */ >>- return 10 * phb->ioda.tce32_count; >>+ return 10 * phb->ioda.dma32_segcount; >> } >> >> static int __pnv_ioda_phb_dma_weight(struct pci_dev *pdev, void *data) >>@@ -1182,7 +1182,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, >>struct pnv_ioda_pe *pe) >> continue; >> } >> pdn->pe_number = pe->pe_number; >>- pe->dma_weight += pnv_ioda_dev_dma_weight(dev); >>+ pe->dma32_weight += pnv_ioda_dev_dma_weight(dev); >> if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) >> pnv_ioda_setup_same_PE(dev->subordinate, pe); >> } >>@@ -1219,10 +1219,10 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus >>*bus, int all) >> pe->flags |= (all ? PNV_IODA_PE_BUS_ALL : PNV_IODA_PE_BUS); >> pe->pbus = bus; >> pe->pdev = NULL; >>- pe->tce32_seg = -1; >>+ pe->dma32_seg = -1; >> pe->mve_number = -1; >> pe->rid = bus->busn_res.start << 8; >>- pe->dma_weight = 0; >>+ pe->dma32_weight = 0; >> >> if (all) >> pe_info(pe, "Secondary bus %d..%d associated with PE#%d\n", >>@@ -1585,7 +1585,7 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, >>u16 num_vfs) >> pe->flags = PNV_IODA_PE_VF; >> pe->pbus = NULL; >> pe->parent_dev = pdev; >>- pe->tce32_seg = -1; >>+ pe->dma32_seg = -1; >> pe->mve_number = -1; >> pe->rid = (pci_iov_virtfn_bus(pdev, vf_index) << 8) | >> pci_iov_virtfn_devfn(pdev, vf_index); >>@@ -2061,7 +2061,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb >>*phb, >> /* XXX FIXME: Allocate multi-level tables on PHB3 */ >> >> /* We shouldn't already have a 32-bit DMA associated */ >>- if (WARN_ON(pe->tce32_seg >= 0)) >>+ if (WARN_ON(pe->dma32_seg >= 0)) >> return; >> >> tbl = pnv_pci_table_alloc(phb->hose->node); >>@@ -2070,7 +2070,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb >>*phb, >> pnv_pci_link_table_and_group(phb->hose->node, 0, tbl, &pe->table_group); >> >> /* Grab a 32-bit TCE table */ >>- pe->tce32_seg = base; >>+ pe->dma32_seg = base; >> pe_info(pe, " Setting up 32-bit TCE table at %08x..%08x\n", >> (base << 28), ((base + segs) << 28) - 1); >> >>@@ -2131,8 +2131,8 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb >>*phb, >> return; >> fail: >> /* XXX Failure: Try to fallback to 64-bit only ? */ >>- if (pe->tce32_seg >= 0) >>- pe->tce32_seg = -1; >>+ if (pe->dma32_seg >= 0) >>+ pe->dma32_seg = -1; >> if (tce_mem) >> __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs)); >> if (tbl) { >>@@ -2520,7 +2520,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb >>*phb, >> int64_t rc; >> >> /* We shouldn't alr
Re: [PATCH v5 08/42] powerpc/powernv: DMA32 cleanup
On 06/04/2015 04:41 PM, Gavin Shan wrote: The patch cleans up DMA32 in pci-ioda.c. It shouldn't introduce behavioural changes: * Rename various fields in "struct pnv_phb" and "struct pnv_ioda_pe" as 32-bits DMA should be related to "DMA", not "TCE", and move them around to reflect their relationship and their relative importance. * Removed struct pnv_ioda_pe::tce32_segcount. Signed-off-by: Gavin Shan --- v5: * Split from PATCH[v4 5/21] --- arch/powerpc/platforms/powernv/pci-ioda.c | 48 +++ arch/powerpc/platforms/powernv/pci.h | 13 +++-- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index d9ff739..4af3d06 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -971,7 +971,7 @@ static void pnv_ioda_link_pe_by_weight(struct pnv_phb *phb, struct pnv_ioda_pe *lpe; list_for_each_entry(lpe, &phb->ioda.pe_dma_list, dma_link) { - if (lpe->dma_weight < pe->dma_weight) { + if (lpe->dma32_weight < pe->dma32_weight) { list_add_tail(&pe->dma_link, &lpe->dma_link); return; } @@ -996,14 +996,14 @@ static unsigned int pnv_ioda_dev_dma_weight(struct pci_dev *dev) if (dev->class == PCI_CLASS_SERIAL_USB_UHCI || dev->class == PCI_CLASS_SERIAL_USB_OHCI || dev->class == PCI_CLASS_SERIAL_USB_EHCI) - return 3 * phb->ioda.tce32_count; + return 3 * phb->ioda.dma32_segcount; /* Increase the weight of RAID (includes Obsidian) */ if ((dev->class >> 8) == PCI_CLASS_STORAGE_RAID) - return 15 * phb->ioda.tce32_count; + return 15 * phb->ioda.dma32_segcount; /* Default */ - return 10 * phb->ioda.tce32_count; + return 10 * phb->ioda.dma32_segcount; } static int __pnv_ioda_phb_dma_weight(struct pci_dev *pdev, void *data) @@ -1182,7 +1182,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe) continue; } pdn->pe_number = pe->pe_number; - pe->dma_weight += pnv_ioda_dev_dma_weight(dev); + pe->dma32_weight += pnv_ioda_dev_dma_weight(dev); if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) pnv_ioda_setup_same_PE(dev->subordinate, pe); } @@ -1219,10 +1219,10 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all) pe->flags |= (all ? PNV_IODA_PE_BUS_ALL : PNV_IODA_PE_BUS); pe->pbus = bus; pe->pdev = NULL; - pe->tce32_seg = -1; + pe->dma32_seg = -1; pe->mve_number = -1; pe->rid = bus->busn_res.start << 8; - pe->dma_weight = 0; + pe->dma32_weight = 0; if (all) pe_info(pe, "Secondary bus %d..%d associated with PE#%d\n", @@ -1585,7 +1585,7 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs) pe->flags = PNV_IODA_PE_VF; pe->pbus = NULL; pe->parent_dev = pdev; - pe->tce32_seg = -1; + pe->dma32_seg = -1; pe->mve_number = -1; pe->rid = (pci_iov_virtfn_bus(pdev, vf_index) << 8) | pci_iov_virtfn_devfn(pdev, vf_index); @@ -2061,7 +2061,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, /* XXX FIXME: Allocate multi-level tables on PHB3 */ /* We shouldn't already have a 32-bit DMA associated */ - if (WARN_ON(pe->tce32_seg >= 0)) + if (WARN_ON(pe->dma32_seg >= 0)) return; tbl = pnv_pci_table_alloc(phb->hose->node); @@ -2070,7 +2070,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, pnv_pci_link_table_and_group(phb->hose->node, 0, tbl, &pe->table_group); /* Grab a 32-bit TCE table */ - pe->tce32_seg = base; + pe->dma32_seg = base; pe_info(pe, " Setting up 32-bit TCE table at %08x..%08x\n", (base << 28), ((base + segs) << 28) - 1); @@ -2131,8 +2131,8 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, return; fail: /* XXX Failure: Try to fallback to 64-bit only ? */ - if (pe->tce32_seg >= 0) - pe->tce32_seg = -1; + if (pe->dma32_seg >= 0) + pe->dma32_seg = -1; if (tce_mem) __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs)); if (tbl) { @@ -2520,7 +2520,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, int64_t rc; /* We shouldn't already have a 32-bit DMA associated */ - if (WARN_ON(pe->tce32_seg >= 0)) + if (WARN_ON(pe->dma32_seg >= 0)) return; /* TVE #1 is selected by PCI addr
[PATCH v5 08/42] powerpc/powernv: DMA32 cleanup
The patch cleans up DMA32 in pci-ioda.c. It shouldn't introduce behavioural changes: * Rename various fields in "struct pnv_phb" and "struct pnv_ioda_pe" as 32-bits DMA should be related to "DMA", not "TCE", and move them around to reflect their relationship and their relative importance. * Removed struct pnv_ioda_pe::tce32_segcount. Signed-off-by: Gavin Shan --- v5: * Split from PATCH[v4 5/21] --- arch/powerpc/platforms/powernv/pci-ioda.c | 48 +++ arch/powerpc/platforms/powernv/pci.h | 13 +++-- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index d9ff739..4af3d06 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -971,7 +971,7 @@ static void pnv_ioda_link_pe_by_weight(struct pnv_phb *phb, struct pnv_ioda_pe *lpe; list_for_each_entry(lpe, &phb->ioda.pe_dma_list, dma_link) { - if (lpe->dma_weight < pe->dma_weight) { + if (lpe->dma32_weight < pe->dma32_weight) { list_add_tail(&pe->dma_link, &lpe->dma_link); return; } @@ -996,14 +996,14 @@ static unsigned int pnv_ioda_dev_dma_weight(struct pci_dev *dev) if (dev->class == PCI_CLASS_SERIAL_USB_UHCI || dev->class == PCI_CLASS_SERIAL_USB_OHCI || dev->class == PCI_CLASS_SERIAL_USB_EHCI) - return 3 * phb->ioda.tce32_count; + return 3 * phb->ioda.dma32_segcount; /* Increase the weight of RAID (includes Obsidian) */ if ((dev->class >> 8) == PCI_CLASS_STORAGE_RAID) - return 15 * phb->ioda.tce32_count; + return 15 * phb->ioda.dma32_segcount; /* Default */ - return 10 * phb->ioda.tce32_count; + return 10 * phb->ioda.dma32_segcount; } static int __pnv_ioda_phb_dma_weight(struct pci_dev *pdev, void *data) @@ -1182,7 +1182,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe) continue; } pdn->pe_number = pe->pe_number; - pe->dma_weight += pnv_ioda_dev_dma_weight(dev); + pe->dma32_weight += pnv_ioda_dev_dma_weight(dev); if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) pnv_ioda_setup_same_PE(dev->subordinate, pe); } @@ -1219,10 +1219,10 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all) pe->flags |= (all ? PNV_IODA_PE_BUS_ALL : PNV_IODA_PE_BUS); pe->pbus = bus; pe->pdev = NULL; - pe->tce32_seg = -1; + pe->dma32_seg = -1; pe->mve_number = -1; pe->rid = bus->busn_res.start << 8; - pe->dma_weight = 0; + pe->dma32_weight = 0; if (all) pe_info(pe, "Secondary bus %d..%d associated with PE#%d\n", @@ -1585,7 +1585,7 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs) pe->flags = PNV_IODA_PE_VF; pe->pbus = NULL; pe->parent_dev = pdev; - pe->tce32_seg = -1; + pe->dma32_seg = -1; pe->mve_number = -1; pe->rid = (pci_iov_virtfn_bus(pdev, vf_index) << 8) | pci_iov_virtfn_devfn(pdev, vf_index); @@ -2061,7 +2061,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, /* XXX FIXME: Allocate multi-level tables on PHB3 */ /* We shouldn't already have a 32-bit DMA associated */ - if (WARN_ON(pe->tce32_seg >= 0)) + if (WARN_ON(pe->dma32_seg >= 0)) return; tbl = pnv_pci_table_alloc(phb->hose->node); @@ -2070,7 +2070,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, pnv_pci_link_table_and_group(phb->hose->node, 0, tbl, &pe->table_group); /* Grab a 32-bit TCE table */ - pe->tce32_seg = base; + pe->dma32_seg = base; pe_info(pe, " Setting up 32-bit TCE table at %08x..%08x\n", (base << 28), ((base + segs) << 28) - 1); @@ -2131,8 +2131,8 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, return; fail: /* XXX Failure: Try to fallback to 64-bit only ? */ - if (pe->tce32_seg >= 0) - pe->tce32_seg = -1; + if (pe->dma32_seg >= 0) + pe->dma32_seg = -1; if (tce_mem) __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs)); if (tbl) { @@ -2520,7 +2520,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, int64_t rc; /* We shouldn't already have a 32-bit DMA associated */ - if (WARN_ON(pe->tce32_seg >= 0)) + if (WARN_ON(pe->dma32_seg >= 0)) return; /* TVE #1 is selected by PCI address bit 59 */ @@ -2530,7 +2530,7 @@ static vo