Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1133009lqo; Thu, 9 May 2024 05:55:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/VTggHYd2TMLW2eEoydCCBD7vyndyxO66YqVgu67J+RVCBdeWkQ6Fg82KPnk850zHpZGKX++bcqzMM9nGzB9UU4HXNglb6r7tUZ96JQ== X-Google-Smtp-Source: AGHT+IHEk6NOTUCdmsZVsCXX33pms63MyLIGXNTTB2i/38u39k1WVdxfyZEXV08JB/nIEonfL28M X-Received: by 2002:a37:ef16:0:b0:792:9148:96a with SMTP id af79cd13be357-792b26ed516mr528802385a.41.1715259312229; Thu, 09 May 2024 05:55:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715259312; cv=pass; d=google.com; s=arc-20160816; b=Z0LiMszCxV/1GLn74TVmhUWxAGlV/cQRKiNg1tPDHow5s2tr9owBRWm3YV5MDWZvhO gq9zLFLT+pso6UWX6SsKAxZFlP4hQjVeLgChMW3XN0cee3K2E74Xl12V588UTNZSopXS iIJaCPv9Kz6Gh9b5F2norpTsQ7YnHoOSBYDFEcXO4MaODPhOzkUJZwJ9PNq1FcG2i0ia IWDx+CB3Muq3CFHcp5COXQbzMRJaRY/cwTUSRDhJl7dJVqMFzPPOUaIPGzH8PkXU4n2h /amOLI5LEr5uL0MNFPkzuz1UzFKKwD/zYLFjaGhAGHFfgn8ZEH8i65VZi0DdZuafQS/J wCWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=B5Gk4ukoJZQgVG37V/xu+1Ad+tb7stFb8DXVTwS7v/0=; fh=O/8461sMflcAl0ECSya7am5ciOxb52F/925brUI24ms=; b=ZF0jCV4u/GTjPlOUlbjUU8Y7JxLRXWGx+UAY0oLGh3Cg7wYn22dJNZQf38z99km3LX g85R0gc5mjVEJkSm/Vxfm7qnJWzc3UrQosj4tjkP/j9EE9JpZmRI1VQSLhRELddf7J8r whs0R4ceakHfSM22nwBMnZiUZf1rtmTKom01bBcNjEE+Qe4b6LAAl364aqv2Hl9j4IqY wVBhP0CLAAoRiuEv4YBbvSVB0J8TcD6kG2o/mKZ41ceoslIbHRGVFhZ9SbW73ZMfUhan WI6AA/Z3Epvsf/1emJDpsXLnArC7vkdOEh7rm1zQZ6mR674cAwvaRoh3aRzpbetSqSAx Tj7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-174519-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf30b7e7si133340285a.334.2024.05.09.05.55.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 05:55:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174519-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-174519-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EEEC41C22327 for ; Thu, 9 May 2024 12:55:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96BAE147C83; Thu, 9 May 2024 12:55:05 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B01E713B7BD for ; Thu, 9 May 2024 12:55:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715259305; cv=none; b=dhRk4ZybUx0qY41HA00dRzFLU6M/js82cTboOWBLGuFqVI/UPS50csNv97tKaYy8Aw24+La/11OQ14DhUb4YnTg23w6Pxof7S6K+i7CW3+0hvADn2N9ImAtlJCfpnvnxZ1rB3oD9kaXHmBzrldiCNlHZZqqdoOVwuoNjI615yRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715259305; c=relaxed/simple; bh=aSkUfhv6SwKhbFuUelERURNoIkOHYjhPTf9RrMCE0mc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ehgKqrFlhj9uyz5F2TsvasuSAESJOnIcC9E0BJaqlPK5ZnzAIgYJ3utZzuj+keqReWC0oVC97qhNy1MA5gxWEvOGDuhATNRjh8BLtr0wAeN3UJr1ZsMtQ8cE/lHT3HafH2wyJ0nEjvATzuCwJwDm7lo96yrS+KgtY2AxZjgHrZM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 94AC8106F; Thu, 9 May 2024 05:55:28 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3EA1C3F6A8; Thu, 9 May 2024 05:55:02 -0700 (PDT) Message-ID: <1be83f24-15bd-43a4-b310-f62c720cf064@arm.com> Date: Thu, 9 May 2024 13:54:56 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] dma-direct: Set SG_DMA_SWIOTLB flag for dma-direct To: Christoph Hellwig , "T.J. Mercier" Cc: Marek Szyprowski , isaacmanjarres@google.com, Catalin Marinas , iommu@lists.linux.dev, linux-kernel@vger.kernel.org References: <20240503183713.1557480-1-tjmercier@google.com> <20240506052955.GA4923@lst.de> <20240506160244.GA16248@lst.de> <20240506161906.GA17237@lst.de> <20240507054314.GA31814@lst.de> <20240508113353.GA31529@lst.de> From: Robin Murphy Content-Language: en-GB In-Reply-To: <20240508113353.GA31529@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 08/05/2024 12:33 pm, Christoph Hellwig wrote: > On Tue, May 07, 2024 at 01:07:25PM -0700, T.J. Mercier wrote: >> On Mon, May 6, 2024 at 10:43???PM Christoph Hellwig wrote: >>> >>> On Mon, May 06, 2024 at 09:39:53AM -0700, T.J. Mercier wrote: >>>>> You should not check, you simply must handle it by doing the proper >>>>> DMA API based ownership management. >>>> >>>> That doesn't really work for uncached buffers. >>> >>> What uncached buffers? >> >> For example these ones: >> https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/drivers/dma-buf/heaps/system_heap.c#141 > > Whatever that code is doing is probably not upstream because it's too > broken to live. Indeed, at a glance it appears to be trying to reinvent dma_alloc_noncontiguous(). What's not immediately obvious is whether it's particular about allocations being DMA-contiguous; if not then I think it comes down to the same thing as vb2-dma-sg and the ideas we were tossing around for that[1]. Thanks, Robin. [1] https://lore.kernel.org/linux-media/20231228074645.765yytb2a7hvz7ti@chromium.org/