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 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED195C43217 for ; Thu, 24 Feb 2022 10:41:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 901BC4166A; Thu, 24 Feb 2022 10:41:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KpUUumsfcmv3; Thu, 24 Feb 2022 10:41:47 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 6617F41630; Thu, 24 Feb 2022 10:41:47 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2237EC001A; Thu, 24 Feb 2022 10:41:47 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5E571C0011 for ; Thu, 24 Feb 2022 10:41:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5634C41638 for ; Thu, 24 Feb 2022 10:41:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P1SXNewVlEsc for ; Thu, 24 Feb 2022 10:41:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp4.osuosl.org (Postfix) with ESMTP id 8C80841630 for ; Thu, 24 Feb 2022 10:41:44 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB6B0ED1; Thu, 24 Feb 2022 02:41:43 -0800 (PST) Received: from [10.163.48.178] (unknown [10.163.48.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1BF8A3F70D; Thu, 24 Feb 2022 02:41:36 -0800 (PST) From: Anshuman Khandual Subject: Re: [PATCH 05/11] swiotlb: pass a gfp_mask argument to swiotlb_init_late To: Christoph Hellwig , iommu@lists.linux-foundation.org References: <20220222153514.593231-1-hch@lst.de> <20220222153514.593231-6-hch@lst.de> Message-ID: Date: Thu, 24 Feb 2022 16:11:39 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20220222153514.593231-6-hch@lst.de> Content-Language: en-US Cc: Juergen Gross , linux-s390@vger.kernel.org, linux-hyperv@vger.kernel.org, Stefano Stabellini , linux-ia64@vger.kernel.org, Robin Murphy , x86@kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, tboot-devel@lists.sourceforge.net, linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, Boris Ostrovsky , David Woodhouse , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2/22/22 9:05 PM, Christoph Hellwig wrote: > Let the caller chose a zone to allocate from. This is being used later via xen_swiotlb_gfp() on arm platform. > > Signed-off-by: Christoph Hellwig > --- > arch/x86/pci/sta2x11-fixup.c | 2 +- > include/linux/swiotlb.h | 2 +- > kernel/dma/swiotlb.c | 4 ++-- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/pci/sta2x11-fixup.c b/arch/x86/pci/sta2x11-fixup.c > index e0c039a75b2db..c7e6faf59a861 100644 > --- a/arch/x86/pci/sta2x11-fixup.c > +++ b/arch/x86/pci/sta2x11-fixup.c > @@ -57,7 +57,7 @@ static void sta2x11_new_instance(struct pci_dev *pdev) > int size = STA2X11_SWIOTLB_SIZE; > /* First instance: register your own swiotlb area */ > dev_info(&pdev->dev, "Using SWIOTLB (size %i)\n", size); > - if (swiotlb_init_late(size)) > + if (swiotlb_init_late(size, GFP_DMA)) > dev_emerg(&pdev->dev, "init swiotlb failed\n"); > } > list_add(&instance->list, &sta2x11_instance_list); > diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h > index b48b26bfa0edb..1befd6b2ccf5e 100644 > --- a/include/linux/swiotlb.h > +++ b/include/linux/swiotlb.h > @@ -40,7 +40,7 @@ extern void swiotlb_init(int verbose); > int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); > unsigned long swiotlb_size_or_default(void); > extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs); > -int swiotlb_init_late(size_t size); > +int swiotlb_init_late(size_t size, gfp_t gfp_mask); > extern void __init swiotlb_update_mem_attributes(void); > > phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t phys, > diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c > index 5f64b02fbb732..a653fcf1fe6c2 100644 > --- a/kernel/dma/swiotlb.c > +++ b/kernel/dma/swiotlb.c > @@ -290,7 +290,7 @@ swiotlb_init(int verbose) > * initialize the swiotlb later using the slab allocator if needed. > * This should be just like above, but with some error catching. > */ > -int swiotlb_init_late(size_t size) > +int swiotlb_init_late(size_t size, gfp_t gfp_mask) > { > unsigned long nslabs = ALIGN(size >> IO_TLB_SHIFT, IO_TLB_SEGSIZE); > unsigned long bytes; > @@ -309,7 +309,7 @@ int swiotlb_init_late(size_t size) > bytes = nslabs << IO_TLB_SHIFT; > > while ((SLABS_PER_PAGE << order) > IO_TLB_MIN_SLABS) { > - vstart = (void *)__get_free_pages(GFP_DMA | __GFP_NOWARN, > + vstart = (void *)__get_free_pages(gfp_mask | __GFP_NOWARN, > order); > if (vstart) > break; > Reviewed-by: Anshuman Khandual _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu