diff mbox series

[RFC,1/2] pci/portdrv: Allow for vendor defined performance monitoring units.

Message ID 20181214131055.52253-2-Jonathan.Cameron@huawei.com
State Not Applicable
Delegated to: Bjorn Helgaas
Headers show
Series Support HiSilicon PCIe Transport Layer PMU | expand

Commit Message

Jonathan Cameron Dec. 14, 2018, 1:10 p.m. UTC
When originally introduced (and still in the docs) it was possible to have
drivers matched by HID, now it isn't so this is a bit ugly in that it will
call any registered PMU driver.

How would people prefer this was done?

* Drop the association with the port and handle as uncore.
  Whilst the driver that follows is not in config space, it is likely that
  future PMU units will use DVSEC (in PCI config space) and so this option
  won't really be available.

* Put a full subsystem style driver matching layer in here.
  Moderately simple to do do and well understood.

Right now this code is a hack to get the conversation going!

It would be nice if there was a standard PCIe PMU specification but whilst
there isn't, everyone will end up doing it differently...

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/pci/pcie/portdrv.h      | 4 +++-
 drivers/pci/pcie/portdrv_core.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index e495f04394d0..64315713a93d 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -20,8 +20,10 @@ 
 #define PCIE_PORT_SERVICE_HP		(1 << PCIE_PORT_SERVICE_HP_SHIFT)
 #define PCIE_PORT_SERVICE_DPC_SHIFT	3	/* Downstream Port Containment */
 #define PCIE_PORT_SERVICE_DPC		(1 << PCIE_PORT_SERVICE_DPC_SHIFT)
+#define PCIE_PORT_SERVICE_PMU_SHIFT	4	/* Vendor defined Perf Units */
+#define PCIE_PORT_SERVICE_PMU		(1 << PCIE_PORT_SERVICE_PMU_SHIFT)
 
-#define PCIE_PORT_DEVICE_MAXSERVICES   4
+#define PCIE_PORT_DEVICE_MAXSERVICES   5
 
 #ifdef CONFIG_PCIEAER
 int pcie_aer_init(void);
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index f458ac9cb70c..c032896a9ab1 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -250,6 +250,8 @@  static int get_port_device_capability(struct pci_dev *dev)
 	    pci_aer_available() && services & PCIE_PORT_SERVICE_AER)
 		services |= PCIE_PORT_SERVICE_DPC;
 
+	services |= PCIE_PORT_SERVICE_PMU;
+
 	return services;
 }