Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp2199669pxy; Sat, 24 Apr 2021 08:06:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9ETpp/Y0PYq0CnBN/K+FKpKYJM+iNOF3QbEn9kJwHgIJTi878lhCWhQeyLLhv9ruI2M1n X-Received: by 2002:a17:902:70c5:b029:ec:9a57:9cc8 with SMTP id l5-20020a17090270c5b02900ec9a579cc8mr9077658plt.73.1619276794014; Sat, 24 Apr 2021 08:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619276794; cv=none; d=google.com; s=arc-20160816; b=uj6S6AOEXiq6v6lYjwGaJTXl+HKdr92U4k7XxVYEZv7IC2+YGY8GeiMPlR5VwuuVuG k1D9FD/ySr8yVapTWMbOxc+CFKFYaMdoQnJDrksR3I4sLObvr7DcqBXSMKlIvjTEMGWk YxL3vVc6waUYuXtHSuqyjvn0voLbHKPFTtdPNZB8SiD3cAdQJ/A6Fl1qH50/C8aoqWWR LGslf5541ARUMvb4v9T8rvln6NsJb5q5gOwNyEWCuivvmkiVupB2i3qY4Bc/9R8MJPrN 38eyLYh2ty4C4xlL3NC9TzmL2TqdddSpi6+JwYVngnVeEx/8/5FGtns3Z9gWwbliUe5y qfpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=tkayxg1EtbdrXZXEU8Log/fMv3xim9ouE1/XmuAML+I=; b=MbbLNcKg0Ugr2MabcO71lsQx/T9SscF4Oa5Q263zj28gRviuI39zEMJgdZCgmVX8Hp bbYZHpNQTgt4rRMVIQxOdfN7mkLO0GighrpHbjIO7Bvufqu3YlU31NTZSS6URRokXPOY hnLqPdhopUKbiRDZ9zi2OZMBkyFtGviN3VX8cUpf+RoemlQXlkzXh4ZsuHBH/FK7UhrJ ME8JKIB3BA8Zr4VNI7c4Prie9WAw1DenncmKyO1/4pDlOHvwQ6OAAA3RlD7GqVLmhZgT KxO8EI0qhFSZMJ92WWmkiXvFDI8+CzAurzakTVuJJfF2V3o9O+AS0oD+GvTVYc4p7QPg K8Cg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si887907pgq.392.2021.04.24.08.06.22; Sat, 24 Apr 2021 08:06:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234399AbhDXPFJ (ORCPT + 99 others); Sat, 24 Apr 2021 11:05:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:55894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233833AbhDXPFC (ORCPT ); Sat, 24 Apr 2021 11:05:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D97136148E; Sat, 24 Apr 2021 15:04:23 +0000 (UTC) From: Tom Zanussi To: vkoul@kernel.org Cc: peterz@infradead.org, acme@kernel.org, mingo@kernel.org, kan.liang@linux.intel.com, dave.jiang@intel.com, tony.luck@intel.com, dan.j.williams@intel.com, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org Subject: [PATCH v4 2/2] dmaengine: idxd: Enable IDXD performance monitor support Date: Sat, 24 Apr 2021 10:04:16 -0500 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Kan Liang Signed-off-by: Tom Zanussi --- drivers/dma/idxd/init.c | 9 +++++++++ drivers/dma/idxd/irq.c | 5 +---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c index 8003f8a25fff..2a926bef87f2 100644 --- a/drivers/dma/idxd/init.c +++ b/drivers/dma/idxd/init.c @@ -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"); @@ -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; @@ -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); } @@ -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; @@ -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); diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c index afee571e0194..ae68e1e5487a 100644 --- a/drivers/dma/idxd/irq.c +++ b/drivers/dma/idxd/irq.c @@ -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; -- 2.17.1