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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77C12C7618B for ; Thu, 25 Jul 2019 05:44:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B79721880 for ; Thu, 25 Jul 2019 05:44:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391232AbfGYFoT (ORCPT ); Thu, 25 Jul 2019 01:44:19 -0400 Received: from verein.lst.de ([213.95.11.211]:58183 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391212AbfGYFoQ (ORCPT ); Thu, 25 Jul 2019 01:44:16 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 659C368B20; Thu, 25 Jul 2019 07:44:13 +0200 (CEST) Date: Thu, 25 Jul 2019 07:44:13 +0200 From: Christoph Hellwig To: Lu Baolu Cc: David Woodhouse , Joerg Roedel , Bjorn Helgaas , Christoph Hellwig , ashok.raj@intel.com, jacob.jun.pan@intel.com, alan.cox@intel.com, kevin.tian@intel.com, mika.westerberg@linux.intel.com, Ingo Molnar , Greg Kroah-Hartman , pengfei.xu@intel.com, Konrad Rzeszutek Wilk , Marek Szyprowski , Robin Murphy , Jonathan Corbet , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Steven Rostedt , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jacob Pan Subject: Re: [PATCH v5 02/10] iommu/vt-d: Use per-device dma_ops Message-ID: <20190725054413.GC24527@lst.de> References: <20190725031717.32317-1-baolu.lu@linux.intel.com> <20190725031717.32317-3-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190725031717.32317-3-baolu.lu@linux.intel.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > /* Check if the dev needs to go through non-identity map and unmap process.*/ > static bool iommu_need_mapping(struct device *dev) > { > - int ret; > - > if (iommu_dummy(dev)) > return false; > > - ret = identity_mapping(dev); > - if (ret) { > - u64 dma_mask = *dev->dma_mask; > - > - if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask) > - dma_mask = dev->coherent_dma_mask; > - > - if (dma_mask >= dma_get_required_mask(dev)) > - return false; Don't we need to keep this bit so that we still allow the IOMMU to act if the device has a too small DMA mask to address all memory in the system, even if if it should otherwise be identity mapped?