From: Nicolin Chen <nicolinc@nvidia.com>
To: <jgg@nvidia.com>, <kevin.tian@intel.com>, <will@kernel.org>
Cc: <robin.murphy@arm.com>, <joro@8bytes.org>, <shuah@kernel.org>,
<iommu@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>
Subject: [PATCH v3 4/4] iommu/arm-smmu-v3: Implement arm_smmu_get_msi_mapping_domain
Date: Wed, 7 Aug 2024 12:00:07 -0700 [thread overview]
Message-ID: <4fb65d188978955861cc3d3bf665ca83b8debb9b.1723056910.git.nicolinc@nvidia.com> (raw)
In-Reply-To: <cover.1723056910.git.nicolinc@nvidia.com>
In a 1-stage translation setup, a device is attached to a paging domain.
In a 2-stage translation setup, a device is attached to a nested domain,
which does not have the mappings for the MSI page but only an s2_parent
paging domain pointer that holds the mappings.
Add arm_smmu_get_msi_mapping_domain in arm_smmu_nested_ops to return the
correct paging domain.
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 24836f3269b3..3962d5a55519 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -3305,10 +3305,20 @@ static int arm_smmu_cache_invalidate_user(struct iommu_domain *domain,
return ret;
}
+static struct iommu_domain *
+arm_smmu_get_msi_mapping_domain(struct iommu_domain *domain)
+{
+ struct arm_smmu_nested_domain *nested_domain =
+ container_of(domain, struct arm_smmu_nested_domain, domain);
+
+ return &nested_domain->s2_parent->domain;
+}
+
static const struct iommu_domain_ops arm_smmu_nested_ops = {
.attach_dev = arm_smmu_attach_dev_nested,
.free = arm_smmu_domain_nested_free,
.cache_invalidate_user = arm_smmu_cache_invalidate_user,
+ .get_msi_mapping_domain = arm_smmu_get_msi_mapping_domain,
};
static struct iommu_domain *
--
2.43.0
prev parent reply other threads:[~2024-08-07 19:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 19:00 [PATCH v3 0/4] iommu: Support IOMMU_RESV_SW_MSI with nesting Nicolin Chen
2024-08-07 19:00 ` [PATCH v3 1/4] iommufd: Reorder include files Nicolin Chen
2024-08-07 19:00 ` [PATCH v3 2/4] iommu/dma: Support MSIs through nested domains Nicolin Chen
2024-08-07 19:00 ` [PATCH v3 3/4] iommufd/selftest: Add coverage for IOMMU_RESV_SW_MSI Nicolin Chen
2024-08-07 19:00 ` Nicolin Chen [this message]
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=4fb65d188978955861cc3d3bf665ca83b8debb9b.1723056910.git.nicolinc@nvidia.com \
--to=nicolinc@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=shuah@kernel.org \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®