From: kan.liang@linux.intel.com
To: joro@8bytes.org, will@kernel.org, baolu.lu@linux.intel.com,
dwmw2@infradead.org, robin.murphy@arm.com,
robert.moore@intel.com, rafael.j.wysocki@intel.com,
lenb@kernel.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org
Cc: yu-cheng.yu@intel.com, Kan Liang <kan.liang@linux.intel.com>
Subject: [PATCH V3 7/7] iommu/vt-d: Enable IOMMU perfmon support
Date: Fri, 20 Jan 2023 08:54:08 -0800 [thread overview]
Message-ID: <20230120165408.500511-8-kan.liang@linux.intel.com> (raw)
In-Reply-To: <20230120165408.500511-1-kan.liang@linux.intel.com>
From: Kan Liang <kan.liang@linux.intel.com>
Register and enable an IOMMU perfmon for each active IOMMU device.
The failure of IOMMU perfmon registration doesn't impact other
functionalities of an IOMMU device.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
---
drivers/iommu/intel/dmar.c | 3 +++
drivers/iommu/intel/iommu.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c
index 43db6ebe8b57..6acfe879589c 100644
--- a/drivers/iommu/intel/dmar.c
+++ b/drivers/iommu/intel/dmar.c
@@ -1144,6 +1144,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
err = iommu_device_register(&iommu->iommu, &intel_iommu_ops, NULL);
if (err)
goto err_sysfs;
+
+ iommu_pmu_register(iommu);
}
drhd->iommu = iommu;
@@ -1166,6 +1168,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
static void free_iommu(struct intel_iommu *iommu)
{
if (intel_iommu_enabled && !iommu->drhd->ignored) {
+ iommu_pmu_unregister(iommu);
iommu_device_unregister(&iommu->iommu);
iommu_device_sysfs_remove(&iommu->iommu);
}
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 560a54c3cbda..d39787944cc7 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -30,6 +30,7 @@
#include "../iommu-sva.h"
#include "pasid.h"
#include "cap_audit.h"
+#include "perfmon.h"
#define ROOT_SIZE VTD_PAGE_SIZE
#define CONTEXT_SIZE VTD_PAGE_SIZE
@@ -4013,6 +4014,8 @@ int __init intel_iommu_init(void)
intel_iommu_groups,
"%s", iommu->name);
iommu_device_register(&iommu->iommu, &intel_iommu_ops, NULL);
+
+ iommu_pmu_register(iommu);
}
up_read(&dmar_global_lock);
--
2.35.1
next prev parent reply other threads:[~2023-01-20 16:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 16:54 [PATCH V3 0/7] iommu/vt-d: Support performance monitoring for IOMMU kan.liang
2023-01-20 16:54 ` [PATCH V3 1/7] iommu/vt-d: Support size of the register set in DRHD kan.liang
2023-01-20 16:54 ` [PATCH V3 2/7] iommu/vt-d: Retrieve IOMMU perfmon capability information kan.liang
2023-01-20 16:54 ` [PATCH V3 3/7] iommu/vt-d: Support Enhanced Command Interface kan.liang
2023-01-20 16:54 ` [PATCH V3 4/7] iommu/vt-d: Add IOMMU perfmon support kan.liang
2023-01-20 16:54 ` [PATCH V3 5/7] iommu/vt-d: Support cpumask for IOMMU perfmon kan.liang
2023-01-20 16:54 ` [PATCH V3 6/7] iommu/vt-d: Add IOMMU perfmon overflow handler support kan.liang
2023-01-20 16:54 ` kan.liang [this message]
2023-01-28 7:10 ` [PATCH V3 0/7] iommu/vt-d: Support performance monitoring for IOMMU Baolu Lu
2023-01-28 18:58 ` Liang, Kan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230120165408.500511-8-kan.liang@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=yu-cheng.yu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).