Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1190549lqh; Sun, 5 May 2024 22:30:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTIip0EMtA1Po2upCbKf9sdsi84JSujv2deN8uJhv3iWnC9X6amyTUSd9pBaF8B/YOLW6+epQ73ZNU0pDkQ9yslB4LlLeN7MVSgUX1Aw== X-Google-Smtp-Source: AGHT+IF/mgpijtLekZWZ3QCm98i8H8UipX+suulV3U8ZpTNJU3YF34npJwUAcmMdk7WJUVpGmqsq X-Received: by 2002:a17:906:c00a:b0:a55:6602:e3a9 with SMTP id e10-20020a170906c00a00b00a556602e3a9mr7560962ejz.1.1714973416212; Sun, 05 May 2024 22:30:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714973416; cv=pass; d=google.com; s=arc-20160816; b=XDjIxIZsfVDMdCR242wKzu44cLWX6eGvNeMGANnJ2Xj0lEem/xNEv3142j98Q6Qu5d Qi9MKoGrTTZq6wYnw48lnfr5bbwZQtphRkng9DQBtZ8LB6OnnHiHhaazA7YZrtFzj/fd PgwQ0Dh5aahJcwoNSboKDT8F2H4tcLUAfkqCAtbObRYFWB8esQyq5+shhbbypCeQWBH+ 4UD9nKvMUFen9pLCJzPdzrgl12kSqKxw7+HOE2tLfteD8wJwFK5eldbZ5Ubq0VILbeqS /zme5+u6nntXgS/Y/JDm8NZnWXIgG86e2BHpeaOPzzCnK9HsinZiSQc0pC0v+/tEQ033 yr8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=lCycQnOktJ+ERmG3C5ufzbbDQaXELBbqo4zDBCOL14I=; fh=B333hC9xCkE59XcLjC5u0jlCbhDoV8jWevvBJZJG7V0=; b=LE3pKbcIa00KgsRQwM15Tm0MkjWMxbSgEStcFfNt1rWR7HsCEOv99XP6Udmvlj9uSa 43BwzJVltNIwv6ZmIi5CvVpHh+pXiI6hfa20Sz2adKRyy84QyplxCA8cviEwjx8aiAc7 HijwSG7sBrRBsFQFuR0RbTIvEA46r1vde9MYQ53fLp7CiR38sQUJbjQTN8L15JGQuSbC xC9Gi2yOzY7CLSUspmblUZiqNnLaeCTVpkOUTej7e+UWB6YNFUQgfzMZnvNK+9wLzLtF OLtfOwj4yhskTPjkwbDFKfyqY8/s3JOrlM2gvsVYr5f7v3fqklCuDGmZP/Dca3HyhvvY /r2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-169318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169318-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hv8-20020a17090760c800b00a59d46fa3desi447423ejc.26.2024.05.05.22.30.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 22:30:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-169318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169318-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DEE481F21CB2 for ; Mon, 6 May 2024 05:30:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6119747F62; Mon, 6 May 2024 05:30:08 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83DC240847 for ; Mon, 6 May 2024 05:30:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714973407; cv=none; b=ibRl24M8QQuAMbcQiRxfy/9rugWGkPm116zZtBFHY+BVyBClaeHTncDc98YZZNNAEXeg8BMKD0Gw7L9r1LB4d7cCYNgF075fKmqDrJRK9gNQos1pq1+s6IKN7cZo/SWYL6Rqg2hg3qediAF0yE4tuWbRn+SRUuN9VcpgTskVb4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714973407; c=relaxed/simple; bh=5QJIYROPzjYVnZe39UAx2vuf2t24LGQvIRd1a3Zxh6A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Di2NxNvS8QBVTvgnPdgOua0uG/xODJk8QtGmXhe/FDAXxdpGLSXHP8HiTED0SmB/fun79CWjDoKAghV1ZjeKkk6c5LRz9lv9Hi1RBM/8KkqyItVMqw3/fO8GkWhWLWvWAw+fAWeyvN7wwk01ewp9AnrIgky5m1et/3+jdTe6u8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 75EE8227A87; Mon, 6 May 2024 07:29:55 +0200 (CEST) Date: Mon, 6 May 2024 07:29:55 +0200 From: Christoph Hellwig To: "T.J. Mercier" Cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , isaacmanjarres@google.com, Catalin Marinas , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dma-direct: Set SG_DMA_SWIOTLB flag for dma-direct Message-ID: <20240506052955.GA4923@lst.de> References: <20240503183713.1557480-1-tjmercier@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240503183713.1557480-1-tjmercier@google.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Fri, May 03, 2024 at 06:37:12PM +0000, T.J. Mercier wrote: > As of commit 861370f49ce4 ("iommu/dma: force bouncing if the size is > not cacheline-aligned") sg_dma_mark_swiotlb is called when > dma_map_sgtable takes the IOMMU path and uses SWIOTLB for some portion > of a scatterlist. It is never set for the direct path, so drivers > cannot always rely on sg_dma_is_swiotlb to return correctly after > calling dma_map_sgtable. Fix this by calling sg_dma_mark_swiotlb in the > direct path like it is in the IOMMU path. I don't think this is the right thing to do. Despite it's name sg_dma_mark_swiotlb really is dma-iommu specific, and doesn't make sense in context of dma-direct. If anything we need to find a better name for the flag.