From patchwork Wed Feb 7 17:40:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13548806 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 6FDD7C4828D for ; Wed, 7 Feb 2024 17:41:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1116D6B0081; Wed, 7 Feb 2024 12:41:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EA246B0082; Wed, 7 Feb 2024 12:41:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2F396B0083; Wed, 7 Feb 2024 12:41:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D48326B0081 for ; Wed, 7 Feb 2024 12:41:17 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AABCE140E43 for ; Wed, 7 Feb 2024 17:41:17 +0000 (UTC) X-FDA: 81765724194.27.6DC5357 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by imf03.hostedemail.com (Postfix) with ESMTP id D0D9720016 for ; Wed, 7 Feb 2024 17:41:15 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none ("invalid DKIM record") header.d=soleen.com header.s=google header.b=We+0Jrm+; spf=none (imf03.hostedemail.com: domain of pasha.tatashin@soleen.com has no SPF policy when checking 209.85.222.172) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707327675; a=rsa-sha256; cv=none; b=WCgX8GYNjYQXJOadj8/8db/5OYn6jd+zKB1ffjDcJzmKjTBHhVqpHQmH7a3aHAYRtf78zh kownvWA5CRbgMQeMufb/5trL4Kj7h6livw6J5ALg7S3J+MYUkg2Jag7cg39WVxqBIoWGJo 7NBCdb/2Xw+eH9a5apSXXG2p2yc8txo= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none ("invalid DKIM record") header.d=soleen.com header.s=google header.b=We+0Jrm+; spf=none (imf03.hostedemail.com: domain of pasha.tatashin@soleen.com has no SPF policy when checking 209.85.222.172) 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=1707327675; 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=Xz6G05O4wA+60kCmvmgiGx9JBrU5EV4e3uvGda8jyEo=; b=SBDgqebDx2lwtiSJQKcYV6+j83195S5h60JohS6q0wCz94zYi+HTrARl2FhIGE7/VyarH4 KAf5BMsio5eXMXpmn9+gtFwcOXwIMe7zzFA0qX4rYKbGzG6BluYFxlwIcSdP3Yr6QvxwJh inlvUVOQP9KTZHzonBS+dCap9YoKuwY= Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-783da26489aso54123285a.3 for ; Wed, 07 Feb 2024 09:41:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1707327675; x=1707932475; 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=Xz6G05O4wA+60kCmvmgiGx9JBrU5EV4e3uvGda8jyEo=; b=We+0Jrm+t+1jGzO/l+kBnBb1thE3wQ0RcHAwL2Fc8GX+WICSA35ZlKEbgUVwf33U1P pf9AB6uwk31uPcpwRtWjNv2ILHqv4yqeQ1bZwCJ4fZXqlPlIkqV93VQ/9vH746l2z0yu DqxwSKtUbikXtEQQUVHC8V91/yd71o2QLAviqtqlVSlR5cwKiEQMXcieEO36angync8+ QbWrlROpLf083CRKXjLTM2HDqE6pfVdxKr7pfgAfHCqZZj/maQRqEavARFMVExQE6OOb cBJoHL8GKAipPASQMScKpj09hwTbkZc7lbsOX2YHr7hb1xjNtgpJP23qvUn4fHGeruc9 5xnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707327675; x=1707932475; 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=Xz6G05O4wA+60kCmvmgiGx9JBrU5EV4e3uvGda8jyEo=; b=MjA8Bf14B118YEkVbHQJ3tqKC2n0NnbbWHHzAFJxU9JetGM2HU7j2wKBWnfnkNZuOF 2AVkTKoblzlhYrbiRAviNdus0gU8lzr615oXDZQCbHtYLCU3lmPr9pndtppayPq18kto RViSoqEKz1LmXNIZuKc7URWvKL1nTyra1ngJ98UgwefJx1fZ/FEg31SDSN9sR35L+kqc x9a8x0UtQGZ48AktCm75K5AKV++89sJ4uXRyjWF5ONb29JmEr9iRpRKMVab8DksjdCvj KgR2EVW07/1lg3eV9cO++NXnyX1VVPBX79noxFD9HbvfG6BeB59tUS3B3Gf2QiNZ1JZV gZ4A== X-Forwarded-Encrypted: i=1; AJvYcCXVSXwj8Ijdqd3zrVe9q5nxItdDMSMCirR+jhwxGyrWbKZNvvXkBF4cY0zi7whqNmwzvz77JBggOBAbz5y8Jc6wVTs= X-Gm-Message-State: AOJu0YyCyaKWd3P7M/T6kcR3n3Sackuix1WJ3ksVCpxCnPAk3vWFD5qf dFR4+tAZp6DJYkppZs64U7XjfJcooUodXzAKeAhJUL1vQsOimw5zDZUIzydRja0= X-Google-Smtp-Source: AGHT+IGm7HEOEjYyU6ceEAyCJbj5ZSiZHtVoT/GGu/ljbSy4K2SHMHGE1ZU+Mc3GOvN+MGgdJxPt7Q== X-Received: by 2002:a05:620a:458f:b0:783:c945:f774 with SMTP id bp15-20020a05620a458f00b00783c945f774mr7801189qkb.16.1707327674945; Wed, 07 Feb 2024 09:41:14 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVrjHWstAmPKNKmmOZss+LrnMGoMozP5bewBJMtBvsxnSH4qAA9cpPi1oYJJyh0BUiRXx8vEuPicCaLWIj7WkRsbPVXs5pF2kWy9iUO8oTShW2B8fsnkt7jYBRZir8Fz5+c72ScE95t4q5LHZ9pZO7lVdBZaewRpE/NRTtfPSseusbUyGGDy6h+O4ovY7nXnFPIJ86SUz3Dtek5Hgc7y2J+Z+WTwUQs9aZpp8P8Z9mAsQP7dpGv5qpZgJJc+KhJ+3YbNawEbDn6BoSaBFcWYvC2iawUphmoa955poBq4d8NK0bieLstlnhd0+F4aMp03PTWFtKgeeGN5BNwOh+yuYSDzJGEgx+Q5FLBw8GUMq8ADEBNdGsxltHxrZkxkDb2Xzr59XaH5uUTXdxZtdNzyKd/WvxprwrkKL/Y0V496ab8itUl+7v63ZAXPuiao/r15D99xjNwwYyQ8MaIZMWx5oBm0W4viPnDezsxhm1S6ldjOX2GYSvbBKZjZKgO8JfaqW7YgAadHrhnWydYP7q897L26rp4R+PTyEyDm1Ttr1BvzrEkF14wY7DMd4cE9vnRmgyMpc9MIV1AS8Yeol//B7sedMHGx9YUlhHmMld6IvICVHr9cPlSBhKJhEgP95TiG37l5tWnPBTjqAnvQXaQ3/ssibX8uYPmb2YjK65W4/kv6al+yX4cpi8g1qWOJc/jWs0DVzguf/yN9hfoKE+C5iMFHsXGhQa+lvEGly3VLu8DY96oAirk3p7ee+Vr4Nq1Eem+lyudfRY8QGxu3vMiiocWWsFzPg+N0ka5b3Ss0zDaGpOtLPitRJvp9TSELiK4t5+VNOo5T7rOmnLnYkmtovz4hQgWWiD7cFKVpP8pPPeuXJf+RIb459I54+kbjtiIBSnxktVzV12pdR/i32lYdnVpfsSTS2IeyOGtJQzkFdR4D+1gKDfQFxHWHeFI5z ESLmyLNW Ao7b6FgzEQATp9gXBFjnlk2upisqGrCNtgs4ViYBAYCn9VIpKTTVJx8QL1GCc6lwCUdWzqqZUFQlS3tf8uWIjDjC6W1SRrYk4pE1Y7e8reWeyw9aF+as40OW4Ezw8RGpi0muxi4Y1aZNhTeh56EfSELm+bOXEfcS787PLN7zzTynHNy2FN+1NnoUfBaolqV9bj4KixvnEsdzHzOZstfc5xGz2ZLCGLAhOGO7jdNWScuTX7NExkhEbv3PnLl9I73PUAjg+brm+juf8r9qQgk+jmy4lk6xDFQ7ssb2ubfZ9vQvNU2uJBgWMc4JqfaH5NW72z05Ap4JDXNghrCFVpeYufB7XyHzfwtAT+J8ApXxOu9QYjpzOWKVDxbi68ugpqpPv65NucRhhZdFJ9QHW8MZrIvjX6h2JEqzGbspJ+yissL6+wfnzJmBK8zVJlAOnxnmzfF5TCDMHoHoER7Lr1dMpSAzmj0/EAtm4Af6trtfEIkamc 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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 09:41:14 -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 06/10] iommu/rockchip: use page allocation function provided by iommu-pages.h Date: Wed, 7 Feb 2024 17:40:58 +0000 Message-ID: <20240207174102.1486130-7-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-Server: rspam08 X-Rspamd-Queue-Id: D0D9720016 X-Stat-Signature: ogb1h8oogcmp6hsq3q3yfkamptre8wew X-Rspam-User: X-HE-Tag: 1707327675-980076 X-HE-Meta: U2FsdGVkX1+960ZFiAu3vkkbD4yVaWSrsaTGBHLnie6rWtZWeu3epVTCYcRliTZYK2P55bTf30851zyrYNcyqnh8pO0U2k2sEONEJTKDJkeHmM7xoyUUpNQ5cnuPa7VQJgxatNhCePtvRHi2CV85QNVFnPcONIxfxe9lUMdF2tXpbTuPHgT5V9TIHCWJGEQKZyunvGqgK6AcHo8B9JYpNw/UDPWnp85+tqNpxgqSuB2U3OkDXZAKB8ONe3lEprXMMmntsGgQOP1ukTzReHMYhbXivsYAwbf+TVNT3jv9Iv+s2uWNQ6+BbXkCPuWRVPlGjDh/fK/pC1k28iL8aVVg0OsL8kGaDgwaoXJYUXLEsZMgAf6ZBILFgSyAKRbl1nZayW5ZBJJ0+Y5gRIXnZ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-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); }