Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp449lqh; Mon, 6 May 2024 09:22:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSyzToc15dtIXz3RzKZBdqearrIwT/iHtYvIMgh+mk61PE3bmw6PsWnmLYIUDkyZZjEgyyYjTuVQCN6ucmLZ5MGcaSa4uh8YKJD9Qvpw== X-Google-Smtp-Source: AGHT+IH0AXfe/WvedBoIOVSAdSNaXeqTXeukS8kN27PatWxMa6FY3mA62O1cF4+0Y3lRwwLoWsxv X-Received: by 2002:a17:903:2306:b0:1eb:1af8:309f with SMTP id d6-20020a170903230600b001eb1af8309fmr16820328plh.4.1715012541915; Mon, 06 May 2024 09:22:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715012541; cv=pass; d=google.com; s=arc-20160816; b=o3XYyZLr7vrS0JeclnMwzYVr580N+/kAktromI7FMUN8mB0anEDROhv+qzPCoEcgvk X4u67w9qzr7cseh3MVBt/RWshFsDY1ePKoHZwkyoE8rEN62BYI7Zrp9HnBaKVP1l8BY3 z8+0cuvumMan/lPu0UPJwuGM2GEF0AFUhzMJm8Rzz8y0jV++G83yufIqXC/RdSoDQSEk Q4JXMj9C7PB20IcxUPMgUWVexMfg2aDVtrAgLM3YBL1rfThWHR+4KIGcHoIKsx9PXR6s 6UhUkJZYyigDgj1fY6gC/iCxhO+po0kFIs2+6Ul1Eyed19sEAOVWaRGba/HwZyiG0dok FDwg== 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=yu2mKKUX6quMfU0Xhpdbju7RJ000UbBgqpaw773JHlw=; fh=B333hC9xCkE59XcLjC5u0jlCbhDoV8jWevvBJZJG7V0=; b=gmA4Yzdiu2lip7dZTwWLxUgfnVDdUGekIXOz1vYxygE7rmL+vnzTq5+fxZrt/IeNa5 NW+B9CbPP6jQjzn+Vd6YEzvFUBmyiWfylKzNgWP6y33dE3M9tNvgQrLj+YwscbXFbXd1 0HhP4fI7rajzv6Hjzv50efv4DWUxfZwHIG838RN+CQLBfwCdaMAlMeFUhDjO/yc2Wn1F 4zFYasr8rcPCobbPB9290x/Apr2wSQ+KhwaKwFKhkVSwRmPxV2GhkrcJTLYuYWSXEf2T 6AHMPxK+UsCiEPWxCcvrr+JUPCcwJ4DhlndIxVQWWq4++Dc3PaQY3lwnXllXt0QuVaYB tLXg==; 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-170151-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170151-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d5-20020a170902654500b001e589307a33si8232951pln.652.2024.05.06.09.22.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:22:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170151-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-170151-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170151-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C0A58286A6B for ; Mon, 6 May 2024 16:21:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6404156F39; Mon, 6 May 2024 16:19:12 +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 E3EC841C84 for ; Mon, 6 May 2024 16:19:10 +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=1715012352; cv=none; b=mcJa4bKxbzeSb9QI1O3rlE4YoyEnLzpgfKx6ZBo7C4YL3AuIPFcOV7qjdMqMijXci6rITmrrT9NC1TuoTwKcWwdyg084grdmqGFbvkuGoFP3AckZTyQox9WKTiINJ9CWe/eW4mXpBKHXO4X7gwWYjWDtgwMH81T5Lpf7Qr/yBJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715012352; c=relaxed/simple; bh=yu2mKKUX6quMfU0Xhpdbju7RJ000UbBgqpaw773JHlw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Zsnm9yQbu5U+bBzrxgx79LM72C4Ja+tMH3ydIilVqDgjhiC3ilDagD4UC5xFV5qT9y3f0Pgna0NKaZz8POGAnu+JjvipIMj96PmaMhdCvqaZN6AcBAkxjDA2L+n2KFtQ4nSNNIe+ReaCefacuwALVp2CSy98OBadxY9svqAUrn0= 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 04247227A87; Mon, 6 May 2024 18:19:07 +0200 (CEST) Date: Mon, 6 May 2024 18:19:06 +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: <20240506161906.GA17237@lst.de> References: <20240503183713.1557480-1-tjmercier@google.com> <20240506052955.GA4923@lst.de> <20240506160244.GA16248@lst.de> 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: User-Agent: Mutt/1.5.17 (2007-11-01) On Mon, May 06, 2024 at 09:10:40AM -0700, T.J. Mercier wrote: > I want to reject mapping a dma_buf for a device if any of the pages > that back the buffer require SWIOTLB. AFAICT there's no way to know > whether SWIOTLB is used until after calling dma_map_sg, so afterwards > I'm trying to check. You should not check, you simply must handle it by doing the proper DMA API based ownership management.