diff options
author | Robin Murphy <robin.murphy@arm.com> | 2016-02-12 20:09:46 +0300 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-02-17 17:15:09 +0300 |
commit | 3850db49da87121b54c3ba43c82cdbe5a7c76be5 (patch) | |
tree | 7734f41a83225e45c19a2999592b2b8eaa68a08c /drivers/iommu/io-pgtable-arm.c | |
parent | 88492a4700360a086e55d8874ad786105a5e8b0f (diff) | |
download | linux-3850db49da87121b54c3ba43c82cdbe5a7c76be5.tar.xz |
iommu/io-pgtable: Rationalise quirk handling
As the number of io-pgtable implementations grows beyond 1, it's time
to rationalise the quirks mechanism before things have a chance to
start getting really ugly and out-of-hand.
To that end:
- Indicate exactly which quirks each format can/does support.
- Fail creating a table if a caller wants unsupported quirks.
- Properly document where each quirk applies and why.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/iommu/io-pgtable-arm.c')
-rw-r--r-- | drivers/iommu/io-pgtable-arm.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index b2bbc8427579..f433b516098a 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -659,8 +659,12 @@ static struct io_pgtable * arm_64_lpae_alloc_pgtable_s1(struct io_pgtable_cfg *cfg, void *cookie) { u64 reg; - struct arm_lpae_io_pgtable *data = arm_lpae_alloc_pgtable(cfg); + struct arm_lpae_io_pgtable *data; + + if (cfg->quirks & ~IO_PGTABLE_QUIRK_ARM_NS) + return NULL; + data = arm_lpae_alloc_pgtable(cfg); if (!data) return NULL; @@ -743,8 +747,13 @@ static struct io_pgtable * arm_64_lpae_alloc_pgtable_s2(struct io_pgtable_cfg *cfg, void *cookie) { u64 reg, sl; - struct arm_lpae_io_pgtable *data = arm_lpae_alloc_pgtable(cfg); + struct arm_lpae_io_pgtable *data; + + /* The NS quirk doesn't apply at stage 2 */ + if (cfg->quirks) + return NULL; + data = arm_lpae_alloc_pgtable(cfg); if (!data) return NULL; |