Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp739677img; Wed, 20 Mar 2019 09:51:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWZcA5RJthnE78+Zu7pXtvdf+1MdNYp2uRkTSssxMgL4Joh2J1/F30NDFuc+iijz4kz5FX X-Received: by 2002:aa7:80c8:: with SMTP id a8mr9246526pfn.193.1553100690381; Wed, 20 Mar 2019 09:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553100690; cv=none; d=google.com; s=arc-20160816; b=gYemDi239GVerKLT8Ahg+um446LJRLLBJEfiFh6MpHHGJhiK/XNy44XUPkg7vHiGi1 JrI0K/vinIS4G5e9/XodEs1Irk5clm0qjuxUibaB4ULXpWTEgSP6NjZNEr2lVZiSG64M CSX361KstfFr48/ot3swEABj9VOfs5iaXS8KpVVeq+6SB+x0drIYApGKp3bGm6+EbPLy 9iqt84G/9kC5kn5hBLYCK+VRegUpqdEjkpySMZqq/plCWWhIXc1OJPtYoxatRER4x3+L 9xg4xRDbdOuqN2h5uJ+pEevs/DUy39MVyzFKDuX8CmceP6W9nr9twvSkrT6rfAcBqfD7 SjNA== 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; bh=vNMbkIIC0J6xXhMX98EyDqFQK2cvhRezRt5u7gYSrzg=; b=sVj7+UnkvencqGxVBkZQFD5Oddih0drj0CYf3iwzpaiLRDuVdQbGVYeg8Q622lKVgj hh0oxAY/ZOhUiKrwoRDkQGIMyKbPmrF78OnGSE3A4huU8bFTWWiK0FFIb9mFRWNwinp+ PX5qiPs244yHfqsa3OoI7o3BZIHG6oJazymV7Ue0obOSB7Gs5yvmnmMC+Q7kOdDuaOIz cLgVbyAlSn3bnVu8M+H3Y6tFO6RhJODudOiINnOQtxWcbUSaF3HbTgZ7Sd5X54Ji/U5f jnU9Ox4rjuzqHfOjweMgVfTHZwDEhB87kUw5T0+ZH88yKuKZBzKaO+ayq838bk7bL4rJ EqeA== 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 f10si1979111pgp.528.2019.03.20.09.51.14; Wed, 20 Mar 2019 09:51:30 -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 S1727118AbfCTQu2 (ORCPT + 99 others); Wed, 20 Mar 2019 12:50:28 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:42882 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbfCTQu2 (ORCPT ); Wed, 20 Mar 2019 12:50:28 -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 97C45A78; Wed, 20 Mar 2019 09:50:27 -0700 (PDT) Received: from [10.1.196.129] (ostrya.cambridge.arm.com [10.1.196.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E60C53F614; Wed, 20 Mar 2019 09:50:24 -0700 (PDT) Subject: Re: [PATCH v6 05/22] iommu: Introduce cache_invalidate API To: Jacob Pan , Eric Auger Cc: yi.l.liu@linux.intel.com, kevin.tian@intel.com, vincent.stehle@arm.com, alex.williamson@redhat.com, ashok.raj@intel.com, kvm@vger.kernel.org, peter.maydell@linaro.org, will.deacon@arm.com, linux-kernel@vger.kernel.org, christoffer.dall@arm.com, marc.zyngier@arm.com, iommu@lists.linux-foundation.org, robin.murphy@arm.com, kvmarm@lists.cs.columbia.edu, eric.auger.pro@gmail.com References: <20190317172232.1068-1-eric.auger@redhat.com> <20190317172232.1068-6-eric.auger@redhat.com> <20190320093727.45a86866@jacob-builder> From: Jean-Philippe Brucker Message-ID: <7ae1df77-18d0-0993-8dab-6af3a4474b42@arm.com> Date: Wed, 20 Mar 2019 16:50:07 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <20190320093727.45a86866@jacob-builder> Content-Type: text/plain; charset=utf-8 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 20/03/2019 16:37, Jacob Pan wrote: [...] >> +struct iommu_inv_addr_info { >> +#define IOMMU_INV_ADDR_FLAGS_PASID (1 << 0) >> +#define IOMMU_INV_ADDR_FLAGS_ARCHID (1 << 1) >> +#define IOMMU_INV_ADDR_FLAGS_LEAF (1 << 2) >> + __u32 flags; >> + __u32 archid; >> + __u64 pasid; >> + __u64 addr; >> + __u64 granule_size; >> + __u64 nb_granules; >> +}; >> + >> +/** >> + * First level/stage invalidation information >> + * @cache: bitfield that allows to select which caches to invalidate >> + * @granularity: defines the lowest granularity used for the >> invalidation: >> + * domain > pasid > addr >> + * >> + * Not all the combinations of cache/granularity make sense: >> + * >> + * type | DEV_IOTLB | IOTLB | PASID | >> + * granularity | | | >> cache | >> + * -------------+---------------+---------------+---------------+ >> + * DOMAIN | N/A | Y | >> Y | >> + * PASID | Y | Y | >> Y | >> + * ADDR | Y | Y | >> N/A | >> + */ >> +struct iommu_cache_invalidate_info { >> +#define IOMMU_CACHE_INVALIDATE_INFO_VERSION_1 1 >> + __u32 version; >> +/* IOMMU paging structure cache */ >> +#define IOMMU_CACHE_INV_TYPE_IOTLB (1 << 0) /* IOMMU IOTLB */ >> +#define IOMMU_CACHE_INV_TYPE_DEV_IOTLB (1 << 1) /* Device >> IOTLB */ +#define IOMMU_CACHE_INV_TYPE_PASID (1 << 2) /* PASID >> cache */ > Just a clarification, this used to be an enum. You do intend to issue a > single invalidation request on multiple cache types? Perhaps for > virtio-IOMMU? I only see a single cache type in your patch #14. For VT-d > we plan to issue one cache type at a time for now. So this format works > for us. Yes for virtio-iommu I'd like as little overhead as possible, which means a single invalidation message to hit both IOTLB and ATC at once, and the ability to specify multiple pages with @nb_granules. > However, if multiple cache types are issued in a single invalidation. > They must share a single granularity, not all combinations are valid. > e.g. dev IOTLB does not support domain granularity. Just a reminder, > not an issue. Driver could filter out invalid combinations. Agreed. Even the core could filter out invalid combinations based on the table above: IOTLB and domain granularity are N/A. Thanks, Jean > >> + __u8 cache; >> + __u8 granularity; >> + __u8 padding[2]; >> + union { >> + __u64 pasid; >> + struct iommu_inv_addr_info addr_info; >> + }; >> +}; >> + >> + >> #endif /* _UAPI_IOMMU_H */ > > [Jacob Pan] > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu >