From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A57AEC49ED6 for ; Wed, 11 Sep 2019 19:12:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A73620838 for ; Wed, 11 Sep 2019 19:12:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FP09PsqM"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="06FeZG8Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A73620838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ql11s56CxMrCDwrMovM2buFjtEckkcSG7Ppo1fFzo80=; b=FP09PsqMDeRRYN gVvOPOkUypheCdGEUkV+1w2muKAVX3DonNsoVpJP9s/K7IGy1NSVcX51MKac2oQikZs94Z+2TqbTH 4wMh7i9+FG+gqUShWzCVWB1pzA3SNhW5k4e9eIrmin7MbNdVPVZVhpM/hXliXU24VNzSgESPfPj5z OubXC8lZ31L+3u9ZobfwlL7pEUGAS4yuQ3L8uADo51FempMq8aK6tssVA/ftKChOQVVRRDPXZyMHw aS/cd05o9l0sKRuq8IhjGRa20/st7xuGF4S+BlHiEUafD3RS2ULnB+m03fXNxVgs6t5opLVlOTNAC fOUdt/3jqhTPZDoCaq9w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i882n-0000W3-Tr; Wed, 11 Sep 2019 19:12:45 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i882j-0000Vg-WE for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2019 19:12:43 +0000 Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A4242075C; Wed, 11 Sep 2019 19:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568229161; bh=VPT7mijC4q1kEydmhkrufKNG2yzGMdjsTOZaEMfyAb8=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=06FeZG8ZNyNusLCCPXzRSYmNlOeHcB9qefO1tzjUjw08sIGocxmuBX/13QuREeVi3 YneN37UBEK1ALsEP802ZNxG5xPe+yh1l9Ame8GNhvAjFqHCXFiolye32I9AJx3Cd3U Dzbya/sKdFP7WtGH5NKiXCZ3PD5UYH97yToyJUN0= Date: Wed, 11 Sep 2019 12:12:34 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Peng Fan Subject: RE: [PATCH V2] arm: xen: mm: use __GPF_DMA32 for arm64 In-Reply-To: Message-ID: References: <1567175255-1798-1-git-send-email-peng.fan@nxp.com> <20190830085807.GA15771@infradead.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190911_121242_062990_F4BC3020 X-CRM114-Status: GOOD ( 21.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "jgross@suse.com" , Stefano Stabellini , Catalin Marinas , "linux@armlinux.org.uk" , Christoph Hellwig , Julien Grall , dl-linux-imx , "xen-devel@lists.xenproject.org" , "boris.ostrovsky@oracle.com" , nd , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Robin Murphy Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 11 Sep 2019, Peng Fan wrote: > > Subject: Re: [PATCH V2] arm: xen: mm: use __GPF_DMA32 for arm64 > > > > + Juergen, Boris > > > > On Fri, 30 Aug 2019, Christoph Hellwig wrote: > > > Can we take a step back and figure out what we want to do here? > > > > > > AFAICS this function allocates memory for the swiotlb-xen buffer, and > > > that means it must be <= 32-bit addressable to satisfy the DMA API > > > guarantees. That means we generally want to use GFP_DMA32 > > everywhere > > > that exists, but on systems with odd zones we might want to dip into > > > GFP_DMA. This also means swiotlb-xen doesn't actually do the right > > > thing on x86 at the moment. So shouldn't we just have one common > > > routine in swiotlb-xen.c that checks if we have CONFIG_ZONE_DMA32 set, > > > then try GFP_DMA32, and if not check if CONFIG_ZONE_DMA is set and > > > then try that, else default to GFP_KERNEL? > > > > Yes, for ARM/ARM64 it makes a lot of sense given that dom0 is 1:1 mapped > > (pseudo-physical == physical). I'll let Juergen and Boris comment on the x86 > > side of things, but on x86 PV Dom0 is not 1:1 mapped so > > GFP_DMA32 is probably not meaningful. > > If we only take ARM/ARM64, so could the following patch be ok? > > diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c > index d33b77e9add3..e5a6a73b2e06 100644 > --- a/arch/arm/xen/mm.c > +++ b/arch/arm/xen/mm.c > @@ -28,7 +28,11 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order) > > for_each_memblock(memory, reg) { > if (reg->base < (phys_addr_t)0xffffffff) { > +#ifdef CONFIG_ZONE_DMA32 > + flags |= __GFP_DMA32; > +#else > flags |= __GFP_DMA; > +#endif > break; > } > } I am OK with something like this, but at that point we can use IS_ENABLED(CONFIG_ZONE_DMA32) for the check. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel