From patchwork Tue Nov 23 11:21:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12633961 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 4E39AC433EF for ; Tue, 23 Nov 2021 11:22:00 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Sj+AW6qRQ9F09c4EwgNADl0tqnIX8Ei/QPaG4gObqck=; b=YDBiwhvCVpVEpS Xt2bFZw7kxfXwa8N3FcWQHpEBGTY62D3RSb6QLDoHMmoQK45hp1i1cTgCIN4OLqSSd038v8gEl1Qp GXPe/nV1Gb7J/eDHtX5w12/ZlvXSVX99hfOCjBfUIfpUZhcyvA9Xs8sIr6idRgj5apM3j4f/ZRh0L 8kLLj616rn7hq/73RJ58dmL8w52JZIPI/MYF0O50mHt4KltrvONHl3T+DBSkfGYT49lPHP1cmyRtP zYgaREWdDb0fjiiJcvpFmjWRReWvdnlvn3y7/l7yFkd/vtZovD+TRt2CMvSiTYW/h1vwinwXj0gP9 jTa0EWo5rhesXbHFEslQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpTs0-001sIw-Oj; Tue, 23 Nov 2021 11:21:52 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpTrN-001s26-Sk for linux-mediatek@lists.infradead.org; Tue, 23 Nov 2021 11:21:17 +0000 Received: by mail-pg1-x532.google.com with SMTP id f65so8369100pgc.0 for ; Tue, 23 Nov 2021 03:21:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cXx4tPUfUH9pafyzAeGR5gquV85Y2Z7tudxqqufT9GE=; b=Wyu1LS1cdtTMg0hBT2U10oleP2US7ydiLPsXo5v+x1MNLCd6m33da3VzYuAdmFxMDv /atTSJHqbJlfRgPOsJTgGAwa42sZEMLJfCeeybWG2f34PtVrGXjnb2T1yJRaaAh4pnH5 yo0ASPO7kd0LehyYoqSA3V7IvNbzQ7efFI4NM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cXx4tPUfUH9pafyzAeGR5gquV85Y2Z7tudxqqufT9GE=; b=Jlsk5Vcuk6B0ItNwfWqJ4LD42ZFPoT3PgrVn3g7OwI5ZcH5wooe6I/FIYoPuMX43hg igRSK6giZdgtkRF/Z2RLuVC6Nmx86llgRpRkCvF7oPa5ccdMJi1Zhmdr8ui4bdERwWoi bXzsTlBH/+JSh2afRGKftP8aW/MbLN/3G+JF3eU/29bpNY3KeIDWfDa/ZOTs1sY37tk0 PqmY4Io0cnfM5gMHF+UVn3L/LUOahFyh9hQKFaTg9b40yU0Pq3WAphkAmdSdAFIIByE6 /QTkx6CIWlDc7ALiYLVQnRWeVMxnJd631OzUTSVD++wK5fCxnnO/cGou1NKXTsH0Qg/9 Udng== X-Gm-Message-State: AOAM53092KoTU6tolfA/CBhPUmaSNF8vgCzVF6K46nq4XP9pVA9YXPUA H/HKN5NOJJ+IWoMtZTvjdSF2PQ== X-Google-Smtp-Source: ABdhPJxjIMzcvOjNvrJ8u+XuK5KrPYWq/y8+SH32D3Ysykp7V9Qvil0zhFT6XjR7GIbSKLcWQI8AkA== X-Received: by 2002:a63:1813:: with SMTP id y19mr3266275pgl.93.1637666472835; Tue, 23 Nov 2021 03:21:12 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:d1ae:c331:ed2a:15e9]) by smtp.gmail.com with ESMTPSA id 63sm11093914pfz.119.2021.11.23.03.21.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 03:21:12 -0800 (PST) From: Hsin-Yi Wang To: Christoph Hellwig Cc: Marek Szyprowski , Robin Murphy , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Rob Herring , Maxime Ripard , - , devicetree@vger.kernel.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, senozhatsky@chromium.org, tfiga@chromium.org Subject: [PATCH 1/3] dma: swiotlb: Allow restricted-dma-pool to customize IO_TLB_SEGSIZE Date: Tue, 23 Nov 2021 19:21:02 +0800 Message-Id: <20211123112104.3530135-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog In-Reply-To: <20211123112104.3530135-1-hsinyi@chromium.org> References: <20211123112104.3530135-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211123_032113_991206_633A78EC X-CRM114-Status: GOOD ( 18.95 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Default IO_TLB_SEGSIZE is 128, but some use cases requires more slabs. Otherwise swiotlb_find_slots() will fail. This patch allows each mem pool to decide their own io-tlb-segsize through dt property. Signed-off-by: Hsin-Yi Wang --- include/linux/swiotlb.h | 1 + kernel/dma/swiotlb.c | 34 ++++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 569272871375c4..73b3312f23e65b 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -95,6 +95,7 @@ struct io_tlb_mem { unsigned long nslabs; unsigned long used; unsigned int index; + unsigned int io_tlb_segsize; spinlock_t lock; struct dentry *debugfs; bool late_alloc; diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 8e840fbbed7c7a..021eef1844ca4c 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -145,9 +145,10 @@ void swiotlb_print_info(void) (mem->nslabs << IO_TLB_SHIFT) >> 20); } -static inline unsigned long io_tlb_offset(unsigned long val) +static inline unsigned long io_tlb_offset(unsigned long val, + unsigned long io_tlb_segsize) { - return val & (IO_TLB_SEGSIZE - 1); + return val & (io_tlb_segsize - 1); } static inline unsigned long nr_slots(u64 val) @@ -186,13 +187,16 @@ static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start, mem->end = mem->start + bytes; mem->index = 0; mem->late_alloc = late_alloc; + if (!mem->io_tlb_segsize) + mem->io_tlb_segsize = IO_TLB_SEGSIZE; if (swiotlb_force == SWIOTLB_FORCE) mem->force_bounce = true; spin_lock_init(&mem->lock); for (i = 0; i < mem->nslabs; i++) { - mem->slots[i].list = IO_TLB_SEGSIZE - io_tlb_offset(i); + mem->slots[i].list = mem->io_tlb_segsize - + io_tlb_offset(i, mem->io_tlb_segsize); mem->slots[i].orig_addr = INVALID_PHYS_ADDR; mem->slots[i].alloc_size = 0; } @@ -523,7 +527,7 @@ static int swiotlb_find_slots(struct device *dev, phys_addr_t orig_addr, alloc_size - (offset + ((i - index) << IO_TLB_SHIFT)); } for (i = index - 1; - io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 && + io_tlb_offset(i, mem->io_tlb_segsize) != mem->io_tlb_segsize - 1 && mem->slots[i].list; i--) mem->slots[i].list = ++count; @@ -603,7 +607,7 @@ static void swiotlb_release_slots(struct device *dev, phys_addr_t tlb_addr) * with slots below and above the pool being returned. */ spin_lock_irqsave(&mem->lock, flags); - if (index + nslots < ALIGN(index + 1, IO_TLB_SEGSIZE)) + if (index + nslots < ALIGN(index + 1, mem->io_tlb_segsize)) count = mem->slots[index + nslots].list; else count = 0; @@ -623,8 +627,8 @@ static void swiotlb_release_slots(struct device *dev, phys_addr_t tlb_addr) * available (non zero) */ for (i = index - 1; - io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 && mem->slots[i].list; - i--) + io_tlb_offset(i, mem->io_tlb_segsize) != mem->io_tlb_segsize - 1 && + mem->slots[i].list; i--) mem->slots[i].list = ++count; mem->used -= nslots; spin_unlock_irqrestore(&mem->lock, flags); @@ -701,7 +705,9 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t paddr, size_t size, size_t swiotlb_max_mapping_size(struct device *dev) { - return ((size_t)IO_TLB_SIZE) * IO_TLB_SEGSIZE; + struct io_tlb_mem *mem = dev->dma_io_tlb_mem; + + return ((size_t)IO_TLB_SIZE) * mem->io_tlb_segsize; } bool is_swiotlb_active(struct device *dev) @@ -788,6 +794,7 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem, { struct io_tlb_mem *mem = rmem->priv; unsigned long nslabs = rmem->size >> IO_TLB_SHIFT; + struct device_node *np; /* * Since multiple devices can share the same pool, the private data, @@ -808,6 +815,17 @@ static int rmem_swiotlb_device_init(struct reserved_mem *rmem, set_memory_decrypted((unsigned long)phys_to_virt(rmem->base), rmem->size >> PAGE_SHIFT); + + np = of_find_node_by_phandle(rmem->phandle); + if (np) { + if (!of_property_read_u32(np, "io-tlb-segsize", + &mem->io_tlb_segsize)) { + if (hweight32(mem->io_tlb_segsize) != 1) + mem->io_tlb_segsize = IO_TLB_SEGSIZE; + } + of_node_put(np); + } + swiotlb_init_io_tlb_mem(mem, rmem->base, nslabs, false); mem->force_bounce = true; mem->for_alloc = true; From patchwork Tue Nov 23 11:21:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12633963 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 BFEB7C433FE for ; Tue, 23 Nov 2021 11:22:18 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dePpTfe2XvxZp8XSvry6hQvcBFlRHnd8TSIS6XeC8LU=; b=tbFEr8D0o1aMns JawtB2zVpmBOt/2sBcItaCzC/Clb8x55bgHXTPCyxfV/q08JpscqaHuxN4vOPrDYyo3Pmm/e6T4dt ymB+Tj04QYC8lrULAYj6Tv3Fi9BYbRgGHrqOkz5sjmzuMI4PYh2bY2vJdlgtMDQbmXVEqSV5d3W+t iBA3yVTsHFN8eA4no0zFv5XQw2ZyoBmuF4fQlKrR+AwbQT6wViqvKRQlhjhHQN22FmBHLRiV0xroX 7iEHz+UmfpTcqoY02R/t4BX4am2t1o9FhLsEBhf6cqHHUS/NKXobTAW2dRURk5FNfTVzX6GO8YUOZ GYM1VRGwnupC35GGMj5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpTsJ-001sQA-IU; Tue, 23 Nov 2021 11:22:11 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpTrQ-001s4V-N6 for linux-mediatek@lists.infradead.org; Tue, 23 Nov 2021 11:21:19 +0000 Received: by mail-pf1-x436.google.com with SMTP id o4so19112643pfp.13 for ; Tue, 23 Nov 2021 03:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z+/tM6AGO8qVa/0Ves95KRNhzSUdOxRaqnGgKB5D++M=; b=XpXqNAebRwgXhworSNtt028SsP5KTorBtVnPQ2NDJ5AqE0w8IT8BOg6T3ewnDOxn0x QaNyBlTudA5wA6HUsP3tTtdlTWjvrE8GuQPbTwT1fW+w1gEOlQN/lkvuxJNQ4SJKqEYn we3ePUFjfo44/HkRFeRMoGLKvp+vx0wcGlvTA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z+/tM6AGO8qVa/0Ves95KRNhzSUdOxRaqnGgKB5D++M=; b=IcJ5+jh7KTjY/vFg+v20kJIcmMeoTXGAcRb7woRNxttQ8uYwCCqgmiUlvZElVyVd3x tr/PVfE3A5RuK1VaL1eA9wkAScPpt6c9trtCfNV4EOPLOaajhVPuT+J1lQYlj6JISBSv iYnds/nc09OIZOlyum84UczI9cqrTHnR38R4GgiAW7xySv0+f4RiOf/4veE/xJGNxw7W 2Lu9oom+lCbdl0c02FuBIA49LFU4fRwLaUuWeFVMTAL+CJ2Ci/bvAeck1fKI5rUYkci3 GuVjN/fknfW9zIqTlfv8TbRQX99JZ0oKvZ0mcSRcYqYrIYJAauk4UEQmLULh3F5+m5r8 euPA== X-Gm-Message-State: AOAM531ZHZCLc2CF/iFPRfjSY+TNq8PzEktZngNzxFRIJkmsxbNFJD0t qZhl0m/9jQdQztccd7zxmFW48w== X-Google-Smtp-Source: ABdhPJxETkQVjZ/TElThsyh1V0RdLsnWog1QFLXL9SdSSg23n2Tff5mZqtPLZT8Oh2DPEEUzXXmy1w== X-Received: by 2002:a63:f64:: with SMTP id 36mr3117696pgp.464.1637666475417; Tue, 23 Nov 2021 03:21:15 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:d1ae:c331:ed2a:15e9]) by smtp.gmail.com with ESMTPSA id 63sm11093914pfz.119.2021.11.23.03.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 03:21:15 -0800 (PST) From: Hsin-Yi Wang To: Christoph Hellwig Cc: Marek Szyprowski , Robin Murphy , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Rob Herring , Maxime Ripard , - , devicetree@vger.kernel.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, senozhatsky@chromium.org, tfiga@chromium.org Subject: [PATCH 2/3] dt-bindings: Add io-tlb-segsize property for restricted-dma-pool Date: Tue, 23 Nov 2021 19:21:03 +0800 Message-Id: <20211123112104.3530135-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog In-Reply-To: <20211123112104.3530135-1-hsinyi@chromium.org> References: <20211123112104.3530135-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211123_032116_854168_E11E792B X-CRM114-Status: GOOD ( 12.21 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add a io-tlb-segsize property that each restricted-dma-pool can set its own io_tlb_segsize since some use cases require slabs larger than default value (128). Signed-off-by: Hsin-Yi Wang --- .../bindings/reserved-memory/shared-dma-pool.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml b/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml index a4bf757d6881de..6198bf6b76f0b2 100644 --- a/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml +++ b/Documentation/devicetree/bindings/reserved-memory/shared-dma-pool.yaml @@ -56,6 +56,14 @@ properties: If this property is present, then Linux will use the region for the default pool of the consistent DMA allocator. + io-tlb-segsize: + type: u32 + description: > + Each restricted-dma-pool can use this property to set its own + io_tlb_segsize. If not set, it will use the default value + IO_TLB_SEGSIZE defined in include/linux/swiotlb.h. The value has + to be a power of 2, otherwise it will fall back to IO_TLB_SEGSIZE. + unevaluatedProperties: false examples: From patchwork Tue Nov 23 11:21:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12633965 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 C7A9FC433EF for ; Tue, 23 Nov 2021 11:22:19 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+sKot2yKYIuUz9oz5o3b/Zrz+tzRNC0o0nXr3y8mVKk=; b=DOfeaWmR4HWxxd 4hN2uu6r/nHX6ruTNnumQfgh8njuwdGfxtipmPDb7auMUOaXk660fsUSAT2h0krp3custOvcFx3W6 CsNnJSR95X3/MLqJuXWEnaeiE4Emvhc2IVCPfcTnCIqQP3kkaKPSlo6zhBYe2OvJBiGZ83P0bxuFC m2O+fWmpN+kUrjT+w6jSCTTGejTtYNL05tTnKiL/JeOk+iJxaSPt/+8vgzdA15VZtdF1enPLYshw7 O2oF7J06b6h4xfTgPJdZdsODkN0W9o8NEtCxSyajGjNg834GzV3x3NsZr8mJ2hG2m1d2WHAEfrpYc lL70k9nEPe/m0i3cfn5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpTsL-001sR2-4Y; Tue, 23 Nov 2021 11:22:13 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpTrT-001s6P-5O for linux-mediatek@lists.infradead.org; Tue, 23 Nov 2021 11:21:20 +0000 Received: by mail-pj1-x1033.google.com with SMTP id j6-20020a17090a588600b001a78a5ce46aso1870715pji.0 for ; Tue, 23 Nov 2021 03:21:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mq8nc34v9wy9BHUcdNCchv5TcJtzwaMW4yDN1UOKTXs=; b=JpDT/+FDBCbI5IBaWeaKfzyOwUUOyTt+Vw1ovqm0zuzKZZrjqWO3dJqGL1pzmsZRcz WEzphSwzny6i8imySPh8owk0bZ7mV09ROF7m2cIZELwxwLD3zWFbiIveEf0Sy/YacdFK n/sQubJ/NkmPIgp5pbeN1xtI08xQWQungcwqY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mq8nc34v9wy9BHUcdNCchv5TcJtzwaMW4yDN1UOKTXs=; b=el5etkj7EB/W5LU4PvTchRSuMhK9lEL6ZRtConsP+8xEpQPnQhwyKtOt+fa4XhULth 6V2KmEI01Jk9tGt0Njg3Yvqk9S/5CBKiodpbgurL0gUkPCXnzf3GiYx09k6dUQ1FURM3 m1LhUlFrA4mJrzILLAP0RMa7xQBKyfmVrUaXs65dk7WczwXswZUn1wBxwqZ37Af1YzrN 0SEbgmDyReInpBORktJTRt7b0ywZwXtS7/rBbc0koTWTkXdXoGnxc5RtNrS6sJws/8Ov HPQ08U9hb0HDOvPvPxKZw79Tph1RRGqZNIcCmHE/6j+Bh7jK6H+1oJj1PVRtis5ocxQz aI7Q== X-Gm-Message-State: AOAM531JNQ/82J21JTGwX0OJacMNsqG9X8ixTZoplxLcIt3K8tbHuHw/ zWWn+i6m5N1bQtI+pY4wkjfOOQ== X-Google-Smtp-Source: ABdhPJxp5J8vQC13ZWDo2EQlaskUNOPku9PaqV5etdp5QIpELJ9fUxb88Pk4hXN6hRe8tLOckb6fGg== X-Received: by 2002:a17:902:7d96:b0:142:87dc:7dd3 with SMTP id a22-20020a1709027d9600b0014287dc7dd3mr5260273plm.11.1637666477920; Tue, 23 Nov 2021 03:21:17 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:d1ae:c331:ed2a:15e9]) by smtp.gmail.com with ESMTPSA id 63sm11093914pfz.119.2021.11.23.03.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 03:21:17 -0800 (PST) From: Hsin-Yi Wang To: Christoph Hellwig Cc: Marek Szyprowski , Robin Murphy , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Rob Herring , Maxime Ripard , - , devicetree@vger.kernel.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, senozhatsky@chromium.org, tfiga@chromium.org Subject: [PATCH 3/3] arm64: dts: mt8183: use restricted swiotlb for scp mem Date: Tue, 23 Nov 2021 19:21:04 +0800 Message-Id: <20211123112104.3530135-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog In-Reply-To: <20211123112104.3530135-1-hsinyi@chromium.org> References: <20211123112104.3530135-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211123_032119_278091_A6C77710 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Use restricted-dma-pool for mtk_scp's reserved memory. And set the io-tlb-segsize to 4096 since the driver needs at least 2560 slabs to allocate memory. Signed-off-by: Hsin-Yi Wang --- arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi index 94c13c45919445..de94b2fd7f33e7 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -109,9 +109,9 @@ reserved_memory: reserved-memory { ranges; scp_mem_reserved: scp_mem_region { - compatible = "shared-dma-pool"; + compatible = "restricted-dma-pool"; reg = <0 0x50000000 0 0x2900000>; - no-map; + io-tlb-segsize = <4096>; }; };