From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx> The Snow Ridge integrated PCIe3 uncore performance monitoring unit (PMU) can be used to collect the performance data, e.g., the utilization between the PCIe devices and the components (in M2IOSF) which are responsible for translating and managing the requests to/from the device. The performance data is very useful for analyzing the performance of the PCIe devices. The PCIe3 uncore PMU was once supported in the Linux kernel, but it was removed by the commit id 2167f1625c2f ("perf/x86/intel/uncore: Remove PCIe3 unit for SNR") due to the conflict between the PCIe Root Port driver and the perf uncore driver. The counters of the PCIe3 uncore PMU are located in the configuration space of the PCIe Root Port device, which already has a bonded driver portdrv_pci. One device can only have one bonded driver. The uncore driver is always failed to be loaded. To re-enable the PCIe3 uncore PMU support in the uncore driver, a new solution should be introduced, which has to meet the requirements as below: - must have a reliable way to find the PCIe Root Port device from the uncore driver; - must be able to access the uncore counters of the PCIe Root Port device from the uncore driver; - must support hotplug. When the PCIe Root Port device is removed, the uncore driver has to be notified and unregisters the PCIe3 uncore PMU. A new platform device 'perf_uncore_pcieport' as a child device of the PCIe Root Port device is introduced to address the issue, which: - can be probed by a unique name, 'perf_uncore_pcieport'. The uncore driver is the only driver for the new platform device. - can provide the struct pci_dev of its parent, aka the PCIe Root Port device. The struct pci_dev can be used by the uncore driver to register a PMU for accessing the counters in the PCIe Root Port device. - can be notified if its parent PCIe Root Port device is removed. The uncore driver can unregister the PMU accordingly. Kan Liang (7): PCI/portdrv: Create a platform device for the perf uncore driver perf/x86/intel/uncore: Factor out uncore_pci_get_die_info() perf/x86/intel/uncore: Factor out uncore_find_pmu_by_pci_dev() perf/x86/intel/uncore: Factor out uncore_pci_pmu_register() perf/x86/intel/uncore: Factor out uncore_pci_pmu_unregister() perf/x86/intel/uncore: Generic support for the platform device perf/x86/intel/uncore: Support PCIe3 unit on Snow Ridge arch/x86/events/intel/uncore.c | 213 +++++++++++++++++++++++++---------- arch/x86/events/intel/uncore.h | 19 ++++ arch/x86/events/intel/uncore_snbep.c | 60 ++++++++++ drivers/pci/pcie/portdrv_pci.c | 38 +++++++ 4 files changed, 271 insertions(+), 59 deletions(-) -- 2.7.4