From patchwork Thu Nov 30 20:15:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13475020 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 E9F2DC10F04 for ; Thu, 30 Nov 2023 20:15:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E3206B04A1; Thu, 30 Nov 2023 15:15:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 693056B04A2; Thu, 30 Nov 2023 15:15:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 471176B04A3; Thu, 30 Nov 2023 15:15:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 300DA6B04A1 for ; Thu, 30 Nov 2023 15:15:18 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 07390140329 for ; Thu, 30 Nov 2023 20:15:18 +0000 (UTC) X-FDA: 81515725116.04.ED3A6F2 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by imf05.hostedemail.com (Postfix) with ESMTP id 461E810001D for ; Thu, 30 Nov 2023 20:15:16 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=c7X7LIcN; spf=pass (imf05.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.42 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701375316; 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=CTqyv+/QBqQRpLXIT6J0+RNMQRf6NZoT619SVstW8Ks=; b=GdRGRCYsVVgsArNMXgS3HRXj2sg6sbHU2LvG1mZ3Os5rhruiYigLCpRNSSyQJiRy122ZOG kcGUg/ZML2eC/7SRFyajwVMJ/yfZ4yK6VNJD+Eep3tGuxGNDYJdev8d46gC3tTKfT4QwI/ LUoLz3lF1Iyz+7awev4c4Fvd0HO427Q= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701375316; a=rsa-sha256; cv=none; b=uj/6zv9Yctn/oHYRiqmMcrAK2zSMMqx7NHsdgI7nTfB0IbF8mEXAC/1u4sSUgavyuYY+90 Q+YjB5XGLX6d9GKamyUjJbnDoc0WdZ00xeuKWoGzxSCvl+3Mj+116R4zKjUP/bVOtBh4vJ vT7esdWCrfujLrqFBHzAJZsQxN7Bw1g= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=c7X7LIcN; spf=pass (imf05.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.42 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-67a8a745c43so6156886d6.0 for ; Thu, 30 Nov 2023 12:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1701375315; x=1701980115; 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=CTqyv+/QBqQRpLXIT6J0+RNMQRf6NZoT619SVstW8Ks=; b=c7X7LIcN3RF65sgEsl63oljkMqMohSPK5BMJQdFcLdwqaAxYFpzirbGTsTPgsWw3Y3 uE6IgLaGZ9IsS/o7QadS636qXi3ET7yFgzn4p5joZula5UjNSOqqnVqnPpP/tWSC5GXG TRO++0YSQ5uk/6Tb6kclw8pAbxQsL5EY9TuFoMz87m2dSZEapU8g+q1U4KXAsVg3gzFm t9A8R9qmGlc48JmhtbtF4tt9R3PSeSPqWSrYuujWpkpQzPPZ4lQe6A0S94vnLgOpl0T2 C4Jz2Gkmhyrfgr2MhZL9D+OguUVY/wnNxKdD1ZFwrcQlmhvbDvvPxPkb2vqqOebd1GHm 3eOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701375315; x=1701980115; 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=CTqyv+/QBqQRpLXIT6J0+RNMQRf6NZoT619SVstW8Ks=; b=JiWp/BZA33zYooIj+5ASWan6a5LCBGL/wwo/ph/gZCSr/UH0q2FqYPZf89u+EHle5n M6gR4T3UCb+XyxwJHqEdmU0XDSkbcwe2x7Dl0OZ1s48BsdYTPgItvjDsZW3iVTsnRdn8 tTWAYqW/O4l6syYSqyVvBAOxr/yUXvXXzHbBlneE1AxixQ1LzpJh+e2g/OjFknuk+yib b8kjM+RwHkr4oyRmBgLcnui5MWNXg8jSsxN3ZoppPDN6VY6F0OByzqMwDDuEXzgkWzYS 1ih9x2AKYfjZGMgHkHimx3yF9eg34cosETv1CjtIlsG+6KQEhML2Or6fiBSimK0/g0Me y12g== X-Gm-Message-State: AOJu0Yw1WIHZDzWFfyuKySV89TLA+HQFRcIvkdCfEkFETfUUD05XGcG6 tP+XrMZzkXU7Qr2rA2OytQjBZA== X-Google-Smtp-Source: AGHT+IE4JYPLoA/tNY4x2pKdpnHf/W/XblnfOPtcPXpbeLos1tHq3JCEAsQT3LPHq1ybHp62KX3VJw== X-Received: by 2002:a05:6214:4115:b0:67a:3a51:8773 with SMTP id kc21-20020a056214411500b0067a3a518773mr24916856qvb.5.1701375315320; Thu, 30 Nov 2023 12:15: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 e1-20020a0cb441000000b0067a35608186sm795252qvf.28.2023.11.30.12.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 12:15: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 Subject: [PATCH v2 08/10] iommu/tegra-smmu: use page allocation function provided by iommu-pages.h Date: Thu, 30 Nov 2023 20:15:02 +0000 Message-ID: <20231130201504.2322355-9-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog In-Reply-To: <20231130201504.2322355-1-pasha.tatashin@soleen.com> References: <20231130201504.2322355-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 461E810001D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: afetm8nhh67p7gufqr65uihi151jiofw X-HE-Tag: 1701375316-89355 X-HE-Meta: U2FsdGVkX1+jzl4iBFme9xEXdwtQpP0SOwM7Lo8sWv8VgaO9lgpD28fEUwQB8jjkzkJ8Zl7nCTF+N5kygLVcM+YFkoGxqAwYD2Gay11zZPpbFDQKc8zdICj4SG87RNtJ5JiqxvYxdAeOMapwjt4TCONSg6fjZMGshPzUH040mfyHrKL9PJkbRpCMOr4B17phfs6JU9+sJBSuK167oe/IuPSPfHXdAJ8g2vb3c4ioBjO8xR39D2xvubFgOImI/y0Eh/Y+A9BPTiYd9JRErCmlmQx03dYqHu0jTJvjSz9xNNY6YKxUZb80yup4TKASoP3NEitzU1HKmh7h1p6J3CeBtS8MZkrDFW3gfMAtJPrsmKakZ65IQkqzKgoX+yyPqjQ7n1VVlmAy/bD/H9WASN4382mP0XGjRzKrk3FSA1R8zUsTJUbIEmrLSxKVbo+oaPIdtARc6hZgSll3igoEq/Af8O0+fQ/g1A8i1I9OQQ4cRET/8ZXKVKDWcMFzmLpKPRAaQSmCyaZdj/gvSzjXUFCSuNc8pdJ10KVH0v13pbBKh3ttWBhrfqjC3yW76yEekVoZS/OAkZCIwhkEBlVrthQI95eciKTE/WEkI+eAthvLWn6jIqOkNHcGfowDNBxERloL8UIqhK/y4NLdaHD1OySdXLCStE33xMLAx3AftVm174QfdmUCAIuBTp0ODjdTTRJjjOhmAwC7fm+iglsON0dSMkYA1+XXtFfN/f9rZyLAoIJlVLAypSio2Oxl3oWR8037u8lvcy69DUN7BKnoVfxUtzmOLkNCRIRhti267mAg6HjBPffcsEcyZAXPMWFohm8oQgKcyH0iSw65jk9+y1u6fjaeHcX42rtrN9eTK71RaIM6Wf0/FUnNxIqd0bFALYSND8mnDQ/ewlgSx3DNxd1DR0Jt816WzVBueAy8H/dT5N2SvmY8cWk9IU8ohBLQE78dk/TPDX31LG/nTE7or8B TzrmUwk/ VLn3Zykc2tfzJLCMfpsp1qw5HUH5Uy0v/T5fVboFTL/TZqIbgXQLyyK3a5NIokK3rHl8tOqhMklcOUL/3B7cyF8i16u1EXAq3zXYFShGh2acc9unvw2onyfav1iz9LRVvBAbFVc/YyHjt8YtlK7qLJAEtCOYt8EfpuSqGxSOfPomuOhQmAhweAyl1vKN0txHnw8dkO9HvAGhwScZKbY7MGxlZf2W1i0jSogVj+2vMCZOjxKy8045XpVSpnHpuliDo1dI/xlu3IWfU+mxi6GNNq//25aJ97mZS33omg+yG9J1Ph0WZbDRdjoiOaJ2ol6tjWoduc0iDR17NmX2GFWmroYz+Hqm72/ck6zCTZH040AVHGTGaxWK7u02mBE5kz39tk/ZUKABATQrXrGeLisF+1GXDXojGBAgqzL9XIe4fWKqR+OczPJEuiNQWHSL9U34v0Kqv3I0SMgsBDrWsVyOHLVlAMeR8I+nVYpdV2+OrhGYCm+BH9s6vWV/0pK4aMjclGmv5yyzSsFlKVCY= 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 --- 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]; }