Commit 0bde4444 authored by Tom Zanussi's avatar Tom Zanussi Committed by Vinod Koul

dmaengine: idxd: Enable IDXD performance monitor support

Add the code needed in the main IDXD driver to interface with the IDXD
perfmon implementation.

[ Based on work originally by Jing Lin. ]
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
Link: https://lore.kernel.org/r/a5564a5583911565d31c2af9234218c5166c4b2c.1619276133.git.zanussi@kernel.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 81dd4d4d
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "../dmaengine.h" #include "../dmaengine.h"
#include "registers.h" #include "registers.h"
#include "idxd.h" #include "idxd.h"
#include "perfmon.h"
MODULE_VERSION(IDXD_DRIVER_VERSION); MODULE_VERSION(IDXD_DRIVER_VERSION);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -541,6 +542,10 @@ static int idxd_probe(struct idxd_device *idxd) ...@@ -541,6 +542,10 @@ static int idxd_probe(struct idxd_device *idxd)
idxd->major = idxd_cdev_get_major(idxd); idxd->major = idxd_cdev_get_major(idxd);
rc = perfmon_pmu_init(idxd);
if (rc < 0)
dev_warn(dev, "Failed to initialize perfmon. No PMU support: %d\n", rc);
dev_dbg(dev, "IDXD device %d probed successfully\n", idxd->id); dev_dbg(dev, "IDXD device %d probed successfully\n", idxd->id);
return 0; return 0;
...@@ -720,6 +725,7 @@ static void idxd_remove(struct pci_dev *pdev) ...@@ -720,6 +725,7 @@ static void idxd_remove(struct pci_dev *pdev)
if (device_pasid_enabled(idxd)) if (device_pasid_enabled(idxd))
idxd_disable_system_pasid(idxd); idxd_disable_system_pasid(idxd);
idxd_unregister_devices(idxd); idxd_unregister_devices(idxd);
perfmon_pmu_remove(idxd);
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA); iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
} }
...@@ -749,6 +755,8 @@ static int __init idxd_init_module(void) ...@@ -749,6 +755,8 @@ static int __init idxd_init_module(void)
else else
support_enqcmd = true; support_enqcmd = true;
perfmon_init();
err = idxd_register_bus_type(); err = idxd_register_bus_type();
if (err < 0) if (err < 0)
return err; return err;
...@@ -782,5 +790,6 @@ static void __exit idxd_exit_module(void) ...@@ -782,5 +790,6 @@ static void __exit idxd_exit_module(void)
pci_unregister_driver(&idxd_pci_driver); pci_unregister_driver(&idxd_pci_driver);
idxd_cdev_remove(); idxd_cdev_remove();
idxd_unregister_bus_type(); idxd_unregister_bus_type();
perfmon_exit();
} }
module_exit(idxd_exit_module); module_exit(idxd_exit_module);
...@@ -156,11 +156,8 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) ...@@ -156,11 +156,8 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause)
} }
if (cause & IDXD_INTC_PERFMON_OVFL) { if (cause & IDXD_INTC_PERFMON_OVFL) {
/*
* Driver does not utilize perfmon counter overflow interrupt
* yet.
*/
val |= IDXD_INTC_PERFMON_OVFL; val |= IDXD_INTC_PERFMON_OVFL;
perfmon_counter_overflow(idxd);
} }
val ^= cause; val ^= cause;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment