From patchwork Wed Feb 7 17:41:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13548808 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 2265DC4828F for ; Wed, 7 Feb 2024 17:41:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 97DDE6B0083; Wed, 7 Feb 2024 12:41:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FF806B0087; Wed, 7 Feb 2024 12:41:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7783B6B0088; Wed, 7 Feb 2024 12:41:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6886F6B0083 for ; Wed, 7 Feb 2024 12:41:20 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 38BB416054E for ; Wed, 7 Feb 2024 17:41:20 +0000 (UTC) X-FDA: 81765724320.29.539E11B Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by imf22.hostedemail.com (Postfix) with ESMTP id 2E586C001E for ; Wed, 7 Feb 2024 17:41:18 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none ("invalid DKIM record") header.d=soleen.com header.s=google header.b="M/+qSCQM"; spf=none (imf22.hostedemail.com: domain of pasha.tatashin@soleen.com has no SPF policy when checking 209.85.222.177) 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=1707327678; 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=xWt6Kj9gOwsVhKnLqI4ecc+RWbgSNCQCfN6SnKHrmRU=; b=IPApgT5LdTSTyM0wQbx/xO1EIFqxE3DBDoa5utc9gkB0JRDvHCHNgGjtInFyx6dHr1Ej7/ cBqlpZpBzQlbM8ArlQUujC0EKgTj2fA51f5pNa9YD6e354cSJsLeH3japjHdnwxgpPn3Is oh36q61KNbt1glfvEVIrQqaaccHQkBQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707327678; a=rsa-sha256; cv=none; b=3mPFcAlQigMK/ZVzRRHzPeG5UGHBjiWKLMNBgHfBu/GKig7XnS4G2y8u8/oQe5+jlNiWZ0 up9fyjfGB/GJWosB2/2wQ362//c9D9x8QtPqTjpu4B2ODLsTmtnl1fOxuSJkoGyLzO85B6 yIMWlDyKFYl9NaLByohQ3kEYO61wpOI= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none ("invalid DKIM record") header.d=soleen.com header.s=google header.b="M/+qSCQM"; spf=none (imf22.hostedemail.com: domain of pasha.tatashin@soleen.com has no SPF policy when checking 209.85.222.177) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-781753f52afso47877885a.2 for ; Wed, 07 Feb 2024 09:41:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1707327677; x=1707932477; 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=xWt6Kj9gOwsVhKnLqI4ecc+RWbgSNCQCfN6SnKHrmRU=; b=M/+qSCQMSiE03W4wtYFORWD/xOl/gRkFeyyyq5pIdgQKvx0xpn8Hv/GNdkBqLQwEN2 +ceTCw7k+2X0xlFHMVbtLTwP4Cw5GiZMIb6OzrsY+vSthmR9C5kngqPl5Zl+dfpnZ3ut +9FhP7WMAMjfff+lBZZpSksqxUrEt3t+6ejGjTxsl1YIY6YdakOAzRtnUKuKIvW3R9NJ x+iJqH67Ulc6e31YNqqVf/zwXOPNah/fQcZQxkfpjXrXn6/LTrFhnPr5TIlmP/ixk0oj nFJJjDCiC+U/t2BnTCYR/7VvzOWVKywv+NFWPx4o01noLp2Ng+bQ3Dqp5y2siWNAlVAl fSiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707327677; x=1707932477; 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=xWt6Kj9gOwsVhKnLqI4ecc+RWbgSNCQCfN6SnKHrmRU=; b=I7eTKIoLJBiWFMZtYt+4wYc6wkAAOXAgln8lscYCaAAoZe0E4+YutwjjFK6UO9Epdv m4T03dhNmuzyDAX4fZDe2outT7qtSSIO61X8uPeHc5YmHjf8zaLbik2iBHW+cuJEPj/i h+/iwY06B4o83aPv77ANgkR3biMw40kX75YMtLgg9yt8vYK9JmaWHbwRHWFvpRIeR96d PSI0sYgkSY4/CHQhxpXE8WtWsu4+rQ3l3mts22iXC8wNQ9BWXocMWBdmbyOYclEE/r0z oZI07IUsARy59nbu+NTGSqFv3HVnq9/HD1pfjH6Mka2xm2jf8Uk5ZseRbaKnS/L5xB+7 0Ssw== X-Gm-Message-State: AOJu0Yykq9r8TaOxP5NbH8qmjNN4XODBb+wQas/Inew5JQwea2wieS7N hOhrivI3Rs6qENo6mgJT21bixM5bi5I8+83aV6MK6Mb7RWDftKtawkI5xzlqpDg= X-Google-Smtp-Source: AGHT+IHeQy+PfPTf7nBSLMGCvJMntsBufk0Si/3gJdM+srJ22A2iBif8tXuqrNfbof1VrQoYmJ+haw== X-Received: by 2002:a05:620a:24c7:b0:783:4c2b:cd31 with SMTP id m7-20020a05620a24c700b007834c2bcd31mr7624063qkn.44.1707327677315; Wed, 07 Feb 2024 09:41:17 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV07MGvI4Ypo2h445jSLHybue8b/Jl//KnDW5a0waD/mCyzQoo4zwqN1ovns4RyMBF7dWelEXf+y/BMce8UTxxq3OAOyEJdx84aMHu3Xj3LNN0h8+PWnMFEE+z2yOaWBuE59sMW37SvqeY2r+eddvdkbwQQ0visKlJywOwTrMUf8bZCr+C97H8x5rJJN90UubbobWaZA/xY1wS0vWPAquvxEg1hW1l28JQ53ZJx95HU0khGFmoTf79lupjMXxqjmuiNshSoarMoqYJlkOScCqu+AzutOUb3hemyHowzfJt4oQ5vEa1AqDVWJc5qq9GwVhdBQpQ1bjwh/41lfRAoS+zdREj8QtB0yC8Yf3fqjP0bV/AQWGDWDl7AfxCGkqvXaWAi3c0FFJ8LHhlIOPCAfJXSiFfWf6hJY4gnlh1zdcTkDpX5vHjlux7o9mLm8xCEuso7GlAvyaCahljtfdJ3n9He1HG2A1JKk14Dp91svBMy4ACi4YjPBYxU5G6arqfc9Aa9ID46kIFxHAabnsJdGUmoWrSiLJ37J4zqxIFPKteeDOU74RPNvqXXZbrh+kwbVkpkNyZe+ausHvzpbhe53+69z5xvpe5yz9LDtoptdeoq/e95bHyxU06s9O4xJWgegjHXaE/TG9CVzS7e8EQ6S+o3PSzjPJiw2FxqV7XKMv5fNqsaq3ZnMqYOZquy2m+v/zhJILWFJWBJQYb1rEPYtmsadOpw3HuDIXjsc7+VkSguFrWGSWLv8KpJD9KFIRW3LI+MvaImrkmCSzDiSVZ6RDudqEFvZYSmqwS7dR+c9ojQ39rqDcRoUTVPgcq9hYxerx4Zb0hKQlrxZdYZlaeEYtvs70TKIyQjNh/90ivUw0nvVBM979zJloyZT0luhm0T77jolZ/+DUh8NcXLhU99yGpN0jycxaJdWQ/XTPQ3YblLvB/JYpeG6+dinfywPf ndj0evBQ cjwGWfxcAlsvta7HagMoAKkZDmGrKu6IQAXTkfceEaOFQjobeyFL7uPcD9WqPNUuTcinn6O2hVSaDE3sB91Fe25TnZxotHh7OfdDU6pVyT5VjN5xHg8ym4Qy8zTk7FhXznhJubrj5oIYVZd7dTTCR6P0f+WG/aKlC2Uv1CpzhAUn5GH/Bc11h/mtj4gUypoq0KQEevPp5E+tw4JPNQGTKi05iYJiEoXJXGCV167QIg4d8lnRnJM41YFlpwAVduF39jQYyREhtCqzsX9O5lpM4WNzt5CxhwcXH3TL905ZjPt804cwe+TFZc+HM/tZC5gRtjBtVeZb/l/cV0C8UVs2UJsWZqdeH83YNXz6q/p4t7x9MRhw58c7FqTjP4PppYzx7DQGiI/8b7Yz5uKM+/NZUCMppthUMAdoId8salBi+S/s5S9pMfWNkj6O/yEOAkekKT1ezCkB+lRuTIX+hjVWjWA4AxIqA8e/PiDfl4OamSHsHK Received: from soleen.c.googlers.com.com (249.240.85.34.bc.googleusercontent.com. [34.85.240.249]) by smtp.gmail.com with ESMTPSA id e10-20020a37db0a000000b007854018044bsm696310qki.134.2024.02.07.09.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 09:41:16 -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, bagasdotme@gmail.com, mkoutny@suse.com Subject: [PATCH v4 08/10] iommu/tegra-smmu: use page allocation function provided by iommu-pages.h Date: Wed, 7 Feb 2024 17:41:00 +0000 Message-ID: <20240207174102.1486130-9-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog In-Reply-To: <20240207174102.1486130-1-pasha.tatashin@soleen.com> References: <20240207174102.1486130-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2E586C001E X-Rspam-User: X-Stat-Signature: rphhwyj9pw4r1bzxykhtx7pf8zei4t3j X-Rspamd-Server: rspam03 X-HE-Tag: 1707327678-879340 X-HE-Meta: U2FsdGVkX1+Q0uFnraHW+KFc86/yrrnk6X8aiFiMAoX/hpiqBPyzzrEbHND5yQVBp145SJogced9Fwwt0lklUe7o0/Y0jOltKvt4BXna4EY0XbHr1oJ6qfTZYbYlIL/jXZMCWwZI29P7D9ON9n//0S5CftU3LbkHMu5lAmRKejFxLaSaAEcAPz+8KymmLzy+8P59RTWCO9/KT9uCBatuUXJdtS6lIbTwfxNCnkCvtFYiS4a7ILE+Xwnzf13bsEPZkaZfuYaWvSAOBxxbyCRnynbdS6UjKf9HQZCuyORk+CdWfgZl3/bY1l1vbZwlmG0NRQdVFICHDhYZMMGNfbRlRxKiC1embmsA1WjACPEsiwWJdfcOShLiY0NUnbijyl1MyqfeHs046NCymi1gyxQ9lCFk57zzIjbabkCJMlWJ+r+/7qUXSeHdjzg+JUqzjd2R5BZiqxoRVemcOXYaatSI9qUmGx1vuacwkuRC1y3tZTkogI36TPuvoJgBw1BZ7DNqO6qan19xCFIKHSiP5wK+rlzOLgNriM8y/NPLLFqHwq8itfGlzUjFHFU4mv4Tlz1iXk5NWm6WGaOELUj36f1ueNWyDFftk6fYsX1THTPbaydWXnotCY0osinpWPodI2OVkeNyDwzZCbUzcGKOp0uBrc5IgQmitUd3ut1N46LjPnFm27dKJBOnh/lhXVDfcV++gznMLK/xHQy5d0dc+J2+3/f45RS1JuORgv9KhbgkLopdI561KzAieL9a6M86lv5MLaWqGD31Y2WDBMnNUk4nvU2qm1FjuL45mQrRD5PArB+eE9HHiX7X3iupEIboLgG8mRkuFUoCVDDmBv7+bqfhzcxSBRNGEoIGsrOGXL9h9J+7hMLCYcECl5ksyINvenAbnYMrJcEdoVoEofdSSY3PCtBgD7weQR6iqRfVOZ3EhJvsQtfhNtBDMPAL9bpWcfwmRSAPQN0bqmTtXhBLlc7 13OMbBd0 fvBAYyysb4fe4/mGDy6k1qSNmboaQl7E3glPQeqab0T5vTzwYvhdsPSkE0goYkvix2rpg1sncx4tWFyUjJsroam9hd0mDTZ03gK4i/oiN4dHTIIzIQgoLKo2miqMNY/X4WrS8X7OHf4U/XeDwAg+CAa07UrzVjSgw0x6JR2bS0QCIZHg1CT1TgsiL0h3QrKwYavGvcEpcMPxPwQFRWMxd9903sWhnhz1EJqUd+vsGd58DnYunOFgDt6QTTioWP1Sjhd1aWzTz13kWC1gPsFdMVzMxMUHoQ/ATf0FH16jTTrPI7O4+J8c3uqVZWgrCeeHuT4s1R6L0EEZvJMN3YXAO5AdxfTdPlnqRbQePxiB6lF9+a7CroA41FAtp+eG+/VP8dcyfa9I4Ho4wschDNhjnGymxHMg7Pmz9By++IHwOqbjdNK+5+bbPULEZZLQ5OzOdetU73xuWvPLT1/uVRCEB5kV43w== 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 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]; }