From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: Laurent Pinchart
<laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org,
Varun.Sethi-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
prem.mallappa-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
Robin.Murphy-5wv7dgnIgG8@public.gmane.org
Subject: [PATCH v2 5/5] iommu: io-pgtable-arm: add non-secure quirk
Date: Fri, 9 Jan 2015 13:54:17 +0000 [thread overview]
Message-ID: <1420811657-21321-6-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1420811657-21321-1-git-send-email-will.deacon-5wv7dgnIgG8@public.gmane.org>
From: Laurent Pinchart <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
The quirk causes the Non-Secure bit to be set in all page table entries.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
Signed-off-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
---
drivers/iommu/io-pgtable-arm.c | 7 +++++++
drivers/iommu/io-pgtable.h | 3 ++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 52fb21487f02..5a500edf00cc 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -82,11 +82,13 @@
#define ARM_LPAE_PTE_TYPE_TABLE 3
#define ARM_LPAE_PTE_TYPE_PAGE 3
+#define ARM_LPAE_PTE_NSTABLE (((arm_lpae_iopte)1) << 63)
#define ARM_LPAE_PTE_XN (((arm_lpae_iopte)3) << 53)
#define ARM_LPAE_PTE_AF (((arm_lpae_iopte)1) << 10)
#define ARM_LPAE_PTE_SH_NS (((arm_lpae_iopte)0) << 8)
#define ARM_LPAE_PTE_SH_OS (((arm_lpae_iopte)2) << 8)
#define ARM_LPAE_PTE_SH_IS (((arm_lpae_iopte)3) << 8)
+#define ARM_LPAE_PTE_NS (((arm_lpae_iopte)1) << 5)
#define ARM_LPAE_PTE_VALID (((arm_lpae_iopte)1) << 0)
#define ARM_LPAE_PTE_ATTR_LO_MASK (((arm_lpae_iopte)0x3ff) << 2)
@@ -208,6 +210,9 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data,
return -EEXIST;
}
+ if (data->iop.cfg.quirks & IO_PGTABLE_QUIRK_ARM_NS)
+ pte |= ARM_LPAE_PTE_NS;
+
if (lvl == ARM_LPAE_MAX_LEVELS - 1)
pte |= ARM_LPAE_PTE_TYPE_PAGE;
else
@@ -251,6 +256,8 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
data->iop.cfg.tlb->flush_pgtable(cptep, 1UL << data->pg_shift,
cookie);
pte = __pa(cptep) | ARM_LPAE_PTE_TYPE_TABLE;
+ if (data->iop.cfg.quirks & IO_PGTABLE_QUIRK_ARM_NS)
+ pte |= ARM_LPAE_PTE_NSTABLE;
*ptep = pte;
data->iop.cfg.tlb->flush_pgtable(ptep, sizeof(*ptep), cookie);
} else {
diff --git a/drivers/iommu/io-pgtable.h b/drivers/iommu/io-pgtable.h
index 05c4e593a25f..10e32f69c668 100644
--- a/drivers/iommu/io-pgtable.h
+++ b/drivers/iommu/io-pgtable.h
@@ -43,7 +43,8 @@ struct iommu_gather_ops {
* @tlb: TLB management callbacks for this set of tables.
*/
struct io_pgtable_cfg {
- int quirks; /* IO_PGTABLE_QUIRK_* */
+ #define IO_PGTABLE_QUIRK_ARM_NS (1 << 0) /* Set NS bit in PTEs */
+ int quirks;
unsigned long pgsize_bitmap;
unsigned int ias;
unsigned int oas;
--
2.1.4
next prev parent reply other threads:[~2015-01-09 13:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-09 13:54 [PATCH v2 0/5] Generic IOMMU page table framework Will Deacon
2015-01-09 13:54 ` [PATCH v2 2/5] iommu: add ARM LPAE page table allocator Will Deacon
2015-01-09 13:54 ` [PATCH v2 4/5] iommu/arm-smmu: make use of generic LPAE allocator Will Deacon
[not found] ` <1420811657-21321-1-git-send-email-will.deacon-5wv7dgnIgG8@public.gmane.org>
2015-01-09 13:54 ` [PATCH v2 1/5] iommu: introduce generic page table allocation framework Will Deacon
2015-01-09 13:54 ` [PATCH v2 3/5] iommu: add self-consistency tests to ARM LPAE IO page table allocator Will Deacon
2015-01-09 13:54 ` Will Deacon [this message]
2015-01-16 14:01 ` [PATCH v2 0/5] Generic IOMMU page table framework Will Deacon
[not found] ` <20150116140130.GQ7091-5wv7dgnIgG8@public.gmane.org>
2015-01-19 13:09 ` joro-zLv9SwRftAIdnm+yROfE0A
[not found] ` <20150119130940.GJ6343-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-01-19 13:18 ` Will Deacon
[not found] ` <20150119131843.GJ32131-5wv7dgnIgG8@public.gmane.org>
2015-01-19 13:56 ` Laurent Pinchart
2015-01-19 14:01 ` joro-zLv9SwRftAIdnm+yROfE0A
[not found] ` <20150119140106.GM6343-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-01-20 16:30 ` [PATCH v2] iommu/ipmmu-vmsa: Use the ARM LPAE page table allocator Laurent Pinchart
[not found] ` <1421771404-22774-1-git-send-email-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2015-01-21 14:44 ` Will Deacon
[not found] ` <20150121144419.GJ4549-5wv7dgnIgG8@public.gmane.org>
2015-01-21 14:58 ` Laurent Pinchart
2015-01-21 15:05 ` joro-zLv9SwRftAIdnm+yROfE0A
[not found] ` <20150121150529.GA30345-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-01-21 15:07 ` Laurent Pinchart
2015-01-21 15:27 ` joro-zLv9SwRftAIdnm+yROfE0A
[not found] ` <20150121152724.GB30345-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-01-21 15:31 ` Laurent Pinchart
2015-01-26 12:46 ` joro-zLv9SwRftAIdnm+yROfE0A
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=1420811657-21321-6-git-send-email-will.deacon@arm.com \
--to=will.deacon-5wv7dgnigg8@public.gmane.org \
--cc=Robin.Murphy-5wv7dgnIgG8@public.gmane.org \
--cc=Varun.Sethi-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=prem.mallappa-dY08KVG/lbpWk0Htik3J/w@public.gmane.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