From patchwork Thu Nov 30 20:15:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13475018 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 84E6DC46CA0 for ; Thu, 30 Nov 2023 20:15:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9550F6B049E; Thu, 30 Nov 2023 15:15:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9040F6B049F; Thu, 30 Nov 2023 15:15:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77F616B04A0; Thu, 30 Nov 2023 15:15:16 -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 607496B049E for ; Thu, 30 Nov 2023 15:15:16 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3BF311C032E for ; Thu, 30 Nov 2023 20:15:16 +0000 (UTC) X-FDA: 81515725032.24.6DAE9B1 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by imf20.hostedemail.com (Postfix) with ESMTP id 6480E1C0015 for ; Thu, 30 Nov 2023 20:15:14 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=a+ShOfy9; dmarc=none; spf=pass (imf20.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.47 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=1701375314; 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=8aM4P70fu6Mpyhz2ZxBL57luN308AqDDoR+bdvrzfCU=; b=nwTSEeycNxioJWGO5Ou5xVdZRKMeZ12rBzqY8SI5wB4AfBiIkPhg79BskK/RWXN/oaTztW wcaiN5Ii27JanaVbKTWmRRhXRvA7KlpKfN3UV4Ptt98qUTht9hlh7F2YfYYfriaUN2GY1G EyuBMWu+ZaDLogHJ9LbWZ5KEqUd0rJA= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=soleen.com header.s=google header.b=a+ShOfy9; dmarc=none; spf=pass (imf20.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.47 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701375314; a=rsa-sha256; cv=none; b=hMHJawtGUdHsX2IdKq6FlopqszYz6MqIC6Qvhlb+zvTrmxpMIgnUxoucXmePOCdALVX3ot Aj5sGpeGf5j6xK9H4qL2X/TAIfKE3ffb4j8jJ2HPwt7Wx2qXLni0KB7fJCQ/sCkO/Xqu0o u+ye6g8Fn05zDmQ9MnHmjNzE9AtK2SM= Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-67a18556e4aso8197266d6.1 for ; Thu, 30 Nov 2023 12:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1701375313; x=1701980113; 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=8aM4P70fu6Mpyhz2ZxBL57luN308AqDDoR+bdvrzfCU=; b=a+ShOfy9Zgy1ghxCh1Mn4vvjMwqxes6xmMt4WRdvx+/oKN1Rq1yKcXXVdx3rFJCLk3 D179YAooTiEF3Y6DDYa1HMJVA6fWg0sI2Ktl/eKShqxQGnAU/XVbB+nEOtxXj92WdDzX scuUuwE28povZCL0cERGVB2fOLsJamENmqTQhQsfqY62TxolGsfGL60JHXUC7HKCe+Rh 6ljTM0fR6p87BA2UVLpO9339DO3Q5bB5QpgAPE995coEuGsLCIkPAMkHPco5hPoK282x 5vszonJgMCpOnInU3sUJRTHNO27JHnROrxtnQbGNcCsT1HDWY/KCCayRfKs0/gJS+++t QgOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701375313; x=1701980113; 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=8aM4P70fu6Mpyhz2ZxBL57luN308AqDDoR+bdvrzfCU=; b=XFp1soORCcv5QsFhEJ/e892gsMGgbFj9TT8l7LKBsTnVgQRnuhPZqgysJKdd/87Abv cOemI+WEDTt92PlJv0qPpHUPB15Nc/G3Uff4NsvUEM8xAb1a3I/vp0sySH0E5yuGSB6A 7I8Dr4P70j7gc0vgePcOXNonNewYxWOP/6EAb1CEYercaF6eyqw3PeQ2UZByCqG7asEb YN6QII9cAnZFjIXBsszLl2Ef//ko8zueftL2Oks70LwNwqlCYVvbokUxDPUa1J+UO9FF bjgZFFyxKmgzrkXSOuWflsJtyujnQK1/IiEgFjbt7D1KIbM/vHPREO0GHN6h6DXQO2C0 gwAA== X-Gm-Message-State: AOJu0YwoIeUp+oLpZOwgCwULAH1MmzCT/oimoQMgeJFWHUKlUXTBRWBJ WekcbUY9mqa5wWHweqDh52lX6A== X-Google-Smtp-Source: AGHT+IEBs6D/FyJYqfxI4mL3iV1h7OCPfLZXSrKHIqLtLdmOiu4XOIwm8bZeJ7cSdUFCvrQdbklyMg== X-Received: by 2002:a05:6214:5294:b0:67a:255c:c43f with SMTP id kj20-20020a056214529400b0067a255cc43fmr20595303qvb.18.1701375313540; Thu, 30 Nov 2023 12:15: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 e1-20020a0cb441000000b0067a35608186sm795252qvf.28.2023.11.30.12.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 12:15: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 Subject: [PATCH v2 06/10] iommu/rockchip: use page allocation function provided by iommu-pages.h Date: Thu, 30 Nov 2023 20:15:00 +0000 Message-ID: <20231130201504.2322355-7-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog In-Reply-To: <20231130201504.2322355-1-pasha.tatashin@soleen.com> References: <20231130201504.2322355-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd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aupZ+ j0red82OyvW/bRRRx6JenfkDtSPE+Ogai59kHhP7cf0k65i8h3N084cHeLmbT4wEw6wM3j8jwog9AP/5/wW/qMYmaVV6OfH4t1R1O6yOXFeGxTDiG4xzNHYNs4yTiAYJK2K+aSJ9QWF13gaCjY8x8o5G4OAVqvXH/fPW6bk/VFKKzBI9bXL1G4N5sFyWLAkM+Vj7sRrfjP0eXwVYnwza3a9BfCAY8XitLVve/BdmoYSdlPuJXKjxAYJK0n6n8UWeL5Fh4kMYejbGABJwlCft0US3OXjskJcKKC0p30mZkia6hPzA8N+T6+ab5W9h+8Ipz9MLV9DnkQdAISNil/paU5aJY58XKWPfcNI8DsZQIeaXtHQI= 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 --- 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); }