Received: by 10.192.165.148 with SMTP id m20csp5482756imm; Wed, 9 May 2018 05:53:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrnmvIVNf8AajAbwFlOH1pX79bXshdcZUEStk9PiPfwbWnFfQJ5xNEXGpinoH4prWgXsLSp X-Received: by 10.98.30.2 with SMTP id e2mr31618974pfe.212.1525870421093; Wed, 09 May 2018 05:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525870421; cv=none; d=google.com; s=arc-20160816; b=jqcm76bxQ4itbqGTJszl613FOE5erbkwGeUGYO4936c5bEvqjFT28N0wq2rz4qODYX en/Zc8p0PhP+8lD/Ib4z3znoJSGa0hDcLU1Wbpc7yDmVO/nKuuL/IXP/02dgJF/k05Dm Q0K6fufSOOOM9RzH6gkp/DI67jJn5ky5UFOhF0Jgmuq3XTuzbOrxM6kMMDOw1EGf6ZAq JUMDVXDbRnewVo4XQBbQ/Z1iECpmN0/k1If5c/8MLPXuL+dsmVIy/xE6/4ySj/+vbsCa ngs+cE/RUYxHFkVTeBN86gEAsMTdNrjORTRUPVyhmus1coc1TW2t34CHZQyE2JOJrmMU FmOg== 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=sZ3PTxxJpmEVxKM2xwhPDKBcG8CHHX5IFkN9Z2znJrM=; b=HvCdLT5Ne58Fp8LmCmoEUmG+7BDA19Qbdme1jZPxQY0ZQt23aAJZDKgd2B3obwVWhS In8zwYy0l/EDlXYmiTVbph2K8RGsNv6qWXTgEFybyPgF4twWAVitG5HnBJl1hjtq5R6b fVP1zFtauTYJYTDb+QzpgErq5W0EvsnnXw3xwDKQwAB9wOz6qvis6d0oF8IhCyitndEC HgO43wxTKIe4gjb9BMdS1KmGM/OLpiDAgvWDd6E94oaexUk3cFq3CGmvAC8USDMU6sdu D/RHO1z3nfM+ILsvB3EA9JFpIFybKKs65p3eTNAWV2W53Q2f5vAg+YCoxNOLQffElPQ+ akpw== 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 w6-v6si21188591pgb.481.2018.05.09.05.53.26; Wed, 09 May 2018 05:53:41 -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 S934801AbeEIMws (ORCPT + 99 others); Wed, 9 May 2018 08:52:48 -0400 Received: from mga04.intel.com ([192.55.52.120]:31712 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934328AbeEIMwr (ORCPT ); Wed, 9 May 2018 08:52:47 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2018 05:52:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,381,1520924400"; d="scan'208";a="49481240" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga003.jf.intel.com with ESMTP; 09 May 2018 05:52:46 -0700 Date: Wed, 9 May 2018 05:55:30 -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: <20180509055530.166ab2a6@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> <20180503214616.51553247@jacob-builder> <20180504110706.3392a98e@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 Tue, 8 May 2018 11:35:00 +0100 Jean-Philippe Brucker wrote: > Hi Jacob, > > Looks mostly good to me, I just have a couple more comments > > On 04/05/18 19:07, Jacob Pan wrote: > > Now the passdown invalidation granularities look like: > > (sorted by coarseness), will send out in v5 patchset soon if no > > issues. > > > > /** > > * enum iommu_inv_granularity - Generic invalidation granularity > > * > > * @IOMMU_INV_GRANU_DOMAIN: Device context cache > > associated with a > > * domain ID. > > * @IOMMU_INV_GRANU_DEVICE: Device context cache > > associated with a > > * device ID > > * @IOMMU_INV_GRANU_DOMAIN_ALL_PASID: TLB entries or PASID > > caches of all > > * PASIDs associated with a > > domain ID > > * @IOMMU_INV_GRANU_PASID_SEL: TLB entries or PASID > > cache associated > > * with a PASID and a domain > > * @IOMMU_INV_GRANU_PAGE_PASID: TLB entries of > > selected page range > > * within a PASID > > * > > * When an invalidation request is passed down to IOMMU to flush > > translation > > * caches, it may carry different granularity levels, which can be > > specific > > * to certain types of translation caches. For an example, PASID > > selective > > * granularity is only applicable PASID cache and IOTLB > > invalidation but for > > * device context caches. > > Should it be "PASID selective granularity is only applicable to PASID > cache and IOTLB but not device context caches"? > right, thanks! > > * This enum is a collection of granularities for all types of > > translation > > * caches. The idea is to make it easy for IOMMU model specific > > driver to > > * convert from generic to model specific value. Not all > > combinations between > > * translation caches and granularity levels are valid. Each IOMMU > > driver > > * can enforce check based on its own conversion table. The > > conversion is > > * based on 2D look-up with inputs as follows: > > * - translation cache types > > * - granularity > > * No global granularity is allowed in that passdown invalidation > > for an > > * assigned device should only impact the device or domain itself. > > That last sentence is a bit confusing, because "global granularity" > might also refer to the "global" TLB flag which is allowed. In my > opinion you can leave this rationale out, I doubt userspace will ever > demand a mechanism for global invalidation. > yes, i can leave the last sentence out. > > * > > * type | DTLB | TLB | PASID | CONTEXT > > * granule | | | | > > * -----------------+-----------+-----------+-----------+----------- > > * DOMAIN | | | | Y > > * DEVICE | | | | Y > > I can't really see a use-case for DOMAIN and DEVICE. It might make > more sense to keep only DN_ALL_PASID, which would then also > invalidate the device context cache. But since they will be very rare > events, factoring them doesn't seem important. > ok. we have no use for now either, was there for completeness. i will remove for now. > > * DN_ALL_PASID | Y | Y | Y | > > * PASID_SEL | Y | Y | Y | > > * PAGE_PASID | | Y | | > > Why not allow PAGE_PASID+DTLB? We need a way to invalidate individual > DTLB entries > I was thinking PAGE_PASID+TLB includes PAGE_PASID+DTLB, but you are right, DTLB should be a 'Y' here. > Thanks, > Jean [Jacob Pan]