Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2706826ybj; Mon, 23 Sep 2019 08:08:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhAivZUd6fZL5gDCjuRS8tV31PZCInKf0UlOJH2X4Lwu2eUkLSwgUvuYk8pSQ5VtsFwRmM X-Received: by 2002:a17:906:d8a9:: with SMTP id qc9mr306523ejb.199.1569251321216; Mon, 23 Sep 2019 08:08:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569251321; cv=none; d=google.com; s=arc-20160816; b=dDq2Yi1jQhssmXxXm1kDkmMaFfy/jwc0lx/uEcPscnwMCjarQrOe9P44MX1P8otS2Q p9t5E9jW3E+P6zBXbELZzKoA3SIRY/JUhmUDLbuaLgTFY5BCr4Sl5qWv959OGPzTv5rG 4UCypEyJnLyvtGcwyPRgmL2XC4J6wgBFt5nbgPvk91N6qqto3RVaZIZ+DklsilEzvUFB zr+AGz3kVnxPcAGdfZsCg9mk7pxAV6YpVylMeiazXV7cIs2q5pV466fKALbmkyjZNcm2 +T5xC26TBuhciHz1uNUc7XYCJ73sQzotJgu00DTIzhzKc24MYtKcHVXZ6e6RO3tg/Md5 RI4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=9vmLAQ7R5a4W7Md1l7Lc9bg9kbsFHm4qVbYqPXDBz0Q=; b=BS276az4xDklcl5JPrdkCBPWA+sM006V6ES+Vrs65i0MO4ODcv8HObdL5tT44NuOtJ HujoRFy9wWuU85VLs/A6xKOjGo/LI3BSVmmVVJi8/Jm3ynLD1RAb/mLcS4Bm1X5x6ehj cJJzhsprap9+1j/kTj84m9r7HgWdxr6YEvOy7PzyRI3JzxHq4jrEN6a+kMNyjynYsF5a jJpWRgR+D1xTQFKEVHSn+dd2rZPKhndPAbt+TChhB7UZykuaJYz2Wkti1PgIPSLy4od9 e8qxrvAlZmp7ss9YVOo2TGiefXNwBc85bgY+wE5KDZXF8G2gUbyDAhiKyOR71JFob878 f7pw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a38si7163892edf.260.2019.09.23.08.08.16; Mon, 23 Sep 2019 08:08: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726922AbfIVADs (ORCPT + 99 others); Sat, 21 Sep 2019 20:03:48 -0400 Received: from mga04.intel.com ([192.55.52.120]:43336 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbfIVADs (ORCPT ); Sat, 21 Sep 2019 20:03:48 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2019 17:03:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,534,1559545200"; d="scan'208";a="192716863" Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga006.jf.intel.com with ESMTP; 21 Sep 2019 17:03:47 -0700 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , David Woodhouse , Alex Williamson , Jean-Philippe Brucker Cc: "Yi Liu" , "Tian, Kevin" , Raj Ashok , "Christoph Hellwig" , "Lu Baolu" , Jonathan Cameron , Eric Auger , Jacob Pan Subject: [PATCH v2 0/4] User API for nested shared virtual address (SVA) Date: Sat, 21 Sep 2019 17:07:46 -0700 Message-Id: <1569110870-12603-1-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This set consists of IOMMU APIs to support SVA in the guest, a.k.a nested SVA. As the complete SVA support is complex, we break down the enabling effort into three stages: 1. PCI device direct assignment 2. Fault handling, especially page request service support 3. Mediated device assignment Each stage includes common API and vendor specific IOMMU driver changes. This series is the common uAPI for stage #1. It is intended to build consensus on the interface which all vendors reply on. This series is extracted from the complete stage1 set which includes VT-d code. https://lkml.org/lkml/2019/8/15/951 Changes: - Use spinlock instead of mutex to protect ioasid custom allocators. This is to support callers in atomic context - Added more padding to guest PASID bind data for future extensions, suggested by Joerg. After much thinking, I did not do name change from PASID to IOASID in the uAPI, considering we have been using PASID in the rest of uAPIs. IOASID will remain used within the kernel. For more discussions lead to this series, checkout LPC 2019 VFIO/IOMMU/PCI microconference materials. https://linuxplumbersconf.org/event/4/sessions/66/#20190909 Change log: v2: - Addressed review comments by Jean on IOASID custom allocators, locking fix, misc control flow fix. - Fixed a compile error with missing header errno.h - Updated Jean-Philiippe's new email and updateded reviewed-by tag Jacob Pan (2): iommu/ioasid: Add custom allocators iommu: Introduce guest PASID bind function Jean-Philippe Brucker (1): iommu: Add I/O ASID allocator Yi L Liu (1): iommu: Introduce cache_invalidate API drivers/iommu/Kconfig | 4 + drivers/iommu/Makefile | 1 + drivers/iommu/ioasid.c | 422 +++++++++++++++++++++++++++++++++++++++++++++ drivers/iommu/iommu.c | 30 ++++ include/linux/ioasid.h | 76 ++++++++ include/linux/iommu.h | 36 ++++ include/uapi/linux/iommu.h | 169 ++++++++++++++++++ 7 files changed, 738 insertions(+) create mode 100644 drivers/iommu/ioasid.c create mode 100644 include/linux/ioasid.h -- 2.7.4