From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org,
devicetree@vger.kernel.org, benh@kernel.crashing.org,
mpe@ellerman.id.au, bhelgaas@google.com, grant.likely@linaro.org,
robherring2@gmail.com, panto@antoniou-consulting.com
Subject: Re: [PATCH v6 09/42] powerpc/powernv: DMA32 cleanup
Date: Tue, 11 Aug 2015 10:19:45 +1000 [thread overview]
Message-ID: <20150811001945.GA15577@gwshan> (raw)
In-Reply-To: <55C85BBF.4070802@ozlabs.ru>
On Mon, Aug 10, 2015 at 06:07:27PM +1000, Alexey Kardashevskiy wrote:
>On 08/06/2015 02:11 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".
>
>s/dma_weight/dma32_weight/ is ok (does not add much though_ but the rest is
>not. The "tce32_" fields are still TCEs (translation entries) while DMA is a
>process initiated by a device which does not know about how exactly DMA
>addresses are translated later. Since we are on the host side and we actually
>manage TCE tables here, I suggest keeping the "tce32_" prefix for TCE tables
>and memory they use.
>
Ok. Will change accordingly.
>> * Removed struct pnv_ioda_pe::tce32_segcount.
>
>That's confusing - I had to walk through patches to find out where you
>stopped using it. It would be simpler if you put this particular change to
>
>[PATCH v6 02/42] powerpc/powernv: Drop pnv_ioda_setup_dev_PE()
>
>where you remove dead code.
>
I'll try to reorder the patch...
>
>>
>>Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>>---
>> arch/powerpc/platforms/powernv/pci-ioda.c | 48 +++++++++++++++----------------
>> arch/powerpc/platforms/powernv/pci.h | 7 ++---
>> 2 files changed, 27 insertions(+), 28 deletions(-)
>>
>>diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
>>index 7342cfd..8456f37 100644
>>--- a/arch/powerpc/platforms/powernv/pci-ioda.c
>>+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
>>@@ -917,7 +917,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;
>> }
>>@@ -942,14 +942,14 @@ static unsigned int pnv_ioda_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)
>>@@ -1057,7 +1057,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_dma_weight(dev);
>>+ pe->dma32_weight += pnv_ioda_dma_weight(dev);
>> if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate)
>> pnv_ioda_setup_same_PE(dev->subordinate, pe);
>> }
>>@@ -1094,10 +1094,10 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, bool 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",
>>@@ -1460,7 +1460,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);
>>@@ -1936,7 +1936,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);
>>@@ -1945,7 +1945,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);
>>
>>@@ -2006,8 +2006,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) {
>>@@ -2405,7 +2405,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 */
>>@@ -2415,7 +2415,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
>> pe->pe_number);
>>
>> /* The PE will reserve all possible 32-bits space */
>>- pe->tce32_seg = 0;
>>+ pe->dma32_seg = 0;
>> pe_info(pe, "Setting up 32-bit TCE table at 0..%08x\n",
>> phb->ioda.m32_pci_base);
>>
>>@@ -2432,8 +2432,8 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
>>
>> rc = pnv_pci_ioda2_setup_default_config(pe);
>> if (rc) {
>>- if (pe->tce32_seg >= 0)
>>- pe->tce32_seg = -1;
>>+ if (pe->dma32_seg >= 0)
>>+ pe->dma32_seg = -1;
>> return;
>> }
>>
>>@@ -2452,7 +2452,7 @@ static void pnv_ioda_setup_dma(struct pnv_phb *phb)
>> /* Calculate the PHB's DMA weight */
>> dma_weight = pnv_ioda_phb_dma_weight(phb);
>> pr_info("PCI%04x has %ld DMA32 segments, total weight %d\n",
>>- hose->global_number, phb->ioda.tce32_count, dma_weight);
>>+ hose->global_number, phb->ioda.dma32_segcount, dma_weight);
>>
>> pnv_pci_ioda_setup_opal_tce_kill(phb);
>>
>>@@ -2461,7 +2461,7 @@ static void pnv_ioda_setup_dma(struct pnv_phb *phb)
>> * weight
>> */
>> list_for_each_entry(pe, &phb->ioda.pe_dma_list, dma_link) {
>>- if (!pe->dma_weight)
>>+ if (!pe->dma32_weight)
>> continue;
>>
>> /*
>>@@ -2472,15 +2472,15 @@ static void pnv_ioda_setup_dma(struct pnv_phb *phb)
>> if (phb->type == PNV_PHB_IODA1) {
>> unsigned int segs, base = 0;
>>
>>- if (pe->dma_weight <
>>- dma_weight / phb->ioda.tce32_count)
>>+ if (pe->dma32_weight <
>>+ dma_weight / phb->ioda.dma32_segcount)
>> segs = 1;
>> else
>>- segs = (pe->dma_weight *
>>- phb->ioda.tce32_count) / dma_weight;
>>+ segs = (pe->dma32_weight *
>>+ phb->ioda.dma32_segcount) / dma_weight;
>>
>> pe_info(pe, "DMA32 weight %d, assigned %d segments\n",
>>- pe->dma_weight, segs);
>>+ pe->dma32_weight, segs);
>> pnv_pci_ioda_setup_dma_pe(phb, pe, base, segs);
>>
>> base += segs;
>>@@ -3211,7 +3211,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
>> mutex_init(&phb->ioda.pe_list_mutex);
>>
>> /* Calculate how many 32-bit TCE segments we have */
>>- phb->ioda.tce32_count = phb->ioda.m32_pci_base >> 28;
>>+ phb->ioda.dma32_segcount = phb->ioda.m32_pci_base >> 28;
>>
>> #if 0 /* We should really do that ... */
>> rc = opal_pci_set_phb_mem_window(opal->phb_id,
>>diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
>>index addd3f7..574fe43 100644
>>--- a/arch/powerpc/platforms/powernv/pci.h
>>+++ b/arch/powerpc/platforms/powernv/pci.h
>>@@ -61,11 +61,10 @@ struct pnv_ioda_pe {
>> /* "Weight" assigned to the PE for the sake of DMA resource
>> * allocations
>> */
>>- unsigned int dma_weight;
>>+ unsigned int dma32_weight;
>>
>> /* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */
>>- int tce32_seg;
>>- int tce32_segcount;
>>+ int dma32_seg;
>> struct iommu_table_group table_group;
>>
>> /* 64-bit TCE bypass region */
>>@@ -181,7 +180,7 @@ struct pnv_phb {
>> unsigned char pe_rmap[0x10000];
>>
>> /* 32-bit TCE tables allocation */
>>- unsigned long tce32_count;
>>+ unsigned long dma32_segcount;
>>
>> /* Sorted list of used PE's, sorted at
>> * boot for resource allocation purposes
>>
Thanks,
Gavin
next prev parent reply other threads:[~2015-08-11 0:19 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 4:11 [PATCH v6 00/42] powerpc/powernv: PCI hotplug suppport Gavin Shan
2015-08-06 4:11 ` [PATCH v6 01/42] PCI: Add pcibios_setup_bridge() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 02/42] powerpc/powernv: Drop pnv_ioda_setup_dev_PE() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 03/42] powerpc/powernv: Enable M64 on P7IOC Gavin Shan
2015-08-10 6:30 ` Alexey Kardashevskiy
2015-08-10 23:45 ` Gavin Shan
2015-08-11 2:06 ` Alexey Kardashevskiy
2015-08-12 10:28 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 04/42] powerpc/powernv: Reorder fields in struct pnv_phb Gavin Shan
2015-08-06 4:11 ` [PATCH v6 05/42] powerpc/powernv: Track IO/M32/M64 segments from PE Gavin Shan
2015-08-10 7:16 ` Alexey Kardashevskiy
2015-08-11 0:03 ` Gavin Shan
2015-08-11 2:23 ` Alexey Kardashevskiy
2015-08-12 10:45 ` Gavin Shan
2015-08-12 11:05 ` Alexey Kardashevskiy
2015-08-12 11:20 ` Gavin Shan
2015-08-12 12:57 ` Alexey Kardashevskiy
2015-08-12 23:34 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 06/42] powerpc/powernv: Simplify pnv_ioda_setup_pe_seg() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 07/42] powerpc/powernv: Improve IO and M32 mapping Gavin Shan
[not found] ` <1438834307-26960-8-git-send-email-gwshan-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2015-08-10 7:40 ` Alexey Kardashevskiy
2015-08-11 0:12 ` Gavin Shan
2015-08-11 2:32 ` Alexey Kardashevskiy
2015-08-12 23:42 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 08/42] powerpc/powernv: Calculate PHB's DMA weight dynamically Gavin Shan
2015-08-10 7:48 ` Alexey Kardashevskiy
2015-08-10 9:21 ` Alexey Kardashevskiy
2015-08-12 23:57 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 09/42] powerpc/powernv: DMA32 cleanup Gavin Shan
2015-08-10 8:07 ` Alexey Kardashevskiy
2015-08-11 0:19 ` Gavin Shan [this message]
2015-08-06 4:11 ` [PATCH v6 10/42] powerpc/powernv: pnv_ioda_setup_dma() configure one PE only Gavin Shan
2015-08-10 9:31 ` Alexey Kardashevskiy
2015-08-11 0:29 ` Gavin Shan
2015-08-11 2:39 ` Alexey Kardashevskiy
2015-08-12 23:59 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 11/42] powerpc/powernv: Trace DMA32 segments consumed by PE Gavin Shan
2015-08-10 9:43 ` Alexey Kardashevskiy
2015-08-11 0:33 ` Gavin Shan
2015-08-13 0:02 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 13/42] powerpc/pci: Cleanup on pci_controller_ops Gavin Shan
2015-08-06 4:11 ` [PATCH v6 14/42] powerpc/pci: Override pcibios_setup_bridge() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 15/42] powerpc/powernv: PE oriented during configuration Gavin Shan
2015-08-10 10:02 ` Alexey Kardashevskiy
2015-08-11 0:39 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 16/42] powerpc/powernv: Helper function pnv_ioda_init_pe() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 18/42] powerpc/powernv: Allocate PE# in deasending order Gavin Shan
2015-08-10 14:39 ` Alexey Kardashevskiy
2015-08-11 0:43 ` Gavin Shan
2015-08-11 2:50 ` Alexey Kardashevskiy
2015-08-13 0:28 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 19/42] powerpc/powernv: Reserve PE# for root bus Gavin Shan
2015-08-06 4:11 ` [PATCH v6 20/42] powerpc/powernv: Create PEs dynamically Gavin Shan
2015-08-14 13:52 ` Alexey Kardashevskiy
2015-08-15 4:59 ` Gavin Shan
2015-08-15 9:23 ` Alexey Kardashevskiy
2015-08-06 4:11 ` [PATCH v6 21/42] powerpc/powernv: Remove DMA32 list of PEs Gavin Shan
2015-08-06 4:11 ` [PATCH v6 22/42] powerpc/powernv: Move functions around Gavin Shan
2015-08-06 4:11 ` [PATCH v6 23/42] powerpc/powernv: Release PEs dynamically Gavin Shan
2015-08-11 13:03 ` Alexey Kardashevskiy
2015-08-13 0:54 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 24/42] powerpc/powernv: Supports slot ID Gavin Shan
2015-08-06 4:11 ` [PATCH v6 25/42] powerpc/powernv: Use PCI slot reset infrastructure Gavin Shan
2015-08-06 4:11 ` [PATCH v6 26/42] powerpc/powernv: Simplify pnv_eeh_reset() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 27/42] powerpc/powernv: Don't cover root bus in pnv_pci_reset_secondary_bus() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 29/42] powerpc/pci: Don't scan empty slot Gavin Shan
2015-08-06 4:11 ` [PATCH v6 30/42] powerpc/pci: Move pcibios_find_pci_bus() around Gavin Shan
2015-08-06 4:11 ` [PATCH v6 31/42] powerpc/pci: Rename pcibios_{add,remove}_pci_devices Gavin Shan
[not found] ` <1438834307-26960-1-git-send-email-gwshan-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2015-08-06 4:11 ` [PATCH v6 12/42] powerpc/powernv: Increase PE# capacity Gavin Shan
[not found] ` <1438834307-26960-13-git-send-email-gwshan-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2015-08-10 9:53 ` Alexey Kardashevskiy
2015-08-11 0:38 ` Gavin Shan
2015-08-11 2:47 ` Alexey Kardashevskiy
2015-08-13 0:23 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 17/42] powerpc/powernv: Rename PE# fields in PHB Gavin Shan
2015-08-10 14:21 ` Alexey Kardashevskiy
2015-08-11 0:40 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 28/42] powerpc/powernv: Fundamental reset in pnv_pci_reset_secondary_bus() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 32/42] powerpc/powernv: Introduce pnv_pci_poll() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 33/42] powerpc/powernv: Functions to get/reset PCI slot status Gavin Shan
2015-08-06 4:11 ` [PATCH v6 34/42] powerpc/pci: Delay creating pci_dn Gavin Shan
2015-08-06 4:11 ` [PATCH v6 37/42] powerpc/powernv: Select OF_DYNAMIC Gavin Shan
2015-08-06 4:11 ` [PATCH v6 35/42] powerpc/pci: Export traverse_pci_device_nodes() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 36/42] powerpc/pci: Update bridge windows on PCI plugging Gavin Shan
2015-08-06 4:11 ` [PATCH v6 38/42] drivers/of: Unflatten subordinate nodes after specified level Gavin Shan
2015-08-06 14:09 ` Rob Herring
2015-11-03 23:16 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 39/42] drivers/of: Allow to specify root node in of_fdt_unflatten_tree() Gavin Shan
2015-08-10 22:42 ` Frank Rowand
2015-08-11 0:52 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 40/42] drivers/of: Return allocated memory chunk from of_fdt_unflatten_tree() Gavin Shan
[not found] ` <1438834307-26960-41-git-send-email-gwshan-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2015-08-06 14:19 ` Rob Herring
2015-08-10 22:42 ` Frank Rowand
2015-08-11 0:52 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 41/42] drivers/of: Export OF changeset functions Gavin Shan
2015-08-06 13:48 ` Rob Herring
2015-08-07 1:43 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 42/42] pci/hotplug: PowerPC PowerNV PCI hotplug driver Gavin Shan
2015-08-15 3:13 ` Alexey Kardashevskiy
2015-08-15 4:47 ` Gavin Shan
2015-08-15 9:15 ` Alexey Kardashevskiy
2015-08-10 6:05 ` [PATCH v6 00/42] powerpc/powernv: PCI hotplug suppport Alexey Kardashevskiy
2015-08-10 7:17 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150811001945.GA15577@gwshan \
--to=gwshan@linux.vnet.ibm.com \
--cc=aik@ozlabs.ru \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=panto@antoniou-consulting.com \
--cc=robherring2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).