Received: by 10.192.165.148 with SMTP id m20csp4133531imm; Tue, 8 May 2018 03:36:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoDkW+Hxnat7RmLg4WJeNZXV7k37HkpKY4AT+8TUQO/G369/l05Epih+CYnrkYBLH5tBZGa X-Received: by 10.98.163.145 with SMTP id q17mr39770131pfl.87.1525775761453; Tue, 08 May 2018 03:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525775761; cv=none; d=google.com; s=arc-20160816; b=lLKhpI9XpyqwCykD0KFc63kQWQtNTPb5XZim6cVFnX/nTr3mvjVq0fvzazsb7iuqhh iVwdCoprmj9j+f4HYC8Amk8dckImUHX0c9m1KZaJMhuPtM7tc6TqCB90nwz6uEIfx1sV Dp3c1DIecqQqgoio+amIt5BJLYMrt6+AWEJQv9H1ubbpcVFpzDlH9C2levLQnvSh8M71 as6+Pp8jQdi1bdxW7IR58Mj+irtUozWtaShQzLk/hvucwfhzVBEbbu7kDY1uAy4zCTq0 9H9BjyEQy0Z7ivfynof2E0yoYkmCrW+Mr4C0s2nVcoUj3h8n0SepslqhXyna9gWuLQB3 3+lQ== 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=hRMHQj+c6pODQWLThm6URuSoUmrCPVD1myxCGmPvDwc=; b=mYA11eQFqFQ8068qEldxWynH7uhITyg8O/V8wHpi7RE7JcnoqrMaAcYhe3mBXPTbJ9 T25j2bsmsFYATrzh1kBrfPzYweqKZezp1D5jjez9MqY0Imtytp6vtpxZ+87OMqJnC2pj gv9GBhLiJI26s1lTyxcVX7zzeDxUADuqNcx5pEl7oleXREigXtUCoAlSl9CnRqlOjWq2 4LpYBh2NSfUCSa0gpzJTwaEJZjHHcarj/b6VqjTRHDj4duTwmHB/PYwocXvn/8oP69aZ aeYn47qVP+9QvBLyqqrQXEX2L4wUiMOuNlNKrh0e7ny5gHiCsNSOeoHGawgkWl/aYKS3 yFNA== 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 f18-v6si19136762pgt.63.2018.05.08.03.35.47; Tue, 08 May 2018 03:36: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 S1754812AbeEHKfM (ORCPT + 99 others); Tue, 8 May 2018 06:35:12 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55726 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754408AbeEHKfL (ORCPT ); Tue, 8 May 2018 06:35:11 -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 A6B901529; Tue, 8 May 2018 03:35:10 -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 157373F592; Tue, 8 May 2018 03:35:07 -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> <20180503214616.51553247@jacob-builder> <20180504110706.3392a98e@jacob-builder> From: Jean-Philippe Brucker Message-ID: Date: Tue, 8 May 2018 11:35:00 +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: <20180504110706.3392a98e@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 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"? > * 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. > * > * 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. > * 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 Thanks, Jean