From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>,
Ashok Raj <ashok.raj@intel.com>,
Aditya Srivastava <yashsri421@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>,
YueHaibing <yuehaibing@huawei.com>,
"Gustavo A . R . Silva" <gustavoars@kernel.org>,
iommu@lists.linux-foundation.org,
Colin Ian King <colin.king@canonical.com>,
Will Deacon <will@kernel.org>
Subject: [PATCH 20/23] iommu/vt-d: Removed unused iommu_count in dmar domain
Date: Thu, 10 Jun 2021 10:01:12 +0800 [thread overview]
Message-ID: <20210610020115.1637656-21-baolu.lu@linux.intel.com> (raw)
In-Reply-To: <20210610020115.1637656-1-baolu.lu@linux.intel.com>
From: Parav Pandit <parav@nvidia.com>
DMAR domain uses per DMAR refcount. It is indexed by iommu seq_id.
Older iommu_count is only incremented and decremented but no decisions
are taken based on this refcount. This is not of much use.
Hence, remove iommu_count and further simplify domain_detach_iommu()
by returning void.
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20210530075053.264218-1-parav@nvidia.com
---
include/linux/intel-iommu.h | 1 -
drivers/iommu/intel/iommu.c | 11 +++--------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 2621eff04c82..574b932dfe86 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -561,7 +561,6 @@ struct dmar_domain {
int agaw;
int flags; /* flags to find out type of domain */
- int iommu_count; /* reference count of iommu */
int iommu_superpage;/* Level of superpages supported:
0 == 4KiB (no superpages), 1 == 2MiB,
2 == 1GiB, 3 == 512GiB, 4 == 1TiB */
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 430ef2232d47..dd8ecfbfdb23 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1920,7 +1920,6 @@ static int domain_attach_iommu(struct dmar_domain *domain,
assert_spin_locked(&iommu->lock);
domain->iommu_refcnt[iommu->seq_id] += 1;
- domain->iommu_count += 1;
if (domain->iommu_refcnt[iommu->seq_id] == 1) {
ndomains = cap_ndoms(iommu->cap);
num = find_first_zero_bit(iommu->domain_ids, ndomains);
@@ -1928,7 +1927,6 @@ static int domain_attach_iommu(struct dmar_domain *domain,
if (num >= ndomains) {
pr_err("%s: No free domain ids\n", iommu->name);
domain->iommu_refcnt[iommu->seq_id] -= 1;
- domain->iommu_count -= 1;
return -ENOSPC;
}
@@ -1944,16 +1942,15 @@ static int domain_attach_iommu(struct dmar_domain *domain,
return 0;
}
-static int domain_detach_iommu(struct dmar_domain *domain,
- struct intel_iommu *iommu)
+static void domain_detach_iommu(struct dmar_domain *domain,
+ struct intel_iommu *iommu)
{
- int num, count;
+ int num;
assert_spin_locked(&device_domain_lock);
assert_spin_locked(&iommu->lock);
domain->iommu_refcnt[iommu->seq_id] -= 1;
- count = --domain->iommu_count;
if (domain->iommu_refcnt[iommu->seq_id] == 0) {
num = domain->iommu_did[iommu->seq_id];
clear_bit(num, iommu->domain_ids);
@@ -1962,8 +1959,6 @@ static int domain_detach_iommu(struct dmar_domain *domain,
domain_update_iommu_cap(domain);
domain->iommu_did[iommu->seq_id] = 0;
}
-
- return count;
}
static inline int guestwidth_to_adjustwidth(int gaw)
--
2.25.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2021-06-10 2:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-10 2:00 [PATCH 00/23] [PULL REQUEST] Intel IOMMU Updates for Linux v5.14 Lu Baolu
2021-06-10 2:00 ` [PATCH 01/23] iommu/vt-d: Remove redundant assignment to variable agaw Lu Baolu
2021-06-10 2:00 ` [PATCH 02/23] iommu/vt-d: Fix kernel-doc syntax in file header Lu Baolu
2021-06-10 2:00 ` [PATCH 03/23] iommu/vt-d: Tweak the description of a DMA fault Lu Baolu
2021-06-10 2:00 ` [PATCH 04/23] iommu/vt-d: Select PCI_ATS explicitly Lu Baolu
2021-06-10 2:00 ` [PATCH 05/23] iommu/vt-d: Support asynchronous IOMMU nested capabilities Lu Baolu
2021-06-10 2:00 ` [PATCH 06/23] iommu/vt-d: Add pasid private data helpers Lu Baolu
2021-06-10 2:00 ` [PATCH 07/23] iommu/vt-d: Use iommu_sva_alloc(free)_pasid() helpers Lu Baolu
2021-06-10 2:01 ` [PATCH 08/23] iommu/vt-d: Use common helper to lookup svm devices Lu Baolu
2021-06-10 2:01 ` [PATCH 09/23] iommu/vt-d: Refactor prq_event_thread() Lu Baolu
2021-06-10 2:01 ` [PATCH 10/23] iommu/vt-d: Allocate/register iopf queue for sva devices Lu Baolu
2021-06-10 2:01 ` [PATCH 11/23] iommu/vt-d: Report prq to io-pgfault framework Lu Baolu
2021-06-10 2:01 ` [PATCH 12/23] iommu/vt-d: Add prq_report trace event Lu Baolu
2021-06-10 2:01 ` [PATCH 13/23] iommu/vt-d: Add common code for dmar latency performance monitors Lu Baolu
2021-06-10 2:01 ` [PATCH 14/23] iommu/vt-d: Expose latency monitor data through debugfs Lu Baolu
2021-06-10 2:01 ` [PATCH 15/23] iommu/vt-d: Add cache invalidation latency sampling Lu Baolu
2021-06-10 2:01 ` [PATCH 16/23] iommu/vt-d: Add PRQ handling " Lu Baolu
2021-06-10 2:01 ` [PATCH 17/23] iommu/vt-d: Fix out-bounds-warning in intel/svm.c Lu Baolu
2021-06-10 2:01 ` [PATCH 18/23] iommu/vt-d: Use DEVICE_ATTR_RO macro Lu Baolu
2021-06-10 2:01 ` [PATCH 19/23] iommu/vt-d: Use bitfields for DMAR capabilities Lu Baolu
2021-06-10 2:01 ` Lu Baolu [this message]
2021-06-10 2:01 ` [PATCH 21/23] iommu/vt-d: Remove unnecessary braces Lu Baolu
2021-06-10 2:01 ` [PATCH 22/23] iommu/vt-d: Define counter explicitly as unsigned int Lu Baolu
2021-06-10 2:01 ` [PATCH 23/23] iommu/vt-d: No need to typecast Lu Baolu
2021-06-10 7:13 ` [PATCH 00/23] [PULL REQUEST] Intel IOMMU Updates for Linux v5.14 Joerg Roedel
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=20210610020115.1637656-21-baolu.lu@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=ashok.raj@intel.com \
--cc=colin.king@canonical.com \
--cc=fenghua.yu@intel.com \
--cc=gustavoars@kernel.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=rdunlap@infradead.org \
--cc=will@kernel.org \
--cc=yashsri421@gmail.com \
--cc=yuehaibing@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.