Skip to content

Commit

Permalink
dmaengine: idxd: Enable IDXD performance monitor support
Browse files Browse the repository at this point in the history
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: Dave Jiang <[email protected]>
Reviewed-by: Kan Liang <[email protected]>
Signed-off-by: Tom Zanussi <[email protected]>
Link: https://lore.kernel.org/r/a5564a5583911565d31c2af9234218c5166c4b2c.1619276133.git.zanussi@kernel.org
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
tzanussi authored and vinodkoul committed Apr 25, 2021
1 parent 81dd4d4 commit 0bde444
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 9 additions & 0 deletions drivers/dma/idxd/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "../dmaengine.h"
#include "registers.h"
#include "idxd.h"
#include "perfmon.h"

MODULE_VERSION(IDXD_DRIVER_VERSION);
MODULE_LICENSE("GPL v2");
Expand Down Expand Up @@ -541,6 +542,10 @@ static int idxd_probe(struct idxd_device *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);
return 0;

Expand Down Expand Up @@ -720,6 +725,7 @@ static void idxd_remove(struct pci_dev *pdev)
if (device_pasid_enabled(idxd))
idxd_disable_system_pasid(idxd);
idxd_unregister_devices(idxd);
perfmon_pmu_remove(idxd);
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
}

Expand Down Expand Up @@ -749,6 +755,8 @@ static int __init idxd_init_module(void)
else
support_enqcmd = true;

perfmon_init();

err = idxd_register_bus_type();
if (err < 0)
return err;
Expand Down Expand Up @@ -782,5 +790,6 @@ static void __exit idxd_exit_module(void)
pci_unregister_driver(&idxd_pci_driver);
idxd_cdev_remove();
idxd_unregister_bus_type();
perfmon_exit();
}
module_exit(idxd_exit_module);
5 changes: 1 addition & 4 deletions drivers/dma/idxd/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,8 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause)
}

if (cause & IDXD_INTC_PERFMON_OVFL) {
/*
* Driver does not utilize perfmon counter overflow interrupt
* yet.
*/
val |= IDXD_INTC_PERFMON_OVFL;
perfmon_counter_overflow(idxd);
}

val ^= cause;
Expand Down

0 comments on commit 0bde444

Please sign in to comment.