From patchwork Sat Apr 13 00:25:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13628414 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 1E43BC00A94 for ; Sat, 13 Apr 2024 00:25:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AAEA46B00A1; Fri, 12 Apr 2024 20:25:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A5B236B00A2; Fri, 12 Apr 2024 20:25:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 812886B00A3; Fri, 12 Apr 2024 20:25:41 -0400 (EDT) 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 56AED6B00A1 for ; Fri, 12 Apr 2024 20:25:41 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9FEFFC0F80 for ; Sat, 13 Apr 2024 00:25:36 +0000 (UTC) X-FDA: 82002615072.22.260BF40 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by imf15.hostedemail.com (Postfix) with ESMTP id D3CD1A0006 for ; Sat, 13 Apr 2024 00:25:34 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=yfCiMQtS; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf15.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.181 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=1712967934; 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=3Msq3s0T9jYWGepWyMOjVGhKtsGemyt6YXf5qXgBQII=; b=fldVWQrkbAaN+lrXc5Ylk6pw4mHHKJB/7KoVmHRszi3CFl486JfAwMMmVQr5I3BfaR9RWs qjk5GNkzjkKv4h6lOefpUx2gPAVw0u5+sDeiAKYsmd562G+nu4SEazB88CFrDSCYfa8W8b vcLIoDL3JQwaWxmuflSgUG+cY6CwWaE= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=yfCiMQtS; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf15.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.181 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712967934; a=rsa-sha256; cv=none; b=z8Mphb7inWNGSwS7QMsF9A6KiQTKBhKkhiygp3BdjhL2nkuJ1FV2Qh6k+9Nz6O4iRqEaCz Ta3K4vtGVZdJIZzRgf1hVvjhzDOogaxcD5J3R6AQbnxho60wYVLhxNN3pf+wNvpC30EQTF FHptKZo+ZTugmBbar+xXJVuqsQE/JCM= Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-78ebc7e1586so247572585a.1 for ; Fri, 12 Apr 2024 17:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1712967934; x=1713572734; 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=3Msq3s0T9jYWGepWyMOjVGhKtsGemyt6YXf5qXgBQII=; b=yfCiMQtSQKH/jXbiV8qgYGLiGBOhgYcCE9xEla8kpkP12wFZKETkeQk2AlJuA6dBb5 N6n7/jC7m81CorDu2Ja4O6RZwTpXJ0Ug1q2CB2ZTARZCY+nzhIML7GYxlc7A9DGxsj3E MkzUZkL4nrw+Pkpc0sIUn2UBS9qHnqIAHwVy3wMLrfi/qe+0Z3i+1qh03bchXuIqsRsf vPc+3Hlwf9nZzjc8c6e27nFXnerZpZsUP35A/BrDpP7idQhDFxbo/2XHbzZT5stUXWk/ oY70YmNyk/E9uaXHpT3rSvvLJ8/S1107596ejMCTUL5gU2vDvXyQvFkgOUV+JKaZI7Q8 DLaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712967934; x=1713572734; 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=3Msq3s0T9jYWGepWyMOjVGhKtsGemyt6YXf5qXgBQII=; b=XU81avW4tiIbclXtvymqyefYunbFRHBiSz2VKOLbFLuw+I10nreoUe1+4TRgjbvpg7 q1djh7gx4sCWk7HNz2GaDvgwLlxEOQsEg+16auS8LMCGjkx6/Qetz8kDHi5kqzC2bQJZ kvlfi9gbtTPJ7Foo2L1zAr7xkq4lCcVTfAaUqBHPraFk5nWk4lLiBdFQxajzyok3XsYA NtRrSGrx2Z7/JXospw7ruuDUNQaFwzvPZBaXAyA3GIfvL20FiHqIDwoJepZU/5+OOWiJ iCjsvfGBV4x/si9OjOpL/3Fb1R82/Y1ITJhJGA+LRJFzI82ZH4k9c1mLYP7ZoxcZfBI2 cbuA== X-Forwarded-Encrypted: i=1; AJvYcCXDA6G272U75p1IVnbF+auUU7HwZvaB8oty/u+Dx1jaKAf0/aCojAiDqvfc3CDQV0gWbztlIeRaRgHmqFcD6FHe2Cg= X-Gm-Message-State: AOJu0YyGZaEw14xg55OInSpV5fNXKEB0vTC8KpKJbYMljeKuNkTx0DMa h0D4FDFU6CcRIJlEJ4bgTEFQx9pw44rq1jdiXT9tVgVsmCQ2iA3U8PKzRPtFhhE= X-Google-Smtp-Source: AGHT+IFLWyccRHbQF5BJmQAmIq2yaafFcDxYEvTdEMzon+yR8BjvOaupqITKjDvsX+13T7c1AAimFg== X-Received: by 2002:a05:620a:4606:b0:78d:77f1:6043 with SMTP id br6-20020a05620a460600b0078d77f16043mr8190515qkb.6.1712967934070; Fri, 12 Apr 2024 17:25:34 -0700 (PDT) Received: from soleen.c.googlers.com.com (128.174.85.34.bc.googleusercontent.com. [34.85.174.128]) by smtp.gmail.com with ESMTPSA id wl25-20020a05620a57d900b0078d5fece9a6sm3053490qkn.101.2024.04.12.17.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 17:25:33 -0700 (PDT) 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, bagasdotme@gmail.com, mkoutny@suse.com Subject: [PATCH v6 09/11] iommu/tegra-smmu: use page allocation function provided by iommu-pages.h Date: Sat, 13 Apr 2024 00:25:20 +0000 Message-ID: <20240413002522.1101315-10-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog In-Reply-To: <20240413002522.1101315-1-pasha.tatashin@soleen.com> References: <20240413002522.1101315-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D3CD1A0006 X-Stat-Signature: q7ondy7tg41qoqxw4zyg3stzbm11t8kf X-HE-Tag: 1712967934-983759 X-HE-Meta: U2FsdGVkX196fumsNAiWdAm8+F2ZAP8soW2ZUsMiZp5Hg/aIb4SNRp8r+epkrx/hwceaNX+FfLofLZ9mp4Qa/svTKtcHeY206bAuV8Sv5A/+/Y5B5mfy6R6JZq1MMg5ciTVL6VyjUgLOV+i/IU/ubwRNmWWz6vAKWIGeQnD0axMt0weg6hXZC2AevwMMtkoTGAVMqUl73V1VMYJ7v2AhPiPOT1du8BFIHfdaob7zCyDUEpHNdGnuK1rFehPjXJL2EsI2/9kTFDD6aBFR0kBvSrqjdnqJR7zjN9nQLkvCr4LKzLeF2EZ1vtc6ZK+l7UNP4lBbsgPSjJezezz/0aYvTpZ7XlqcHcGZ7zu5gSJlX+QkkRIQXjtsEYiDUi7aEyW9IW0Ow+T0cPb662HHSOQB0MXgrIyvy1wzaMnrrVtfBeR54g9uAUpeeeiuyzIm0XQRXBZ7zwbwxp2NapW9EIGDxjsOr7tQ1fMWggna8NpkZzCGHudenu/0MGuqO+FCh0BXOGRLxPjh1q3rxmBVKJT5pgXqgy+EgNsysL8ZUuh2DqKUIiJgUz5hkzXlxWTpdRMSvIKE6pbiK/T0e+XH5mpbCTCbxXIKHdfnk6cnQJbcdSA2nhqn2mHimeLQAB49/RjlbFFJfaT9ntCkvXqZ41PAM8pmM4K3zSxI2yuskRA8/TFtqZ8RIQpV0mMySkzzrAf+L6OfgJNtMW8lNgip8LwjU4ZroxgkHY+HBCCfFXw0AzRbxgZxKfsiZAkpdhuiar3Dz08AiAqhssnwEzkA+qamTmdi6cX8xdj8hKr962r4ySLJfDVFz7itbxByDTTozYpcmpKxdUoGl+iRavbEVZrkzdEfF2hmw9sp0jbaNZS22zye8z5YSnKMTGi2bd2vVKMQ1mrSR9urasZLyWIiwIhfvwIPr/jf04DAzyAhcsDcrQzyTM4i9Fer11q29R2i9DzODv32gIWGcAXWJ0qSI95 y8aHu8KJ kGwNUdEMZey3JbOpqUVjJDelAXoPppQNJwUCSY5Mk7JKz9prKoGqDXOZsb4z1LHUpNZVKyc5H9UTf+VE5uIiMJsOsc/8829ud2/+u3xVH1Kn0Q6rnpUVGziokwJnYgQrqI8dh10SwQq+fj3u0Q3XAhOqXAK9v/WVpd+JskkPRyJtBqsK6A02sDBM2YEsLlD1/dT/UAr6VSPwLqc6ZsOjVAwXw4KrnJ+jE0nmqHsqk8fZ9A9pdF5mHdQYE3vmW7fUBCtDUNuDcYZVubwuQmRJ85U9L7lkVDrTxFZBcYSeD7En7AApZRblk81wU7Jz2qXmioBxR+Hdu65hwwYxwQj5y9p2Z0uJb/cYRKiG8/IjRF4AtoxYRGSeTxa/me1DS0H697k9ZwqpDZxMM1b4AJnf4W9LTY7DntidG53rcvnj26oaDoXI+4hf3wlA/2rCbpS1+ms164rsnBzQAWMAk4lBCjdBQCftc2BfjVGhfDCBKpeN+Q10puKSmbq0X8otIL0KevxFmjaaml8w+oYr7wyAmFDHwwG6CSlcC64sCrcUuSVzHYV3GlnIzSWKbbhGYbBzGf25jnQZF3ES8WBudtkBK5TPUZrLFplHOTl7G 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 Tested-by: Bagas Sanjaya --- 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 14e525bd0d9b..f86c7ae91814 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_pages(GFP_KERNEL | __GFP_DMA, 0); 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_pages(as->pd, 0); 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_pages(as->pd, 0); 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_pages(page, 0); 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_pages(page, 0); 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_pages(page, 0); 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_pages(gfp | __GFP_DMA, 0); 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_pages(page, 0); page = as->pts[pde]; }