Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4250667pxb; Thu, 14 Oct 2021 01:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiAIJIvln6vI+KvjjfhrdOB3vrY2qL8/7oAUnbpeLXPVidRmQz+z6PvYLJNTpybRm390vJ X-Received: by 2002:a17:90a:858e:: with SMTP id m14mr18981197pjn.1.1634199865200; Thu, 14 Oct 2021 01:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634199865; cv=none; d=google.com; s=arc-20160816; b=ZuwEOx7i+21y5nUxy4Gd0aUcFafG+3eCbtoY7WTZHGz9MlRIGjkNi8ITOUytemQLtP Ls4PgSrGQ+88puFQXKt3F+c3GAbTQrReDxidedXozCKjh35I2CnmED8+XzRTQUo2Gdjr BzAjCXR8J55OrPMZCOLJ32qexcBbN8rfSojjVr/8YkF1zJbN9bnQi7O0tdAnJ/qxEUVF taQwqQe3PhapTv4f2kePQjvFtCX/P5SixxIsBXuEYu51Wb3wkExG/fP23FR/VsjuJFA4 kMhF8NKD7eR/SUd/K1mVuHAI8R1SC0bEEsYCt3RpUg6kxc/vL1HwtCeA7VkhOVLjShAu Zblg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cbsHz+V/xl69wMqIja4cwWI7whJ/S7WwR2zdfRm/dM0=; b=N8Q3eBCgoRSjrEetFOJ1cUYbbJBWqHxLOLd4TM7zZzXBL4npCRuB+rSurrKsBg0Cu+ m1rbL9Km5DddpII3SzjX+3LTKHXq6SR/FyJpvbsIQ2RDa79aHLDwwhnCvo0PQuOM7ggE sfJaeyGx7m9Ex7o6DvvXOU0ZoCWEPQ3Zz4EWGor4MfesU88jrVsequqJyeLjyIUV1ANI 8Eej9ifZv8j+1KL2JrVQuIlre5cvAt8rW9YKhdrmy3QFZK1EXAhJ2l3lFrpIuG0f5VBy AdjFOur93o2hhbZ6DxeXfbHDmriq3mtxbMKq/tdOSbq7/zVvtSEv0mDYNLYYVKURAhmy f6mA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si2877479pfj.196.2021.10.14.01.24.11; Thu, 14 Oct 2021 01:24:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbhJNIYd (ORCPT + 99 others); Thu, 14 Oct 2021 04:24:33 -0400 Received: from verein.lst.de ([213.95.11.211]:49147 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbhJNIYd (ORCPT ); Thu, 14 Oct 2021 04:24:33 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id E172B68B05; Thu, 14 Oct 2021 10:22:24 +0200 (CEST) Date: Thu, 14 Oct 2021 10:22:24 +0200 From: "hch@lst.de" To: "Tian, Kevin" Cc: "hch@lst.de" , Jason Gunthorpe , Jean-Philippe Brucker , "kvm@vger.kernel.org" , "jasowang@redhat.com" , "kwankhede@nvidia.com" , "Jiang, Dave" , "Raj, Ashok" , "corbet@lwn.net" , "parav@mellanox.com" , Alex Williamson , "lkml@metux.net" , "david@gibson.dropbear.id.au" , "dwmw2@infradead.org" , "Tian, Jun J" , "linux-kernel@vger.kernel.org" , "lushenming@huawei.com" , "pbonzini@redhat.com" , "robin.murphy@arm.com" Subject: Re: [RFC 10/20] iommu/iommufd: Add IOMMU_DEVICE_GET_INFO Message-ID: <20211014082224.GA30554@lst.de> References: <20210923112716.GE964074@nvidia.com> <20210923122220.GL964074@nvidia.com> <20210929123630.GS964074@nvidia.com> <20210930220446.GF964074@nvidia.com> <20211001032816.GC16450@lst.de> 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 14, 2021 at 08:13:03AM +0000, Tian, Kevin wrote: > Based on above information my interpretation is that existing > DMA API manages coherency per device and It's not designed for > devices which are coherent in nature but also set PCI no-snoop > for selective traffic. Then the new DMA_ATTR_NO_SNOOP, once > set in dma_map, allows the driver to follow non-coherent > semantics even when the device itself is considered coherent. > > Does it capture the whole story correct? Yes. > > > What I don't really understand is why ARM, with an IOMMU that supports > > > PTE WB, has devices where dev_is_dma_coherent() == false ? > > > > Because no IOMMU in the world can help that fact that a periphal on the > > SOC is not part of the cache coherency protocol. > > but since DMA goes through IOMMU then isn't IOMMU the one who > should decide the final cache coherency? What would be the case > if the IOMMU sets WB while the peripheral doesn't want it? No. And IOMMU deal with address translation, it can't paper over a fact that there is no coherency possible.