From patchwork Thu Feb 22 17:39:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13567725 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 02CDDC54791 for ; Thu, 22 Feb 2024 17:47:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 667146B00A0; Thu, 22 Feb 2024 12:47:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F0156B00A1; Thu, 22 Feb 2024 12:47:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 469336B00A2; Thu, 22 Feb 2024 12:47:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 32B8D6B00A0 for ; Thu, 22 Feb 2024 12:47:49 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F0D9EA1489 for ; Thu, 22 Feb 2024 17:47:48 +0000 (UTC) X-FDA: 81820172616.26.748E58D Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) by imf13.hostedemail.com (Postfix) with ESMTP id 349EC2001A for ; Thu, 22 Feb 2024 17:47:47 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=Q3n+VrnL; spf=pass (imf13.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.161.51 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=1708624067; 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=C9sOCaXXTnuRzyvLt2S+i0eLigQNp6D64P7FATFt28E=; b=vE5uj5jYmQ+5jfc84t+hRXp4We9rzcIJPrcDgYq82xCm0BVTcXl4Ups63jYYguChZbHnN1 LiPv9ZgdeaZg6lDsKXMMRXG/fYBG2m6FKLESjT4NBNoMaBu9WP8tQM9nk+8y6XE0yJcwyX 8dHWyu7hP8qisBx67F/9b8ihHil6BZc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708624067; a=rsa-sha256; cv=none; b=jVQ1QLtxQnpBPQr8oU+2KDHBHb58Dqi9KyyDekkeNcT++s0PXNUNpFlCpCXfzpihucPikJ P12UpsB1BFwUBxARDx2qd8AJdHppM1sUU6e1DF6zJD38N6gHCWEiCDxGG3jomhTyqFJxAR P+4MqmnktyRKiQinWlmylvPkDgIv9D8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=Q3n+VrnL; spf=pass (imf13.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.161.51 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-59fd6684316so35488eaf.0 for ; Thu, 22 Feb 2024 09:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1708624066; x=1709228866; 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=C9sOCaXXTnuRzyvLt2S+i0eLigQNp6D64P7FATFt28E=; b=Q3n+VrnLj5Fwa7Ic1KQnMLOELJSuBOTkr5Nt7qGSj8/BHmJcvO/m0D0TfPZIJnHM9z 1hcYi2mJ2qhTZyQJLY3A0yZMbVPmrKxrG2n1sGR9Kt7lioF7czVUpTs6aPB6PR9gWOH+ UCSfRew4H9LI3UXMROc7S+rVfbA/a6rvbfnayZPvl0ByuSSJfmY84NLFNB/86btUKnVe pKLdHiG+84Ysxg8eokj7KYgkOkGoZBjrLl9EDR1g3UnET7pO/RoIsBzFtCKJxHeiJiUT obVx4tC1kDbjBCRByA/0e0pZL7DhytZEvgbgkf88GiBm9SXlLzuX3P4qXb09ump5Pndm SUFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624066; x=1709228866; 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=C9sOCaXXTnuRzyvLt2S+i0eLigQNp6D64P7FATFt28E=; b=aUBzcEhy0+PC7FzHjiz6AyStfVeFoGWkGraMfbyz6Sv2M4Fu1mKfx2iwjzNUQUIFYx bQ/UbzaOgl9Sjk7BnDJAPYhS/Gi3CSFxdo2I5GsjimkoowHQb5WlalcAjkW1IUgfHNMe +Mdf3/sPsrUpypYL8w6xsJggszJYYVIFmC9csDzc91RtdM6h6CAhwcq2kv0/WvCIYKuY 56HqjfUebbG1qp1RP1ptOCcxHKvHptsSu9QD5BTBHrpdNzOBQLJ+hG8ULd6SwQXUi8P9 TCBO8m4cqdXG4gz0EqubGf0dnMfCDOCmWaa76NUuJCAI0TSb3kWW1eYHmy0eIawh/luO 5YQw== X-Forwarded-Encrypted: i=1; AJvYcCXWJ+07pI+1Y+rnfwVRZALfSTdjDQaZJvOVrJ4pIUCTq4yQ+++ERKd8d7yH7EQQujYddvymNarnKc9JqWYGDyU44s4= X-Gm-Message-State: AOJu0YxvR8NekIdxRxh53QJuzShPOTflDgnARPt677GeH6O2x+JAgNPp 0UGdxnshQLINs4ufDQkrzJ7fsu56P1pCKEgWNi2gwnhyXWdK019I9xt0XbOK21gKmYbpWBQG7pi W X-Google-Smtp-Source: AGHT+IEnNHT8mmpNAC8qGBK3waMn+7XKEftGRHH+gMR5BoK6c8bTMJMeqnbIkBxo5nuTApw4Lzgcmg== X-Received: by 2002:a05:622a:103:b0:42d:b355:1538 with SMTP id u3-20020a05622a010300b0042db3551538mr27425174qtw.55.1708623589605; Thu, 22 Feb 2024 09:39:49 -0800 (PST) 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 f17-20020ac86ed1000000b0042e5ab6f24fsm259682qtv.7.2024.02.22.09.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:39:49 -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 v5 04/11] iommu/io-pgtable-arm: use page allocation function provided by iommu-pages.h Date: Thu, 22 Feb 2024 17:39:30 +0000 Message-ID: <20240222173942.1481394-5-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240222173942.1481394-1-pasha.tatashin@soleen.com> References: <20240222173942.1481394-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 349EC2001A X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: fadxan1e3xsw76o9g7acuh6m7pwcbgoe X-HE-Tag: 1708624067-689955 X-HE-Meta: U2FsdGVkX18jVIBirzJYz5IKSG+gvPKzCdmFap76GMvxOA2WsBFxW+r8edbF+XM1+ZHDl87INlyuBa5Aze4eV8aXOdhSPx9Zsofjl8fso+v8TGKlV4h9FeiGRDVP1rIiaSVkZfaJxS2D5+60Hem6K+hrH+95rr/bp1wLcs0gH1d0Bh4k84gGxnwhHRceG8zYtEHLkb4Mtus01FzLYv5X/6qEHdqeDOycPRrbb4+0ShkvTUonjmq3yjeZoS39rDjqX7uHbUfrVxr77F1OOTqV1Vl2QzDWL/x95MRnohSPvAYtN2KsWaddlVIGm2rUonr4qkd50eW+SKpaHflOJAfiFy5DmtLemS9lkEbZkR46mKIU5QOILxztPctOhNCelgmC17Voe3ls1Yqxdj2i0prkYlWLDtpap/7dmmNKmLD9KgJNL30KRBFSiTCoR9pOYgzfRyGcr26z9LUSQoAAiRSfmteFNuhWll0n1DQr7OlzhvtIPE8qTShaoragTyAoREjn37Oyd90oBcxcCGY51wjr57sOg0WsmQ00FJnJjoShgge+0HXksXfL8Cpq6RgB4DcpdnjeNqc4KK98Q3Lw3RtUVdTeyfeLR0O3EPImNbcgsEP0HNWbknwP+eel+nNGAwJ5IHpKe+RJIdDn3bU5ObsmHS4Wz53+ELW8bbabWP9kuJEKStVZnQpHsrahXs/FmaqqTfJb9213s4vzGZ+eIqy+Csba5I6u/VCDQIaiSdDKYi1o6G+54X+gYhb2T00hhVNgI6f9fVLqSg/zWlok+2u4lGdm2zjztVlT0JJl4XYqIv2UJ1gNb73vdf9neFWfO3W0m+IEdXTE7d1YgsPS/amXYZsELUcfcnVrpcFKY1DMMXwY6K4Q4LNe+LbDT/N7eRSaMdJ1TmyHO77Zhnk2n8gQCISuVbn63j6oAD3/pKqzeY9XwXj4j2J3314sPn2MOH5dpQ92NmCqVK+SCQEC6TH upOmXbdW 66hFsN+dTPEiheh+IdbK9sJPm+NWgDwM7qtPE48K4O/hMvX10XDBCYdSXvUAwSC+TRBI9T6eDcS5LCM521GtHxjxVhqzuL/tKO2CnbFlpVD7xnH4qY9lmHsXypk90Eje0SVa1ZbnQR9RQk1wC2yuAE+/ms0QsC8b/2b3/fkn3U4vnjyLQrZkWcjgo+kRUcej92F1uTnKCAfDFXCSr4jCT3xmicUJR1/8Y0YqWRZAaC616Vo0EL5Edg9rqxPNZGlD5HnElclreKsBg/DO3ZEHXjF/zENqlVLml2+Z7L9uZzlSP7Y1NnqBjwz+/cDfAxcNLoMn0CgJki3D/wq0YHHG9qsbhBkeotJeRRE5+IFEA+qDX48JreDx8W0lIECQMw6FsQ8CiJtzsAJ3XdPj2y7fiz0JPXc+jjOAEBODrQ2zcFO7Cw+Zo3BKrIkfQYEcwhf7PqFJiAgtMqFKMqyKBW0iUnOkaNuOqwjM4T/ux8yfmqXydEvQn40D3cgA0ZLL9Rd/r7zMw+d4Wbe0wyIZnxdv94BH5r2pvGjnvGLlSyzincY19rvacICIc8uvgaRKRzLWOM3pg 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,