From patchwork Wed Feb 7 17:40:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13548803 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 74267C4829C for ; Wed, 7 Feb 2024 17:41:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61AE06B0078; Wed, 7 Feb 2024 12:41:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CBB16B007D; Wed, 7 Feb 2024 12:41:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 421036B007E; Wed, 7 Feb 2024 12:41:13 -0500 (EST) 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 2F0FB6B0078 for ; Wed, 7 Feb 2024 12:41:13 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0215AA067B for ; Wed, 7 Feb 2024 17:41:12 +0000 (UTC) X-FDA: 81765724026.15.AF901E0 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by imf01.hostedemail.com (Postfix) with ESMTP id F1E5340011 for ; Wed, 7 Feb 2024 17:41:10 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none ("invalid DKIM record") header.d=soleen.com header.s=google header.b=Dmh+7nCP; dmarc=none; spf=none (imf01.hostedemail.com: domain of pasha.tatashin@soleen.com has no SPF policy when checking 209.85.222.182) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707327671; 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=0JA+g9MenvDAdiHbGDRChMbxLGZk1W2zcwaqv2KKBmE=; b=zFmwrGSw7WCIQLNdbeOvqcgLNdBd/rGsWj0wagUguYpwnuNvYw3I+s7bd/7/+nUk3rgALX bDrNkrTAGtAxlfLVoWgxx3ER1dR7kdZoAUWCjNBWxzhJUasv32bs0vVMZXTBOjFvwhFtBZ zC7JCl8mpA7IRe9efSeHZbqJRHodC/0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none ("invalid DKIM record") header.d=soleen.com header.s=google header.b=Dmh+7nCP; dmarc=none; spf=none (imf01.hostedemail.com: domain of pasha.tatashin@soleen.com has no SPF policy when checking 209.85.222.182) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707327671; a=rsa-sha256; cv=none; b=ImTHt3L4I3SjMXRK9DBr9tHnqD8Wv4NK59Eu1umyvrZcGgW2Xb//q8CK7Huuf/dd2ZA7wN pjDblVWioqRZZOrZdCJnXmguCE4tTfgZKvanhvh2lsP19FalAhLm91ppBvWy+Vt6xkqZc9 L5uYGU8d+JP3/Yw1ifmutFLPHCkvJyA= Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-783045e88a6so59383385a.0 for ; Wed, 07 Feb 2024 09:41:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1707327670; x=1707932470; 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=0JA+g9MenvDAdiHbGDRChMbxLGZk1W2zcwaqv2KKBmE=; b=Dmh+7nCPmrPKDRa2OH9C/nnsqM4R8TxEi3hVDZ6sFdLv6X7IBmx8D8L2nsGibURyOS 5EyQpyxQQjwFGVv56lhDWoJJPalmyVlX3bowTCHUAQ7r9stqqJ5BixZOYvC61+xKlLNO HlRpn7gfbr32NnApjIvgJAYG4lhvHvuc5Wnr3hFif2Xnfq2/olXnMxD44PikFWTKmrpU T9OZj6FKcPcWffRk/h597ffpsjj3tODya9Xqxuu+UmMhTBgEQx5j6QpkVyYgK/HJHFyE 9/YJCUyXxLthwLPHR8OfN75sFfa/Av1VsR+EuMpztuPd+pS+Pexs3qvmIeN67UmR8sNt oq3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707327670; x=1707932470; 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=0JA+g9MenvDAdiHbGDRChMbxLGZk1W2zcwaqv2KKBmE=; b=AbmZHeb5oqgFDs57X9hm/ulRFeZSRkrlukeekqob5+pCW1M0GlActHUBnTcuZD2auW PFHBgTVPvqqIod5T6GkcH8JXeRrbu1cClguah5XOIrKgo7R+DQJr7ArkA0pI/0fLcF5c lzI9ZxNOZ7SStKtFjfP55nLybqB7o56mJP46D6GQ5W9/TUZ1DZ/ysa5LflhNeXIViyTa SxqKMtJMVHMIakCrfbTd2NTupVhUklWBwhDSUw57l8Zbq8r8V867/W40TrAGjC8HtOmd lxJAD5VdOLLvjlVay4mIQJ1mZmR9juEm/cOf4cldTGNbFYHT1v+DlNZRbw5KJZsaqKf4 3GZg== X-Forwarded-Encrypted: i=1; AJvYcCXeVgRjd25gUd9+g7OSFNMr52SL28f2NXqX5ODp1TjEVTI+QToX6MFYr07szb+zD3AwRbUouCXQdVsOnCziP/+TBg0= X-Gm-Message-State: AOJu0YxlF6hI4USOX7KY0jTIm/eiG7at/l3kjQbiS7sqVSoUx4TP4ynO TTvEnOwNPLpZjxNsTXlVKKOfUsR0H1lyjmgBrjhnKXQwBsdlhUzwPlshFHn35LA= X-Google-Smtp-Source: AGHT+IElGFXh4B0vtRDxKd8uklPl89u5PGWF33uvo1vT3Tprks3bAAOetfH+2TcFICeRh6m1eJF/jA== X-Received: by 2002:a05:620a:4393:b0:785:98ab:8898 with SMTP id a19-20020a05620a439300b0078598ab8898mr3650487qkp.18.1707327670170; Wed, 07 Feb 2024 09:41:10 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXnOhFQK//OwjZNKUHINcQcq4GudU6s8Wsutjl75lKOf6D9RWh4FLHgsOUIKofDqbNFRfWgV/NHq4wMqswC5boWbx8uBB3eLjdPPJEDG+JpokbKJ24prVlsZCvz1bJ8lArrWCc2ovwEGlsvxtG2iwKNu+/Trrg2V6q2NVi2AnFBisRh30T4uHYT71AYbFR4RAaBrB9DJfu9gBgqW67xCIrBebLJHhdBt6iemjDFphM1ze+qyCJ3SfW7rnvQ5VN6LILBv5D3M7D7p6BESzx5yvv9tZ5MPENSw4Yf9hiA8/mM0hyJirPFR3Xlk2WeN4BnK0oM+unwGSpufCd27SfWadz7626HL/nyFqCDcbVwRo8suAZcfP7aVH3ftKhXi6Q8gEh19xp+lm04M8pJOSbegy3UzRzuOw3uqCPHO7d8Ej+iytbJKsDI2UXVT9eAbbYyddf8AnjZLxS1cT8BWSLa6QB/OJDMNI7YrAQ3ZRoUeEb7ZtVTnV0VjJOOJ6Q7tLPMt8I93o5ADXBUFTOS9Z9dIxPsD7pylm5o6N1CCII9ENXJ6rarWAvN+lCwGz8ANG5TOcZPgc2iBQK9wElVV3Q0nKQCa4keQlJZlBGxROG/lIjqXc8OZkfJELUKKlOCYFqJwdG3iUsNbOyS5cfUAg2cD9YpKt2ZAVtvZ9RW1/CCho7S2eD9vihzafV7l7B+GY27RkKonMQEbqUHIdBr25L/ZVWDF/B20M96ndDH/iNnjt1cg/U80ydG5MX4tEA4YoPWEnJkF4/BKzDpEGuIWseeppB1JFzf4HUfSuRm/JSL/kw+l0fYUTI1X4A5KLT8AAhJEptMUaFu18pKAwXNBHVI4MJTHWXC6vB/NP8WjoxON8R4WP1Ffpw01ZL8E75NGkzZcgJmptCJQrPFWgJ/dJ8JHS5Rh+kHTNTYJL6Scxh+h3vshyVNyKXHTwab2M6eST 2kOzCUNQ +Zy4XD7JcdygwKNsFqhHYU9f4qLik9Wt+jJXdBCmW00mbGJQLSbt3auPkpzgZCWxdDiUkyWmSy2erf5ZmNoCCvTODBILMexUleg+8Zh/lUkX0mcQ2a3MEsLeys6KUqvNvWS18JlWOiJw7TALOzXDz3BxJS9qCWzgIT7MpIfbZLqPPjvO1RwhcvaMoGpFJABn52u1L64O87/jK116UWlhgXqQ0Xvme+jQrcJnwQxdgnLFl1NuOU9EBjTG0MLF2Zs9CkGuzI9VfaEAw6FFDPBRx/3kRTFC+HLR/teJ9sN6aRXkgugBq3eJQbqTGhWa6RM01Mqk6tgSJO978N5R3lGHqQkt5pjjpX5hqYiMYIyWldRmjRI1ZqkL3m60FfU2mFBF+CA91okBT0Jdtj/YeL/cJRGUvYR6Uqz6L3ShLyC2UepAwEUE9xgfVRs8EEJx2MJn6QdFO8I493pkNddkbzt8GpT4eFRrro01q41ZILmvRYLx0l 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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 09:41:09 -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 03/10] iommu/io-pgtable-arm: use page allocation function provided by iommu-pages.h Date: Wed, 7 Feb 2024 17:40:55 +0000 Message-ID: <20240207174102.1486130-4-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: F1E5340011 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: bwz95rmw6wu691perrpkrrgzpyr5jjjo X-HE-Tag: 1707327670-412358 X-HE-Meta: U2FsdGVkX19RFBXcd5h17KWPLDsMAFtLN68fybNp1ILU/5/t0YiL7BACcPPSPI1GvTsH1cVDWq09pKOctTBsLFuqbFYR0ovVodkOPKqQYGlX/jc5hsOd/DmIQc65CsR4aHfNPqxqzj8UwVAb6Gl9LC2tXuYc1uVLh8ztBPVeqdq1ZMLQxWWxKUx9M0Cfp5BbMipezTgDGAzwDQ/JLU9AymDxg02bbOBlhIEvw8IEpdAzDjDVWQaAjQANlix/suVgLSEOqktTPCv2Abn2BvcQb25PVvzu8PkBzvEQB6CqrQ4lVcJILEMIQTeJFJFu5owe0jdxHhThGHDxukPMPx5R+P18jQC9MzCynknM2xN7qYsDXDk9p4naEA1z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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,