public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vfio/pci: Add DVSEC PCI Extended Config Capability to user visible list.
@ 2023-03-03  5:54 K V P, Satyanarayana
  2023-03-06 13:57 ` Jason Gunthorpe
  0 siblings, 1 reply; 6+ messages in thread
From: K V P, Satyanarayana @ 2023-03-03  5:54 UTC (permalink / raw)
  To: kvm, linux-kernel, alex.williamson, cohuck, jgg; +Cc: K V P, Satyanarayana

Intel Platform Monitoring Technology (PMT) support is indicated by presence
of an Intel defined PCIe Designated Vendor Specific Extended Capabilities
(DVSEC) structure with a PMT specific ID.However DVSEC structures may also
be used by Intel to indicate support for other features. The Out Of Band Management
Services Module (OOBMSM) uses DVSEC to enumerate several features, including PMT.

The current VFIO driver does not pass DVSEC capabilities to virtual machine (VM)
which makes intel_vsec driver not to work in the VM. This series adds DVSEC
capability to user visible list to allow its use with VFIO.

Signed-off-by: K V P Satyanarayana <satyanarayana.k.v.p@intel.com>
---
 drivers/vfio/pci/vfio_pci_config.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index 523e0144c86f..d984c0dd6cca 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -96,6 +96,7 @@ static const u16 pci_ext_cap_length[PCI_EXT_CAP_ID_MAX + 1] = {
 	[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_DVSEC]	=	0xFF,
 };
 
 /*
@@ -1440,6 +1441,13 @@ static int vfio_ext_cap_len(struct vfio_pci_core_device *vdev, u16 ecap, u16 epo
 			return PCI_TPH_BASE_SIZEOF + (sts * 2) + 2;
 		}
 		return PCI_TPH_BASE_SIZEOF;
+	case PCI_EXT_CAP_ID_DVSEC:
+		ret = pci_read_config_dword(pdev, epos + PCI_DVSEC_HEADER1, &dword);
+		if (ret)
+			return pcibios_err_to_errno(ret);
+
+		return PCI_DVSEC_HEADER1_LEN(dword);
+
 	default:
 		pci_warn(pdev, "%s: unknown length for PCI ecap %#x@%#x\n",
 			 __func__, ecap, epos);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-15  5:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-03  5:54 [PATCH] vfio/pci: Add DVSEC PCI Extended Config Capability to user visible list K V P, Satyanarayana
2023-03-06 13:57 ` Jason Gunthorpe
2023-03-07  5:54   ` Tian, Kevin
2023-03-07 23:28     ` Alex Williamson
2023-03-08  7:50       ` Tian, Kevin
2023-03-15  5:16         ` K V P, Satyanarayana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox