From: Rick Song <songwenjun@huawei.com>
To: will.deacon@arm.com, robin.murphy@arm.com, joro@8bytes.org,
linux-arm-kernel@lists.infradead.org,
iommu@lists.linux-foundation.org, alex.williamson@redhat.com,
kvm@vger.kernel.org, songwenjun@huawei.com
Subject: [RFC,v1,1/2] iommu/arm-smmu: support s2 domain attribute
Date: Fri, 21 Oct 2016 12:39:23 +0800 [thread overview]
Message-ID: <1477024764-79882-1-git-send-email-songwenjun@huawei.com> (raw)
Under some condition, user want to use the
only stage 2 translation ability, so smmu
driver need support setting only s2 domain
attribute.
Signed-off-by: Rick Song <songwenjun@huawei.com>
---
drivers/iommu/arm-smmu-v3.c | 12 ++++++++++++
include/linux/iommu.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 15c01c3..d3b19d2 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -1854,6 +1854,18 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
mutex_lock(&smmu_domain->init_mutex);
switch (attr) {
+ case DOMAIN_ATTR_S2:
+ if (smmu_domain->smmu) {
+ ret = -EPERM;
+ goto out_unlock;
+ }
+
+ if (*(int *)data)
+ smmu_domain->stage = ARM_SMMU_DOMAIN_S2;
+ else
+ smmu_domain->stage = ARM_SMMU_DOMAIN_S1;
+
+ break;
case DOMAIN_ATTR_NESTING:
if (smmu_domain->smmu) {
ret = -EPERM;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 436dc21..0b5a387 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -114,6 +114,7 @@ enum iommu_attr {
DOMAIN_ATTR_FSL_PAMU_ENABLE,
DOMAIN_ATTR_FSL_PAMUV1,
DOMAIN_ATTR_NESTING, /* two stages of translation */
+ DOMAIN_ATTR_S2, /* only stage 2 translation */
DOMAIN_ATTR_MAX,
};
--
1.9.1
next reply other threads:[~2016-10-21 4:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-21 4:39 Rick Song [this message]
2016-10-21 4:39 ` [RFC,v1,2/2] vfio/iommu-type1: set only stage 2 translation Rick Song
[not found] ` <1477024764-79882-2-git-send-email-songwenjun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-21 14:27 ` Alex Williamson
[not found] ` <20161021082703.4890c419-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
2016-10-21 14:48 ` Robin Murphy
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=1477024764-79882-1-git-send-email-songwenjun@huawei.com \
--to=songwenjun@huawei.com \
--cc=alex.williamson@redhat.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=robin.murphy@arm.com \
--cc=will.deacon@arm.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).