From mboxrd@z Thu Jan 1 00:00:00 1970 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 273F1C88E75 for ; Fri, 18 Sep 2026 07:14:29 +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:References :In-Reply-To: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=j1mQnON85vKXUmFkxjQObMeTrgDybGyNEAFXT82Yu4E=; b=3e+31NZQNhvOgx MJYpYd4Fj0TajZUBM520T2Qlj3CdG1GGviwpbhWjq0jd+P/vY8bMoNNDuhexCfzUzvZ3G8BSn8A9v SdH4OrXCxF1moTPi+6TAiePw+4Tuy0QuZsxXzWJeF40fjkUc22Ikju65+Qoz5jhEq7J+rWO/omarJ w29AkGR2E9jdtW2455cbOSWW/gsCBuHqWhuZFfOZD7UIyUVHBVqnx6Qxne1cT50eFL6fJchrFtLCs hPegeUSEcEzI/MZZoO6QJBCgGyMPheNW5Ex76jAxJPkEnR9fGM+IhkRGGHoIz38roFLFg644TVezU 6cyoPQtnhEUJnuo5wzQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x7SnZ-0000000DfLJ-0fXQ; Fri, 18 Sep 2026 07:14:17 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x7SnV-0000000DfKe-1txJ; Fri, 18 Sep 2026 07:14:15 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id D4BA643309; Fri, 18 Sep 2026 07:14:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D737D1F000FF; Fri, 18 Sep 2026 07:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789715652; bh=JSN/3RICUGwBIu5VwI98GdvFqpcrp4blbXSy58qpsRU=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=Ko5U5HydpSiCUC607T3WB/2e0AHn/OAQOLnxt0skGjaJ6dlvhiveUPAe5HA2uE/PT /hc+DeZpWm/sd4F8F5oAdb0eLJNrmiRC+bntUlPg4EDlGiIcfENFfIbBGiIxZDGJK+ wUq6IdZ/oaxCSHRvKEaIWY6++Qi6+D40+DXu4AW9PP3xG3yH/xeFAfC9eAUQ8BglQC k3mFx4QcVIodeIsTG2wP5wzvEjPZ+f94XFWjmYH+IIE1de1/4uniXYM9JgPIaPqejU MOnV3VtS8mgbZEoQ/cKvMnpocjve8EM2tRtFBwQoUzlU/nCjp62BkJGkb9lbetw+5s qREbZFA6/p+FA== X-Mailer: emacs 31.1 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: Catalin Marinas Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Robin Murphy , Marek Szyprowski , Will Deacon , Marc Zyngier , Steven Price , Suzuki K Poulose , Jiri Pirko , Jason Gunthorpe , Mostafa Saleh , Petr Tesarik , Alexey Kardashevskiy , Dan Williams , Xu Yilun , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Russell King , Huacai Chen , Thomas Bogendoerfer , Jiaxun Yang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v4 3/5] dma: swiotlb: Centralize memory-encryption pool sizing In-Reply-To: References: <20260914070135.313337-1-aneesh.kumar@kernel.org> <20260914070135.313337-4-aneesh.kumar@kernel.org> Date: Fri, 18 Sep 2026 12:43:59 +0530 Message-ID: MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Catalin Marinas writes: > On Mon, Sep 14, 2026 at 12:31:32PM +0530, Aneesh Kumar K.V (Arm) wrote: >> +/** >> + * swiotlb_adjusted_size() - get the prospective adjusted SWIOTLB size >> + * >> + * Return the size that confidential-computing guest sizing would select for >> + * the default pool, without changing the configured SWIOTLB size. An >> + * explicit swiotlb= size is always preserved. An explicit area count is >> + * included in the size calculation. Automatic area sizing is initialized >> + * later from the running kernel's possible CPU map and any resulting size >> + * adjustment is therefore not reflected in the returned size. >> + */ >> +unsigned long __init swiotlb_adjusted_size(void) >> +{ >> + unsigned long nslabs, size = swiotlb_size_or_default(); >> + >> + if (swiotlb_default_size_changed() || >> + !cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) >> + return size; >> + /* >> + * For SEV and TDX and CCA, all DMA has to occur via >> + * shared/unencrypted pages. Kernel uses SWIOTLB to make this >> + * happen without changing device drivers. However, depending on >> + * the workload being run, the default 64MB of SWIOTLB may not be >> + * enough and SWIOTLB may run out of buffers for DMA, resulting in >> + * I/O errors and/or performance degradation especially with high >> + * I/O workloads. >> + * >> + * Adjust the default size of SWIOTLB using a percentage of guest >> + * memory for SWIOTLB buffers. Also, as the SWIOTLB bounce buffer >> + * memory is allocated from low memory, ensure that the adjusted >> + * size is within the limits of low available memory. > > Nit: if SWIOTLB_ANY is passed, do we still allocate only from low > memory? I think this comment made sense on x86 but it's not valid for > s390, pseries with the changes so far. > I'll remove that part of the comment, as the code does not check the adjusted size against the low-memory limit. > > Otherwise: > > Reviewed-by: Catalin Marinas -aneesh _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv