Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1335208ybn; Wed, 2 Oct 2019 14:35:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSYGrOVOb7W/047Nx6lk7DPCLMhDOh12nxGMuqEaR6hBxDxs7VTl4mWHMgUGu1joTlgmV6 X-Received: by 2002:a17:906:2cc8:: with SMTP id r8mr4917742ejr.197.1570052103333; Wed, 02 Oct 2019 14:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570052103; cv=none; d=google.com; s=arc-20160816; b=XpLiVLZNfsGM8fmeh8GhdZe/h+nadDb5msNYoMZepHoQP7+7GI19hKDqHi8p2qon5F bsm0jvhjAvvzk06zy/JeDik8wbDZOq7t0gFdCLPrDpOV8Lty8/UTc61GrqOKRYjrFrnV wKbjQMuCJjA3xYUIlYpVudIwy85J5r8jBL8vS/GOA9IQdZKfHi6hZxwiWH9/ETJhE+jx vnIZicmWUYDCdzfAJg0LV7fob5jEuCWHGRRxCAib4mkQ2ruNxt+HnJMYanxmrBs9GZOD tam/MIBCoBKelwbSvCkzQVLbz//NhPgKhK+wznxAacjpQKAYe8QLQLAdW7tIq6xa1gaT 31Ig== 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=B6OfxxhdNK83o3fOf1ZYSNi2OZmGbPtyk8+3z3zZc54=; b=AvdVKBwzGZ41NNUs8ZtizEWsVPSreKerYRNTd6YBMi6uTZclEtfHTStRn2nbe2MoPp PGdPZaSgx2wpZBlVSMUIEqInel6yqettSGRP87HOdP4jwvmsiQuXhU2d1aQAnRsheBU7 UvgYvD1lSZZKA9QPbhFljYwtccQeOWm8pZkyolW+kvr3shHrVCODMIxuw2spBoxU1xrB tYjog4tzH1cKZA7wbj9Njfm65UbcIxY7iBFVTUBJEG4+Y0JFV0Eh7CjutqFq4Q/wkTQ6 8YozxV0YURgJGifKmZOdmMDfAZALPAnP279FuVoMKCTqNY01P9RE3M8z7T/6u98epu8D GN6w== 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 t49si244691edd.198.2019.10.02.14.34.38; Wed, 02 Oct 2019 14:35:03 -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 S1728988AbfJBTiu (ORCPT + 99 others); Wed, 2 Oct 2019 15:38:50 -0400 Received: from mga06.intel.com ([134.134.136.31]:10181 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726087AbfJBTih (ORCPT ); Wed, 2 Oct 2019 15:38:37 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Oct 2019 12:38:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,249,1566889200"; d="scan'208";a="275456097" Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga001.jf.intel.com with ESMTP; 02 Oct 2019 12:38:34 -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 , Jerry Snitselaar , Jacob Pan Subject: [PATCH v4 0/4] User API for nested shared virtual address (SVA) Date: Wed, 2 Oct 2019 12:42:39 -0700 Message-Id: <1570045363-24856-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: v4: - minor patch regroup and fixes based on review from Jean v3: - include errno.h in ioasid.h to fix compile error - rebased to v5.4-rc1, no change 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