Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2825535rdh; Sun, 26 Nov 2023 22:39:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOJ4utkLCaAKFk40/YWaWBViYI5UXvf/vbDwPwWCkdyswe8v/2LIUlkZ7yrbHYyAg7z5me X-Received: by 2002:a05:6a00:1990:b0:6cb:911b:8000 with SMTP id d16-20020a056a00199000b006cb911b8000mr12746192pfl.28.1701067174771; Sun, 26 Nov 2023 22:39:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701067174; cv=none; d=google.com; s=arc-20160816; b=oyKZj/gwdIJHs0CRb9dR3ZGheCzONGBoV8S26enfeVBzdb4/bsOEyKoCtEQUf+niTD olqElDPSNRHV/MsCCe9f/mI8qDIZanq12OfxEzm8deWBiKWXLIEanl7fCXYtMZgY3Gyo 3+28+5U50F8K+luup1j7oY1ACfRBTD/LgUeerL4lEm/GSlpNQM3o4R1HCVZ4I8l3TYr3 0gD7atxN32zFM95rN9u0t4rkN6ITZDc+SWFqrvSZUlnyGcVEtg/slZ7QrQYe/t6ouSS/ TPqlWSGU0ZbBUitROg9JVD37xz366hnC5H2g7ncV13DSJx85g1zJyWP8TA/Cqfnsc+CU SsoQ== 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=cJe+BwTxegf3U4MwqnGw8b6F3tr1EweZYLdYtlGdwnE=; fh=gm0A6EtasJwovXfz1TpeYfkY+4H0EN5E4rSCpite+Dk=; b=OeBTxpynCWn9L0n+Uw/PqCeLvgG0sKu41WVflbJt1Xn9EOgVco2T6SO3uv5MwQk8XA G9B5X7b+dz4jwQHgH38jrLxUXUjbMQ/2VhRsGIqROhS0hjcYEry/0nA4afcc1xs563qT fWH49pWmNjb3Wra6LuLOQyuqoh/bnp8S+nz5j8qXblH9L15ArRpEL3YYic+3fYTEliho 1cLFqXN58ZttSGF/Sg0olAcHVlYtADFsOtR73qzKHQGvSeKy4t6FTDA20ZX0IjPTGhmN z1t+tE5DbxVFLEH0as02EauN5E+i9Kd3WSfWB8mPukygLgw3J5wVmOTUiBH1jh/nk29I PoZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fdJDnIfR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id t5-20020a625f05000000b006cb83b233a2si8459251pfb.355.2023.11.26.22.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 22:39:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fdJDnIfR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id F2ADA8088A6E; Sun, 26 Nov 2023 22:39:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbjK0GjG (ORCPT + 99 others); Mon, 27 Nov 2023 01:39:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbjK0GjE (ORCPT ); Mon, 27 Nov 2023 01:39:04 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66E9D113; Sun, 26 Nov 2023 22:39:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701067151; x=1732603151; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wWLfgYUjzP+gqB9GkQe3X8Oga+Po8HH51kWXVclMi80=; b=fdJDnIfRyiI6heaeHpfEkygUnhDOBKJqaIxs7K8UYdybgBaBXdIHGk5Z hVfc+dlbYOjPaSJuWRFEI2x/mWkWogwNAB3XlxDQqmd/hfCAyT4Uhn8lV FG+brZXhBrMciibLA6+sIjpoUnLZnsTjyNbJkU2Stx+LJJ/nsmxApis14 OR210OooaRt/u2WgQa/OnmVbm5ktDeXoy97ErUxnw9nHtyePrcHUry3D8 OmVK+G3ElFutiKMcbzNIKbkbZGZ4bQ2rAcpuZF1oHrP8U3+82vEy3Yd6W fMmLLT3F8wCD9c99OnEwl8TUIBMFhQDlpfWtlITT/XRfVK7vv4eWmMxbT w==; X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="392397722" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="392397722" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2023 22:39:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="717940800" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="717940800" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by orsmga003.jf.intel.com with ESMTP; 26 Nov 2023 22:39:10 -0800 From: Yi Liu To: joro@8bytes.org, alex.williamson@redhat.com, jgg@nvidia.com, kevin.tian@intel.com, robin.murphy@arm.com, baolu.lu@linux.intel.com Cc: 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, xin.zeng@intel.com, yan.y.zhao@intel.com Subject: [PATCH 0/3] vfio-pci support pasid attach/detach Date: Sun, 26 Nov 2023 22:39:06 -0800 Message-Id: <20231127063909.129153-1-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Sun, 26 Nov 2023 22:39:27 -0800 (PST) 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], tested with a draft Qemu branch[3] [1] https://lore.kernel.org/linux-iommu/20231127063428.127436-1-yi.l.liu@intel.com/ [2] https://github.com/yiliu1765/iommufd/tree/iommufd_pasid [3] https://github.com/yiliu1765/qemu/tree/zhenzhong/wip/iommufd_nesting_rfcv1%2Bpasid Change log: v1: - Report PASID capability via VFIO_DEVICE_FEATURE (Alex) rfc: https://lore.kernel.org/linux-iommu/20230926093121.18676-1-yi.l.liu@intel.com/ 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: Report PASID capability via VFIO_DEVICE_FEATURE ioctl drivers/vfio/device_cdev.c | 45 +++++++++++++++++++++ drivers/vfio/iommufd.c | 48 ++++++++++++++++++++++ drivers/vfio/pci/vfio_pci.c | 2 + drivers/vfio/pci/vfio_pci_core.c | 47 ++++++++++++++++++++++ drivers/vfio/vfio.h | 4 ++ drivers/vfio/vfio_main.c | 8 ++++ include/linux/vfio.h | 11 ++++++ include/uapi/linux/vfio.h | 68 ++++++++++++++++++++++++++++++++ 8 files changed, 233 insertions(+) -- 2.34.1