From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: Mitchel Humpherys <mitchelh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH] iommu/arm-smmu: don't touch the secure STLBIALL register
Date: Wed, 7 Jan 2015 18:53:22 +0000 [thread overview]
Message-ID: <20150107185322.GU7485@arm.com> (raw)
In-Reply-To: <vnkwh9w2bfr6.fsf-Yf+dfxj6toJBVvN7MMdr1KRtKmQZhJ7pQQ4Iyu8u01E@public.gmane.org>
On Wed, Jan 07, 2015 at 06:35:41PM +0000, Mitchel Humpherys wrote:
> On Wed, Jan 07 2015 at 10:04:20 AM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> > On Wed, Jan 07, 2015 at 05:52:46PM +0000, Mitchel Humpherys wrote:
> >> On Wed, Jan 07 2015 at 02:13:00 AM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> >> > If would be better to check for the ARM_SMMU_OPT_SECURE_CFG_ACCESS feature
> >> > and, if it's set then zero ARM_SMMU_GR0_STLBIALL at the correct address
> >> > otherwise do the ARM_SMMU_GR0_TLBIALLH and ARM_SMMU_GR0_TLBIALLNSNH.
> >>
> >> I'm confused. The problem I'm addressing here is that we're touching a
> >> register that's marked as "secure only", which causes our system to
> >> crash. Why would we ever want to touch a secure only register, calxeda
> >> workaround or not?
> >
> > Because I think the way the SMMU is wired for Calxeda is that the CPU can
> > only see the secure side of the register interface, so the only way to nuke
> > the whole TLB would be to use ARM_SMMU_GR0_STLBIALL.
>
> Still not sure I understand what "the correct address" is for STLBIALL
> on Calxeda (i.e. whether or not we need to use ARM_SMMU_GR0_NS), but
> something like:
Hehe, I wasn't actually expecting a patch, but thanks!
> -- >8 --
> Subject: [PATCH v2] iommu/arm-smmu: don't touch the secure STLBIALL register
>
> Currently we do a STLBIALL when we initialize the SMMU. However, on
> systems with sane secure
> configurations (i.e. !ARM_SMMU_OPT_SECURE_CFG_ACCESS) that register is
> not supposed to be touched and is marked as "Secure only" in the spec.
> Touching it results in a crash on those platforms. However, on
> platforms with ARM_SMMU_OPT_SECURE_CFG_ACCESS it's the only way to nuke
> the whole TLB, so leave it in for them but rip it out for everyone else.
>
> Signed-off-by: Mitchel Humpherys <mitchelh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---
> drivers/iommu/arm-smmu.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index 60558f794922..d4c149d83f3d 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1686,9 +1686,12 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
> }
>
> /* Invalidate the TLB, just in case */
> - writel_relaxed(0, gr0_base + ARM_SMMU_GR0_STLBIALL);
> - writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLH);
> - writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLNSNH);
> + if (smmu->options & ARM_SMMU_OPT_SECURE_CFG_ACCESS) {
> + writel_relaxed(0, gr0_base + ARM_SMMU_GR0_STLBIALL);
Right, so this is the bit where we'd need some Calxeda information about
whether or not to subtract 0x400 from gr0_base or not.
> + } else {
> + writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLH);
> + writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLNSNH);
> + }
For now, I've applied your original patch pending any insight on the above.
Cheers,
Will
WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] iommu/arm-smmu: don't touch the secure STLBIALL register
Date: Wed, 7 Jan 2015 18:53:22 +0000 [thread overview]
Message-ID: <20150107185322.GU7485@arm.com> (raw)
In-Reply-To: <vnkwh9w2bfr6.fsf@mitchelh-linux.qualcomm.com>
On Wed, Jan 07, 2015 at 06:35:41PM +0000, Mitchel Humpherys wrote:
> On Wed, Jan 07 2015 at 10:04:20 AM, Will Deacon <will.deacon@arm.com> wrote:
> > On Wed, Jan 07, 2015 at 05:52:46PM +0000, Mitchel Humpherys wrote:
> >> On Wed, Jan 07 2015 at 02:13:00 AM, Will Deacon <will.deacon@arm.com> wrote:
> >> > If would be better to check for the ARM_SMMU_OPT_SECURE_CFG_ACCESS feature
> >> > and, if it's set then zero ARM_SMMU_GR0_STLBIALL at the correct address
> >> > otherwise do the ARM_SMMU_GR0_TLBIALLH and ARM_SMMU_GR0_TLBIALLNSNH.
> >>
> >> I'm confused. The problem I'm addressing here is that we're touching a
> >> register that's marked as "secure only", which causes our system to
> >> crash. Why would we ever want to touch a secure only register, calxeda
> >> workaround or not?
> >
> > Because I think the way the SMMU is wired for Calxeda is that the CPU can
> > only see the secure side of the register interface, so the only way to nuke
> > the whole TLB would be to use ARM_SMMU_GR0_STLBIALL.
>
> Still not sure I understand what "the correct address" is for STLBIALL
> on Calxeda (i.e. whether or not we need to use ARM_SMMU_GR0_NS), but
> something like:
Hehe, I wasn't actually expecting a patch, but thanks!
> -- >8 --
> Subject: [PATCH v2] iommu/arm-smmu: don't touch the secure STLBIALL register
>
> Currently we do a STLBIALL when we initialize the SMMU. However, on
> systems with sane secure
> configurations (i.e. !ARM_SMMU_OPT_SECURE_CFG_ACCESS) that register is
> not supposed to be touched and is marked as "Secure only" in the spec.
> Touching it results in a crash on those platforms. However, on
> platforms with ARM_SMMU_OPT_SECURE_CFG_ACCESS it's the only way to nuke
> the whole TLB, so leave it in for them but rip it out for everyone else.
>
> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
> ---
> drivers/iommu/arm-smmu.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index 60558f794922..d4c149d83f3d 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -1686,9 +1686,12 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
> }
>
> /* Invalidate the TLB, just in case */
> - writel_relaxed(0, gr0_base + ARM_SMMU_GR0_STLBIALL);
> - writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLH);
> - writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLNSNH);
> + if (smmu->options & ARM_SMMU_OPT_SECURE_CFG_ACCESS) {
> + writel_relaxed(0, gr0_base + ARM_SMMU_GR0_STLBIALL);
Right, so this is the bit where we'd need some Calxeda information about
whether or not to subtract 0x400 from gr0_base or not.
> + } else {
> + writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLH);
> + writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLNSNH);
> + }
For now, I've applied your original patch pending any insight on the above.
Cheers,
Will
next prev parent reply other threads:[~2015-01-07 18:53 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-23 17:39 [PATCH] iommu/arm-smmu: don't touch the secure STLBIALL register Mitchel Humpherys
2014-12-23 17:39 ` Mitchel Humpherys
2015-01-06 14:15 ` Will Deacon
2015-01-06 14:15 ` Will Deacon
[not found] ` <20150106141507.GB3484-5wv7dgnIgG8@public.gmane.org>
2015-01-06 20:16 ` Mitchel Humpherys
2015-01-06 20:16 ` Mitchel Humpherys
2015-01-06 22:35 ` Rob Herring
2015-01-06 22:35 ` Rob Herring
[not found] ` <CAL_JsqJYZ+-qt8UXPP7=pCsZFXeOkB8ogOzbuusdv1Cb+o1d2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-06 23:30 ` Mitchel Humpherys
2015-01-06 23:30 ` Mitchel Humpherys
[not found] ` <vnkw61cjebbq.fsf-Yf+dfxj6toJBVvN7MMdr1KRtKmQZhJ7pQQ4Iyu8u01E@public.gmane.org>
2015-01-07 10:13 ` Will Deacon
2015-01-07 10:13 ` Will Deacon
[not found] ` <20150107101300.GC7485-5wv7dgnIgG8@public.gmane.org>
2015-01-07 17:52 ` Mitchel Humpherys
2015-01-07 17:52 ` Mitchel Humpherys
[not found] ` <vnkw4ms2cwb5.fsf-Yf+dfxj6toJBVvN7MMdr1KRtKmQZhJ7pQQ4Iyu8u01E@public.gmane.org>
2015-01-07 18:04 ` Will Deacon
2015-01-07 18:04 ` Will Deacon
[not found] ` <20150107180420.GR7485-5wv7dgnIgG8@public.gmane.org>
2015-01-07 18:35 ` Mitchel Humpherys
2015-01-07 18:35 ` Mitchel Humpherys
[not found] ` <vnkwh9w2bfr6.fsf-Yf+dfxj6toJBVvN7MMdr1KRtKmQZhJ7pQQ4Iyu8u01E@public.gmane.org>
2015-01-07 18:53 ` Will Deacon [this message]
2015-01-07 18:53 ` Will Deacon
[not found] ` <20150107185322.GU7485-5wv7dgnIgG8@public.gmane.org>
2015-01-08 20:58 ` Rob Herring
2015-01-08 20:58 ` Rob Herring
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=20150107185322.GU7485@arm.com \
--to=will.deacon-5wv7dgnigg8@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=mitchelh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.