From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70920C433FE for ; Fri, 1 Oct 2021 03:24:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D1C261A3D for ; Fri, 1 Oct 2021 03:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351771AbhJAD0Z (ORCPT ); Thu, 30 Sep 2021 23:26:25 -0400 Received: from verein.lst.de ([213.95.11.211]:33465 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbhJAD0W (ORCPT ); Thu, 30 Sep 2021 23:26:22 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id E0CAA67373; Fri, 1 Oct 2021 05:24:34 +0200 (CEST) Date: Fri, 1 Oct 2021 05:24:34 +0200 From: "hch@lst.de" To: Lu Baolu Cc: "Tian, Kevin" , Jason Gunthorpe , "Lu, Baolu" , Jean-Philippe Brucker , Alex Williamson , "Liu, Yi L" , "hch@lst.de" , "jasowang@redhat.com" , "joro@8bytes.org" , "parav@mellanox.com" , "lkml@metux.net" , "pbonzini@redhat.com" , "lushenming@huawei.com" , "eric.auger@redhat.com" , "corbet@lwn.net" , "Raj, Ashok" , "yi.l.liu@linux.intel.com" , "Tian, Jun J" , "Wu, Hao" , "Jiang, Dave" , "jacob.jun.pan@linux.intel.com" , "kwankhede@nvidia.com" , "robin.murphy@arm.com" , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "dwmw2@infradead.org" , "linux-kernel@vger.kernel.org" , "david@gibson.dropbear.id.au" , "nicolinc@nvidia.com" Subject: Re: [RFC 10/20] iommu/iommufd: Add IOMMU_DEVICE_GET_INFO Message-ID: <20211001032434.GB16450@lst.de> References: <20210919063848.1476776-11-yi.l.liu@intel.com> <20210922152407.1bfa6ff7.alex.williamson@redhat.com> <20210922234954.GB964074@nvidia.com> <20210923112716.GE964074@nvidia.com> <20210923122220.GL964074@nvidia.com> <9a04c421-4a25-f1de-a896-321026b3f0ce@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a04c421-4a25-f1de-a896-321026b3f0ce@linux.intel.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 09:43:58PM +0800, Lu Baolu wrote: > Here, we are discussing arch_sync_dma_for_cpu() and > arch_sync_dma_for_device(). The x86 arch has clflush to sync dma buffer > for device, but I can't see any instruction to sync dma buffer for cpu > if the device is not cache coherent. Is that the reason why x86 can't > have an implementation for arch_sync_dma_for_cpu(), hence all devices > are marked coherent? arch_sync_dma_for_cpu and arch_sync_dma_for_device are only used if the device is marked non-coherent, that is if Linux knows the device can't be part of the cache coherency protocol. There are no known x86 systems with entirely not cache coherent devices so these helpers won't be useful as-is.