From: Russell Currey <ruscur@russell.cc>
To: linuxppc-dev@lists.ozlabs.org
Cc: benh@kernel.crashing.org, alistair@popple.id.au, aik@ozlabs.ru,
tpearson@raptorengineering.com,
Russell Currey <ruscur@russell.cc>
Subject: [PATCH 1/3] powerpc/powernv/pci: Track largest available TCE order per PHB
Date: Fri, 29 Jun 2018 17:34:35 +1000 [thread overview]
Message-ID: <20180629073437.4060-2-ruscur@russell.cc> (raw)
In-Reply-To: <20180629073437.4060-1-ruscur@russell.cc>
Knowing the largest possible TCE size of a PHB is useful, so get it out
of the device tree. This relies on the property being added in OPAL.
It is assumed that any PHB4 or later machine would be running firmware
that implemented this property, and otherwise assumed to be PHB3, which
has a maximum TCE order of 28 bits or 256MB TCEs.
This is used later in the series.
Signed-off-by: Russell Currey <ruscur@russell.cc>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 16 ++++++++++++++++
arch/powerpc/platforms/powernv/pci.h | 3 +++
2 files changed, 19 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 5bd0eb6681bc..17c590087279 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3873,11 +3873,13 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
struct resource r;
const __be64 *prop64;
const __be32 *prop32;
+ struct property *prop;
int len;
unsigned int segno;
u64 phb_id;
void *aux;
long rc;
+ u32 val;
if (!of_device_is_available(np))
return;
@@ -4016,6 +4018,20 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
}
phb->ioda.pe_array = aux + pemap_off;
+ phb->ioda.max_tce_order = 0;
+ /* Get TCE order from the DT. If it's not present, assume P8 */
+ if (!of_get_property(np, "ibm,supported-tce-sizes", NULL)) {
+ phb->ioda.max_tce_order = 28; /* assume P8 256mb TCEs */
+ } else {
+ of_property_for_each_u32(np, "ibm,supported-tce-sizes", prop,
+ prop32, val) {
+ if (val > phb->ioda.max_tce_order)
+ phb->ioda.max_tce_order = val;
+ }
+ pr_debug("PHB%llx Found max TCE order of %d bits\n",
+ phb->opal_id, phb->ioda.max_tce_order);
+ }
+
/*
* Choose PE number for root bus, which shouldn't have
* M64 resources consumed by its child devices. To pick
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index eada4b6068cb..c9952def5e93 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -173,6 +173,9 @@ struct pnv_phb {
struct list_head pe_list;
struct mutex pe_list_mutex;
+ /* Largest supported TCE order bits */
+ uint8_t max_tce_order;
+
/* Reverse map of PEs, indexed by {bus, devfn} */
unsigned int pe_rmap[0x10000];
} ioda;
--
2.17.1
next prev parent reply other threads:[~2018-06-29 7:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 7:34 [PATCH 0/3] PCI DMA pseudo-bypass for powernv Russell Currey
2018-06-29 7:34 ` Russell Currey [this message]
2018-07-02 7:32 ` [PATCH 1/3] powerpc/powernv/pci: Track largest available TCE order per PHB Alexey Kardashevskiy
2018-07-02 7:34 ` Alexey Kardashevskiy
2018-07-03 5:49 ` Russell Currey
2018-06-29 7:34 ` [PATCH 2/3] powerpc/powernv: DMA operations for discontiguous allocation Russell Currey
2018-06-30 2:52 ` Benjamin Herrenschmidt
2018-07-02 8:47 ` Alexey Kardashevskiy
2018-07-03 6:09 ` Russell Currey
2018-07-04 6:12 ` Russell Currey
2018-06-29 7:34 ` [PATCH 3/3] powerpc/powernv/pci: Track TCE tables in debugfs Russell Currey
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=20180629073437.4060-2-ruscur@russell.cc \
--to=ruscur@russell.cc \
--cc=aik@ozlabs.ru \
--cc=alistair@popple.id.au \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=tpearson@raptorengineering.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).