From patchwork Tue Sep 26 09:31:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Liu X-Patchwork-Id: 14519 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1787895vqu; Tue, 26 Sep 2023 02:42:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGzFt+tIDSDFPtKOWz3p6mYHm9MgyCZjc1qju5ATgztJCS/y6Hvb44Wh0ZjNSPqzlaDSur X-Received: by 2002:a05:6808:18a:b0:3a8:5133:4832 with SMTP id w10-20020a056808018a00b003a851334832mr10786567oic.23.1695721351645; Tue, 26 Sep 2023 02:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695721351; cv=none; d=google.com; s=arc-20160816; b=CXkMdI0J84EcGHLhEwy1uMVKgUCcq6vn2yQTKovQcvBdpxiW/H61hEP91TFg8g1vkO FVjLLRzRbgz7tbolDnlnxDxFF7evdVFX7bqjN6XN7T77pmFKBK6/rM+5TcoQUckgWVSx EhshYuJ4XXXnmTNH7S2zxrzBJx4N2KLXkG7f6MXnpWdJMwO86KQ0oHo/Vr58gMXxdd8Z MsUz0v4uMrSYVZW32PBxUxotkNvMa2hReN49F99UGw2t3yau8YW0BgfHjFKULhyOPIrx QcQR0Ion1Fw5fz+ldKxskr6qWczgUFCzGIecFjY44fA69/Gp/CcX0vGiZPxO68kFUfFJ Miqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=SdRWnE58teYhv8+vERfyDCIqv9XNF/hWFZxku2/sCKI=; fh=Kv+cxc+457xZThbZHBdHDWxamNAAkIiByoci0wEvMsM=; b=YL4deIwSQj6nAdjVpRRBrZiKXQLCSrdup7ciR5FJphKN/AAC3X0lS4r+PTw5Eq2+mE +pJRWSlJtt2yCC1syZQI3rHycchECTKy7sse5TfPQCj7l0GrTpzgAaAJXo48tV6zpCV5 gu3bEF2Yny0RkTD9QhlFnrmmC/bYqUZa76nZ3N+1xMIR/QJ5AyLGpZgBWXm9hAypf1NV iz0AFbVcXGAyxmWJYGdErc/ML9+t4WmE0LtC/Ss/Afy+oZsa2unoELD5DEXFMdwhfCoI z/tABeb6y8Ft3l3bKA/j/bTyapxmRjjfafd6jGeUoxGG/+nDMe0j6L4vYh4iJ8kRVNNr U5tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SYJIkBZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id t5-20020a628105000000b00690d25b198dsi12162912pfd.103.2023.09.26.02.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 02:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SYJIkBZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A896A80BB5E2; Tue, 26 Sep 2023 02:35:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234264AbjIZJfa (ORCPT + 27 others); Tue, 26 Sep 2023 05:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234086AbjIZJfT (ORCPT ); Tue, 26 Sep 2023 05:35:19 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00D9DEB; Tue, 26 Sep 2023 02:35:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695720913; x=1727256913; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=TNdNMjdyY903iNYTtJMXeD069ihbZWkt8cAbuDlkz7w=; b=SYJIkBZYATV5PD2z9Y6q1I9kQXywGBUNlsYCawofz+aw7Yq2DSPpHGeY 8BvcTYd2CvEL0Vm+BNXOHMR/C4FLwFgc4Ijd0FC2M9ZmMh2ZXSacqTXzb /8q/8OOHp7xIIOaFycY7Yx1Ir3E+0vyib1NPNMaTuZysSODmgzSMdzhhn Nwuwbpps90FzODzcw9m50RkOO51w68VH1AX/mlxRQbIDdnkXP+0+1lezA cE7lW/Cy8yRaZu+rQrIgiwABhoHPNpq3RFFDOhDaj3iAAfR/9199cNMdy sOfIsv4nJGHx0fTC51FsukqLWlMxD03t+CgfIpIdKhugUp7aQ8+7jCJbU g==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="412442877" X-IronPort-AV: E=Sophos;i="6.03,177,1694761200"; d="scan'208";a="412442877" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 02:31:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="725372986" X-IronPort-AV: E=Sophos;i="6.03,177,1694761200"; d="scan'208";a="725372986" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by orsmga006.jf.intel.com with ESMTP; 26 Sep 2023 02:31:22 -0700 From: Yi Liu To: alex.williamson@redhat.com, jgg@nvidia.com, kevin.tian@intel.com, robin.murphy@arm.com, baolu.lu@linux.intel.com Cc: joro@8bytes.org, cohuck@redhat.com, eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org, mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com, yi.l.liu@intel.com, yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com, shameerali.kolothum.thodi@huawei.com, lulu@redhat.com, suravee.suthikulpanit@amd.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, zhenzhong.duan@intel.com, joao.m.martins@oracle.com Subject: [RFC 0/3] vfio-pci support pasid attach/detach Date: Tue, 26 Sep 2023 02:31:18 -0700 Message-Id: <20230926093121.18676-1-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:35:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778092711757365605 X-GMAIL-MSGID: 1778092711757365605 This adds the pasid attach/detach uAPIs for userspace to attach/detach a PASID of a device to/from a given ioas/hwpt. Only vfio-pci driver is enabled in this series. After this series, PASID-capable devices bound with vfio-pci can report PASID capability to userspace and VM to enable PASID usages like Shared Virtual Addressing (SVA). This series first adds the helpers for pasid attach in vfio core and then add the device cdev ioctls for pasid attach/detach, finally exposes the device PASID capability to user. It depends on iommufd pasid attach/detach series [1]. Complete code can be found at [2] [1] https://lore.kernel.org/linux-iommu/20230926092651.17041-1-yi.l.liu@intel.com/ [2] https://github.com/yiliu1765/iommufd/tree/iommufd_pasid Regards, Yi Liu Kevin Tian (1): vfio-iommufd: Support pasid [at|de]tach for physical VFIO devices Yi Liu (2): vfio: Add VFIO_DEVICE_PASID_[AT|DE]TACH_IOMMUFD_PT vfio/pci: Expose PCIe PASID capability to userspace drivers/vfio/device_cdev.c | 45 ++++++++++++++++++++++++ drivers/vfio/iommufd.c | 48 ++++++++++++++++++++++++++ drivers/vfio/pci/vfio_pci.c | 2 ++ drivers/vfio/pci/vfio_pci_config.c | 2 +- drivers/vfio/vfio.h | 4 +++ drivers/vfio/vfio_main.c | 8 +++++ include/linux/vfio.h | 11 ++++++ include/uapi/linux/vfio.h | 55 ++++++++++++++++++++++++++++++ 8 files changed, 174 insertions(+), 1 deletion(-)