From: Suravee Suthikulpanit via iommu <iommu@lists.linux-foundation.org>
To: <iommu@lists.linux-foundation.org>
Cc: robin.murphy@arm.com, ashish.kalra@amd.com, vasant.hegde@amd.com
Subject: [PATCH 6/7] iommu/amd: Do not support IOMMU_DOMAIN_IDENTITY when SNP is enabled
Date: Sun, 12 Jun 2022 20:25:01 -0500 [thread overview]
Message-ID: <20220613012502.109918-7-suravee.suthikulpanit@amd.com> (raw)
In-Reply-To: <20220613012502.109918-1-suravee.suthikulpanit@amd.com>
Since DTE[Mode]=0 is prohibited on system, which enables SNP,
the passthrough domain (IOMMU_DOMAIN_IDENTITY) is not support.
Instead, only support IOMMU_DOMAIN_DMA[_FQ] domains.
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
drivers/iommu/amd/iommu.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index ca4647f04382..ecde9e08102d 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2379,6 +2379,17 @@ static int amd_iommu_def_domain_type(struct device *dev)
return 0;
}
+static bool amd_iommu_domain_type_supported(struct device *dev, int type)
+{
+ /*
+ * Since DTE[Mode]=0 is prohibited on SNP-enabled system,
+ * default to use IOMMU_DOMAIN_DMA[_FQ].
+ */
+ if (amd_iommu_snp_en && (type == IOMMU_DOMAIN_IDENTITY))
+ return false;
+ return true;
+}
+
struct iommu_ops amd_iommu_ops = {
.capable = amd_iommu_capable,
.domain_alloc = amd_iommu_domain_alloc,
@@ -2391,6 +2402,7 @@ struct iommu_ops amd_iommu_ops = {
.is_attach_deferred = amd_iommu_is_attach_deferred,
.pgsize_bitmap = AMD_IOMMU_PGSIZES,
.def_domain_type = amd_iommu_def_domain_type,
+ .domain_type_supported = amd_iommu_domain_type_supported,
.default_domain_ops = &(const struct iommu_domain_ops) {
.attach_dev = amd_iommu_attach_device,
.detach_dev = amd_iommu_detach_device,
--
2.32.0
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2022-06-13 1:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 1:24 [PATCH 0/7] iommu/amd: Enforce IOMMU restrictions for SNP-enabled system Suravee Suthikulpanit via iommu
2022-06-13 1:24 ` [PATCH 1/7] iommu/amd: Process all IVHDs before enabling IOMMU features Suravee Suthikulpanit via iommu
2022-06-13 1:24 ` [PATCH 2/7] iommu/amd: Introduce a global variable for tracking SNP enable status Suravee Suthikulpanit via iommu
2022-06-13 1:24 ` [PATCH 3/7] iommu/amd: Introduce function to check SEV-SNP support Suravee Suthikulpanit via iommu
2022-06-13 14:40 ` Suthikulpanit, Suravee via iommu
2022-06-13 1:24 ` [PATCH 4/7] iommu/amd: Set translation valid bit only when IO page tables are in use Suravee Suthikulpanit via iommu
2022-06-13 1:25 ` [PATCH 5/7] iommu: Add domain_type_supported() callback in iommu_ops Suravee Suthikulpanit via iommu
2022-06-13 9:31 ` Robin Murphy
2022-06-13 14:38 ` Suthikulpanit, Suravee via iommu
2022-06-14 9:51 ` Robin Murphy
2022-06-15 1:25 ` Suthikulpanit, Suravee via iommu
2022-06-13 1:25 ` Suravee Suthikulpanit via iommu [this message]
2022-06-13 1:25 ` [PATCH 7/7] iommu/amd: Do not support IOMMUv2 APIs when SNP is enabled Suravee Suthikulpanit via iommu
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=20220613012502.109918-7-suravee.suthikulpanit@amd.com \
--to=iommu@lists.linux-foundation.org \
--cc=ashish.kalra@amd.com \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.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