Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2999935rdb; Tue, 26 Dec 2023 12:07:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IECyqdSB0wTOWvooJpojcMhzN/WlPV2wFKV8f6WheqVNgTPLncB6n8UxBrWv6TY/S3Gv6lO X-Received: by 2002:aa7:8d59:0:b0:6d9:8d11:5692 with SMTP id s25-20020aa78d59000000b006d98d115692mr6870413pfe.45.1703621236225; Tue, 26 Dec 2023 12:07:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703621236; cv=none; d=google.com; s=arc-20160816; b=T7x5IWUk+GlJrEYWHKewpbFhKeG99Px5/ddks8+2b1VEc59X9T/TzQOBAwMU9yhND2 C/0jjLVzCPphkYDXNQsV/b43Acg2IIEWlnOT3KLc84OrzbHAdjNcDU6JBl1Rwo3bcFyO n72/KRC91rAaOkEiRjci9G3kXP37REOO3ea4qdb4PB4qYopEt1gsi97Kl/0VK2Gvy4Iz 7C9U/XRzXGUx3x4gztHJnVjEgXIUso78/jrmykWep4EqtNYvmU7SPFFy9xrbCB5k9pnS h8hfXi1wiIU8s1lrKSDTNe9OgQwDpqB34bJ6g0buTl7Ky6hvjLY2+hungQeoHBROTwDY nL0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=4Px5z3jJNMJ+cqkQJ8fykFQGitjbal7TFA82XDDTiIs=; fh=lUkiT048LCyG2kYH3uS9GPNyu6fkGQdYtFXGdyQ4NZk=; b=QalfGCQF0PxZmGo6dY/i7VvzK/v1sApscWr3nVejfwn45RSZRtfdSHXeKob+OQKbHw K9ps3UCg5i8NJwV1rkixpfpCn+Ai1qWaM8BEXYq+Dg3Yu18E0Zw0uaPe6uqgcPXns97r iC0Q2yM5706IL0NXMlElJLZfpkpdMDWzTHyFo0essVL/TLaHcWxGY8OHQFFRtjKHbPA4 rT3a5ninfEF+xWuUb26D75CA7BCbUlpSc2jIUhp0SA8nZz1wzU3SeDRFQ5r/qTyqY1zP J3pEPkgWq0eT0kfUId9ucewYQXY3cy+nl0bb8/xc9CBMXGHTBUpJnWeyK6SW3g7rWJuq 8u3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=Te9G1ay1; spf=pass (google.com: domain of linux-kernel+bounces-11673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11673-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k196-20020a6284cd000000b006d990146f11si7183469pfd.316.2023.12.26.12.07.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 12:07:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=Te9G1ay1; spf=pass (google.com: domain of linux-kernel+bounces-11673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11673-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A21B2B2214B for ; Tue, 26 Dec 2023 20:06:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EC7418C19; Tue, 26 Dec 2023 20:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="Te9G1ay1" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6CDB101DE for ; Tue, 26 Dec 2023 20:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-594cac3cbaeso188052eaf.1 for ; Tue, 26 Dec 2023 12:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1703620934; x=1704225734; darn=vger.kernel.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=4Px5z3jJNMJ+cqkQJ8fykFQGitjbal7TFA82XDDTiIs=; b=Te9G1ay1sgVaCjpLw2BIug2C1a+spbwdzBBR/7jKkU3EL5vkqT4FtxRfjW3tSGLPtF 4oOdA4Q3dY1h/RwHDkfwdQkMvJVMzOpUPx8wQ62xxefCr4I41QVUeDyRAnFX65GZJ2eL 3URjLIVPwTLr+RGe4C1Ec8QmF6TvJKROKcEYfcHOk57GR/yw8C22IZQVjfHSUk9f37L0 hi8OT6s3QZqBJyS5LEqnSCQwHc/124sA/pYKXGBJAMFYbO8iVbzJGMFgXM1AdwI4He4K xbd9YXdcGmnRYpEGBCDYmGgkb0YFP9/u0GzeF5+aPQx4/n6Kc4klvLMmlvQeAm5Sy4q3 Z1ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703620934; x=1704225734; 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=4Px5z3jJNMJ+cqkQJ8fykFQGitjbal7TFA82XDDTiIs=; b=I96qZAm1H59L38h0duzIb8AF8UB2L7QK6uxVbjl3KYjIu2zBQPRp4vI2smMCjDBGQW 7B8+uboelx+G6vyn86EPshIFec3zfvHDjm2/L9CeA4R4fjSu5Yov5f+WyUtuAnFkj0Wp MGgBv/MbKOKvM5PqIbIuVy0OCiQ+bFedmoyXoEKypi/bu4FhLfxl7/GkrZFSCMmqyFOS 6IqK7jg+5SEk5IGr0rfmtBRrqvjZFJb37mTguHSiO0Cqcq2O8uETBrFwabx7CX3WSitX ARlDD2oVlQwTPOXT3pmD3u8ADZvfBM51KZQUlUVqTc2dVHvmO4EMr+siI1jrkO3PVh+2 V6Qw== X-Gm-Message-State: AOJu0YzyJGRJtisNwFb+f15A6aqp5SWKoI2KIK8EUGqVX/TMiKowDF8S P4+0zH4DRtnBJbLfQJOehkWwn9pHTuuJNA== X-Received: by 2002:a05:6358:70c4:b0:174:edbf:a9a2 with SMTP id h4-20020a05635870c400b00174edbfa9a2mr2577495rwh.48.1703620933708; Tue, 26 Dec 2023 12:02:13 -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 t5-20020a0cf985000000b0067f696f412esm4894539qvn.112.2023.12.26.12.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 12:02:13 -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 Subject: [PATCH v3 06/10] iommu/rockchip: use page allocation function provided by iommu-pages.h Date: Tue, 26 Dec 2023 20:02:01 +0000 Message-ID: <20231226200205.562565-7-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20231226200205.562565-1-pasha.tatashin@soleen.com> References: <20231226200205.562565-1-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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); } -- 2.43.0.472.g3155946c3a-goog