From: Zenghui Yu <yuzenghui@huawei.com>
To: <kvmarm@lists.cs.columbia.edu>, <maz@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <wanghaibin.wang@huawei.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Yanlei Jia <jiayanlei@huawei.com>
Subject: [PATCH] irqchip/gic-v3-its: Clear Valid before writing any bits else in VPENDBASER
Date: Mon, 24 Feb 2020 10:50:29 +0800 [thread overview]
Message-ID: <20200224025029.92-1-yuzenghui@huawei.com> (raw)
The Valid bit must be cleared before changing anything else when writing
GICR_VPENDBASER to avoid the UNPREDICTABLE behavior. This is exactly what
we've done on 32bit arm, but not on arm64.
This works fine on GICv4 where we only clear Valid for a vPE deschedule.
With the introduction of GICv4.1, we might also need to talk something else
(e.g., PendingLast, Doorbell) to the redistributor when clearing the Valid.
Let's port the 32bit gicr_write_vpendbaser() to arm64 so that hardware can
do the right thing after descheduling the vPE.
Cc: Yanlei Jia <jiayanlei@huawei.com>
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
---
arch/arm64/include/asm/arch_gicv3.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/arch_gicv3.h b/arch/arm64/include/asm/arch_gicv3.h
index 25fec4bde43a..effe66e1ca58 100644
--- a/arch/arm64/include/asm/arch_gicv3.h
+++ b/arch/arm64/include/asm/arch_gicv3.h
@@ -143,7 +143,18 @@ static inline u32 gic_read_rpr(void)
#define gicr_write_vpropbaser(v, c) writeq_relaxed(v, c)
#define gicr_read_vpropbaser(c) readq_relaxed(c)
-#define gicr_write_vpendbaser(v, c) writeq_relaxed(v, c)
+#define gicr_write_vpendbaser(v, c) do { \
+ u64 tmp = readq_relaxed(c); \
+ \
+ /* Clear Valid before writing any bits else. */ \
+ if (tmp & GICR_VPENDBASER_Valid) { \
+ tmp &= ~GICR_VPENDBASER_Valid; \
+ writeq_relaxed(tmp, c); \
+ } \
+ \
+ writeq_relaxed(v, c); \
+} while (0)
+
#define gicr_read_vpendbaser(c) readq_relaxed(c)
static inline bool gic_prio_masking_enabled(void)
--
2.19.1
next reply other threads:[~2020-02-24 2:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 2:50 Zenghui Yu [this message]
2020-02-24 23:47 ` [PATCH] irqchip/gic-v3-its: Clear Valid before writing any bits else in VPENDBASER Marc Zyngier
2020-02-25 2:06 ` Zenghui Yu
2020-02-25 19:45 ` Marc Zyngier
2020-02-26 1:35 ` Zenghui Yu
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=20200224025029.92-1-yuzenghui@huawei.com \
--to=yuzenghui@huawei.com \
--cc=jiayanlei@huawei.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=wanghaibin.wang@huawei.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).