From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55B25C2D0A3 for ; Tue, 3 Nov 2020 18:19:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8AB620786 for ; Tue, 3 Nov 2020 18:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604427550; bh=Qy5s1NAtEIojqVksxSHVm3F5XXZqPZGBiGCDzHx7iD8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=Bq6I18RCD9LbFWHyBzWfsmnMV9GE/UkEcWu/KNQeH8B1ZCqn8lmY+H+Ms9e15cJn4 qd4WimmzTKbdM/RnfSASdmNKAJTkqkEy413N5+uVU9yfyt79LyfsejV37pwzfLp1xU PZ7TWmcFVVlpfPmY5s5mWbB6W4SH8RNb4th/KK+M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729048AbgKCSTI (ORCPT ); Tue, 3 Nov 2020 13:19:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:40140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725957AbgKCSTI (ORCPT ); Tue, 3 Nov 2020 13:19:08 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D24E620757; Tue, 3 Nov 2020 18:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604427548; bh=Qy5s1NAtEIojqVksxSHVm3F5XXZqPZGBiGCDzHx7iD8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QVSpz+cJ/k/J1C/+B7pJevQKOg4AJS/uRjknGB2ip0qjRXq4+JJh/nylcXj8PAjSf D7B6rqbB9kJLobAbXIDNpbtjm77z9IWQAofecB0xkVVRuz6Yoz1WgSmOuFy0ElLOmd ZhTLiysbxH26bvzaZUSIgXdJe3FbpfruZEJWMi8k= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1ka0td-007E4I-JL; Tue, 03 Nov 2020 18:19:05 +0000 Date: Tue, 03 Nov 2020 18:19:04 +0000 Message-ID: <87imamtiav.wl-maz@kernel.org> From: Marc Zyngier To: Xu Qiang Cc: , , , Subject: Re: [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. In-Reply-To: <20201103081123.119969-1-xuqiang36@huawei.com> References: <20201103081123.119969-1-xuqiang36@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/26.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: xuqiang36@huawei.com, tglx@linutronix.de, jason@lakedaemon.net, linux-kernel@vger.kernel.org, rui.xiang@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 03 Nov 2020 08:11:23 +0000, Xu Qiang wrote: > > 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 > --- > 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; You are wiping the ITS queue before even stopping the ITS. How well is that going to work? What if there is something in flight? I don't understand what you are trying to do here, nor how ATF is involved. So please describe the whole sequence of events, and we'll decide whether that's something we need to fix. Thanks, M. -- Without deviation from the norm, progress is not possible.