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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 508A9C4167E for ; Mon, 4 Apr 2022 22:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380407AbiDDWHP (ORCPT ); Mon, 4 Apr 2022 18:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379540AbiDDR0c (ORCPT ); Mon, 4 Apr 2022 13:26:32 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B8B31909 for ; Mon, 4 Apr 2022 10:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=N24CpBDygfALbt/hrcJkTFYe4AX/XLB390dNSfysj5g=; b=NVYwAi0WWPljQrXbqyVfROhDET Yia/c6sRhlxlfiABHHpesebhHQjtnVtRPI7ShBOv/6Eq1SP3n0t6faH96gj+xfWQ6ORQTfK4Plt4j WgCLKfbqhOU/yRzepQHfQ8eEWl0qaGp6rTobEXAEg41NGF13ZC0++grPjTX0ENG/sTkyNp2jJpHV2 8qgXWugQhy8Qux2xZu6rlNSffJCdWpeuVdlLsex6Nbrnerg22khrz62qDjPyGKtHJid9ney+hx58n EtN3vqK6Ss/pqCTABq4+L0b/rmyE/yi62/XVUy+EwV6CHHTsUntUszvh8dB36LsGCiGrSPb0+HmHH +4VlDutw==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbQRJ-00G0Q6-1x; Mon, 04 Apr 2022 17:24:29 +0000 Date: Mon, 4 Apr 2022 10:24:29 -0700 From: Christoph Hellwig To: "Limonciello, Mario" Cc: Christoph Hellwig , Joerg Roedel , Will Deacon , Marek Szyprowski , Robin Murphy , "open list:IOMMU DRIVERS" , "Suthikulpanit, Suravee" , "Hegde, Vasant" , open list Subject: Re: [PATCH 0/2] Fix issues with untrusted devices and AMD IOMMU Message-ID: References: <20220404164707.1128-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 04, 2022 at 05:05:00PM +0000, Limonciello, Mario wrote: > I do expect that solves it as well. The reason I submitted the way I > did is that there seemed to be a strong affinity for having swiotlb > disabled when IOMMU is enabled on AMD IOMMU. The original code that > disabled SWIOTLB in AMD IOMMU dates all the way back to 2.6.33 (commit > 75f1cdf1dda92cae037ec848ae63690d91913eac) and it has ping ponged around > since then to add more criteria that it would be or wouldn't be > disabled, but was never actually dropped until your suggestion. Well, that was before we started bounce buffering for untrusted devices. We can't just have a less secure path for them because some conditions are not met. Especially given that most AMD systems right now probably don't have that swiotlb buffer if the IOMMU is enabled. So not freeing the buffer in this case is a bug fix that is needed to properly support the bounce buffering for unaligned I/O to untrusted devices. > I do think that my messaging patch (1/2) may still be useful for > debugging in the future if for another reason SWIOTLB is disabled. I think the warning is useful. For dma-direct we have it in the caller so I'd be tempted todo the same for dma-iommu.