Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2373605imu; Wed, 21 Nov 2018 10:35:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/XgwN+bh53SP3w0zNnAFMCRFvX0S/KBJPOUt1s19yAJ2JkxK8Vq/ZyXWGtv2K3p65YzgLCA X-Received: by 2002:a63:4745:: with SMTP id w5mr7127501pgk.377.1542825301057; Wed, 21 Nov 2018 10:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542825301; cv=none; d=google.com; s=arc-20160816; b=K/wSEY4impmbz4nloa27rC6uwr8hp3HJhKAjrxxCHj6XttnTExIfnlttwDJ2VWERcK uPyqB5Yc7wYqE+f+y9F2KjVTL+V6weHDv/R8kRld3XhqIxxDMy7/YJE3arIZR72fZtCh MolG1M3Ir3azDEIh92hBFGiiFBxgkawG/wnnrYW8FuggjNracm5NQMb9NGFue1day5Zc gmS0tIc1AKLuE/AZ8q3g13DR+J8ai02fA0kBTzWkWYlgV3sr7PDJagHvIvZAQWnIOLxd oNriiqRzY5ZxZb/Gb0zyXQfzf3ayMdkpH/TXqy9qm0Y2OuoXohB1J7n/IfgNfQZ4Zw9K ghrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pvqf064DvG6QnOH+v30Mc9tQqgRoIdM7lHqWTIUWjEI=; b=s4JqBjDCe1DLNXBOwOVEc0Dx5thWGrzCIVN5WxzmtAIQC0P8OE9c69uRabCSS2vlK6 wzm9BOwKWubhLG/x7rXAonR9eV8LfpxfWsLMpUcz/+MMeyzgna9Wm+vhp5WstKBUormB tLwC9nX+bFIhaREIBFOrtSqFr81tohM5vYvonWBvpU5VqzW1EwYQcDHD3AZk0FMI0HoY F+SmICqMLgU6ZMVB5dnXLgCOKB4+qpqphbPuiKzAgTw65E8fm31kaWLhAy7iSsh7UFd1 3NryCnVYaJQbOnCq019dX5Jufisgui7Rdq4uDyzuD3KSNlFDa/J/hDlWyXvlmVl9J3at 1/6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3-v6si47536648plp.323.2018.11.21.10.34.45; Wed, 21 Nov 2018 10:35:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730812AbeKVDVf (ORCPT + 99 others); Wed, 21 Nov 2018 22:21:35 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54822 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726941AbeKVDVf (ORCPT ); Wed, 21 Nov 2018 22:21:35 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 17C7222F8; Wed, 21 Nov 2018 08:46:23 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D928D3F5AF; Wed, 21 Nov 2018 08:46:22 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 9B6321AE100A; Wed, 21 Nov 2018 16:46:38 +0000 (GMT) Date: Wed, 21 Nov 2018 16:46:38 +0000 From: Will Deacon To: Nicolas Boichat Cc: Robin Murphy , Joerg Roedel , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Michal Hocko , Mel Gorman , Levin Alexander , Huaisheng Ye , Mike Rapoport , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yong Wu , Matthias Brugger , Tomasz Figa , yingjoe.chen@mediatek.com Subject: Re: [PATCH v2 3/3] iommu/io-pgtable-arm-v7s: Request DMA32 memory, and improve debugging Message-ID: <20181121164638.GD24883@arm.com> References: <20181111090341.120786-1-drinkcat@chromium.org> <20181111090341.120786-4-drinkcat@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181111090341.120786-4-drinkcat@chromium.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 11, 2018 at 05:03:41PM +0800, Nicolas Boichat wrote: > For level 1/2 pages, ensure GFP_DMA32 is used if CONFIG_ZONE_DMA32 > is defined (e.g. on arm64 platforms). > > For level 2 pages, allocate a slab cache in SLAB_CACHE_DMA32. > > Also, print an error when the physical address does not fit in > 32-bit, to make debugging easier in the future. > > Fixes: ad67f5a6545f ("arm64: replace ZONE_DMA with ZONE_DMA32") > Signed-off-by: Nicolas Boichat > --- > > Changes since v1: > - Changed approach to use SLAB_CACHE_DMA32 added by the previous > commit. > - Use DMA or DMA32 depending on the architecture (DMA for arm, > DMA32 for arm64). > > drivers/iommu/io-pgtable-arm-v7s.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c > index 445c3bde04800c..996f7b6d00b44a 100644 > --- a/drivers/iommu/io-pgtable-arm-v7s.c > +++ b/drivers/iommu/io-pgtable-arm-v7s.c > @@ -161,6 +161,14 @@ > > #define ARM_V7S_TCR_PD1 BIT(5) > > +#ifdef CONFIG_ZONE_DMA32 > +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA32 > +#define ARM_V7S_TABLE_SLAB_CACHE SLAB_CACHE_DMA32 > +#else > +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA > +#define ARM_V7S_TABLE_SLAB_CACHE SLAB_CACHE_DMA > +#endif It's a bit grotty that GFP_DMA32 doesn't just map to GFP_DMA on 32-bit architectures, since then we wouldn't need this #ifdeffery afaict. Will