From patchwork Wed Jan 25 22:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13116336 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 E909AC54E94 for ; Wed, 25 Jan 2023 22:19:51 +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=GWw1xc0CP36fucA6VUtCYE/FXt2yohIonLTZnBFV4+c=; b=ARnd0mt0pipLoR6H/vrwRRXrrP 9GyTgdjpVnv2af0Mq+u61B/cR+ODg6x63WeEWDsYq6GE7LDdIHCQH+obms0SUZvnsoNpG+sGWMlNV eLSzM9M7wsyjupYIJ7tmwpaGw/W4zS8O/3YbEp406uFiXRzezsY87SzRmyBP3zuMzQYC0eyJit4IK EjI7ciqJhuEsq1wH6qH1tplgg867e3nQFZnNZQxLS+oRabdk4R05tveDGlk634+LtM7sznM9n9exG VrgJe5vNm6zBWuGE7PPWQSCx+A8T/6QKAS6ncCGdVQnoUYhOudN41quEOyfds5XIYPX9kIARPLjWW n5CpKTDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKo6G-008xzH-9c; Wed, 25 Jan 2023 22:18:36 +0000 Received: from xvfrqvdb.outbound-mail.sendgrid.net ([168.245.72.219]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKo5z-008xrP-UR for linux-arm-kernel@lists.infradead.org; Wed, 25 Jan 2023 22:18:23 +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=v/+7TIKYeL3kSElncchHEqaouv/ZY1YfqWgkjj3Wl8c=; b=lG96mQWWdWgwMCw2+oIkuZjnI+KQC/mIrcJdO6BxadIf1FWJvJRMCJMI3nFxpdh/1jw4 RyNi+903jOXwy3eHQNVVluXBRKDdgkYk8W7S0dI86YBjCu7UhBm0KgNHoWor3nO4DH0Lo1 qHpwW1cEM5nMw7jcoc0qRyQW+oQ390mwGDF50yNaLJwDV2ZcLbxS+wBlnVribstX9OI4at epcImt3UejXSGdstAu5cLVBlTR3g4C2wtxY5SIfssjXA2R7fhYI5gllHsZYCkqgjwIxEGG W3YSbHv60yUK2kNMHimtLTI7m1X+Ti6BOIeV/vdOmJVeGyLctv/WxQaUBhGF67dQ== Received: by filterdrecv-8569859b9-97x8c with SMTP id filterdrecv-8569859b9-97x8c-1-63D1AAA4-23 2023-01-25 22:18:12.571250041 +0000 UTC m=+5958685.948296575 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5-2 (SG) with ESMTP id jPjw9qkGQaSNJoFiiH0Fjw Wed, 25 Jan 2023 22:18:12.364 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 1/3] iommu: rockchip: Fix discovery table address encoding Date: Wed, 25 Jan 2023 22:18:12 +0000 (UTC) Message-Id: <20230125221809.3275481-2-jonas@kwiboo.se> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125221809.3275481-1-jonas@kwiboo.se> References: <20230125221809.3275481-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0hzE9y3ON40KepxhFBb7izHX1JjXxyuEqDlHxxqRyDUjHN6Q7El3VcYONIjJcWc2HkzGQB9uZ1ZUBAwtO2Uy94ebjR4HF6TBJp484VM77eVUje5qqD8tdpXUD7QfTlSQg06TSYGb8xyJH90TXvBij/mMF1C83Dc5WGz0EZLDs3q0hlaAm73nZdx9SPsUl4bHd8Q== To: Joerg Roedel , Will Deacon , Heiko Stuebner Cc: Robin Murphy , Benjamin Gaignard , iommu@lists.linux.dev, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230125_141820_266708_16D86FB8 X-CRM114-Status: GOOD ( 14.27 ) 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 currently. 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 --- 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 f30db22ea5d7..3f92b95e6b67 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -277,8 +277,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 @@ -576,7 +576,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); @@ -966,7 +966,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 Wed Jan 25 22:18:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13116337 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 4B7DAC27C76 for ; Wed, 25 Jan 2023 22:19:52 +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=xfE/FHaq6PP3Z8qyfvpoHEL6mbmFX9VXZw3jYRUrtOs=; b=45snDT3zxsFtznMW6bE0D3DyGG +s7LFbZt1VpjZfDSdAm/FOohmvHSj+ht3OXvd1uFZbiYrJz/uia7spbNuuHJAC2n6j3H4M6HbtXIA Sa4/uy1j9NdvikfMKbxU1XUS8BUrWJaaoCGRecMR9wBrVMEfaq8YBZdjOdv/t8/r9EWyS84f1qi// Gm0IjPn//dWBw8xyyeUHiJyWpC2eByJDl+soUCMktCAAm3ki3CW0A/n0PX7LndNVn9LoWFtxD/Drg O1NEpGPVujRWHnTrBzLnvs54ZAeKaVSgaLCXZ5gdn+s1z5nzxaWwzuy+7AAqJdSohnmOM+D1Y3JQX aJzJKx/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKo6Q-008y2T-66; Wed, 25 Jan 2023 22:18:46 +0000 Received: from wrqvxttq.outbound-mail.sendgrid.net ([149.72.167.116]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKo63-008xtE-38 for linux-arm-kernel@lists.infradead.org; Wed, 25 Jan 2023 22:18:24 +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=iWGLuXTri0QUMLM39KAoA8ZFb9x7Tah4lh6B9HcxKQo=; b=K4Ny8Mtl1aiXfHXItfDpXjJ10RGpTDkRmOO67w0SxVYQvYPBAKnxELPudKnuwaNl2IMH sRMyZ7vq+daNQ5zjBoTmzHxjAT8O/GVI/wZjiNwhr25pRefpKPMZMReOVPjjYsOmodS2JZ nLIWv0+VsevauLdEC6pLlkzZ61iqJatXwCYlHBAyDeBOvkTl8V7HlqgCQolXnkP2B6/V/L QBKBpbhRIFrPsknfSpoLXPpszR8KKcapgEERSne4jD3yPo3RETvjk5zLzUGCbMULcEF+bz Aw2+KYpkHRqsShpevf6jhIxedb6UiFLLUuVrpk8WAyqnGc/4BcJ+J1f+/ZyCy4cQ== Received: by filterdrecv-557d69979-xq98h with SMTP id filterdrecv-557d69979-xq98h-1-63D1AAAC-2B 2023-01-25 22:18:20.997120133 +0000 UTC m=+5958759.859829075 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5-2 (SG) with ESMTP id xuI068K6TJa03t-X8Y6_dg Wed, 25 Jan 2023 22:18:12.617 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 2/3] iommu: rockchip: Remove unused variant ops Date: Wed, 25 Jan 2023 22:18:21 +0000 (UTC) Message-Id: <20230125221809.3275481-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125221809.3275481-1-jonas@kwiboo.se> References: <20230125221809.3275481-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h5zjs67zwtlOkuZFUltLNHMI26EIuXvOLJYE8xK+1f74lSRt1OEfR2k8D6p+sIeDJGB1E3YPUWSHA3xnh8kDvavVH6MTkVxVu/3Q6px7SSqDLgLhSPi7Bv41WqH3/Ok6LnJANS6kMcaoyUQx0DuKDTRCc4cTq5eQT+KxsYyUuhkdtb4pOoMXkI/HV6nSaV5o7A== To: Joerg Roedel , Will Deacon , Heiko Stuebner Cc: Robin Murphy , Benjamin Gaignard , iommu@lists.linux.dev, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230125_141823_319704_67C942B9 X-CRM114-Status: UNSURE ( 9.85 ) 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 --- 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 3f92b95e6b67..ca47f198455e 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; }; @@ -530,33 +528,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]; @@ -1370,8 +1341,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), }; @@ -1379,8 +1348,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 Wed Jan 25 22:18:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13116338 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 1864CC27C76 for ; Wed, 25 Jan 2023 22:20:10 +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=s0j82Cemp5wmtCKwqkQ4P/9podvg7ZqV2AX8Q+q9xGA=; b=TJrqPkriZke+K+4jedl7oM6SWD 2L1rnBJ0r88G6Eidzc0nMtJSN76r9afJhSQxTyt5KepfD1q3lUXIb4TkgeH+eBGsbLqs8KFAhNX8O 3sd5oKW1haH1Jmj/EeCEL9rwhX7URr4VXRYCV47IsUkwn2etsfpzOQgmRb2WMmJeKBvE/5VCpyHsP pBTBvDZvFmRnufecTzIl4kRq42W4nxLJ/dxiZJ2l5X1DYPvIgVhexN3971LQLfYViyWFTjE9ukal9 UzQu85liuhiMDuLhrHsCz76INButAjEqVnNJx/AZoNexMRT5xYw3acVJyGtZTNOpkDOqfmwT5u+qn 2aLacHDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKo6s-008yEx-63; Wed, 25 Jan 2023 22:19:14 +0000 Received: from xtrwsqbh.outbound-mail.sendgrid.net ([167.89.100.176]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKo6D-008xxs-Jx for linux-arm-kernel@lists.infradead.org; Wed, 25 Jan 2023 22:18:35 +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=sHEGuDI+QAsBRHQDABhGANagI0i+/Ox7a/1vEXYK3PY=; b=oY4iPqE0yBl/0nVlsDUz8K3Qencz96m5NjSKWs3AakkW53Yafd8qDpk2aqNePoJm3nWo VseGSBWv4EsVWBCFZD3YsPpdJ0K/DRn85ZHLyGqRgY5TigASzJbXisqcxUXVMGYk1WY3cU bkB7uZ8etxEtAyl+k/x1gbYzId9qwj/0NCucjTITqswWlQkFvSNU8i7xm5gL6EdfY6Q/3c vIDYwwyODTl7y+0dXkP4yYhJWn6mgITdo4p4qf+EXAYDVd5FLQYi3f+wU6ObnM1V/gVS08 F3UuM8jsjeuzhO6vXHlN17eH7cLbpXvcyBEFTPPw1tcMfZ6I190XX8fJpr3H0oaw== Received: by filterdrecv-8569859b9-xfh5v with SMTP id filterdrecv-8569859b9-xfh5v-1-63D1AAB7-2A 2023-01-25 22:18:31.954514689 +0000 UTC m=+5958699.083386124 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5-2 (SG) with ESMTP id NI2nFHi_TkuaGBqMj9k9gA Wed, 25 Jan 2023 22:18:20.957 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 3/3] iommu: rockchip: Allocate tables from all available memory Date: Wed, 25 Jan 2023 22:18:32 +0000 (UTC) Message-Id: <20230125221809.3275481-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125221809.3275481-1-jonas@kwiboo.se> References: <20230125221809.3275481-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h/X+CIU4kFU9zG1GiwEbP/5kLr6ZQf9m6wDe9ilvpgqcQh5sPBuMV6GUW1ay67FN9Xi4rS28UZ8dNzfF4/iuyI2P1Nc5Eu+gKjKAQoQ/6+l4KXDUBpw1H3rKCyVVLLN9YqXVpRC6r5FeDlBoY/Tcada9OqSs74s6uIWypT8Ckhy1Hw/FrfZYDZROGOv7R5WM5g== To: Joerg Roedel , Will Deacon , Heiko Stuebner Cc: Robin Murphy , Benjamin Gaignard , iommu@lists.linux.dev, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230125_141833_766930_B9F20E32 X-CRM114-Status: GOOD ( 12.88 ) 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 --- 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 ca47f198455e..799ecc2c0d0e 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -726,7 +726,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); @@ -1047,7 +1047,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;