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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 D15FCC07E9A for ; Tue, 13 Jul 2021 02:42:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4F09C611F1 for ; Tue, 13 Jul 2021 02:42:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F09C611F1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m38NT-00060V-78 for qemu-devel@archiver.kernel.org; Mon, 12 Jul 2021 22:42:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m38Mh-00059J-9K; Mon, 12 Jul 2021 22:41:43 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:44639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m38Mf-0000tF-Cq; Mon, 12 Jul 2021 22:41:43 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id BED1832008FC; Mon, 12 Jul 2021 22:41:35 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute2.internal (MEProxy); Mon, 12 Jul 2021 22:41:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type:content-transfer-encoding; s=fm3; bh=GmPmL uzZOb8exTg9V/MMokFTNadVtf4wSAUb2Wfg1Zk=; b=UA2svfpbvltXG4l1bg+0h zK9IS6tz+Mf11+DNXQkutGtIvU3Yysi3xJfdkkHzlcpyKv9oMHrWw2/1HtZ/cfY6 rRFa0zWdf3Im27ylrL+6CPVcYturge491Tr0CNQ1lT2wgwy6KfyEKzP4RK+mLQPF 1NOW/R5dwbqy6tw821Yo0m2F3uSKaFzC17SfOZnPu6rLNAfJMKIbo7gR3dKC9K6Z oVxLpJEwa2TkP28q9AaTqVQ19NCHsgUBCx1BgO1d0EH2OAzYPQ8jO2dKQPx1AlRS Vsrj/9nvFiEZjeB5hzFPIMBU8cgg7AgVikvIB2s9fK4wb/J9igS4cMFmk9xPY22A A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=GmPmLuzZOb8exTg9V/MMokFTNadVtf4wSAUb2Wfg1 Zk=; b=QH/bL3ZOWsGsx+14NxirwQKGIrQLf+LiU4wICXEKI04zdTvUFGZBynxJT pSwiwFPNFnwaUIFM//CiSunDKEvWQZiJylUi8U16pX94L1MDQs5h3+R0A/JIezdJ fk2XOUTgcRp/+RQYofyQuxooBJbQ0lh37C+UrusW2fAQsafM3IdaU3Xn0Cx1YNx9 wi2ktxCLYrX7Y8vQL50j+iw76vX0FR9o/9yt22qzEaIH3MpC1YGGa2/Xuzc6RoXr LdTCjikAyFMud3IEzzim/BYTyMhWMSdRMCle7dqlayMG6GQc1tAG23bUOyguRfDZ CkVkbWHguJw++gTzaXZWgk9xaRPZA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeggdefhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdetnhgu rhgvficulfgvfhhfvghrhidfuceorghnughrvgifsegrjhdrihgurdgruheqnecuggftrf grthhtvghrnhepvdegkeehgeefvdfhteehhfduteetgeeugefgieeigeeuheekudegtdek gfelgfehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvgifsegrjhdrihgurdgruh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 274ACAC0081; Mon, 12 Jul 2021 22:41:34 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-533-gf73e617b8a-fm-20210712.002-gf73e617b Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20210709053107.1829304-1-andrew@aj.id.au> <20210709053107.1829304-3-andrew@aj.id.au> Date: Tue, 13 Jul 2021 12:11:13 +0930 From: "Andrew Jeffery" To: =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= , "Cameron Esfahani via" Subject: Re: [PATCH 2/2] watchdog: aspeed: Fix sequential control writes Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=64.147.123.21; envelope-from=andrew@aj.id.au; helo=wout5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?Q?C=C3=A9dric_Le_Goater?= , Joel Stanley Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Fri, 9 Jul 2021, at 16:59, Philippe Mathieu-Daud=C3=A9 wrote: > On 7/9/21 7:31 AM, Andrew Jeffery wrote: > > The logic in the handling for the control register required toggling= the > > enable state for writes to stick. Rework the condition chain to allo= w > > sequential writes that do not update the enable state. > >=20 > > Fixes: 854123bf8d4b ("wdt: Add Aspeed watchdog device model") > > Signed-off-by: Andrew Jeffery > > --- > > hw/watchdog/wdt_aspeed.c | 2 ++ > > 1 file changed, 2 insertions(+) > >=20 > > diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c > > index faa3d35fdf21..69c37af9a6e9 100644 > > --- a/hw/watchdog/wdt_aspeed.c > > +++ b/hw/watchdog/wdt_aspeed.c > > @@ -166,6 +166,8 @@ static void aspeed_wdt_write(void *opaque, hwadd= r offset, uint64_t data, > > } else if (!enable && aspeed_wdt_is_enabled(s)) { > > s->regs[WDT_CTRL] =3D data; > > timer_del(s->timer); > > + } else { > > + s->regs[WDT_CTRL] =3D data; >=20 > What about simplifying by moving here: >=20 > if (!enable && aspeed_wdt_is_enabled(s)) { > timer_del(s->timer); > } >=20 I don't think that works, as aspeed_wdt_is_enabled() tests the value of=20= s->regs[WDT_CTRL]. If you set it before you test then you end up in the=20= wrong state. Andrew