From patchwork Tue Nov 23 11:21:01 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: 12693440 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 19BAFC433F5 for ; Tue, 23 Nov 2021 11:22:55 +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: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:In-Reply-To:References: List-Owner; bh=jUjGiMv63MzeAyszFQaWVJTvZzr1Ma7+qWdYIWsBzzc=; b=Pp5j8u8Jzv1o1a 5eC135/bEyYqXvmlkyrZ6KKGBYnqDdbsPutThHUamJXwDvnMfn5uNniQZrFp50tHcpbhQJcd0TxYv cJxbGOig9SEejIOgL1irhZJ4kxuHPoqF6PqxwcE12+98DcApkiPB8zbtLKeKYMptHWnluIPLM9IKX I/A/vS1fk23Kh6fTxLmwp3I+yGSHlFCJ6KcQxYimqKQ246yf416noUzqTKVKUSag+wFi+oIEG2x9c VkwBNrsxjS4k6Ted30Cbc91oP9aQwXch2PWRei9BWTxmjbxj7iwO/+ZiOHmxuvG801Ap8x1/CZS4F g6TOk80wUeHeW+snFn+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpTrW-001s5n-BC; Tue, 23 Nov 2021 11:21:22 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpTrN-001s14-Mb for linux-arm-kernel@lists.infradead.org; Tue, 23 Nov 2021 11:21:15 +0000 Received: by mail-pl1-x632.google.com with SMTP id y7so16847601plp.0 for ; Tue, 23 Nov 2021 03:21:10 -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:mime-version :content-transfer-encoding; bh=5/NUU473gHgJJWAHyz9icycAmdo+qfzcO9MMsTUYLCA=; b=Ka+/WtPAVKmsC47ebx/EttMPimSyaFaQsXvSwohDRgg53jo8emMNbvUMSjBffFZJiF 6mmEV31XO/9nn98pDJV/kWkNmFi5luffIqiHkegaqh/MUKTubaMVlPLwa07SSu/o/XsD 8ngdYw/RZqDR/Hmx12cSy0gEWVZ3Gd2d3Mktk= 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:mime-version :content-transfer-encoding; bh=5/NUU473gHgJJWAHyz9icycAmdo+qfzcO9MMsTUYLCA=; b=tNIxCwMqD/m8kaqKL5wLZbuZTzuJPWG9UBU7Nu9RwXwTYpf/76mNA8wjMc7fsEKw9Z Zuh4vHRE7WDsWAueSRMtdwmXIKippiQAOf8/RW/8y2h6tsGU7XRgwkT7ukcXdapIGQYe mKdd+/mjiVFY0V2rW2XcM608cHkJ/xXYOf5N08AMmRcZ+ylhIVkerJT5P03hax9VQVeP avicvT9sfBWK+GLgYIQwCqXeYj28DL4lXkc+c/ogBgjkZDZNzNFtYLx0AvrAIUl9UVUm VBdFnnkKUPvQGHsLuZ+34bvWZBaKlWirRWHspQkwh+LQJ7YulqT/I2e6rK8ItHHECxJt F8hg== X-Gm-Message-State: AOAM530X2472V7WPYFFq71bFfqK1SVN5cgTByipMBLqmNfe5sLZEt8Dh cc04vw3DbS1VEg9gFmBVlTHB0g== X-Google-Smtp-Source: ABdhPJzZX7TeNDOF6tm1dgQN6UgDtm8Er0h77Xe7AqW6C2wdt/CMcVsKuhDG9eZ4EtpKo4xugVw3nw== X-Received: by 2002:a17:902:e5ce:b0:142:780:78db with SMTP id u14-20020a170902e5ce00b00142078078dbmr5853227plf.12.1637666470227; Tue, 23 Nov 2021 03:21:10 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 03:21:09 -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 0/3] Allow restricted-dma-pool to customize IO_TLB_SEGSIZE Date: Tue, 23 Nov 2021 19:21:01 +0800 Message-Id: <20211123112104.3530135-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211123_032113_809732_1AEBB9AA X-CRM114-Status: GOOD ( 11.25 ) 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 Default IO_TLB_SEGSIZE (128) slabs may be not enough for some use cases. This series adds support to customize io_tlb_segsize for each restricted-dma-pool. Example use case: mtk-isp drivers[1] are controlled by mtk-scp[2] and allocate memory through mtk-scp. In order to use the noncontiguous DMA API[3], we need to use the swiotlb pool. mtk-scp needs to allocate memory with 2560 slabs. mtk-isp drivers also needs to allocate memory with 200+ slabs. Both are larger than the default IO_TLB_SEGSIZE (128) slabs. [1] (not in upstream) https://patchwork.kernel.org/project/linux-media/cover/20190611035344.29814-1-jungo.lin@mediatek.com/ [2] https://elixir.bootlin.com/linux/latest/source/drivers/remoteproc/mtk_scp.c [3] https://patchwork.kernel.org/project/linux-media/cover/20210909112430.61243-1-senozhatsky@chromium.org/ Hsin-Yi Wang (3): dma: swiotlb: Allow restricted-dma-pool to customize IO_TLB_SEGSIZE dt-bindings: Add io-tlb-segsize property for restricted-dma-pool arm64: dts: mt8183: use restricted swiotlb for scp mem .../reserved-memory/shared-dma-pool.yaml | 8 +++++ .../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 4 +-- include/linux/swiotlb.h | 1 + kernel/dma/swiotlb.c | 34 ++++++++++++++----- 4 files changed, 37 insertions(+), 10 deletions(-)