Received: by 10.192.165.148 with SMTP id m20csp336573imm; Thu, 3 May 2018 21:44:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo+ScykIpQC3WqtIXlNKkHEev8SnNY40X81ySfqkGmREuBF1kMty2zidS5zWUN85BULfkKh X-Received: by 2002:a63:a34d:: with SMTP id v13-v6mr21418232pgn.224.1525409041749; Thu, 03 May 2018 21:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525409041; cv=none; d=google.com; s=arc-20160816; b=SDFyhOtKbTyDs3BVho2+Ky0knHVoaLekwqyxQ7h0/hjDVzwy/dPQ1vO5RijbnYdyoP IEpwtDkpXOErBtkldcE4qEijE8IjVisTNTTEg9ybG+zVbyS9ecRcP0N2MAcIxnJHA1e5 8AOO5xALAB5nxJHNUlNb4EV4BBs3JAOXW9y7hoYxaol1Dt8u2sWOtWY3Z6/hb1uYLdMZ chioauthwp9OfOnRcFzwtehOQoS1ZTuA7uyWdCebI/VJf4tpSK0x+FfiwKNc5u7aqynq 2r3eUvZvOTwNwkqqx/Pm4AnjSLWaKCCht/ufSVmTfg2+MM/KTsiW8/H2YZByomb2End+ wAww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=jDxow1AR4SrfaBxdTg1QxNahvHHP5zbWhXh7/Ry3yrk=; b=tEBInbt8gCESbVhsgkXuAviqtH93eYEfbiPppTDNRltCZIEIVkXv9L9cX+OmOgHzVH 3XYUY8qB5vJbyJZ4bnZEVtBiFYW9OaS/gM6VYaZrzfCE3VbLx+RUdnHxPjPotZ7793q+ S2Yj1NoqJoDSzI0ectLyd/S0kUbR1hgKsSz7HhWOQXs4hvoTGXCNmGREHAWpTBhAYXdA eQAYi0+4fjzYjHzXiMDoUkTVqtaEcgC9YuSH1u4Cu4nB1yAZUcMDkSDlm1wYEnHbHl7K fA0Lv3eWvrq0H/o/Y7A0vQxbOOAl3m1zrOD1d6J174XQQ/CCSChK9kjWd62+erGrrsgL wmmw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23-v6si13455617plo.492.2018.05.03.21.43.45; Thu, 03 May 2018 21:44:01 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751002AbeEDEni (ORCPT + 99 others); Fri, 4 May 2018 00:43:38 -0400 Received: from mga05.intel.com ([192.55.52.43]:53799 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbeEDEnh (ORCPT ); Fri, 4 May 2018 00:43:37 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 21:43:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,361,1520924400"; d="scan'208";a="53085446" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga001.jf.intel.com with ESMTP; 03 May 2018 21:43:35 -0700 Date: Thu, 3 May 2018 21:46:16 -0700 From: Jacob Pan To: Jean-Philippe Brucker Cc: "iommu@lists.linux-foundation.org" , LKML , Joerg Roedel , David Woodhouse , Greg Kroah-Hartman , Alex Williamson , Rafael Wysocki , "Liu, Yi L" , "Tian, Kevin" , Raj Ashok , Jean Delvare , Christoph Hellwig , Lu Baolu , "Liu, Yi L" , "Liu@ostrya.localdomain" , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v4 05/22] iommu: introduce iommu invalidate API function Message-ID: <20180503214616.51553247@jacob-builder> In-Reply-To: References: <1523915351-54415-1-git-send-email-jacob.jun.pan@linux.intel.com> <1523915351-54415-6-git-send-email-jacob.jun.pan@linux.intel.com> <20180420181951.GA50099@ostrya.localdomain> <20180423134325.6780f6ac@jacob-builder> <72ee47c4-55fa-4ff1-d94e-cc26203e3eda@arm.com> <20180501155838.4ec3720c@jacob-builder> Organization: OTC X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 May 2018 10:31:50 +0100 Jean-Philippe Brucker wrote: > On 01/05/18 23:58, Jacob Pan wrote: > >>>> Maybe this should be called "NG_PAGE_PASID", > >>> Sure. I was thinking page range already implies non-global > >>> pages. > >>>> and "DOMAIN_PAGE" should > >>>> instead be "PAGE_PASID". If I understood their meaning correctly, > >>>> it would be more consistent with the rest. > >>>> > >>> I am trying not to mix granu between request w/ PASID and w/o. > >>> DOMAIN_PAGE meant to be for request w/o PASID. > >> > >> Is the distinction necessary? I understand the IOMMU side might > >> offer many possibilities for invalidation, but the user probably > >> doesn't need all of them. It might be easier to document, upstream > >> and maintain if we only specify what's currently needed by users > >> (what does QEMU VT-d use?) Others can always extend it by > >> increasing the version. > >> > >> Do you think that this invalidation message will be used outside of > >> BIND_PASID_TABLE context? I can't see an other use but who knows. > >> At the moment requests w/o PASID are managed with > >> VFIO_IOMMU_MAP/UNMAP_DMA, which doesn't require invalidation. And > >> in a BIND_PASID_TABLE context, IOMMUs requests w/o PASID are just a > >> special case using PASID 0 (for Arm and AMD) so I suppose they'll > >> use the same invalidation commands as requests w/ PASID. > >> > > My understanding is that for GIOVA use case, VT-d vIOMMU creates > > GIOVA-GPA mapping and the host shadows the 2nd level page tables to > > create GIOVA-HPA mapping. So when assigned device in the guest can > > do both DMA map/unmap and VFIO map/unmap, VFIO unmap is one time > > deal (I guess invalidation can be captured in other code path), but > > guest kernel use of DMA unmap could will trigger invalidation. QEMU > > needs to trap those invalidation and passdown to physical IOMMU. So > > we do need invalidation w/o PASID. > > Hm, isn't this all done by host userspace? Whether guest does DMA > map/unmap or VFIO map/unmap, it creates/removes IOVA-GPA mappings in > the vIOMMU. QEMU captures invalidation requests for these mappings > from the guest, finds GPA-HVA in the shadow map and sends a VFIO > map/unmap request for IOVA-HVA. > Sorry for the delay but you are right, I have also confirmed with Yi that we don't need second level invalidation. I will remove IOTLB invalidation w/o PASID case from the API. Thanks, > Thanks, > Jean > [Jacob Pan]