From: Marc Gonzalez <marc.w.gonzalez@free.fr>
To: Robin Murphy <robin.murphy@arm.com>,
Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Marc Zyngier <marc.zyngier@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Jeffrey Hugo <jhugo@codeaurora.org>,
MSM <linux-arm-msm@vger.kernel.org>,
AngeloGioacchino Del Regno <kholk11@gmail.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] arm64/io: Don't use WZR in writel
Date: Thu, 2 May 2019 19:27:01 +0200 [thread overview]
Message-ID: <190e3c4f-7486-f56c-b3e1-7ee07da88395@free.fr> (raw)
In-Reply-To: <3757fc2d-0587-be46-8f75-6d79906be8bd@arm.com>
On 02/05/2019 18:33, Robin Murphy wrote:
> Both Angelo's and your reports strongly imply that the previous
> constant-folding debate was a red herring and the trivial fix[1] should
> still be sufficient, but nobody's given me actual confirmation of
> whether it is or isn't :(
>
> Robin.
>
> [1]
> http://linux-arm.org/git?p=linux-rm.git;a=commitdiff;h=a13e3239f0c543f1f61ce5f7f5c06320e521701c
>
>
> Apparently some Qualcomm arm64 platforms which appear to expose their
I'd write qcom. I don't think they deserve to be named & capitalized :'p
> SMMU global register space are still in fact using a hypervisor to
> mediate it by trapping and emulating register accesses. Sadly, some
> deployed versions of said trapping code have bugs wherein they go
> horribly wrong for stores using r31 (i.e. XZR/WZR) as the source
> register.
>
> While this can be mitigated for GCC today by tweaking the constraints
> for the implementation of writel_relaxed(), to avoid any potential arms
> race with future compilers compilers more aggressively optimising
"compilers compilers" ... typo?
> register allocation the simple way is to just remove all the problematic
> constant zeros. For the write-only TLB operations, the actual value is
> irrelevant anyway and any old nearby variable will provide a suitable
> GPR to encode. The one point at which we really do need a zero to clear
> a context bank happens before any of the TLB maintenance where hangs
> have been reported, so is apparently not a problem... :/
>
> Reported-by: Angelo G. Del Regno <kholk11@gmail.com>
> Reported-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index 045d938..80bf29e 100644 (file)
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -422,7 +422,7 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu,
> {
> unsigned int spin_cnt, delay;
>
> - writel_relaxed(0, sync);
> + writel_relaxed((unsigned long)sync, sync);
You don't think this might deserve a comment explaining that the value
is irrelevant? (On top of the commit message, I mean.)
> for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) {
> for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) {
> if (!(readl_relaxed(status) & sTLBGSTATUS_GSACTIVE))
> @@ -1760,8 +1760,8 @@ 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_TLBIALLH);
> - writel_relaxed(0, gr0_base + ARM_SMMU_GR0_TLBIALLNSNH);
> + writel_relaxed(reg, gr0_base + ARM_SMMU_GR0_TLBIALLH);
> + writel_relaxed(reg, gr0_base + ARM_SMMU_GR0_TLBIALLNSNH);
Same here?
Anyway, your solution works on msm8998, therefore you have my
Tested-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
and you can throw in my
Reviewed-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
for good measure ;-)
All that's left now is to submit it to Linus during the merge window :-p
Regards.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-05-02 17:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-09 18:34 [PATCH] arm64/io: Don't use WZR in writel AngeloGioacchino Del Regno
2019-02-11 10:57 ` Will Deacon
2019-02-11 11:52 ` Marc Zyngier
2019-02-11 14:29 ` AngeloGioacchino Del Regno
2019-02-11 14:59 ` Marc Zyngier
2019-02-11 16:15 ` AngeloGioacchino Del Regno
2019-02-11 16:37 ` Robin Murphy
2019-02-23 18:12 ` Bjorn Andersson
2019-02-23 18:37 ` Marc Zyngier
2019-02-24 3:53 ` Bjorn Andersson
2019-03-12 12:36 ` Marc Gonzalez
2019-03-18 16:04 ` Robin Murphy
2019-03-18 17:00 ` Russell King - ARM Linux admin
2019-03-18 17:11 ` Ard Biesheuvel
2019-03-18 17:19 ` Robin Murphy
2019-03-18 17:24 ` Robin Murphy
2019-03-19 11:45 ` Robin Murphy
2019-03-18 17:30 ` Marc Gonzalez
2019-03-18 17:59 ` Robin Murphy
2019-05-02 16:05 ` Marc Gonzalez
2019-05-02 16:33 ` Robin Murphy
2019-05-02 16:50 ` Marc Gonzalez
2019-05-03 11:36 ` Marc Gonzalez
2019-05-03 12:48 ` Robin Murphy
2019-05-03 13:07 ` Marc Gonzalez
2019-05-04 13:35 ` AngeloGioacchino Del Regno
2019-05-05 18:05 ` AngeloGioacchino Del Regno
2019-05-20 15:05 ` Marc Gonzalez
2019-05-02 17:27 ` Marc Gonzalez [this message]
2019-05-03 0:38 ` Bjorn Andersson
-- strict thread matches above, loose matches on Subject: below --
2019-02-09 18:30 AngeloGioacchino Del Regno
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=190e3c4f-7486-f56c-b3e1-7ee07da88395@free.fr \
--to=marc.w.gonzalez@free.fr \
--cc=bjorn.andersson@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=jhugo@codeaurora.org \
--cc=kholk11@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--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).