From patchwork Sat Apr 13 00:25:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13628392 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 19C6FC00A94 for ; Sat, 13 Apr 2024 00:25:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6E096B0096; Fri, 12 Apr 2024 20:25:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B21506B0098; Fri, 12 Apr 2024 20:25:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9724D6B0099; Fri, 12 Apr 2024 20:25:32 -0400 (EDT) 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 75DAA6B0096 for ; Fri, 12 Apr 2024 20:25:32 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 412CD120FA7 for ; Sat, 13 Apr 2024 00:25:32 +0000 (UTC) X-FDA: 82002614904.19.74EF7F9 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) by imf07.hostedemail.com (Postfix) with ESMTP id A23E240003 for ; Sat, 13 Apr 2024 00:25:30 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=lxghCS30; spf=pass (imf07.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.45 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712967930; a=rsa-sha256; cv=none; b=xxtp9PcrbuaSug21yt9F+rfqujH1upvG62EBNq5i9wW7JoCkG2IJcFV52rPPKKAomjXMbP R9IZ/tQFTirU4lvZUDBlRetw0lQVjhZ0OwXGzetAI2YKcNa60aI4LiGNNW4S1GXsBDeado bBFDLJ8DvAcApKSfioQZCrjjf9wA8NM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=lxghCS30; spf=pass (imf07.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.45 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712967930; 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=8/4w+T4tucdgPG/H173cldAS0HyQQ6sjlO97Kz+1k94=; b=5ktK7OImjluwPN3cuI9RwcwfFXhnWYVOY4NBZhwIw9ITcCdSoC/kR6imfgmh91Gwr9Cz9H EKDh6N4KbYfjDsFRIrbz0b3/71IX27i4qJZiRYkGma4ihU/HGs9f3JX93qAEwEv0/+0NWA 8dfReWfQxbibg1hQE0QN6EO/3ZGsisI= Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-233f389a61eso356024fac.3 for ; Fri, 12 Apr 2024 17:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1712967929; x=1713572729; 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=8/4w+T4tucdgPG/H173cldAS0HyQQ6sjlO97Kz+1k94=; b=lxghCS30yGQUUy4mqwMothErQKLnzUfC+hIR9sPIZcMGQnbVZ1XJCH+8GBRrrxX8m3 Q5L9WN0yJTgMBn2/BltfPmo8+oYxzgY8kJDe9HJd0uqvDoNJceRtl/4MXXX7j4mR+jbx sx8vS/sGLxE3Rel7NKmcddpySseEAlKgZ95yzAe6TK1JGa1xPYeTi5pM7ItoJavsOFx1 LqWyjr/L4bU4Tc7fIhkmT6aBeJPxPCpRLZTw0B71OeocYQn/WIfgJHWwMq/gYGA/5ex3 THgp8qljHm8do1924TpBGe0d7FjfkRtVFbQQLZ0eHlXrRolLH/080ZRsj2vj8tmjBR+L YsTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712967929; x=1713572729; 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=8/4w+T4tucdgPG/H173cldAS0HyQQ6sjlO97Kz+1k94=; b=o1JzLSZNtUuQcV1lujSsh4SWOFI8kLUbpe4916Z8SOo7DUcRitKunT9s68NYW0leQo oKP9zIDlCo0p4kWdNzRtAhsNaglWkURkbBok59VfACd5ziO/0kZjVowIlzuHlYL5iQlt Sy9IQytbjaw7R0RBnPGgfJrThhd3TxPJY958ZHDz6JkrFWotgYkcRMChHSUO0u+nZltv iHa6jUSiRS9886UW9NwSaAa0qhDV+w6NlMhPMVuKU9TCMiy9OrueNJKqvlWiSme57TE/ MLObsTCJfsCyCm8jYFlLsRL6UmE939Abf9M51rous7c/0q/PrKycUosimjDcU9YSUm9H bzEw== X-Forwarded-Encrypted: i=1; AJvYcCV4VZ5I0gu7BJi7/mEoMjn4l5Og628uwEf7fSR8raBr138SXdjqWrejDISqu0vkb87iqmp4oZ3IDGDwnHRud7mCJas= X-Gm-Message-State: AOJu0YyPioFVQmX93leUTaFFd2jSLQGxwz2vti+n+FI+ULyZRQWGDkfi aDAThlUBTjIiRuqWlqZDtRPPdwh3zUgrNSpU2QJdTDz6e0s2Yr8G460tmzKdxxI= X-Google-Smtp-Source: AGHT+IGQ8QPk+98rhr31FfHy1KfwN56vAk+9hMwwlY09C3v6VEVpJ5zGBKiShhcihkczGu9koLGDjQ== X-Received: by 2002:a05:6870:2254:b0:22e:8ba0:921f with SMTP id j20-20020a056870225400b0022e8ba0921fmr4264166oaf.52.1712967929611; Fri, 12 Apr 2024 17:25:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 17:25:28 -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 04/11] iommu/io-pgtable-arm: use page allocation function provided by iommu-pages.h Date: Sat, 13 Apr 2024 00:25:15 +0000 Message-ID: <20240413002522.1101315-5-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-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A23E240003 X-Stat-Signature: ihf8yyqk4t7eobedao9gasjeery598cg X-Rspam-User: X-HE-Tag: 1712967930-779653 X-HE-Meta: U2FsdGVkX18JR9qy40wgBQm+5jVaVjL8uilBa+JXUFbcp+sZcNBDnrJyCWIpf5FvKzGkDY75JyIJzpHX3k091mBlWyqy5zppvW8cLSviBDlLlh4mdH4YSSpZu9uV6bTmwIq1D/rK4SkyMMt7FE7GoTz9iHaWP6vUHaUHUBP6byreeUp5KHak6reauf8rkmLDz/N5GXNdj7Ck6qo37+rR9iEpRpPL5PrcbfbIEH0l6cCUtgDcEM8kNDQmWWHf4bTBqmAKk4zVKy1uScn6hFNLEd8KhCPfFO35JEaA70+r0gDF2Do9B9XAJBkdAIk+wagFLt5TC18rF/QbAPwSgKPXNln/GoS77Xpwd1dvUODwsdIfBaChfkUVulD0usvwapXLqrSz0x/I/AJQdtBJQdeHHTGKaLAAWmBAw5yufxdexjAjNnDXA509wTmV8w1EGuxSJiYGxt3flZ66FxIWc6lVsMrdkaSHtkQXYf5eErIzsl+jtpa+PMa2qbUJrEkfQ4hCN3G+KteF0ixRYKlL+1kf31Z/3CiY5Wx2Ul+tjyUZZWG9CzqUQ2/pvtMkp6yT8NFH+6Eo3szz3yOCmKKVPv5H+wuesvrHGisUMO8fwsUMrxLyEXcvEx7XdG2iKgHBnw9mPDcz0UCynecoJV+ritNjTcL8r6IxPeBDpxflg4vzIXTV5VmSzqvtHGMG4Qokpw8hAmFP1hxllUiRVV32A+7AuWjXXjDF8q1so2H1GL8/bnKS73E9luNmBnQ3CuIsKc19aKG2VcASaDNFrVYW0hlmGWhnk8mR5IrdAL76QuWsDz5HeB6r48H9gBjxJOWKM0M/WD38e0hrtHUw20orHNXdfDw3ZbVvMIab2vHBbFlYX/tCQZow/Eh/QB1Lqnfrcst1KWov/NuR3Ku7JDDu5EPOMUULSglKplMcDRZE4vv3WhqTVgsmI7+tJiU2J6vFO3GJmxtTXnlTAId246RGEcp 3z5yY+Eg KWyl1M3TBKXfe/s71oObCqkuWip5xR5dKCWiuc5i2q4K1n5Nv3sY9E5svd7AOTqagEWnUbVlMQD6F44vVSgkK7u5njUqzryvRxbNLo2Z1UHviJMNg4u2xiUp3woLncOvls3RrzyhnRt2TuQY2CgiJA1neKMcowl7vti7RT/UF2HOZBJIoQbM3JoIof1LekPsKW6ipy/QEBF5W0St8Go4DBKlCgSOlNXIZKQuO2pPdE8xdfH4HvYwjf89xfw== 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/io-pgtable-arm.c to use the new page allocation functions provided in iommu-pages.h. Signed-off-by: Pasha Tatashin Acked-by: David Rientjes Tested-by: Bagas Sanjaya --- drivers/iommu/io-pgtable-arm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index f7828a7aad41..3d23b924cec1 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -21,6 +21,7 @@ #include #include "io-pgtable-arm.h" +#include "iommu-pages.h" #define ARM_LPAE_MAX_ADDR_BITS 52 #define ARM_LPAE_S2_MAX_CONCAT_PAGES 16 @@ -198,14 +199,10 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp, VM_BUG_ON((gfp & __GFP_HIGHMEM)); - if (cfg->alloc) { + if (cfg->alloc) pages = cfg->alloc(cookie, size, gfp); - } else { - struct page *p; - - p = alloc_pages_node(dev_to_node(dev), gfp | __GFP_ZERO, order); - pages = p ? page_address(p) : NULL; - } + else + pages = iommu_alloc_pages_node(dev_to_node(dev), gfp, order); if (!pages) return NULL; @@ -233,7 +230,7 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp, if (cfg->free) cfg->free(cookie, pages, size); else - free_pages((unsigned long)pages, order); + iommu_free_pages(pages, order); return NULL; } @@ -249,7 +246,7 @@ static void __arm_lpae_free_pages(void *pages, size_t size, if (cfg->free) cfg->free(cookie, pages, size); else - free_pages((unsigned long)pages, get_order(size)); + iommu_free_pages(pages, get_order(size)); } static void __arm_lpae_sync_pte(arm_lpae_iopte *ptep, int num_entries,