Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1969355rdh; Tue, 26 Sep 2023 08:33:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2vDbL1CMDnZUOxWpV9yKg35QUrMKe0m5Zbae1HMWhZC0eGJOw20DLTER3sR6r5GZRb37d X-Received: by 2002:a05:6358:d181:b0:147:9b6d:f7f6 with SMTP id ka1-20020a056358d18100b001479b6df7f6mr1149095rwb.27.1695742428701; Tue, 26 Sep 2023 08:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695742428; cv=none; d=google.com; s=arc-20160816; b=QqdSB28Dabnnx9DlrdCeKkvg+4Q0TFlXYryc5A+DTYNjxkbMqpYgYXE7ahC2SRXrmN /hR34D08MKTquSYmKBG6zfQMI62neNQj+DNIqgmXe90v5UKKyioE3zPCvMcI9wWY9haE bGq0pS/S58F9U/zh8wuhmUaDxYQsEQhjbQmK9ukLUVTenYyEzYjxCxURmUER/r56c05G +bI76IgZmtnzUUUo5sW6vz1yXc5SFGJc56rpfUg3sQ//dT9ejDAbvFWR3ZVbjTvBrGGT F9kKdtctZ4aBYhaQxHkR7wcokfpNwED/rYnI5eHFvS/wRtv1ZGkaicvhwJ7DyUlALi8S LcQQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=chqNXPWoxq6NAS2n5n8XL0z9LhMbkxnIDip8oI3wTTE=; fh=Kv+cxc+457xZThbZHBdHDWxamNAAkIiByoci0wEvMsM=; b=hde++UX2vfndsxFpQr++hy+AALY9jBqjwAIHloXB+mFR5cCACWvPeJfp/HwdTKD9+V /2VPI/Ocps/cMdK4tA7FwzVjXqov0f8DELUj6NrqTHHHdLipJfhm0dtaeIGxcRyAcY9t 3X8S+tHt1F5fPsfpp9LIrgGyeYAsjQHZSf2kADADw9CS+lNr0S7J7zwpWm/0AfgVmv/C 6d0lGwFkvgDI4CmzPbRfakaUQCJOVnL0l50GqKTlSoeAVPqh0KvYUKYz6M7M77zKx2LG faENquc0SXaHee4zCzODC1lGOEB9S8LTsDYJWKNFzTVicYfO7ZRrhZNC8N215oJyf6yj 4Qqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CsFHfwDj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id z16-20020a656650000000b00543c84bf588si11941590pgv.473.2023.09.26.08.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 08:33:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CsFHfwDj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 8870B8049B72; Tue, 26 Sep 2023 02:35:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234274AbjIZJff (ORCPT + 99 others); Tue, 26 Sep 2023 05:35:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234114AbjIZJfT (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 035FEF3; Tue, 26 Sep 2023 02:35:13 -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:in-reply-to: references:mime-version:content-transfer-encoding; bh=bZj72hwk6aGVHqUfVsQNiXvoc1GB8ZJ+RY64a2dEVnk=; b=CsFHfwDjUPio3TMeQ2KS9igb5wWbW/08xnYhqcUybO0NggZHh19kwHyS zfDr9YI0ht/JkwU0sUIZkmzL/dz3nLYJkZ4wIc47evQ6z8tA2v1zhUc5t uOfB7Khf9qO5+w0fGR4A/6N+HDM9qkxrjpvJ+1M80GXqZVEZQ4QSNxm+m 30lC/HqCC9+K8kv6MZcJw/TNjs5E2YmweYPrjJQzuzW9y6o4fCzJfPmKz A6T2NGk1UwqBmYDlKdv2LIv1flPwHNfxsHTAMqY9KdR9CIbwb7ELoTalM Bp2FZgH+OggPdYuwpW4kUhQgVMGPOg50lLIjgbwIq+xeadLWGUVZcNihI A==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="412442921" X-IronPort-AV: E=Sophos;i="6.03,177,1694761200"; d="scan'208";a="412442921" 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="725373049" X-IronPort-AV: E=Sophos;i="6.03,177,1694761200"; d="scan'208";a="725373049" Received: from 984fee00a4c6.jf.intel.com ([10.165.58.231]) by orsmga006.jf.intel.com with ESMTP; 26 Sep 2023 02:31:26 -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 3/3] vfio/pci: Expose PCIe PASID capability to userspace Date: Tue, 26 Sep 2023 02:31:21 -0700 Message-Id: <20230926093121.18676-4-yi.l.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230926093121.18676-1-yi.l.liu@intel.com> References: <20230926093121.18676-1-yi.l.liu@intel.com> 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:35:45 -0700 (PDT) This exposes PCIe PASID capability to userspace and where to emulate this capability if wants to further expose it to VM. And this only exposes PASID capability for devices which has PCIe PASID extended struture in its configuration space. While for VFs, userspace is still unable to see this capability as SR-IOV spec forbides VF to implement PASID capability extended structure. It is a TODO in future. Related discussion can be found in below links: https://lore.kernel.org/kvm/20200407095801.648b1371@w520.home/ https://lore.kernel.org/kvm/BL1PR11MB5271A60035EF591A5BE8AC878C01A@BL1PR11MB5271.namprd11.prod.outlook.com/ Signed-off-by: Yi Liu --- drivers/vfio/pci/vfio_pci_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index 7e2e62ab0869..dfae5ad5ebc0 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -95,7 +95,7 @@ static const u16 pci_ext_cap_length[PCI_EXT_CAP_ID_MAX + 1] = { [PCI_EXT_CAP_ID_LTR] = PCI_EXT_CAP_LTR_SIZEOF, [PCI_EXT_CAP_ID_SECPCI] = 0, /* not yet */ [PCI_EXT_CAP_ID_PMUX] = 0, /* not yet */ - [PCI_EXT_CAP_ID_PASID] = 0, /* not yet */ + [PCI_EXT_CAP_ID_PASID] = PCI_EXT_CAP_PASID_SIZEOF, [PCI_EXT_CAP_ID_DVSEC] = 0xFF, }; -- 2.34.1