From patchwork Thu Feb 22 17:39:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13567704 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 13761C5479F for ; Thu, 22 Feb 2024 17:40:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 415016B008C; Thu, 22 Feb 2024 12:39:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 39FD46B0092; Thu, 22 Feb 2024 12:39:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C9A26B0093; Thu, 22 Feb 2024 12:39:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0AABA6B008C for ; Thu, 22 Feb 2024 12:39:55 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CAF31140AFE for ; Thu, 22 Feb 2024 17:39:54 +0000 (UTC) X-FDA: 81820152708.03.29A33CE Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by imf30.hostedemail.com (Postfix) with ESMTP id 18FCE8001E for ; Thu, 22 Feb 2024 17:39:52 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=XWveh08i; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf30.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.171 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708623593; 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=1VAat8TBDVTapf/cNKrpWJJOpQ7pgkQwxbfklHwcriQ=; b=3ChVGG6s1h/DgX0RtiNyqjR6WY42YzkzBG1TT++5J7WwrTSPYZfrEr324BeOVzzorEMlCP Dsk69tfhTPii4JG/zNfabJgxdeBEUJc/a52FBLGIVw6k1LMsVWM4sfmkSnDMNvBiIZCatx pD2d9JcX1yla+ms8ICHQUp2ba3KTEWE= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=XWveh08i; dmarc=pass (policy=none) header.from=soleen.com; spf=pass (imf30.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.160.171 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708623593; a=rsa-sha256; cv=none; b=KoiWsR3g0/+vRRYhKYjKMTfamYe5UrTRsKlsYwzpRAtIOj+Y+viogySzklGB2sw9Q0hvxc doUriNx5PWYQ27RsMwRzoZ2bOtwJRiJw4d5UeI6Ik5ZSlDpqrt/D4VHZi+lKtQWF8Cv8to d5NAbvwgmjKTS+Ge3t3TMsvwh6GKt/o= Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-42dd6f6518fso26854811cf.1 for ; Thu, 22 Feb 2024 09:39:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1708623592; x=1709228392; 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=1VAat8TBDVTapf/cNKrpWJJOpQ7pgkQwxbfklHwcriQ=; b=XWveh08i3vqu0J/5S3ueHhucF04SqreSTCtlPikHgKJlULyo4KsmbRyhUsfZQ7lFkx B4CaysG95lTK8vqQjd+WrTn9aqwD2F6GzaUgd5m4E2bAuvNAn5bV2mJLR0G4E85kzXm6 s7OkZxh+t5Aslhh+OWXUb9++JxTfJIpkg717C3Zp4rnBhTLl4RAVA7ybRggWAG2k4zmE P6rYCebxvL093bvUO05N2ItBP6LNYNW6j/xs/GZ6QQgTNuw4DU5ghlHCwwm1d6cJQIi+ Pow3JbLN4IMvDtKAU0D2qJ4GrFB5L//OWIeeo+mhP8t7gCxEdfj54CXk+SLazuq6NDIS ey0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708623592; x=1709228392; 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=1VAat8TBDVTapf/cNKrpWJJOpQ7pgkQwxbfklHwcriQ=; b=kZhLta3YczPuh3eLKK28smhuZYip8p27N9Fkg5BYpCTP9Qjc02IVOfPCUIGQ4FovCn WyFFLO9xTDke8CoUb96GlbA9WIwvdyZ1f1A/nWGeWZT+xK5fxeJoV8SfMb0qBJo7EoGg rh8xOe1kDTRk7+XLr7DzfTZetoXSyqadaz/41QJJFPRb0zDr5+5ejMIfcsWTlBcLYQ6W ps/BwiJ6Lxmrmgf1G7nWxpyPYgT/j5DImLPw+hGuV15IZ7uJe/w5E5kxySLIcSyfGt4F VBBDhvThCbYp6zufbZscawFVU5Ea2hSIXi1YnfPEGrVbGzh40ecHdLucZ/dFT28l7vSo ZndA== X-Forwarded-Encrypted: i=1; AJvYcCXaYShIW36iZTwNk3oGeOaahqlZHqwnPPq3oF3ZH0CMCelpyJlfp2Ozc+YQJdQmOVacie0ukw3+oi36JuqZ2b1Q4+M= X-Gm-Message-State: AOJu0Yxuj7h5H53ZZlFJRoauG5KEl0Xk16/6hRSWjrqmQfsb3f0fa/Ts D+WPpuDTPg2EsEq41X5Z2MzCFP6rqWQqs5AximxM6GkBzOOosdoNQl2sRGmYi8w= X-Google-Smtp-Source: AGHT+IHz4D/tAkiJUKSEKYTo9KdtwALGRXWZMTTOk9WSdUZLPjcPPGovrQbnMAx6QcYLnGz/9iyYUQ== X-Received: by 2002:ac8:5f4c:0:b0:42c:7b12:70eb with SMTP id y12-20020ac85f4c000000b0042c7b1270ebmr25812453qta.3.1708623592225; Thu, 22 Feb 2024 09:39:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:39:51 -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 07/11] iommu/rockchip: use page allocation function provided by iommu-pages.h Date: Thu, 22 Feb 2024 17:39:33 +0000 Message-ID: <20240222173942.1481394-8-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-Rspam-User: X-Stat-Signature: opjagpt65q7fwnq8ey8b7kcdwc3coo1u X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 18FCE8001E X-HE-Tag: 1708623592-283530 X-HE-Meta: U2FsdGVkX18RxXUAgQ+2geOt09qmHIzMm8FYqSqBv2k5naAlCwITYHLr91ErakFjbkUSORZa6rhgwlSpe9cKJxeCbZDXOKub5SeNk3cr5vhO3epxREhY+WB1A/+/D7IiGb4NOe4uuKAY7tjTubtH6Xyx/bXSnU9nuu8ZmC+RhtFZxHiNNJ7LU/1fWJGRypE9WVV6va5T48k0oSpqKBE6lXOtoKGoRuFooFJIqzc8JQ//B3wsQUYTXpCunEes7nx0tySaABZordgp8dTAcNP5+t5DTKb00AdAasuTbdVMbULk9LCFLLHm6S7GJpZOpRfAIre7/Lv1VHJSk8FZZCA8+DMw0Cd0cal6sqCfuWBkDch1d2tB4bIi+mWovywHSeHu4TlLApa8FiFDXVyfDZq9VANIPQ8fyVjVkaxMZlpQrL/nrilDIHi4w7H5IRF7juvaiQhSQ9XwoBO3NY2Xj2t/NNe6XiLze5iB52LZhHJUeob8YNbWrqAKym3vDNNgKShVPzlutkWCyOa9D4NV04hKGQ6xAYE+7V0ofXXuKX/xhz1yuwpIk2QAgUV39Fwh1AcepmVhEh7Vx5dn7DZYHHV62M8ITYv7ljbkX1AcD2ltfbHnnqRcigzRLj/OiSqUnHhF2O6FZ7yMN3+Vm8+aQGt+00u4dTJl9nxZewG3xK2UFVaeCLJfaAoLQUOK4RJzn6oTPrSnt/IvCUYHvj4KEjX/YDdy9BeIkKhxTb5jdklIM/+xlDxjF5NZeQf8jsgI8U5i1j0I3ydbgHR7Mufp2rcyvuzzuJOvGA0lGAOg5LD3sF49X7v6536drlGBefFJUU9mgRimG124i4tyZyPRBjfwokIY/DMa/IRn8vu2tFFuqQbqlqfB2/3iCX1vCl7jQ3RBRV3bp4hGlUIMEsA3R3lGQqK39QgQG7SoZfRBrwh6EIwPaWKyIMs1r8QeaHo/vg5qGFSFhGTCr1kUg6n6CZ0 6l4yKyVD 8kKw5CAM2oxB5yZzZfTo5XGUhjhgOXC8suf4b0+M+SRNw1i8rQA1sjhGfeYal58UQEld2/vH7Uo3eujN/YX4O5cieSi/YfX50fln/0cYyMEcOWrf4v/paAU+8+RlZHHLY3oIEPtZgQ2ttoUdp0sh6N0naWHH22Yux6UDd8JYiG0gJ8NPq3SMtl0jzIIkk+Oj0z4PDjr/K6AbczSdTKAolvhKV64efhij8YR9eFiiI1jQOpzcte1UEtcjnf+pNRkj1Sk8r+f1DhOvvSzcL1wp7hrVTl7/rudfeNAnaRoGgrYAZTj4hGfV0Ks2XBxRiwndBL8z8jNb/jb6bQMX+chNQtPOJLWzb9tqwbiP5P0kvrXHmaLGM40HLFXO2Xp/rZ6fgdrlEyDf7cYcjqYdP8dmTeUL5/xA8DjogBzqN4sctyLyeUF4D5Y89rqzAqv31FMmLBMDCTdf/TslL3EbFrvA2z9Xkvq4inBZyz5xhi0cKJbPwjfXTwmBh4nEHz9xu4f7pYWkO/4LepHe9pup0fdvTpqAQVaSk15fVCrJmm6dx96g46z3jWZiKWQaf8KBqkhWEGNRt 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/rockchip-iommu.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/rockchip-iommu.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 2685861c0a12..e04f22d481d0 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -26,6 +26,8 @@ #include #include +#include "iommu-pages.h" + /** MMU register offsets */ #define RK_MMU_DTE_ADDR 0x00 /* Directory table address */ #define RK_MMU_STATUS 0x04 @@ -727,14 +729,14 @@ static u32 *rk_dte_get_page_table(struct rk_iommu_domain *rk_domain, if (rk_dte_is_pt_valid(dte)) goto done; - page_table = (u32 *)get_zeroed_page(GFP_ATOMIC | rk_ops->gfp_flags); + page_table = iommu_alloc_page(GFP_ATOMIC | rk_ops->gfp_flags); if (!page_table) return ERR_PTR(-ENOMEM); pt_dma = dma_map_single(dma_dev, page_table, SPAGE_SIZE, DMA_TO_DEVICE); if (dma_mapping_error(dma_dev, pt_dma)) { dev_err(dma_dev, "DMA mapping error while allocating page table\n"); - free_page((unsigned long)page_table); + iommu_free_page(page_table); return ERR_PTR(-ENOMEM); } @@ -1061,7 +1063,7 @@ static struct iommu_domain *rk_iommu_domain_alloc_paging(struct device *dev) * Each level1 (dt) and level2 (pt) table has 1024 4-byte entries. * Allocate one 4 KiB page for each table. */ - rk_domain->dt = (u32 *)get_zeroed_page(GFP_KERNEL | rk_ops->gfp_flags); + rk_domain->dt = iommu_alloc_page(GFP_KERNEL | rk_ops->gfp_flags); if (!rk_domain->dt) goto err_free_domain; @@ -1083,7 +1085,7 @@ static struct iommu_domain *rk_iommu_domain_alloc_paging(struct device *dev) return &rk_domain->domain; err_free_dt: - free_page((unsigned long)rk_domain->dt); + iommu_free_page(rk_domain->dt); err_free_domain: kfree(rk_domain); @@ -1104,13 +1106,13 @@ static void rk_iommu_domain_free(struct iommu_domain *domain) u32 *page_table = phys_to_virt(pt_phys); dma_unmap_single(dma_dev, pt_phys, SPAGE_SIZE, DMA_TO_DEVICE); - free_page((unsigned long)page_table); + iommu_free_page(page_table); } } dma_unmap_single(dma_dev, rk_domain->dt_dma, SPAGE_SIZE, DMA_TO_DEVICE); - free_page((unsigned long)rk_domain->dt); + iommu_free_page(rk_domain->dt); kfree(rk_domain); }