summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv/pci-ioda.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-09-25 09:28:58 +0200
committerIngo Molnar <mingo@kernel.org>2015-09-25 09:28:58 +0200
commit9c9ab385bc6c3f0787f742d5e9baf04063d9697a (patch)
treecc6ac425f7580a40d011ad2e8fc7974678843e0b /arch/powerpc/platforms/powernv/pci-ioda.c
parent93f13a9f96771a064c716364aebc6e283b186eb8 (diff)
parentbcee19f424a0d8c26ecf2607b73c690802658b29 (diff)
downloadtalos-op-linux-9c9ab385bc6c3f0787f742d5e9baf04063d9697a.tar.gz
talos-op-linux-9c9ab385bc6c3f0787f742d5e9baf04063d9697a.zip
Merge branch 'linus' into x86/asm, to refresh the tree before applying new changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci-ioda.c')
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 2927cd5c8303..414fd1a00fda 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2049,9 +2049,23 @@ static long pnv_pci_ioda2_setup_default_config(struct pnv_ioda_pe *pe)
struct iommu_table *tbl = NULL;
long rc;
+ /*
+ * crashkernel= specifies the kdump kernel's maximum memory at
+ * some offset and there is no guaranteed the result is a power
+ * of 2, which will cause errors later.
+ */
+ const u64 max_memory = __rounddown_pow_of_two(memory_hotplug_max());
+
+ /*
+ * In memory constrained environments, e.g. kdump kernel, the
+ * DMA window can be larger than available memory, which will
+ * cause errors later.
+ */
+ const u64 window_size = min((u64)pe->table_group.tce32_size, max_memory);
+
rc = pnv_pci_ioda2_create_table(&pe->table_group, 0,
IOMMU_PAGE_SHIFT_4K,
- pe->table_group.tce32_size,
+ window_size,
POWERNV_IOMMU_DEFAULT_LEVELS, &tbl);
if (rc) {
pe_err(pe, "Failed to create 32-bit TCE table, err %ld",
OpenPOWER on IntegriCloud