From patchwork Thu Jun 15 20:10:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13281711 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD0D4EB64D9 for ; Thu, 15 Jun 2023 20:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1z3ENaZMAgPWrWUxTfPqZ3wMFlbQZBoZUhz/QLrzjUw=; b=Oho8vxXHxO+B+XRM0OyoRHuTuD pZqkPIIAiLdnoz2tjm4GStnXGRm537XnydqhgO3m1MXREg3hBakPMAvjuJPTX5Nf5wpNBvv1GtKI7 WkWBwXLj5hXaIxCjqwp2UoabaUOpW/3LIXW0YSRqIjucH+7XbQLjxhUvORbHaecVt5r1zHIbzJsFP 6iw4rgKToAnxxpyEe0xiRyannBGy5H2y59KgMEAMWNEau3bpWXNdXex+MTBnfmlz3D/HT9auf8N78 X9yHZwtOZB5+hzVmbnmF3+rtr4vyl4w4L44GWwmOd07oI9EIazOre6D2NJmYWHprChg19zgwydVHb c0PQmqQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9tJJ-00Fzc4-0T; Thu, 15 Jun 2023 20:11:13 +0000 Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9tIx-00FzP9-21 for linux-arm-kernel@lists.infradead.org; Thu, 15 Jun 2023 20:10:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=InoMtFPn0qTi9rWJ9dL8ZNuMI6SUv/MQcYAVE6/OKuo=; b=HiCP8luTDml4dCPktTvI4G2UlOh2JqkOCf/aGXztdfKU9pDKYRW1eYvbwGA77RClrwUq ALcRzlSdAjaPwSy12HtHnldT3u/ghdJxx8AVijFBmON6CitofS5IIg7T6xmDyCL9r8mkYu Pn31l4ZYbpCyYAuAjOtSgiIJN/+HHf9XwCoLUOJJrkMwkO3KKAIKmdl2Qq0X7c8PnkPNEX EeSiTxErTQHQW384TL3a/ErkaCV3oCRTFsTRw9DEepQHGT6MwvTCaRveHm1JBEjtURvBfm hKsrYjTBfjHGnjzSrfnZVxqNmPSVEmMiTMVwrX81/HPVVZMCn0HNbhG71JEU7dTw== Received: by filterdrecv-84b96456cb-bvsrh with SMTP id filterdrecv-84b96456cb-bvsrh-1-648B7046-1F 2023-06-15 20:10:46.550315811 +0000 UTC m=+3097935.073942733 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id iwNkUP0QQjuksV59p23YJg Thu, 15 Jun 2023 20:10:46.259 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v2 1/3] iommu: rockchip: Fix discovery table address encoding Date: Thu, 15 Jun 2023 20:10:46 +0000 (UTC) Message-Id: <20230615201042.2291867-2-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615201042.2291867-1-jonas@kwiboo.se> References: <20230615201042.2291867-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h2WrMIoUX2Eyj8rSFyVoSoz7tVbeJqQR7WFNCHUyheNyk/bPq147L39vx2smspVWTq7LOi9K7FyO33CWUW1L7UjvkPFH4PzSLYGRNfdXRAuVRhLxKlBgI2kNfpgTGzDw0o5ZhF+r4EKIza4nk4nX51vE+0yS7SJwD7pVm/GZVMIRxkBWI5lkp4ZjZrEfZADcqA== To: Joerg Roedel , Will Deacon , Robin Murphy , Heiko Stuebner , Benjamin Gaignard Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman , Joerg Roedel X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230615_131051_793330_51019EA4 X-CRM114-Status: GOOD ( 14.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The address to the discovery table is currently encoded using the following bit layout. 31:12 - Address bit 31:0 11: 4 - Address bit 39:32 This is also the bit layout used by the vendor kernel. However, testing has shown that addresses to the discovery/page tables and memory pages are all encoded using the same bit layout. IOMMU v1: 31:12 - Address bit 31:0 IOMMU v2: 31:12 - Address bit 31:0 11: 8 - Address bit 35:32 7: 4 - Address bit 39:36 Change to use the mk_dtentries ops to encode the discovery table address correctly. Also update the bit layout comment for the page address. These changes render the dte_addr_phys and dma_addr_dte ops unused and will be removed in a following patch. Fixes: 227014b33f62 ("iommu: rockchip: Add internal ops to handle variants") Signed-off-by: Jonas Karlman --- v2: - replace currently with correctly in commit message drivers/iommu/rockchip-iommu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 4054030c3237..d46319f77e5c 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -278,8 +278,8 @@ static u32 rk_mk_pte(phys_addr_t page, int prot) /* * In v2: * 31:12 - Page address bit 31:0 - * 11:9 - Page address bit 34:32 - * 8:4 - Page address bit 39:35 + * 11: 8 - Page address bit 35:32 + * 7: 4 - Page address bit 39:36 * 3 - Security * 2 - Writable * 1 - Readable @@ -577,7 +577,7 @@ static void log_iova(struct rk_iommu *iommu, int index, dma_addr_t iova) page_offset = rk_iova_page_offset(iova); mmu_dte_addr = rk_iommu_read(base, RK_MMU_DTE_ADDR); - mmu_dte_addr_phys = rk_ops->dte_addr_phys(mmu_dte_addr); + mmu_dte_addr_phys = rk_ops->pt_address(mmu_dte_addr); dte_addr_phys = mmu_dte_addr_phys + (4 * dte_index); dte_addr = phys_to_virt(dte_addr_phys); @@ -967,7 +967,7 @@ static int rk_iommu_enable(struct rk_iommu *iommu) for (i = 0; i < iommu->num_mmu; i++) { rk_iommu_write(iommu->bases[i], RK_MMU_DTE_ADDR, - rk_ops->dma_addr_dte(rk_domain->dt_dma)); + rk_ops->mk_dtentries(rk_domain->dt_dma)); rk_iommu_base_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE); rk_iommu_write(iommu->bases[i], RK_MMU_INT_MASK, RK_MMU_IRQ_MASK); } From patchwork Thu Jun 15 20:10:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13281708 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6D58EB64DA for ; Thu, 15 Jun 2023 20:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ZG+F9V3PFT74AUkEA3KdIw4gGoNWwuTg+nlrgfgjzZI=; b=DUTu4qCBOplcspqriUhg/iyS+R sD05ziCQCzG/NoZSUp9DhH9GxzwM4ry5H2ME5pJTS8LO0QHCH2oNHFgCXpEKXSNcFY9KJq2wHZkOL Ob2JmTWZKJl5QBe5yAhUUJTVGy1H5waVyzUAipG0f8PjFU7/fMiIDvYAT68ow1AAysQ+9cQoW3CWM XJ4J+xPHYkbXGE20V1x3gzzH9bx3VlTCWYgPh6qppXbiTTRGIMeEBVUHPGzmuOZeiQLAjqhJQHaFB BzvT4POh68ys+k2TWbS3N6IPhAEXIreXP5LBKw5Mj4t9uGaq0yVTws9TsaeSFL5Y7RIfhnrB+4Yn3 iPQ/bCuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9tJ3-00FzUn-16; Thu, 15 Jun 2023 20:10:57 +0000 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9tIx-00FzPL-0O for linux-arm-kernel@lists.infradead.org; Thu, 15 Jun 2023 20:10:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=Jo6WrxNEBvFGf7AFwmeZPUW/JDvN4uXBntOmSb9t0Xw=; b=UJJk/i2kqv2+FgNaiQ7osSjPGFyvg+xx90znS7A6WMqpEnFj0gnvj33JNOjwqfmjCZoI tSLxmZqwcsQKATSs6fM4Gps9ufnOKMUjlhXvEDSoWroLpX/rE1PWMnXqRlUb8XbXb0MgLF ibIF8AKNo2ZVEmVCK9SaYEib/6zYEyPutujJQ6JxhTZgZU4f4DVgstiAX6+v4ke3IAVvYX jkbxngwRNbkcrAxNCy26C4VTpKJKETu3TDec6VksvJbNLTZ8k+IaeqCMkusynPGdCvjFts DyBy4hJZT+mhIHF/WSKbH+OfwXp+4NDboY5ZJ8WFOTs+XDyMYuDiBeHPL8Y5Hzwg== Received: by filterdrecv-77869f68cc-lcgp6 with SMTP id filterdrecv-77869f68cc-lcgp6-1-648B7047-29 2023-06-15 20:10:47.655923269 +0000 UTC m=+3098089.849329708 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id HeBgvyqzQEmrDPru8i_iZw Thu, 15 Jun 2023 20:10:47.460 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v2 2/3] iommu: rockchip: Remove unused variant ops Date: Thu, 15 Jun 2023 20:10:47 +0000 (UTC) Message-Id: <20230615201042.2291867-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615201042.2291867-1-jonas@kwiboo.se> References: <20230615201042.2291867-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0hw3PhMXq4dBde3yCzR1jfjYCf+7fd8HHpQWrb68EQHPtq89X0VUIvV9yqtrQo51l3wTBwoWjkkPMRshT5iwndBQe0F9tDVqPdw1fcJGD6TMECOyYiYKsLsmOBCRWiyrREtBBQC3Yfzs9gR1DRSHQP/BonfeOXcnoDi5sdoBsgrdOYDuwMXnza1O3TXj8Z70EOQ== To: Joerg Roedel , Will Deacon , Robin Murphy , Heiko Stuebner Cc: Benjamin Gaignard , iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230615_131051_350386_FB40E135 X-CRM114-Status: UNSURE ( 9.88 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The dte_addr_phys and dma_addr_dte ops is now unused by the driver, let's remove them. Signed-off-by: Jonas Karlman --- v2: - no change drivers/iommu/rockchip-iommu.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index d46319f77e5c..62be9bf42390 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -98,8 +98,6 @@ struct rk_iommu_ops { phys_addr_t (*pt_address)(u32 dte); u32 (*mk_dtentries)(dma_addr_t pt_dma); u32 (*mk_ptentries)(phys_addr_t page, int prot); - phys_addr_t (*dte_addr_phys)(u32 addr); - u32 (*dma_addr_dte)(dma_addr_t dt_dma); u64 dma_bit_mask; }; @@ -531,33 +529,6 @@ static int rk_iommu_force_reset(struct rk_iommu *iommu) return 0; } -static inline phys_addr_t rk_dte_addr_phys(u32 addr) -{ - return (phys_addr_t)addr; -} - -static inline u32 rk_dma_addr_dte(dma_addr_t dt_dma) -{ - return dt_dma; -} - -#define DT_HI_MASK GENMASK_ULL(39, 32) -#define DTE_BASE_HI_MASK GENMASK(11, 4) -#define DT_SHIFT 28 - -static inline phys_addr_t rk_dte_addr_phys_v2(u32 addr) -{ - u64 addr64 = addr; - return (phys_addr_t)(addr64 & RK_DTE_PT_ADDRESS_MASK) | - ((addr64 & DTE_BASE_HI_MASK) << DT_SHIFT); -} - -static inline u32 rk_dma_addr_dte_v2(dma_addr_t dt_dma) -{ - return (dt_dma & RK_DTE_PT_ADDRESS_MASK) | - ((dt_dma & DT_HI_MASK) >> DT_SHIFT); -} - static void log_iova(struct rk_iommu *iommu, int index, dma_addr_t iova) { void __iomem *base = iommu->bases[index]; @@ -1405,8 +1376,6 @@ static struct rk_iommu_ops iommu_data_ops_v1 = { .pt_address = &rk_dte_pt_address, .mk_dtentries = &rk_mk_dte, .mk_ptentries = &rk_mk_pte, - .dte_addr_phys = &rk_dte_addr_phys, - .dma_addr_dte = &rk_dma_addr_dte, .dma_bit_mask = DMA_BIT_MASK(32), }; @@ -1414,8 +1383,6 @@ static struct rk_iommu_ops iommu_data_ops_v2 = { .pt_address = &rk_dte_pt_address_v2, .mk_dtentries = &rk_mk_dte_v2, .mk_ptentries = &rk_mk_pte_v2, - .dte_addr_phys = &rk_dte_addr_phys_v2, - .dma_addr_dte = &rk_dma_addr_dte_v2, .dma_bit_mask = DMA_BIT_MASK(40), }; From patchwork Thu Jun 15 20:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13281709 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4EE7EB64DA for ; Thu, 15 Jun 2023 20:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=jSYKriZGeUKIrdbC3t6bWN3YCdjC4vhyLNs3ZjZSDVg=; b=3nRqZ6kY9xBsruh2akz4zB5fBk w7J5fyDPC6mEo1qjBGivphf9nzjgCWW9aWhibsbjizk9xXUIyhHp8OAhlw7092I+mctDMcX7tgGX4 D57lq5fpnJTNclpV5rnxMuTrfLMG9XK6v1gEt679YdDHOsxOhNQl2Ltt3ltwUHMMgRxU06Gq5oPix WjksmyvCm5TWGFtzRwA4jdJewboo6WNGtf9wGl8sELn/evZTXilzxIqtAU88QSu3ugT/iEfiHxXKC DT/2JaouwWN1Et3Nj68cCxuLVW+HUBhuz67/hCf5j6W6yIiWXUqbOxsFpF2Ol3fkCcNYKSh6kSFj4 oBpT72Vg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9tJ2-00FzTm-0s; Thu, 15 Jun 2023 20:10:56 +0000 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9tIw-00FzPD-1r for linux-arm-kernel@lists.infradead.org; Thu, 15 Jun 2023 20:10:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=/qL4tWH5vlfUGDltwgczmV318twf9yMJvn1JbUu8GiY=; b=Oci/zWt4tgI1SRFLzpYzM1/YhWgKLN++0kQB/UrIyGdcxHE9JjapDGiGKk4efPOZLgf9 R3H+LI+3oeIyEUf+h2WAi9ni5//WfQGwSAOruYTyMjLZS5z3IuPi3t7QGAWKacHelM1JwA 7GwXbbL37UEi/aTaJ4i8eNECvwYkE4hYAhicBv4gsVPMGDUyGaK/IuBCSYfExxwi2L2kOY eyOA7DEIvALtozWTqML2K25reBwoAKSVs0boFeBnvry3XNkLXJkcWncRpR5tcQo8v4Td1x CKAvvto5ebEeVCvNt4wjGv+O/wcCEI1T53uGb/wFi1PFtZ1I10XNtddq1ouhDF+A== Received: by filterdrecv-65f68489c8-xfp5j with SMTP id filterdrecv-65f68489c8-xfp5j-1-648B7048-2B 2023-06-15 20:10:48.817052942 +0000 UTC m=+3098087.423003092 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id UaAYmYNhTEmHCxT9KxKCWA Thu, 15 Jun 2023 20:10:48.624 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v2 3/3] iommu: rockchip: Allocate tables from all available memory Date: Thu, 15 Jun 2023 20:10:49 +0000 (UTC) Message-Id: <20230615201042.2291867-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230615201042.2291867-1-jonas@kwiboo.se> References: <20230615201042.2291867-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0hwSnsPxsggRhT/D+A9yEtkGRht4pdol+jy3k6QpCorymp5gRwI4WQaU73dOcXB8iUX5JPwAso4KvAGCmmGsdC8xgj/hcxYweunxX4ber9dR4RpFj1E75SDkk+fV/aGnBo2Y7W73dXmdtylckys8b60h5S8L8XSFeE34SYIpUXXbAljuF9aeRp1VibUgPvqwLHQ== To: Joerg Roedel , Will Deacon , Robin Murphy , Heiko Stuebner Cc: Benjamin Gaignard , iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230615_131051_352501_1691413C X-CRM114-Status: GOOD ( 13.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Newer Rockchip SoCs, RK356x and RK3588, support more then 4GB of memory. However, the RK IOMMU driver is using the GFP_DMA32 flag to limit allocation of the discovery and page tables into memory below 4GB. Let's remove this limitation now that the discovery table address is correctly configured for addresses above 4GB. Signed-off-by: Jonas Karlman --- v2: - no change drivers/iommu/rockchip-iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index 62be9bf42390..46498fc382ee 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -727,7 +727,7 @@ 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 | GFP_DMA32); + page_table = (u32 *)get_zeroed_page(GFP_ATOMIC); if (!page_table) return ERR_PTR(-ENOMEM); @@ -1076,7 +1076,7 @@ static struct iommu_domain *rk_iommu_domain_alloc(unsigned type) * 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 | GFP_DMA32); + rk_domain->dt = (u32 *)get_zeroed_page(GFP_KERNEL); if (!rk_domain->dt) goto err_free_domain;