Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1486787lqh; Mon, 6 May 2024 09:03:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXN1zpCxHoY1i+kqyf18Fgb87juwPc6Gy0g4tnIiOytEUZ2yGlv2PM31EAe9g+ug2furkEBqBmcrGEVhbDBBqhtlAEQd80yttVqdUKvcQ== X-Google-Smtp-Source: AGHT+IFG4YVPlV4I7DQrpSbLPD+mPOfc1UPJIAf/pevnnIRWUrKXte/OrFj9gLlCAfjRcK7xbnJ7 X-Received: by 2002:a05:6870:d88f:b0:21e:b8f7:9a1b with SMTP id oe15-20020a056870d88f00b0021eb8f79a1bmr11331194oac.25.1715011414844; Mon, 06 May 2024 09:03:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715011414; cv=pass; d=google.com; s=arc-20160816; b=z9HWiBOXrGrpuqoI7Wlt93UXoTzxq9CKYswm41YXI2RSvhoH3FtCd+xMY4Ptft+e3O fMhrky+fVMhxeyqIi5NUoKfoY9esCb4eSZuV2kK49RCKwJp7wOmy+MzfXHtYL8aljFhX oWXHce7cw47i6XY/eBUPF9g8krIhtsxwVpVm1wI7VwGw7O3E1SImKSV0Jsu92ss+lVnG 1FJ5iAUo6avwWp6S8TnLSkuOPgZeSkps4MMZFRzGiqLAtjQlXmS4g5vHup5copDV6g9P QODHoHu89mupbfsM/+BtqW2MHIS2EdwOUt1s37DlAYK1Zynvo+SrEIlFQyhiAjt2EJw/ YcRg== 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=OI8KG/TB2fyLxGUXJt61azWoxL/nJOPaaHOvTpcrmoc=; fh=B333hC9xCkE59XcLjC5u0jlCbhDoV8jWevvBJZJG7V0=; b=eeDadIxYmqzYtN2L9XSxaSj6HSl2YZERZrAXL6yQNZ84tzGb6YUpYOo+2gBeCBYxc7 NS0C1wNNv9k0rkxciUey6wsuMf70622D9um2ohAfyb++btIE0Sj0DHVSGcjO5mHzqv5B 9A4LGwtqUd6HlqGDtACplY47wEfoKNMha9iEGUpldBOXnmeAzPpnYxOPA9BDElVJM5tM EHe43WY+KJD+R0UzRmeBXL1WzdItBEgO0uZnvN57NpNAYMkfmaWnMsvWMd4nm2PSP3VV zJYuoctjER/LoPS5rLJsRdNNYvVEykN4oYtO9pgu8G6Sqvxhlfs+2s+f6PseCxvpjygM UwyA==; 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-170120-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170120-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 fs3-20020a056870f78300b0023f45f399e0si1319960oab.167.2024.05.06.09.03.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:03:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170120-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-170120-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170120-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 A22B62854EF for ; Mon, 6 May 2024 16:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B069A155A47; Mon, 6 May 2024 16:02:57 +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 994181553A7 for ; Mon, 6 May 2024 16:02:54 +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=1715011377; cv=none; b=QDgw2CuMPxn3WwvMcwA5mGHX+EvRU1sKOEdDayq/A6/mCUod3Oocz/XKR91MIEYZEEfl+U4dh/rmHFge/pvDZYThYnRXYgA22f4+Ivmo3lhZ3EJL+ZKx/yvPkoK1xnxXCGUN2I9kic/9wSKBuDKJeORpmgelH/IMg+qp7ACgWJ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715011377; c=relaxed/simple; bh=v5x3U+x8DQXfwQO2ShgOACnPVHyFVvdqv8MMZOJHQJM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mtsuHWSqTTHgU2g8F+OUwlu61kI3g8XNi22RTTH2lydgJhvh2ZnIq1elfx2bJW8VciGpavXHHvy7OFIBPZHgzSHynt4UZ3WEJeJQ7EDTPjsTjyUz7uEwDNgxQo8mNFUH21IA9jn7inWoBZLnxJwyIl4cLBN4wKC42kDk8gOOpzg= 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 B4053227A87; Mon, 6 May 2024 18:02:44 +0200 (CEST) Date: Mon, 6 May 2024 18:02:44 +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: <20240506160244.GA16248@lst.de> References: <20240503183713.1557480-1-tjmercier@google.com> <20240506052955.GA4923@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:00:59AM -0700, T.J. Mercier wrote: > Oh, that's disappointing. I'm looking for a way to quickly check if > any addresses point at a SWIOTLB buffer without doing a potentially > expensive call to iommu_iova_to_phys. Since it's meant to be dma-iommu > only I guess I could use sg_dma_is_swiotlb if iommu_get_domain_for_dev > returns a domain, and is_swiotlb_buffer otherwise for dma-direct, but > it'd be nice to have just one way to check which it looked like the > SG_DMA_SWIOTLB flag could be used for. This sounds like you're trying to do that from a consumer of the DMA API, which is simply wrong. What is the actual problem you are trying to solve?