From patchwork Tue Dec 26 20:02:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13505034 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5454C47077 for ; Tue, 26 Dec 2023 20:02:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 041C26B0083; Tue, 26 Dec 2023 15:02:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E53E76B0087; Tue, 26 Dec 2023 15:02:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBBEB6B0088; Tue, 26 Dec 2023 15:02:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 97B9D6B0087 for ; Tue, 26 Dec 2023 15:02:18 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 78C17A14F7 for ; Tue, 26 Dec 2023 20:02:18 +0000 (UTC) X-FDA: 81610041156.29.8A0B82F Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by imf20.hostedemail.com (Postfix) with ESMTP id 7B56E1C002F for ; Tue, 26 Dec 2023 20:02:16 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=lgWc8HoT; dmarc=none; spf=pass (imf20.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.46 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703620936; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DYpA5AoyDPqGEngVGgZPNQ1qp0VmBsjf7LHh4aHHikg=; b=SJnzwuzO51lDaNjDhHQnytQwXVXPBLnhCHIiYHugwVkxvxYKYeDyM60v3g+uo21YKDLugF 1IxRTd6oDCBhMKE73CIIwwkrvkW+7i6XECjT4lASh4eJQysNquRvoTxA9aE4MZoOK9/58C Egm6L1TT++5OulO2Bb29HD1pmGwyg/g= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=lgWc8HoT; dmarc=none; spf=pass (imf20.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.46 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703620936; a=rsa-sha256; cv=none; b=Fjc9/o+zBrRCoH1qR5daWKxubwIMf5COiC9OWXjoj9MkAFLrCzcZtOlMz/l6uNTCEAaDoz IyrCp+5nQ48aMp7URKE2TslXtUx3ZHIigkkPyju9mYwEYm0H2UqnLEnm/+EzpDwPjfjbKT pg2m9pD5UXDIzGMe68E6egN08E+CUks= Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-67f147c04b7so43559776d6.2 for ; Tue, 26 Dec 2023 12:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1703620935; x=1704225735; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DYpA5AoyDPqGEngVGgZPNQ1qp0VmBsjf7LHh4aHHikg=; b=lgWc8HoT6VWtc+v4VueWZDA2kBJoelSg5Bof2MomqJzbKL7ry82otTs0Pj5cZ/VMDr ROT1zpWlostngpwKJcwVbO8DmO2GAzUZXwNYelN353Z0PDewPrzbE6eh1CnuGEWFYCeg jlH4jg+GvdXx7eR/VdFJgOeUTGiBfzjyEgaib/tJKb5Hcvw/otbyp52juG5DAvxjQ2WD VmsvqgCePVwOz0elkujhM4owd6PS+Kh2oan25NIlpdufbEUh12IWVr8RWnzckFU3sHtn PUtdfY1SMm/EoENTLvIfugpayQ8qXCc5wng8xvt8SRrY8MhEM80ASCdgn4pXjULuZeG6 xTcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703620935; x=1704225735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DYpA5AoyDPqGEngVGgZPNQ1qp0VmBsjf7LHh4aHHikg=; b=kvbOD4o3bj6yrAsBpdvGh9Yl+qrQIarRn/3BNdUEslyL7sXL/JgZ0KcYyoSLAgOlxC YK8nvEFYCCK4eBenqCs7r+0MrYhr3yjQgzoFNF9hQC8z3e2SSgyvQJRo3u4RsebTrYrb TxRLkPLXligM22SDRGiVI0uBYLnadU45auNelPqhXm6Kp8Uwboyr0VqwcvPKyRT8MCnl 0pXbkbmur/kTGVCMYmKXNexNM67+Kng0/CSIuwuzkkOxeGZOg/gtfu5bv231xclQNqvQ GoJ1ZxxbipZVPbx+ng/4cx8HVf6LGGGWP58uNE9tPCJoTMPPz7/tR5Gkya3M74+eREiL PIwg== X-Gm-Message-State: AOJu0YyPToFGkV9G6UCjoHKB8tdtJbUS/aDiv3NKWm54bBQXvxS2QExk 1dox3e+SUUHaCTtgrJi7onYzSbqgq++aTQ== X-Google-Smtp-Source: AGHT+IEHD5SgGbWwK85ao2UYnS0Sh88kCiwjBFDK6W+qd5C2eGRRvAW0T4zywkQC2m/uRIGxj913QQ== X-Received: by 2002:a05:6214:1fd3:b0:67f:bd9a:a4c0 with SMTP id jh19-20020a0562141fd300b0067fbd9aa4c0mr6481858qvb.108.1703620935668; Tue, 26 Dec 2023 12:02:15 -0800 (PST) Received: from soleen.c.googlers.com.com (55.87.194.35.bc.googleusercontent.com. [35.194.87.55]) by smtp.gmail.com with ESMTPSA id t5-20020a0cf985000000b0067f696f412esm4894539qvn.112.2023.12.26.12.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 12:02:15 -0800 (PST) From: Pasha Tatashin To: akpm@linux-foundation.org, alim.akhtar@samsung.com, alyssa@rosenzweig.io, asahi@lists.linux.dev, baolu.lu@linux.intel.com, bhelgaas@google.com, cgroups@vger.kernel.org, corbet@lwn.net, david@redhat.com, dwmw2@infradead.org, hannes@cmpxchg.org, heiko@sntech.de, iommu@lists.linux.dev, jernej.skrabec@gmail.com, jonathanh@nvidia.com, joro@8bytes.org, krzysztof.kozlowski@linaro.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, lizefan.x@bytedance.com, marcan@marcan.st, mhiramat@kernel.org, m.szyprowski@samsung.com, pasha.tatashin@soleen.com, paulmck@kernel.org, rdunlap@infradead.org, robin.murphy@arm.com, samuel@sholland.org, suravee.suthikulpanit@amd.com, sven@svenpeter.dev, thierry.reding@gmail.com, tj@kernel.org, tomas.mudrunka@gmail.com, vdumpa@nvidia.com, wens@csie.org, will@kernel.org, yu-cheng.yu@intel.com, rientjes@google.com Subject: [PATCH v3 08/10] iommu/tegra-smmu: use page allocation function provided by iommu-pages.h Date: Tue, 26 Dec 2023 20:02:03 +0000 Message-ID: <20231226200205.562565-9-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20231226200205.562565-1-pasha.tatashin@soleen.com> References: <20231226200205.562565-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X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hGY+E+8cI n5t5oZ6P 7L0foifcazZyVxUg/vfT8ym4XOlHc5ZABId/8t/vfH2jxlRyUtnwNozhceE4gPAalMQYLFbVKn2WBZ1MazrYMUWvJiV+IBDf0GRqz2BujDBnAyblXSg5Z8RYL3MQ7uwM1cFq+dw3VfnkqzCxZ14JtA796sxvcesafCbXI50Efx7PNjTEqO44Ymfkj3tC9bOu/6g/4eF84INhbWSLQiwJf1+1m2zQkAA+867Ikwt39JfyZaUEvg1rH6Hr/2GfRpiyUC+NOBFheLESXTSY21TZzFuJs/nkv55l+ngea35cOS5Y4ikJLNShfnLhhL2jKusDodaOMmJEIQxyc9SxWFC7Q4XmbvxSiIIUA8efIRR8bHYvjqzPHpenAIC3u/uENrGv1hU9+qCocNuy7OA0ZSBespiGx5Mil/h9q9vffWPBbOdUONsylxceEt7SUfrHmRUAPVmDcpa4bYygIQpzRS+o2PPf53Q== 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: List-Subscribe: List-Unsubscribe: Convert iommu/tegra-smmu.c to use the new page allocation functions provided in iommu-pages.h. Signed-off-by: Pasha Tatashin Acked-by: David Rientjes Acked-by: Thierry Reding --- drivers/iommu/tegra-smmu.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 310871728ab4..5e0730dc1b0e 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -19,6 +19,8 @@ #include #include +#include "iommu-pages.h" + struct tegra_smmu_group { struct list_head list; struct tegra_smmu *smmu; @@ -282,7 +284,7 @@ static struct iommu_domain *tegra_smmu_domain_alloc_paging(struct device *dev) as->attr = SMMU_PD_READABLE | SMMU_PD_WRITABLE | SMMU_PD_NONSECURE; - as->pd = alloc_page(GFP_KERNEL | __GFP_DMA | __GFP_ZERO); + as->pd = __iommu_alloc_page(GFP_KERNEL | __GFP_DMA); if (!as->pd) { kfree(as); return NULL; @@ -290,7 +292,7 @@ static struct iommu_domain *tegra_smmu_domain_alloc_paging(struct device *dev) as->count = kcalloc(SMMU_NUM_PDE, sizeof(u32), GFP_KERNEL); if (!as->count) { - __free_page(as->pd); + __iommu_free_page(as->pd); kfree(as); return NULL; } @@ -298,7 +300,7 @@ static struct iommu_domain *tegra_smmu_domain_alloc_paging(struct device *dev) as->pts = kcalloc(SMMU_NUM_PDE, sizeof(*as->pts), GFP_KERNEL); if (!as->pts) { kfree(as->count); - __free_page(as->pd); + __iommu_free_page(as->pd); kfree(as); return NULL; } @@ -599,14 +601,14 @@ static u32 *as_get_pte(struct tegra_smmu_as *as, dma_addr_t iova, dma = dma_map_page(smmu->dev, page, 0, SMMU_SIZE_PT, DMA_TO_DEVICE); if (dma_mapping_error(smmu->dev, dma)) { - __free_page(page); + __iommu_free_page(page); return NULL; } if (!smmu_dma_addr_valid(smmu, dma)) { dma_unmap_page(smmu->dev, dma, SMMU_SIZE_PT, DMA_TO_DEVICE); - __free_page(page); + __iommu_free_page(page); return NULL; } @@ -649,7 +651,7 @@ static void tegra_smmu_pte_put_use(struct tegra_smmu_as *as, unsigned long iova) tegra_smmu_set_pde(as, iova, 0); dma_unmap_page(smmu->dev, pte_dma, SMMU_SIZE_PT, DMA_TO_DEVICE); - __free_page(page); + __iommu_free_page(page); as->pts[pde] = NULL; } } @@ -688,7 +690,7 @@ static struct page *as_get_pde_page(struct tegra_smmu_as *as, if (gfpflags_allow_blocking(gfp)) spin_unlock_irqrestore(&as->lock, *flags); - page = alloc_page(gfp | __GFP_DMA | __GFP_ZERO); + page = __iommu_alloc_page(gfp | __GFP_DMA); if (gfpflags_allow_blocking(gfp)) spin_lock_irqsave(&as->lock, *flags); @@ -700,7 +702,7 @@ static struct page *as_get_pde_page(struct tegra_smmu_as *as, */ if (as->pts[pde]) { if (page) - __free_page(page); + __iommu_free_page(page); page = as->pts[pde]; }