From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 22/20] iommu/arm-smmu: Fall back to global bypass
Date: Mon, 12 Sep 2016 10:12:15 +0100 [thread overview]
Message-ID: <20160912091215.GA23211@arm.com> (raw)
In-Reply-To: <9c467662ca0fb562cff6d5c9443d77eacb257060.1473443407.git.robin.murphy@arm.com>
On Fri, Sep 09, 2016 at 07:17:47PM +0100, Robin Murphy wrote:
> Unlike SMMUv2, SMMUv3 has no easy way to bypass unknown stream IDs,
> other than allocating and filling in the entire stream table with bypass
> entries, which for some configurations would waste *gigabytes* of RAM.
> Otherwise, all transactions on unknown stream IDs will simply be aborted
> with a C_BAD_STREAMID event.
>
> Rather than render the system unusable in the case of an invalid DT,
> avoid enabling the SMMU altogether such that everything bypasses
> (though letting the explicit disable_bypass option take precedence).
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/iommu/arm-smmu-v3.c | 28 +++++++++++++++++++++++-----
> 1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index be293b5aa896..859b80c83946 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -126,6 +126,9 @@
> #define CR2_RECINVSID (1 << 1)
> #define CR2_E2H (1 << 0)
>
> +#define ARM_SMMU_GBPA 0x44
> +#define GBPA_ABORT (1 << 20)
> +
> #define ARM_SMMU_IRQ_CTRL 0x50
> #define IRQ_CTRL_EVTQ_IRQEN (1 << 2)
> #define IRQ_CTRL_PRIQ_IRQEN (1 << 1)
> @@ -2242,7 +2245,7 @@ static int arm_smmu_device_disable(struct arm_smmu_device *smmu)
> return ret;
> }
>
> -static int arm_smmu_device_reset(struct arm_smmu_device *smmu)
> +static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
> {
> int ret;
> u32 reg, enables;
> @@ -2343,8 +2346,14 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu)
> return ret;
> }
>
> - /* Enable the SMMU interface */
> - enables |= CR0_SMMUEN;
> +
> + /* Enable the SMMU interface, or ensure bypass */
> + if (!bypass || disable_bypass) {
> + enables |= CR0_SMMUEN;
> + } else {
> + reg = readl_relaxed(smmu->base + ARM_SMMU_GBPA);
> + writel_relaxed(reg & ~GBPA_ABORT, smmu->base + ARM_SMMU_GBPA);
> + }
I think this invokes the CONSTRAINED UNPREDICTABLE monster, because the
GBPA register has some a special update procedure involving the 'update'
bit (bit 31).
You might be able to reuse arm_smmu_write_reg_sync to poll for completion
with offset 0. I'm happy to assume that the update bit is initially clear.
Will
next prev parent reply other threads:[~2016-09-12 9:12 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 15:33 [PATCH v6 00/20] Generic DT bindings for PCI IOMMUs and ARM SMMU Robin Murphy
2016-09-06 15:33 ` [PATCH v6 01/20] Docs: dt: add PCI IOMMU map bindings Robin Murphy
2016-09-06 15:33 ` [PATCH v6 02/20] of/irq: Break out msi-map lookup (again) Robin Murphy
2016-09-06 15:33 ` [PATCH v6 03/20] iommu/of: Handle iommu-map property for PCI Robin Murphy
2016-09-06 15:33 ` [PATCH v6 04/20] iommu/of: Introduce iommu_fwspec Robin Murphy
2016-09-06 15:33 ` [PATCH v6 05/20] iommu/arm-smmu: Implement of_xlate() for SMMUv3 Robin Murphy
2016-09-06 15:33 ` [PATCH v6 06/20] iommu/arm-smmu: Support non-PCI devices with SMMUv3 Robin Murphy
2016-09-06 15:33 ` [PATCH v6 07/20] iommu/arm-smmu: Set PRIVCFG in stage 1 STEs Robin Murphy
2016-09-06 15:33 ` [PATCH v6 08/20] iommu/arm-smmu: Handle stream IDs more dynamically Robin Murphy
2016-09-06 15:33 ` [PATCH v6 09/20] iommu/arm-smmu: Consolidate stream map entry state Robin Murphy
2016-09-06 15:33 ` [PATCH v6 10/20] iommu/arm-smmu: Keep track of S2CR state Robin Murphy
2016-09-06 15:33 ` [PATCH v6 11/20] iommu/arm-smmu: Refactor mmu-masters handling Robin Murphy
2016-09-06 15:33 ` [PATCH v6 12/20] iommu/arm-smmu: Streamline SMMU data lookups Robin Murphy
2016-09-06 15:33 ` [PATCH v6 13/20] iommu/arm-smmu: Add a stream map entry iterator Robin Murphy
2016-09-06 15:33 ` [PATCH v6 14/20] iommu/arm-smmu: Intelligent SMR allocation Robin Murphy
2016-09-06 15:33 ` [PATCH v6 15/20] iommu/arm-smmu: Convert to iommu_fwspec Robin Murphy
2016-09-06 15:33 ` [PATCH v6 16/20] Docs: dt: document ARM SMMU generic binding usage Robin Murphy
2016-09-06 15:33 ` [PATCH v6 17/20] iommu/arm-smmu: Wire up generic configuration support Robin Murphy
2016-09-06 15:33 ` [PATCH v6 18/20] iommu/arm-smmu: Set domain geometry Robin Murphy
2016-09-06 15:33 ` [PATCH v6 19/20] iommu/dma: Add support for mapping MSIs Robin Murphy
2016-09-07 9:55 ` [PATCH v6.1] " Robin Murphy
2016-09-09 14:38 ` Thomas Gleixner
2016-09-09 14:42 ` Marc Zyngier
2016-09-06 15:33 ` [PATCH v6 20/20] iommu/dma: Avoid PCI host bridge windows Robin Murphy
2016-09-09 17:37 ` [PATCH v6 00/20] Generic DT bindings for PCI IOMMUs and ARM SMMU Will Deacon
2016-09-09 18:17 ` [PATCH 21/20] drm/exynos: Fix iommu_dma_init_domain prototype change Robin Murphy
2016-09-12 9:18 ` Will Deacon
2016-09-09 18:17 ` [PATCH 22/20] iommu/arm-smmu: Fall back to global bypass Robin Murphy
2016-09-12 9:12 ` Will Deacon [this message]
2016-09-09 18:17 ` [PATCH 4.5/20] Docs: dt: document ARM SMMUv3 generic binding usage Robin Murphy
2016-09-12 9:16 ` Will Deacon
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=20160912091215.GA23211@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).