From patchwork Tue Nov 28 20:49:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13471794 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 A2A18C46CA3 for ; Tue, 28 Nov 2023 20:50:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B19576B035F; Tue, 28 Nov 2023 15:49:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC65D6B0362; Tue, 28 Nov 2023 15:49:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CBA86B0363; Tue, 28 Nov 2023 15:49:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7826D6B035F for ; Tue, 28 Nov 2023 15:49:55 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4E97B140388 for ; Tue, 28 Nov 2023 20:49:55 +0000 (UTC) X-FDA: 81508554750.08.2BECD40 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) by imf18.hostedemail.com (Postfix) with ESMTP id 878F91C000A for ; Tue, 28 Nov 2023 20:49:53 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=fi9tGPoo; dmarc=none; spf=pass (imf18.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.53 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=1701204593; 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=a+UOgwMSr+fO8+WjK0+Yyvo5WTdVa2NG4Hhe17BBstICWoTdBEYHsuktcdSpsiX2PQG6ta 1j/2ODn1vO0uuWAeCIAO4ORWvuDSaP5zO1w26zEAl1Vz6FReRDkqsVDZOTvaGYZ9Xf2VUP cP0pQyTr/wJVPB3k3HqeeEHQO7uMj2g= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=fi9tGPoo; dmarc=none; spf=pass (imf18.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.53 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701204593; a=rsa-sha256; cv=none; b=ciINCWtOoTmN3832LsbHSY/yt1FsA5EFf0uupSCg2cTVS0CXvvoI+zh0e5iXB3OVg/+dzq yK053X1AWex5Z1AmVcUzTu9MWZjzAi8P6nyGZferqJ4PuVDpH2qfYXVE0giutKzgW0d9Yt l0ncSlKDx5uPhVgrZytIu9Di8Z3ml2U= Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-67a095fbe27so1639996d6.1 for ; Tue, 28 Nov 2023 12:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1701204592; x=1701809392; 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=fi9tGPoog52TSWD+5FtBWQi2IVWWJhSQO31E1yBcaSE7SSvpEXbuZDSZytQYYWqo5K Sv/myzN0Lo0BxyifMTKLhG3R3ha/5PaiDvXRpMaQKEAwnWyTCT/qEehtVHrhLxPmD3cD 36tYz7jpTkoUFma+RhZMx3Wq4JXvLdQGG/+wG7/DipZb8srLEDB4Os9A9MNP9cfcxXut uV/lH/Wieh3j6jGaOfYkj4zCFPZc8GGWQ72IGsiLrabGrrX86RDnkR6mz53J6zG3O/Ip kjKOZICYBH7kYLdaZfwghPjCV7O1+E5VTvL3z1Ed7YKj8u3VHuWLJ1ohrCHD67TrAysx hyxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701204592; x=1701809392; 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=TlkmzXRh/j2Q/7qN1Q728SnMRxfvsMyQzPHUmT+5cjIJhbMOA73F+A6GweyXpEKnFv GoIHyFoerM2K8IU6mIXh6EHfv59TaW2w7hId8khx3b9DOfC5TtZGpTZ2YoFADIMsqJaU HCrkQFuVAxzViTvDmLvyfiOq8g433MmTxYq2kPIunbbJWGKGF9J7uEu8rP3sK3YDRhnY InfBEwqzktVozADHjof5x91Z9+ZUVZOC6L0nWEDnuICMWFfS8MGL2YYXmqr8c671bwtp X2ynV4U2zQZnPIyH5BPMzShKJ9UVLYp3+NRPvn6WzuG9X03a+dTqVlGhBsfHDc4Vg/GG dD7g== X-Gm-Message-State: AOJu0YxFbNxiB9qmzxgsYch7EjWrjiPkwTtDaQZzTirs28TbIG147nC4 NLi3FBmN4L7nf7gG/FAmwc35Eg== X-Google-Smtp-Source: AGHT+IE3AYmHHgK/QSP8+MPcS+KRS5b9M1xHWJUdTuMzT9sQ+l/sj698GMRB0ddulu50PHGvh8bO9Q== X-Received: by 2002:a05:6214:c86:b0:67a:4f19:d862 with SMTP id r6-20020a0562140c8600b0067a4f19d862mr8115033qvr.18.1701204592666; Tue, 28 Nov 2023 12:49:52 -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 d11-20020a0cfe8b000000b0067a56b6adfesm1056863qvs.71.2023.11.28.12.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 12:49:52 -0800 (PST) From: Pasha Tatashin To: akpm@linux-foundation.org, alex.williamson@redhat.com, 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, jasowang@redhat.com, jernej.skrabec@gmail.com, jgg@ziepe.ca, jonathanh@nvidia.com, joro@8bytes.org, kevin.tian@intel.com, krzysztof.kozlowski@linaro.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.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, mst@redhat.com, m.szyprowski@samsung.com, netdev@vger.kernel.org, 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, virtualization@lists.linux.dev, wens@csie.org, will@kernel.org, yu-cheng.yu@intel.com Subject: [PATCH 12/16] iommu/tegra-smmu: use page allocation function provided by iommu-pages.h Date: Tue, 28 Nov 2023 20:49:34 +0000 Message-ID: <20231128204938.1453583-13-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog In-Reply-To: <20231128204938.1453583-1-pasha.tatashin@soleen.com> References: <20231128204938.1453583-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 878F91C000A X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: kcwsweraikuiqrf9fbipe5powyqrtjau X-HE-Tag: 1701204593-940994 X-HE-Meta: U2FsdGVkX1872XVWyJDKBIJjc+sH7tf8KxjWn1ZMDzVraIkea9YYD0Xs3IROzA6GA86TPRCWJ/cdce+dmEVNHXG5l8VTEXcXCi4l6T4NRoy+2bmXZ4vEquaPZLODaz9oAZrS17iTmdbgQ4yUemrAH6VN0jKPRJsrICVqXUTgZEnXnldpTqs1QVjlV39a4h+fHkUjx/z/DsdhCP+OTGzmY9U8i/b2+wdUyQVVb4YS4CivMsa7shAyPmAdu5SeytSjks5uesOPPY0j97rqGA7boTKcMY8uq0RkLb/tDqNe4WMzEOqrZGZsqrpTfw6svW7Vza7lKtwaW670m68WtH5g4j24SP67j9+zSbHdfKk44ZeNcwA6wbBufuG6U4sT4qaCuKkBFPjRlGEJTjUMFw5qro2VSXSt0F+BMJ5UlbmkDy/ZxwVCPdPCN3Lt0MisXOs5Erbsl+luLJakjl1uhtu5eFjJHArfayFul+iXINvDDH6u6MQTjjteUoAGeaPg/3/SU9Bx7dzzx44PBstJqVUDSjr4NrmUDeo0i8hOd0yrBtgstbFQv4m8YcREiP2PdG8XwkARVtX6bSEumcv/pH9Lq0Dfwq+xTpweuyNaSDY03S5UballXD0SVL14xdZxTGz1ZcPC4chqdglW3u82YtjdZG72bKP1f6BnFi65HAY3oIXP2RA+mZqarAe22G7W4ohcgBRMyXIRAt3URVkFM6V98uq2B0QUjT05Gn8mnnpAqau/TIDPYA3GQbESlFaHWm5y3emWo0xGT6H2T4HHDN7y/SSKngqy1Vtmh9gpYHtAvF08jDv3z/CMLscp7j4U7MkDojzwkhPxuIS4jDYjq0ySYRbhEBUvo6fRKDboGhr1f6p7zw0wHTMoLf4EU+jYzvamTXLHBEwTAO4KI8Bjt+rO8pCj19k0L7x/DdYlfFzRGtfcVZwQJFsMlL0OvRDpoXkpYEFnvfv240I/sgBxRnp aolPtgz3 +ub5W8T08I1Ao7ggPVGkiPxOOpt1k/0IR6K2LdqmMfVQSogClKbf6bDaB0YQQj+7b8oGFurfi9cIO68V858rRVfrSL/3JfhCoU7hlww8IukhibK1zRj4qzddHSEHMnTjrNqpXbrWIhjEgwrf3RGrG/Sxd0yEL1TH7dEySYZ8yML5bfh76M+j+8V3ZEvwOISLauywxqi8ICj99Ut+Xuy6BhCCr1M15hIR70g8R06U0995v7xziMiPLTIi9Ja96gZZzR/fvFpbxnQyss+n/KvfTxx71LO+1KGzgUWFcjpwvVbYFQVU65+24ujoVn3tHIRJXX1x72mge1DNGYhhuytBf22GHYOZOo5uSXKcU05sd+3jEXcc6BDGUIjwiGUDVItD5yRs+eEGMfrRi3X9+XM4VbEGKrsgP/rLpDIbgzh0FYEHNGU2DCCJ/43D46xCmKBk4kQGU 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 --- 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]; }