From patchwork Tue Nov 28 20:49:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13471787 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 8583FC07E98 for ; Tue, 28 Nov 2023 20:49:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E0906B0356; Tue, 28 Nov 2023 15:49:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 06F626B0357; Tue, 28 Nov 2023 15:49:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD3D06B0358; Tue, 28 Nov 2023 15:49:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C83C46B0356 for ; Tue, 28 Nov 2023 15:49:48 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A54C1160354 for ; Tue, 28 Nov 2023 20:49:48 +0000 (UTC) X-FDA: 81508554456.12.A3408B2 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by imf28.hostedemail.com (Postfix) with ESMTP id D88ACC000F for ; Tue, 28 Nov 2023 20:49:46 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=Rl1tGf8+; spf=pass (imf28.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.47 as permitted sender) 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=1701204586; 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=EfTMP0IEjMSODjtdYrx10bu5wkmZdOPfzS7HMIYgctc=; b=IokSi+a8z8+s3aiOLvxrLabUh4BxeGy87xom1zHLxYsDV6wAEs0L4Aok5Gx+GUy0jEVXVF MPaTXuG8JwC48OQvDUmP5iEUzR0Uwe2X1azvLT2oGsUrsv9B7kAP2klTCFeQD9YgR+penO V7J42nK3biqPh5HSfW3fudO2Ql8A5hE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701204586; a=rsa-sha256; cv=none; b=D7An4iDj1cZte7F8P8gSxi6/41ES6yxgL9EgJSdMvcamdghP4YhmSufEKUrOThoc3QUE7A IG1TtnW7AqUdStgYV+AG1vga9L0xWcU0AF1Kkhnl4KV80QzF5R+TSouGpOpX3Ug16xCzM9 Skx1/O13tU3A7ZhcjhI9Omu/9s60Eig= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=Rl1tGf8+; spf=pass (imf28.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.47 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-67a51ad638eso1805756d6.0 for ; Tue, 28 Nov 2023 12:49:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1701204586; x=1701809386; 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=EfTMP0IEjMSODjtdYrx10bu5wkmZdOPfzS7HMIYgctc=; b=Rl1tGf8+HGYqKd+Q7QSeH0LDMgOB5jSe9mKF8hSa0Q0FVDHsKVTTSBx0DFK6E3NEoX WYEMeYyHd+mVfMwi/6ez8RqIbnBiJwcDvFn0/JqHqsAxf7+ecbKvlHh4TLi+fO7sVUzr e7xwOt41erYgfoMyTNLZPidpZeFxdwxxk/O2y85dNBqQ6XQWCvS6JjImCj8x/u1fEqp2 AFLeCUN4Hi4bKjtpagImXvtmO+lLh99BIGvsjVRadjeb8KpAtHoqYsskE81fQ4Y0nLnh kp65rIixua8v6gTgSRguTsm7fVr+kQaynH+G+A0FMtd1pIjLuhY33J8gghqLNY2bJC0e eZ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701204586; x=1701809386; 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=EfTMP0IEjMSODjtdYrx10bu5wkmZdOPfzS7HMIYgctc=; b=wTkfNgTfEjZJVnLVjv1OSa2hEOUV/GeywvPt0OXBjzPI7iC+fo+m46YcxMfephlgHF x3gOJKTVUZ7m7iis+ediiGfSnI5XUmfgK1aglf15XdSbLbO/4z0uUIgfu4kJ+T1KEEio KOytpZObJYDWx9r66gYdRgrtElO3TjZoxNQvXnkPIn6FQNsn92XCX5SzrkkABWmad/Ia BaTpT6hA+gEORtF0qnZy5J32PrWxDXLFMJ30VDUjED0mGDzrqo9CbKdUzPOVZdDj1bB4 AG2NCWqVDgxcd63wOITjnwh3Z+DFMXUIXisfkFw8rNuF4pIprHZjEGx9HnmA1UQ7TOmh 8Wgg== X-Gm-Message-State: AOJu0YyJFgYBGOoTObKfYt+n9aOWA1RyK8+i3ZZVHqcSVSjvHCJq1c14 Av5lGK+OcRB5nYGWMNIzjogg/g== X-Google-Smtp-Source: AGHT+IEKeO0ndku7kDd+vg89Kzhd+WrQKp5SmuH7bGrf2GIbl4sfu3JTwF6Gf3JxLicYu9UrEBSdGQ== X-Received: by 2002:a05:6214:1c0b:b0:67a:4546:9895 with SMTP id u11-20020a0562141c0b00b0067a45469895mr14672255qvc.12.1701204585983; Tue, 28 Nov 2023 12:49:45 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 12:49:45 -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 05/16] iommu/io-pgtable-arm-v7s: use page allocation function provided by iommu-pages.h Date: Tue, 28 Nov 2023 20:49:27 +0000 Message-ID: <20231128204938.1453583-6-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-Stat-Signature: h1e549yx6da8oiwbgm5fq3zkdj58y8nx X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: D88ACC000F X-Rspam-User: X-HE-Tag: 1701204586-760493 X-HE-Meta: U2FsdGVkX18TYlfi6YsB7MDtlO4xcx+NqILiuTzm1UUI7Ls3SB61A1+r0B3GKKkF6t9D62bnvs9tyC3te3MSpd1l6Ik1cd5mMESZfoN6c+6uBMG6Heqo1X/g1OVdJ+scX+nsns2owqNWsY6xjp9JQ97b4WX9QgzHzuF+yGlGTzBN+AXaWc7PVHz31IX+Ttonzcm3sIJE0ulXLEh5ONc/M+ycVHwZMq+wVswFb+Vbyiy3LgkEuFs3TFanQQVrbXQ+HguTsdX+6CuQw9h0i5UreOOx5fa+NZ+z9V3h8xWD9RphzQU/lK127CksPZiqxRLX1CQ0oxtyJhWPQrkqqI3rinRHnwgHdBb+bO896OuKOp3UrzWOynJceXNh8ANSGQLPt1raOf/XdhprR+uKDCiBnTPJeWZo+ja/eWm34Y60z1XYLct1/oJlACdY6x7Y079SQRLNL+y5eMNwLy6j6q8x4hNVPX8HNQx7HIhXa703L+UTZACuF5VcT3NeBOCB/1yke8W9R2LcEVeT1HyuO7ncy0oHjIXwGa1oBeFJeMaqMiIBopSvVkKuVOL8/OHUBlHkthvODYg0Yy5aOJlu5X274iEYIqfMEQN3jEggu4+YEaSFkYzvi9IKXZxilSJmisz7LHNhRH+xjDSl+aT7NQgX+zplphVLZK8M/GL+kiU5tnQUq2bL97NYSVC9MZ5ntJk1EIyGrwr2lUWDKfMKgMXT+IJwrRjwjFCuoLwDO1Mon9f8o8EjMam6703A7Z0vSLGEgmYxXiCPT1l0EjZB4ieAaQLWyKfK83p1ExpzqnPtO1EALVmRcCPgD4Si/da1z9Ii6VuRapGCmCQ5ySvRJ+s/fzQbxFN0wdlgXhjv42qc+dsNwTSZ/t7g9XIQ8MguZLCiKPr/9FCEVQ982xKikkIUUe8/io3mcZCo5aDSYVvFkuAqULZuddhvtuB2ZEjHNUdzUZTR55Uj+4hLgGtpIkj S+XRyX/D Eek3jUawegNi2n1kecvDex1ZLZaFXUBnXgAh4dVSL0FmP0mfiLVedIup3a59dypiNb5euJM6wpQi1mnq9J0e24mTxZmDPTTDABRlOlQBqXlahLUATdDeLQuO9M33DHHfKPRoePGWhbgRZti8AkUv6cWvO8eBO13j7jY4DoSk8VW2irr6WQZLCyQZXwphHpv4vOGH68OUrp+fmSeyiZ9C3RyC42EV5tYUGK74pDMgHeFiYw//sLdeLwyPIYtVTNVmX4hGoEvIKi9C84icoGFaNYJBxEaR2CAXaaB2K+mjBXBw6DDBtUytCDGCeX9HANucESp4HN7erCeYwBZwKSZuEB8XCxeQSW56CPtyf3u7v0yvhNg6jv1UGKeOYnckXtSGwpecoN6gFTUw97i801RpFRhgQ0bHOadMZBLPz6gmfVDaJ6avX777D+wpsdlcRe6/CKNW0 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-v7s.c to use the new page allocation functions provided in iommu-pages.h. Signed-off-by: Pasha Tatashin --- drivers/iommu/io-pgtable-arm-v7s.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index 75f244a3e12d..3d494ca1f671 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -34,6 +34,7 @@ #include #include +#include "iommu-pages.h" /* Struct accessors */ #define io_pgtable_to_data(x) \ @@ -255,7 +256,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, GFP_KERNEL : ARM_V7S_TABLE_GFP_DMA; if (lvl == 1) - table = (void *)__get_free_pages(gfp_l1 | __GFP_ZERO, get_order(size)); + table = iommu_alloc_pages(gfp_l1, get_order(size)); else if (lvl == 2) table = kmem_cache_zalloc(data->l2_tables, gfp); @@ -283,6 +284,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, } if (lvl == 2) kmemleak_ignore(table); + return table; out_unmap: @@ -290,7 +292,7 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, dma_unmap_single(dev, dma, size, DMA_TO_DEVICE); out_free: if (lvl == 1) - free_pages((unsigned long)table, get_order(size)); + iommu_free_pages(table, get_order(size)); else kmem_cache_free(data->l2_tables, table); return NULL; @@ -306,8 +308,9 @@ static void __arm_v7s_free_table(void *table, int lvl, if (!cfg->coherent_walk) dma_unmap_single(dev, __arm_v7s_dma_addr(table), size, DMA_TO_DEVICE); + if (lvl == 1) - free_pages((unsigned long)table, get_order(size)); + iommu_free_pages(table, get_order(size)); else kmem_cache_free(data->l2_tables, table); }