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 05/42] powerpc/powernv: Track IO/M32/M64 segments from PE
Date: Tue, 11 Aug 2015 10:03:42 +1000 [thread overview]
Message-ID: <20150811000342.GB10753@gwshan> (raw)
In-Reply-To: <55C84FD8.302@ozlabs.ru>
On Mon, Aug 10, 2015 at 05:16:40PM +1000, Alexey Kardashevskiy wrote:
>On 08/06/2015 02:11 PM, Gavin Shan wrote:
>>The patch is adding 6 bitmaps, three to PE and three to PHB, to track
>
>The patch is also removing 2 arrays (io_segmap and m32_segmap), what is that
>all about? Also, there was no m64_segmap, now there is, needs an explanation
>may be.
>
Originally, the bitmaps (io_segmap and m32_segmap) are allocated dynamically.
Now, they have fixed sizes - 512 bits.
The subject "powerpc/powernv: Track IO/M32/M64 segments from PE" indicates
why m64_segmap is added.
>
>>the consumed by one particular PE, which can be released once the PE
>>is destroyed during PCI unplugging time. Also, we're using fixed
>>quantity of bits to trace the used IO, M32 and M64 segments by PEs
>>in one particular PHB.
>>
>
>Out of curiosity - have you considered having just 3 arrays, in PHB, storing
>PE numbers, and ditching PE's arrays? Does PE itself need to know what PEs it
>is using? Not sure about this master/slave PEs though.
>
I don't follow your suggestion. Can you rephrase and explain it a bit more?
>It would be easier to read patches if this one was right before
>[PATCH v6 23/42] powerpc/powernv: Release PEs dynamically
>
I'll try to reoder the patch, but not expect too much...
>
>
>>Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>>---
>> arch/powerpc/platforms/powernv/pci-ioda.c | 29 +++++++++++++++--------------
>> arch/powerpc/platforms/powernv/pci.h | 18 ++++++++++++++----
>> 2 files changed, 29 insertions(+), 18 deletions(-)
>>
>>diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
>>index e4ac703..78b49a1 100644
>>--- a/arch/powerpc/platforms/powernv/pci-ioda.c
>>+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
>>@@ -388,6 +388,12 @@ static int pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all)
>> list_add_tail(&pe->list, &master_pe->slaves);
>> }
>>
>>+ /* M64 segments consumed by slave PEs are tracked
>>+ * by master PE
>>+ */
>>+ set_bit(pe->pe_number, master_pe->m64_segmap);
>>+ set_bit(pe->pe_number, phb->ioda.m64_segmap);
>>+
>> /* P7IOC supports M64DT, which helps mapping M64 segment
>> * to one particular PE#. However, PHB3 has fixed mapping
>> * between M64 segment and PE#. In order to have same logic
>>@@ -2871,9 +2877,11 @@ static void pnv_ioda_setup_pe_seg(struct pci_controller *hose,
>>
>> while (index < phb->ioda.total_pe &&
>> region.start <= region.end) {
>>- phb->ioda.io_segmap[index] = pe->pe_number;
>>+ set_bit(index, pe->io_segmap);
>>+ set_bit(index, phb->ioda.io_segmap);
>> rc = opal_pci_map_pe_mmio_window(phb->opal_id,
>>- pe->pe_number, OPAL_IO_WINDOW_TYPE, 0, index);
>>+ pe->pe_number, OPAL_IO_WINDOW_TYPE,
>>+ 0, index);
>
>Unrelated change.
>
True, will drop. However, checkpatch.pl will complain wtih:
exceeding 80 characters.
>> if (rc != OPAL_SUCCESS) {
>> pr_err("%s: OPAL error %d when mapping IO "
>> "segment #%d to PE#%d\n",
>>@@ -2896,9 +2904,11 @@ static void pnv_ioda_setup_pe_seg(struct pci_controller *hose,
>>
>> while (index < phb->ioda.total_pe &&
>> region.start <= region.end) {
>>- phb->ioda.m32_segmap[index] = pe->pe_number;
>>+ set_bit(index, pe->m32_segmap);
>>+ set_bit(index, phb->ioda.m32_segmap);
>> rc = opal_pci_map_pe_mmio_window(phb->opal_id,
>>- pe->pe_number, OPAL_M32_WINDOW_TYPE, 0, index);
>>+ pe->pe_number, OPAL_M32_WINDOW_TYPE,
>>+ 0, index);
>
>Unrelated change.
>
same as above.
>> if (rc != OPAL_SUCCESS) {
>> pr_err("%s: OPAL error %d when mapping M32 "
>> "segment#%d to PE#%d",
>>@@ -3090,7 +3100,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
>> {
>> struct pci_controller *hose;
>> struct pnv_phb *phb;
>>- unsigned long size, m32map_off, pemap_off, iomap_off = 0;
>>+ unsigned long size, pemap_off;
>> const __be64 *prop64;
>> const __be32 *prop32;
>> int len;
>>@@ -3175,19 +3185,10 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
>>
>> /* Allocate aux data & arrays. We don't have IO ports on PHB3 */
>
>
>This comment came with if(IODA1) below, since you are removing the condition
>below, makes sense to remove the comment as well or move it where people will
>look for it (arch/powerpc/platforms/powernv/pci.h ?)
>
Yes, will do.
>
>> size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long));
>>- m32map_off = size;
>>- size += phb->ioda.total_pe * sizeof(phb->ioda.m32_segmap[0]);
>>- if (phb->type == PNV_PHB_IODA1) {
>>- iomap_off = size;
>>- size += phb->ioda.total_pe * sizeof(phb->ioda.io_segmap[0]);
>>- }
>> pemap_off = size;
>> size += phb->ioda.total_pe * sizeof(struct pnv_ioda_pe);
>> aux = memblock_virt_alloc(size, 0);
>
>
>After adding static arrays to PE and PHB, do you still need this "aux"?
>
"aux" is still needed to tell the boundary of pe_alloc_bitmap and pe_array.
>
>> phb->ioda.pe_alloc = aux;
>>- phb->ioda.m32_segmap = aux + m32map_off;
>>- if (phb->type == PNV_PHB_IODA1)
>>- phb->ioda.io_segmap = aux + iomap_off;
>> phb->ioda.pe_array = aux + pemap_off;
>> set_bit(phb->ioda.reserved_pe, phb->ioda.pe_alloc);
>>
>>diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
>>index 62239b1..08a4e57 100644
>>--- a/arch/powerpc/platforms/powernv/pci.h
>>+++ b/arch/powerpc/platforms/powernv/pci.h
>>@@ -49,6 +49,15 @@ struct pnv_ioda_pe {
>> /* PE number */
>> unsigned int pe_number;
>>
>>+ /* IO/M32/M64 segments consumed by the PE. Each PE can
>>+ * have one M64 segment at most, but M64 segments consumed
>>+ * by slave PEs will be contributed to the master PE. One
>>+ * PE can own multiple IO and M32 segments.
>
>
>A PE can have multiple IO and M32 segments but just one M64 segment? Is this
>correct for IODA1 or IODA2 or both? Is this a limitation of this
>implementation or it comes from P7IOC/PHB3 hardware?
>
It's correct for IO and M32. However, on IODA1 or IODA2, one PE can have
multiple M64 segments as well.
>>+ */
>>+ unsigned long io_segmap[8];
>>+ unsigned long m32_segmap[8];
>>+ unsigned long m64_segmap[8];
>
>Magic constant "8", 64bit*8 = 512 PEs - where did this come from?
>
>Anyway,
>
>#define PNV_IODA_MAX_PE_NUM 512
>
>unsigned long io_segmap[PNV_IODA_MAX_PE_NUM/BITS_PER_LONG]
>
I prefer "8", not macro for 3 reasons:
- The macro won't be used in the code.
- The total segment number of specific resource is variable
on IODA1 and IODA2. I just choosed the max value with margin.
- PNV_IODA_MAX_PE_NUM, indicating max PE number, isn't 512 on
IODA1 or IODA2.
>>+
>> /* "Weight" assigned to the PE for the sake of DMA resource
>> * allocations
>> */
>>@@ -145,15 +154,16 @@ struct pnv_phb {
>> unsigned int io_segsize;
>> unsigned int io_pci_base;
>>
>>+ /* IO, M32, M64 segment maps */
>>+ unsigned long io_segmap[8];
>>+ unsigned long m32_segmap[8];
>>+ unsigned long m64_segmap[8];
>>+
>> /* PE allocation */
>> struct mutex pe_alloc_mutex;
>> unsigned long *pe_alloc;
>> struct pnv_ioda_pe *pe_array;
>>
>>- /* M32 & IO segment maps */
>>- unsigned int *m32_segmap;
>>- unsigned int *io_segmap;
>>-
>> /* IRQ chip */
>> int irq_chip_init;
>> struct irq_chip irq_chip;
>>
Thanks,
Gavin
next prev parent reply other threads:[~2015-08-11 0:03 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 [this message]
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
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
[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 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
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=20150811000342.GB10753@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