All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Mike Rapoport <rppt@linux.ibm.com>,
	Christian Zigotzky <chzigotzky@xenosoft.de>,
	Christoph Hellwig <hch@lst.de>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Sasha Levin <sashal@kernel.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH AUTOSEL 4.4 11/25] powerpc: Ensure that swiotlb buffer is allocated from low memory
Date: Fri, 27 Dec 2019 13:15:35 -0500	[thread overview]
Message-ID: <20191227181549.8040-11-sashal@kernel.org> (raw)
In-Reply-To: <20191227181549.8040-1-sashal@kernel.org>

From: Mike Rapoport <rppt@linux.ibm.com>

[ Upstream commit 8fabc623238e68b3ac63c0dd1657bf86c1fa33af ]

Some powerpc platforms (e.g. 85xx) limit DMA-able memory way below 4G.
If a system has more physical memory than this limit, the swiotlb
buffer is not addressable because it is allocated from memblock using
top-down mode.

Force memblock to bottom-up mode before calling swiotlb_init() to
ensure that the swiotlb buffer is DMA-able.

Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191204123524.22919-1-rppt@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/mm/mem.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 1efe5ca5c3bc..5bb2c89d55c8 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -330,6 +330,14 @@ void __init mem_init(void)
 	BUILD_BUG_ON(MMU_PAGE_COUNT > 16);
 
 #ifdef CONFIG_SWIOTLB
+	/*
+	 * Some platforms (e.g. 85xx) limit DMA-able memory way below
+	 * 4G. We force memblock to bottom-up mode to ensure that the
+	 * memory allocated in swiotlb_init() is DMA-able.
+	 * As it's the last memblock allocation, no need to reset it
+	 * back to to-down.
+	 */
+	memblock_set_bottom_up(true);
 	swiotlb_init(0);
 #endif
 
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Christian Zigotzky <chzigotzky@xenosoft.de>,
	linuxppc-dev@lists.ozlabs.org, Christoph Hellwig <hch@lst.de>
Subject: [PATCH AUTOSEL 4.4 11/25] powerpc: Ensure that swiotlb buffer is allocated from low memory
Date: Fri, 27 Dec 2019 13:15:35 -0500	[thread overview]
Message-ID: <20191227181549.8040-11-sashal@kernel.org> (raw)
In-Reply-To: <20191227181549.8040-1-sashal@kernel.org>

From: Mike Rapoport <rppt@linux.ibm.com>

[ Upstream commit 8fabc623238e68b3ac63c0dd1657bf86c1fa33af ]

Some powerpc platforms (e.g. 85xx) limit DMA-able memory way below 4G.
If a system has more physical memory than this limit, the swiotlb
buffer is not addressable because it is allocated from memblock using
top-down mode.

Force memblock to bottom-up mode before calling swiotlb_init() to
ensure that the swiotlb buffer is DMA-able.

Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191204123524.22919-1-rppt@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/mm/mem.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 1efe5ca5c3bc..5bb2c89d55c8 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -330,6 +330,14 @@ void __init mem_init(void)
 	BUILD_BUG_ON(MMU_PAGE_COUNT > 16);
 
 #ifdef CONFIG_SWIOTLB
+	/*
+	 * Some platforms (e.g. 85xx) limit DMA-able memory way below
+	 * 4G. We force memblock to bottom-up mode to ensure that the
+	 * memory allocated in swiotlb_init() is DMA-able.
+	 * As it's the last memblock allocation, no need to reset it
+	 * back to to-down.
+	 */
+	memblock_set_bottom_up(true);
 	swiotlb_init(0);
 #endif
 
-- 
2.20.1


  parent reply	other threads:[~2019-12-27 18:16 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-27 18:15 [PATCH AUTOSEL 4.4 01/25] locking/spinlock/debug: Fix various data races Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 02/25] netfilter: ctnetlink: netns exit must wait for callbacks Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 03/25] ARM: vexpress: Set-up shared OPP table instead of individual for each CPU Sasha Levin
2019-12-27 18:15   ` Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 04/25] netfilter: uapi: Avoid undefined left-shift in xt_sctp.h Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 05/25] netfilter: bridge: make sure to pull arp header in br_nf_forward_arp() Sasha Levin
2019-12-27 18:15   ` [Bridge] " Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 06/25] af_packet: set defaule value for tmo Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 07/25] fjes: fix missed check in fjes_acpi_add Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 08/25] ARM: dts: am437x-gp/epos-evm: fix panel compatible Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 09/25] tty: serial: msm_serial: Fix lockup for sysrq and oops Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 10/25] net: usb: lan78xx: Fix suspend/resume PHY register access error Sasha Levin
2019-12-27 18:15 ` Sasha Levin [this message]
2019-12-27 18:15   ` [PATCH AUTOSEL 4.4 11/25] powerpc: Ensure that swiotlb buffer is allocated from low memory Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 12/25] 6pack,mkiss: fix possible deadlock Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 13/25] bnx2x: Do not handle requests from VFs after parity Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 14/25] bnx2x: Fix logic to get total no. of PFs per engine Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 15/25] net: usb: lan78xx: Fix error message format specifier Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 16/25] rfkill: Fix incorrect check to avoid NULL pointer dereference Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 17/25] ASoC: wm8962: fix lambda value Sasha Levin
2019-12-27 18:15   ` [alsa-devel] " Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 18/25] regulator: rn5t618: fix module aliases Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 19/25] kconfig: don't crash on NULL expressions in expr_eq() Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 20/25] net: qlogic: Fix error paths in ql_alloc_large_buffers() Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 21/25] net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive() Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 22/25] parisc: Fix compiler warnings in debug_core.c Sasha Levin
2019-12-27 18:15 ` [PATCH AUTOSEL 4.4 23/25] net: hisilicon: Fix a BUG trigered by wrong bytes_compl Sasha Levin

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=20191227181549.8040-11-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=chzigotzky@xenosoft.de \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=rppt@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.