perf/x86/intel/uncore: Generic support for the PCI sub driver
authorKan Liang <kan.liang@linux.intel.com>
Mon, 14 Sep 2020 14:34:19 +0000 (07:34 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 24 Sep 2020 13:55:51 +0000 (15:55 +0200)
commit95a7fc77443328ac8b68378df8e137a044ece5e8
treeccf2f079011ea5a69051144a0aeda3f64f65a754
parentcdcce92a3a03bccbb0b4a0342fc7e279fc507bc3
perf/x86/intel/uncore: Generic support for the PCI sub driver

Some uncore counters may be located in the configuration space of a PCI
device, which already has a bonded driver. Currently, the uncore driver
cannot register a PCI uncore PMU for these counters, because, to
register a PCI uncore PMU, the uncore driver must be bond to the device.
However, one device can only have one bonded driver.

Add an uncore PCI sub driver to support such kind of devices.

The sub driver doesn't own the device. In initialization, the sub
driver searches the device via pci_get_device(), and register the
corresponding PMU for the device. In the meantime, the sub driver
registers a PCI bus notifier, which is used to notify the sub driver
once the device is removed. The sub driver can unregister the PMU
accordingly.

The sub driver only searches the devices defined in its id table. The
id table varies on different platforms, which will be implemented in the
following platform-specific patch.

Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/1600094060-82746-6-git-send-email-kan.liang@linux.intel.com
arch/x86/events/intel/uncore.c
arch/x86/events/intel/uncore.h