Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp58221pxy; Wed, 21 Apr 2021 18:26:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWbcG5IY5N9cGpSBPhC0saK/bbclnDrMSY8KQKNKI126ye446pcudA1QR9JSxptVbw3LBh X-Received: by 2002:a63:fc58:: with SMTP id r24mr973930pgk.368.1619054766731; Wed, 21 Apr 2021 18:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619054766; cv=none; d=google.com; s=arc-20160816; b=N5ElGx5zKUicDD88ZCaUtZ7rE5PHPEsPugDxVs1pRnQBhMMIroQMqqVD+vsr+EW4KU dAjzqUftKDuO0dSm6b9NAkRnNIDV70ZWt9VHw+aDPbo9UMAK3p+p/4NByM+80RLEhT/K PHHRc+jpVvGayCvaVGoCRv3cZycDSdq6cXbmIFB5VrsRT7aoyAbX7GCoWsvXlP0FF1gK O7QJ4rqBxHQkUgNCVdTWEBlLWgDikf34qaC5Iwekg9UU/tsLmcM/KSQXEA6xHI4d4NT6 Tzi4fX2oJo6708k75x1FRZLZFfi6uhB2Grlti0F7wKIxU15oHuVLIcyvGVJPCTBL8Q7I QZLw== 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=CD8Cmu2jJcImDvARBp2Nx8KguJB6/8Z1DQ+op1kEqtc=; b=R272vqINbnx3OVmSxuXZCKdiyganQjN0G/NZkwRCKLUnmD3j8vSm0U4BxPuM8C3ipi QbHgSOfkeRVShtW1zhGRQudpJqt3Mt3drrOvdd4a0IJHmwVyY/Sm0EbfKIeThGeSp2Ef 0HoPsOzDeD8YxCiBCaTEjDsWNp7DRMoWEdF2FqvH2jUEcGmLK+S7Yf8LWrvEQGqqkgMF HoJCxwHU9V1mpYjqReU5t6sCfd4QZKjACkI1HehzrVVL18lPpDb4f5+eDUsBk0ZRhmTV MQzHGSJmpucK0uiU4aUBwDv2Cr6hS5R3gFar42QLfyuHXqQ6w/DZUnWooHeGkHAD24KE Qs0A== 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 t129si1155422pfb.112.2021.04.21.18.25.55; Wed, 21 Apr 2021 18:26:06 -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 S245722AbhDUVFi (ORCPT + 99 others); Wed, 21 Apr 2021 17:05:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:43644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245716AbhDUVFh (ORCPT ); Wed, 21 Apr 2021 17:05:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9841E613B7; Wed, 21 Apr 2021 21:05:02 +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 v3 2/2] dmaengine: idxd: Enable IDXD performance monitor support Date: Wed, 21 Apr 2021 16:04:55 -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 e8f64324bb3a..4c6ea15cb641 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"); @@ -489,6 +490,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; @@ -636,6 +641,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); } static struct pci_driver idxd_pci_driver = { @@ -664,6 +670,8 @@ static int __init idxd_init_module(void) else support_enqcmd = true; + perfmon_init(); + err = idxd_register_bus_type(); if (err < 0) return err; @@ -697,5 +705,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 fc0781e3f36d..ae6738470fab 100644 --- a/drivers/dma/idxd/irq.c +++ b/drivers/dma/idxd/irq.c @@ -165,11 +165,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