From patchwork Wed Dec 4 12:35:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 11272873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEE7B13A4 for ; Wed, 4 Dec 2019 12:35:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 922EA2086D for ; Wed, 4 Dec 2019 12:35:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="A+OJZidz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 922EA2086D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C7E8F6B0A8E; Wed, 4 Dec 2019 07:35:35 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C2E956B0A8F; Wed, 4 Dec 2019 07:35:35 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B44BB6B0A90; Wed, 4 Dec 2019 07:35:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0202.hostedemail.com [216.40.44.202]) by kanga.kvack.org (Postfix) with ESMTP id 9B0926B0A8E for ; Wed, 4 Dec 2019 07:35:35 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 574FA499616 for ; Wed, 4 Dec 2019 12:35:35 +0000 (UTC) X-FDA: 76227405030.01.low65_880f97b915d29 X-Spam-Summary: 2,0,0,b2c3cea1a8d7b206,d41d8cd98f00b204,rppt@kernel.org,:linux-kernel@vger.kernel.org:linuxppc-dev@lists.ozlabs.org:linux-arch@vger.kernel.org::iommu@lists.linux-foundation.org:rppt@linux.ibm.com:chzigotzky@xenosoft.de:benh@kernel.crashing.org:hch@lst.de:darren@stevens-zone.net:madskateman@gmail.com:mpe@ellerman.id.au:nsaenzjulienne@suse.de:paulus@samba.org:robin.murphy@arm.com:robh+dt@kernel.org,RULES_HIT:41:355:379:541:800:960:967:973:988:989:1260:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2525:2559:2563:2682:2685:2859:2902:2903:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3867:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:5007:6261:6653:6742:7514:7576:9025:10004:11026:11473:11658:11914:12043:12295:12296:12297:12438:12517:12519:12555:12679:12895:13069:13221:13229:13311:13357:13846:13894:14096:14181:14384:14394:14721:21080:21451:21627:21939:30054:30070,0,RBL:error,Cache IP:none, X-HE-Tag: low65_880f97b915d29 X-Filterd-Recvd-Size: 3433 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Dec 2019 12:35:34 +0000 (UTC) Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D7B2A20862; Wed, 4 Dec 2019 12:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575462933; bh=M1Wf/f30+BvSWegCWZV9CQ1OJDcWNvDUUneWC9hFQOQ=; h=From:To:Cc:Subject:Date:From; b=A+OJZidzgtdJt6409seAEyH45Ss0kz2SBVJ8TWk3Q0UceO0y4S6OsXy2bjaslg5lP LK6ARqr0xZruFvxNrlV5jBQ6dU6ReePVQk9HAWRwyTXGhM4FszRdjBL0OgxolzqKS0 a9CRC+a0jEEIjKw+N+wMhE7DRPXw7GklS56VuPLw= From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Mike Rapoport , Christian Zigotzky , Benjamin Herrenschmidt , Christoph Hellwig , Darren Stevens , mad skateman , Michael Ellerman , Nicolas Saenz Julienne , Paul Mackerras , Robin Murphy , Rob Herring Subject: [PATCH] powerpc: ensure that swiotlb buffer is allocated from low memory Date: Wed, 4 Dec 2019 14:35:24 +0200 Message-Id: <20191204123524.22919-1-rppt@kernel.org> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Mike Rapoport 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. Link: https://lkml.kernel.org/r/F1EBB706-73DF-430E-9020-C214EC8ED5DA@xenosoft.de Reported-by: Christian Zigotzky Signed-off-by: Mike Rapoport Cc: Benjamin Herrenschmidt Cc: Christoph Hellwig Cc: Darren Stevens Cc: mad skateman Cc: Michael Ellerman Cc: Nicolas Saenz Julienne Cc: Paul Mackerras Cc: Robin Murphy Cc: Rob Herring Reviewed-by: Christoph Hellwig --- 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 be941d382c8d..14c2c53e3f9e 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -260,6 +260,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