Received: by 10.192.165.148 with SMTP id m20csp417452imm; Wed, 2 May 2018 02:33:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoKyINpPojyYZb6yiCAnYOp3mZqhs3zQQ3B7ZuCI/aqGuwD2hASeKT56LVoEMuuiZFEuNgU X-Received: by 2002:a65:644b:: with SMTP id s11-v6mr15441071pgv.360.1525253630918; Wed, 02 May 2018 02:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525253630; cv=none; d=google.com; s=arc-20160816; b=Wm3VqGStymaTaBofUywqVa6ZzGLO7vxh7yqqx5jRBuMgsLjwcUhm7vRur5zHCkGuy2 gsennifoovhrSrpAOfc3LEjYRr9bIgoVoUZu4qi/YefiHKw+dMDMs9CRbE/gSN4ABHNx zI0CIF5O7hqRhwbrl5Wp4IqHE+Wxs32V5Gre0NkGPZyU9hsPdKGsLKyPEBLtBibPMIqL vRdq896nKLtrj0fmI01cZ02SBtaNpsF1onl1O7U7LF6/MKMJDkf7xoBZmS3COGY2k+0X NLfyDcZht8gTdJv/BwLB21mU9E9Xn8lrpRbVdyVv/mqN8T1wRwnzwoTf/bKN24GPfzR2 JrFg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=VBg0HdZNWzpwc9kslyZevmOaYPNi3RJRrDzA5rDhs+g=; b=lqqdN+HrKeHtyL2J97jA4kcQVzfvmg+0hIYo4K1UjYi26ykyJYKb8uhAKAaNv1D9lY xfZeSArfAgfmyPMeezLe5RA442qM27GfEgTG25KWgg6sCsaP0VJA2z6rRIkbI/IOb7WQ vpWFSaUt2nfGAOQodci4qY5T7uZursX9Pd9N1tsd5DGJpYgVKaKeUiyhOwsf2JNeFQlZ etRei7s+NVhOEB971aVr2S0h+xAf2CipA3t6yVy/rJ6R4VVxsauGCRITg7UnQ4XSTSPb 5WC5HmvtJMOZvla9ipL2yLdA6UvcIriOo9qctY82BxxXlHsTwPasPDYE0vVEQOsOb+80 2Ueg== 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 p15-v6si9040977pgq.478.2018.05.02.02.33.37; Wed, 02 May 2018 02:33:50 -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 S1751152AbeEBJcB (ORCPT + 99 others); Wed, 2 May 2018 05:32:01 -0400 Received: from foss.arm.com ([217.140.101.70]:55358 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750921AbeEBJcA (ORCPT ); Wed, 2 May 2018 05:32:00 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 94BF11435; Wed, 2 May 2018 02:31:59 -0700 (PDT) Received: from [10.1.210.33] (ostrya.cambridge.arm.com [10.1.210.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F27F73F5A0; Wed, 2 May 2018 02:31:56 -0700 (PDT) Subject: Re: [PATCH v4 05/22] iommu: introduce iommu invalidate API function To: Jacob Pan 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" 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> From: Jean-Philippe Brucker Message-ID: Date: Wed, 2 May 2018 10:31:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180501155838.4ec3720c@jacob-builder> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Jean