linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xu Qiang <xuqiang36@huawei.com>
To: <tglx@linutronix.de>, <jason@lakedaemon.net>, <maz@kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <rui.xiang@huawei.com>
Subject: [PATCH -next] irq-chip/gic-v3-its: Fixed an issue where the ITS executes the residual commands in the queue again when the ITS wakes up from sleep mode.
Date: Tue, 3 Nov 2020 08:11:23 +0000	[thread overview]
Message-ID: <20201103081123.119969-1-xuqiang36@huawei.com> (raw)

During wakeup, the ATF restore interface restores the values of
the cbaser and cwriter registers. As a result, the ITS executes
the residual commands in the queue, which may cause memory corruption.

To solve this problem, clear all data in the command queue
in the suspend interface of the ITS driver.

Signed-off-by: Xu Qiang <xuqiang36@huawei.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 0fec31931e11..b8487f78ac21 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -4741,6 +4741,14 @@ static int its_save_disable(void)
 	list_for_each_entry(its, &its_nodes, entry) {
 		void __iomem *base;
 
+		/*
+		 * Clear the command queue so that the ITS will not re-execute
+		 * the remaining commands in the command queue when
+		 * the cwriter and cbaser registers are restored
+		 * in the restore interface of the firmware.
+		 */
+		memset(its->cmd_base, 0, ITS_CMD_QUEUE_SZ);
+
 		if (!(its->flags & ITS_FLAGS_SAVE_SUSPEND_STATE))
 			continue;
 
-- 
2.25.0


             reply	other threads:[~2020-11-03  8:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03  8:11 Xu Qiang [this message]
2020-11-03 18:19 ` [PATCH -next] irq-chip/gic-v3-its: Fixed an issue where the ITS executes the residual commands in the queue again when the ITS wakes up from sleep mode Marc Zyngier
2020-11-05 11:54   ` xuqiang (M)
2020-11-05 13:12     ` Marc Zyngier
2020-11-05 14:06       ` xuqiang (M)
2020-11-05 14:24         ` Marc Zyngier
2020-11-06 10:05           ` xuqiang (M)
2020-11-07 10:42 Xu Qiang
2020-11-07 16:54 ` Marc Zyngier
2020-11-09  3:05   ` xuqiang (M)
2020-11-09 10:43     ` Marc Zyngier
2020-11-10  9:09       ` xuqiang (M)
2020-11-17 13:37         ` xuqiang (M)
2020-11-22 12:47 ` Marc Zyngier

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=20201103081123.119969-1-xuqiang36@huawei.com \
    --to=xuqiang36@huawei.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=rui.xiang@huawei.com \
    --cc=tglx@linutronix.de \
    /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).