Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp744658pxa; Fri, 21 Aug 2020 21:29:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3IVEPE8xNxkk+Dyh2nWszNCvKfViQT1LgUGSrAshB4gFhLkVvNsStnlFBkMqDtLfvCKJV X-Received: by 2002:aa7:d70a:: with SMTP id t10mr5771545edq.68.1598070566453; Fri, 21 Aug 2020 21:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598070566; cv=none; d=google.com; s=arc-20160816; b=FAOjj2j6HWWs6nDE3r6qgx9B08F0aKdLN0oRj43y59X8R7bSS9P7fxcUh/+qBshC/a pMrEWTHY5VkVrC/WgC03tkb8dd8D++jN8IYfXLwuP2vlxRv5571UxffYP6izijIjCjKj fPjA81Md4VZXS9mBw90FjZNeVt76vkpBrCHNmoEBUAeh697ht+TO0VWZ/yiOhynGJ3tY +5NMRxlIvqIk9/X1b6tncOpJujTUVttHKG6B3TFrrbd7SfKQ9bvu6o9msHDf/s68mlIg xCjXaWzRDovLeRofKxFdYOmKhoBGnKAGXO9bTJbMRH7dSmMaWHpmzbzo512QTmVwOiYp XZ2Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=YYpeb/PkPwRbYOwET4nNHLv4kDK8jDR1mJWP198+wu4=; b=Zz3YOHR2c52xswy2xKM012GCfExTbkNpLmWsD15MTndDrqtujqqV9bftmsdCAFfyBD 9G7UAr4SToTW7SNbBJfCfyxgRJl0JtiToQVNu1409sxOIIevnZ+BQF3uZ6mxAa2WeEk5 diykwrm4+HvnoJ9EK44A1YmeUMIgh66U2NAAttTdHD7ibgAlDmTlGmKi6l6hxmQu7sWO CFGiFmXBhrwDx89PT+s0J9Tb4dAYP1Wvgyn6FETaNVTcqRysCaM2MnhxvGLiJaqeOQbK IuTPNqWCGvfBDHojY302ZOA0NVDPKTRkEUeSs781c/oOB2rEe8k5Cu4YlO2GSumsUb3o 23Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=loWFE4rM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si390786edq.495.2020.08.21.21.29.02; Fri, 21 Aug 2020 21:29:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=loWFE4rM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725856AbgHVE2X (ORCPT + 99 others); Sat, 22 Aug 2020 00:28:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbgHVE2W (ORCPT ); Sat, 22 Aug 2020 00:28:22 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D57C7C061573 for ; Fri, 21 Aug 2020 21:28:22 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id q1so1675938pjd.1 for ; Fri, 21 Aug 2020 21:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YYpeb/PkPwRbYOwET4nNHLv4kDK8jDR1mJWP198+wu4=; b=loWFE4rMVDX8IGXeu/alOJRUkonwP9feeX6uYFVfzGYkUYTqL0rN1TSZox0V/jBcyE ST0IcVmRzqfvHAw59t0VXChNV9zmzKHttulB69GBPiMG+Zrf25IK179q5Z+pPQY+X69a BdTrJxCFPs99S9DEJGUsAljDdRDO0zuWgQeODz3iY3GcIi6iqLbsT22dMqgr/ZA+7ulJ fDeI4TBx18g9TnJnrtonVP9OLRI2oiJt32HScRYg4A3t22ALg9tfafoLn+MEo+T0Xeho kg7zMvakUzqOY6fTRrb/HvAKBjQJ99Iww5ownAxZe1ZpugIu1tbk8qh1uF/Uxe0VkhJZ B97g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YYpeb/PkPwRbYOwET4nNHLv4kDK8jDR1mJWP198+wu4=; b=Z2DSw3G71JEeJnoFsdTKvgmRV1Z4zu8zPycGSMuTgGKrZFGF810diVIMyLNkyHcUj1 lV1oTasODgBjhC3/TMAybZMYuyRCI2DHiVWiOMrLbLVMAkDb8hSjca+kDOroEwG7QhCH eUJ+OG4AZbQPt+ik1v3C0SkW9G9Sd6x/iKs2Mgobd9Y73hUFZnjgFPXYvhhf1r2Mzz7j qBmDPGxAp+MzxYR47whkHBfsGSSj1tIUg3MWVOBklQJV80lTjKn7SKWnr54wTeSWOhgV 607tXSsUrZ/FTPuai0O63fXk/sqEXykNbWDLdmQjBuCDkI/Lln0NHyK0Owvd1EfGRWqq x/bw== X-Gm-Message-State: AOAM5308v0FufrUoEo/DQkcTiuXpgvjoatW+QNLsPhsCwuGuxLuplJgu BPf6MHWicT3fkwqpa8t0Bu4= X-Received: by 2002:a17:902:690a:: with SMTP id j10mr4872494plk.155.1598070502310; Fri, 21 Aug 2020 21:28:22 -0700 (PDT) Received: from jacob-builder.jf.intel.com ([192.55.55.43]) by smtp.gmail.com with ESMTPSA id q5sm3341582pgi.31.2020.08.21.21.28.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Aug 2020 21:28:21 -0700 (PDT) From: Jacob Pan X-Google-Original-From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , Jean-Philippe Brucker , "Lu Baolu" , Joerg Roedel , David Woodhouse Cc: Yi Liu , "Tian, Kevin" , Raj Ashok , Eric Auger , Wu Hao Subject: [PATCH v2 0/9] IOASID extensions for guest SVA Date: Fri, 21 Aug 2020 21:35:09 -0700 Message-Id: <1598070918-21321-1-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IOASID was introduced in v5.5 as a generic kernel allocator service for both PCIe Process Address Space ID (PASID) and ARM SMMU's Sub Stream ID. In addition to basic ID allocation, ioasid_set was defined as a token that is shared by a group of IOASIDs. This set token can be used for permission checking, but lack of some features to address the following needs by guest Shared Virtual Address (SVA). - Manage IOASIDs by group, group ownership, quota, etc. - State synchronization among IOASID users - Non-identity guest-host IOASID mapping - Lifecycle management across many users This patchset introduces the following extensions as solutions to the problems above. - Redefine and extend IOASID set such that IOASIDs can be managed by groups. - Add notifications for IOASID state synchronization - Add reference counting for life cycle alignment among users - Support ioasid_set private IDs, which can be used as guest IOASIDs Please refer to Documentation/ioasid.rst in enclosed patch 1/9 for more details. This patchset only included VT-d driver as users of some of the new APIs. VFIO and KVM patches are coming up to fully utilize the APIs introduced here. You can find this series at: https://github.com/jacobpan/linux.git ioasid_ext_v2 (VFIO and KVM patches will be available at this branch when published.) This work is a result of collaboration with many people: Liu, Yi L Wu Hao Ashok Raj Kevin Tian Thanks, Jacob Changelog V2: - Redesigned ioasid_set APIs, removed set ID - Added set private ID (SPID) for guest PASID usage. - Add per ioasid_set notification and priority support. - Back to use spinlocks and atomic notifications. - Added async work in VT-d driver to perform teardown outside atomic context Jacob Pan (9): docs: Document IO Address Space ID (IOASID) APIs iommu/ioasid: Rename ioasid_set_data() iommu/ioasid: Introduce ioasid_set APIs iommu/ioasid: Add reference couting functions iommu/ioasid: Introduce ioasid_set private ID iommu/ioasid: Introduce notification APIs iommu/vt-d: Listen to IOASID notifications iommu/vt-d: Send IOASID bind/unbind notifications iommu/vt-d: Store guest PASID during bind Documentation/ioasid.rst | 618 ++++++++++++++++++++++++++++++++ drivers/iommu/intel/iommu.c | 27 +- drivers/iommu/intel/pasid.h | 1 + drivers/iommu/intel/svm.c | 97 ++++- drivers/iommu/ioasid.c | 835 ++++++++++++++++++++++++++++++++++++++++++-- include/linux/intel-iommu.h | 2 + include/linux/ioasid.h | 166 ++++++++- 7 files changed, 1699 insertions(+), 47 deletions(-) create mode 100644 Documentation/ioasid.rst -- 2.7.4