Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2101848imm; Fri, 7 Sep 2018 10:48:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbB9LPbffhaZZAOYgo3Tr0BtTcjOWrF6Rf4vbJkBbFJyJdftQWmfe8DDAxixi9RqOOuoqhR X-Received: by 2002:a17:902:e5:: with SMTP id a92-v6mr9144198pla.273.1536342526975; Fri, 07 Sep 2018 10:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536342526; cv=none; d=google.com; s=arc-20160816; b=ublJa2z6fxnhvS3js/eU631SQuhljLuHiIxWNINejItevtrUx7HJ5idQIQf6cstMLO J2l9Y/QVciP2wlMr/prRSEVrMI3CscVHhvBrAXEiN+yWEZSd4FAbHbnR8jSqB1h4/2Kg IBjhGZklZlQFl2YSA8ba0ncvtR1K31QI4ODRPGe9qPIz+y0bhx7w0ZVUHPA9UU0iwyue ZQ2zQo1bK4zSN0Xk9PFZx/mdo7OAgVxXFk+cQ3j7so+0SpeDcAJ40vUfMQqCfsTTRK87 /Lj5zddJESb+IaRWYX/kWcLX6bMGj4hMsu3Y9f1JCwm4jhtsuQlzkPQqOSs+hHG/nrmI /rTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MexQ4CVtPV+D2QH/uJL7KY66os80DfRYWJxAIlwFqPg=; b=tc2dxy1I1Ent8N0l4nax30iSPW4MNoCUl92awf1dEPb9KmrM+AtIgmfBkhj3FXew72 xvFUlHtaWyZrN4jxEDsyqRYSrbsAUrZXfH3Ur4I00dgBkfjJCo50hvPv9ZvaUFOkRjRf dCXDZNV5IERUW7oJfNiZ538BiExp/UlKT3gx6Ky/9s42X4aUKSpNqo6B6Ul3gjG0KYlF M+wmCVx8JAU74feZfXgq+7r6LoB2GdNu9R0oX9QKhuEqEFNUSQ7q9E36CkHOTMJohDPg pICk0N/X3mRJN4UH2MLs18xHJtHLmkkrEmMiRPTtl4lqzllc8DK1a5GQrYkcXy+NB5H0 wgNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1-v6si9074503pld.322.2018.09.07.10.48.30; Fri, 07 Sep 2018 10:48:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727261AbeIGW3X (ORCPT + 99 others); Fri, 7 Sep 2018 18:29:23 -0400 Received: from mga06.intel.com ([134.134.136.31]:9706 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726929AbeIGW3X (ORCPT ); Fri, 7 Sep 2018 18:29:23 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Sep 2018 10:47:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,343,1531810800"; d="scan'208";a="261623139" Received: from otc-nc-03.jf.intel.com (HELO otc-nc-03) ([10.54.39.32]) by fmsmga006.fm.intel.com with ESMTP; 07 Sep 2018 10:43:27 -0700 Date: Fri, 7 Sep 2018 10:43:28 -0700 From: "Raj, Ashok" To: Lu Baolu Cc: "Tian, Kevin" , Joerg Roedel , David Woodhouse , "Kumar, Sanjay K" , "Pan, Jacob jun" , "Liu, Yi L" , "Sun, Yi Y" , "peterx@redhat.com" , Jean-Philippe Brucker , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , Jacob Pan Subject: Re: [PATCH v2 06/12] iommu/vt-d: Add second level page table interface Message-ID: <20180907174328.GA95061@otc-nc-03> References: <20180830013524.28743-1-baolu.lu@linux.intel.com> <20180830013524.28743-7-baolu.lu@linux.intel.com> <331eef29-ae41-2d36-9487-265d773aae5b@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <331eef29-ae41-2d36-9487-265d773aae5b@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 07, 2018 at 10:47:11AM +0800, Lu Baolu wrote: > > >>+ > >>+ intel_pasid_clear_entry(dev, pasid); > >>+ > >>+ if (!ecap_coherent(iommu->ecap)) { > >>+ pte = intel_pasid_get_entry(dev, pasid); > >>+ clflush_cache_range(pte, sizeof(*pte)); > >>+ } > >>+ > >>+ pasid_based_pasid_cache_invalidation(iommu, did, pasid); > >>+ pasid_based_iotlb_cache_invalidation(iommu, did, pasid); > >>+ > >>+ /* Device IOTLB doesn't need to be flushed in caching mode. */ > >>+ if (!cap_caching_mode(iommu->cap)) > >>+ pasid_based_dev_iotlb_cache_invalidation(iommu, dev, > >>pasid); > > > >can you elaborate, or point to any spec reference? > > > > In the driver, device iotlb doesn't get flushed in caching mode. I just > follow what have been done there. > > It also makes sense to me since only the bare metal host needs to > consider whether and how to flush the device iotlb. > DavidW might remember, i think the idea was to help with cost of virtualization, we can avoid taking 2 exits vs handling it directly when we do iotlb flushing instead. the other optimization was to only do devtlb flushing when you unmap since when establish not-present to present there is no need to flush devtlb at that point.