Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2018-10-31 13:27:38 +0100
committerMichal Suchanek <msuchanek@suse.de>2018-10-31 23:28:43 +0100
commit7c25236c545b6753b4d6244c454ae2105ddf889d (patch)
tree706ed2858e1a0fc1594e588afc25e90bacf5125a
parentb5bd143f8749d38b737b771a2324c90f646a5b09 (diff)
powerpc/powernv: Rework TCE level allocation (bsc#1061840).
-rw-r--r--patches.arch/powerpc-powernv-Rework-TCE-level-allocation.patch78
-rw-r--r--series.conf1
2 files changed, 79 insertions, 0 deletions
diff --git a/patches.arch/powerpc-powernv-Rework-TCE-level-allocation.patch b/patches.arch/powerpc-powernv-Rework-TCE-level-allocation.patch
new file mode 100644
index 0000000000..c8496a9efa
--- /dev/null
+++ b/patches.arch/powerpc-powernv-Rework-TCE-level-allocation.patch
@@ -0,0 +1,78 @@
+From 9bc98c8a43c4900ee63b160f805c65051e35d917 Mon Sep 17 00:00:00 2001
+From: Alexey Kardashevskiy <aik@ozlabs.ru>
+Date: Wed, 4 Jul 2018 16:13:48 +1000
+Subject: [PATCH] powerpc/powernv: Rework TCE level allocation
+
+References: bsc#1061840
+Patch-mainline: v4.19-rc1
+Git-commit: 9bc98c8a43c4900ee63b160f805c65051e35d917
+
+This moves actual pages allocation to a separate function which is going
+to be reused later in on-demand TCE allocation.
+
+While we are at it, remove unnecessary level size round up as the caller
+does this already.
+
+Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
+Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/platforms/powernv/pci-ioda-tce.c | 30 +++++++++++++++++----------
+ 1 file changed, 19 insertions(+), 11 deletions(-)
+
+diff --git a/arch/powerpc/platforms/powernv/pci-ioda-tce.c b/arch/powerpc/platforms/powernv/pci-ioda-tce.c
+index 88cecc1815d9..123c49925b46 100644
+--- a/arch/powerpc/platforms/powernv/pci-ioda-tce.c
++++ b/arch/powerpc/platforms/powernv/pci-ioda-tce.c
+@@ -31,6 +31,23 @@ void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
+ tbl->it_type = TCE_PCI;
+ }
+
++static __be64 *pnv_alloc_tce_level(int nid, unsigned int shift)
++{
++ struct page *tce_mem = NULL;
++ __be64 *addr;
++
++ tce_mem = alloc_pages_node(nid, GFP_KERNEL, shift - PAGE_SHIFT);
++ if (!tce_mem) {
++ pr_err("Failed to allocate a TCE memory, level shift=%d\n",
++ shift);
++ return NULL;
++ }
++ addr = page_address(tce_mem);
++ memset(addr, 0, 1UL << shift);
++
++ return addr;
++}
++
+ static __be64 *pnv_tce(struct iommu_table *tbl, bool user, long idx)
+ {
+ __be64 *tmp = user ? tbl->it_userspace : (__be64 *) tbl->it_base;
+@@ -165,21 +182,12 @@ static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned int shift,
+ unsigned int levels, unsigned long limit,
+ unsigned long *current_offset, unsigned long *total_allocated)
+ {
+- struct page *tce_mem = NULL;
+ __be64 *addr, *tmp;
+- unsigned int order = max_t(unsigned int, shift, PAGE_SHIFT) -
+- PAGE_SHIFT;
+- unsigned long allocated = 1UL << (order + PAGE_SHIFT);
++ unsigned long allocated = 1UL << shift;
+ unsigned int entries = 1UL << (shift - 3);
+ long i;
+
+- tce_mem = alloc_pages_node(nid, GFP_KERNEL, order);
+- if (!tce_mem) {
+- pr_err("Failed to allocate a TCE memory, order=%d\n", order);
+- return NULL;
+- }
+- addr = page_address(tce_mem);
+- memset(addr, 0, allocated);
++ addr = pnv_alloc_tce_level(nid, shift);
+ *total_allocated += allocated;
+
+ --levels;
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index b18a7d6ba1..d2ece30db6 100644
--- a/series.conf
+++ b/series.conf
@@ -17664,6 +17664,7 @@
patches.arch/powerpc-powernv-Move-TCE-manupulation-code-to-its-ow.patch
patches.arch/KVM-PPC-Make-iommu_table-it_userspace-big-endian.patch
patches.arch/powerpc-powernv-Add-indirect-levels-to-it_userspace.patch
+ patches.arch/powerpc-powernv-Rework-TCE-level-allocation.patch
patches.arch/cxl-Fix-wrong-comparison-in-cxl_adapter_context_get.patch
patches.arch/powerpc-pkeys-Give-all-threads-control-of-their-key-.patch
patches.arch/powerpc-pkeys-Deny-read-write-execute-by-default.patch