Add a perf PMU driver to expose the hardware events for a HiSilicon PCIe root port. There are several reasons this is an RFC: 1. The binding to the PCIe port 2. There aren't any existing PCI Performance Monitoring Units (PMU), drivers that I can find, so new ground to break. Taking these in turn. Binding to the PCIe port ------------------------ The original PCIe port driver had a concept of vendor defined sub drivers but that has been removed due to lack of users (it was still in the documentation last time I checked). This 'could' be used to support PMUs, and seems to be a relatively elegant approach, representing that these are fundamentally part of the PCIe port. There are several ways the hardware interface for a PMU for a PCIe port could have been implemented. 1) In PCIe config space (DVSEC) of root port. 2) As a 'platform device' on the host that has some known associate with the port. This is the case we have here. Note the current interface is a hack to illustrate the point. The alternative is just to have this as an uncore PMU and perhaps use naming to identify that it is associated with the PCIe port. To my mind this is an ugly solution and doesn't work if hardware using config space (option 1) come along shortly. It is worth noting that we can only make the association here because the ACPI provide the resources to the PCIe device in DSDT. A related question is where the driver should actualy go? PCI Performance Monitoring Units -------------------------------- There is no standard for performance monitoring of PCI transport layer (or any other for that matter). However, a lot of things being counted are likely to be fairly consistent across different implementations. To that end, it would be good to define naming of the events to be 'standard' if possible! Jonathan Cameron (2): pci/portdrv: Allow for vendor defined performance monitoring units. PCI/portdrv Hisilicon PCIe transport layer Port PMU driver. drivers/pci/pcie/Kconfig | 9 + drivers/pci/pcie/Makefile | 2 + drivers/pci/pcie/hisi_pcie_pmu.c | 528 +++++++++++++++++++++++++++++++ drivers/pci/pcie/portdrv.h | 4 +- drivers/pci/pcie/portdrv_core.c | 2 + include/linux/cpuhotplug.h | 1 + 6 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 drivers/pci/pcie/hisi_pcie_pmu.c -- 2.19.1