From nobody Wed Nov 12 13:14:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571409225; cv=none; d=zoho.com; s=zohoarc; b=Uw1F6R2bdPzH8ckGs4D4sPxTtUrORIrD1xMuDPGmTshe3bsFIbh8pe9K0jwgoojj83YV1dOZ48t9PMxXYIFv9UwiIoRM2hobJlyAB0QrnhVfzwyDivOFcHVTJQ6d66Z49JxUyOTbdZ/VYHGe8d13GEwo5QWlfeGgl4htkMlhmuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571409225; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=M/re3SutNLZ5EZ1/qaqbg2V+z7g6WDXA7WOt1KwyO2M=; b=kdDYStKphPRL0jhJkdJ+d38xDWd//mYTvudwwMTG8zmIOQ2Snje5R08fwr4G/K/c3A2twOsUav8B/3WI7+Wx9dWZlTG8kUjYpi80KHRuutu4Qem82egCAoxncmeBV5qCHzJTnpKjz99p2C+WjNW2MofjK22NOrtfVcZDiKMZmLw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571409225269937.3228285801952; Fri, 18 Oct 2019 07:33:45 -0700 (PDT) Received: from localhost ([::1]:41000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLTK3-0001mA-RD for importer@patchew.org; Fri, 18 Oct 2019 10:33:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLTIJ-0000BD-30 for qemu-devel@nongnu.org; Fri, 18 Oct 2019 10:31:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLTIH-0002iJ-Qe for qemu-devel@nongnu.org; Fri, 18 Oct 2019 10:31:55 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:33590) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLTIH-0002gj-Ja for qemu-devel@nongnu.org; Fri, 18 Oct 2019 10:31:53 -0400 Received: by mail-wr1-x444.google.com with SMTP id b9so6534462wrs.0 for ; Fri, 18 Oct 2019 07:31:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e17sm5537915wma.15.2019.10.18.07.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 07:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=M/re3SutNLZ5EZ1/qaqbg2V+z7g6WDXA7WOt1KwyO2M=; b=E3evIrKVfb6VrDkAdbWiUVhX3s2jIKvEViOPVwEssmNHw6sfxVOFYEpVasdjy+Br0X itZen4j1ZzInbcWg1zkoO6gdOaiO918AXKi4bBC4YCFA/ooPd3hLsoTdtRDttKdSA+aj O3HzOfiOEfHdrbzqiTwfS2WxEgIc7FWZjFnvjI5HSyfHl05x+D8cO/sntPG/Hkc2CQQE hUiyS73w/YTLENmo3hz0zDZ+KSUvYXA6JMcT28UONktKbAnErs+v6QHUmNiclznDlLSc 2TxhjIgUROg7cNdwKTJcgUpbETg686qFvuTtzGyKILibtc9t7zC8OPm/rs3tbzxV6IpD NowQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=M/re3SutNLZ5EZ1/qaqbg2V+z7g6WDXA7WOt1KwyO2M=; b=bKaDVdvZ7x3rbW7jGoQKkgwnuKNkhRCPSXwPFFcBsBLs0/QILyX9KQNCOnxKtPNuua GCDLda7/ue3yZtwj07Coj0mbIBno2N9YaPgsbnFDuX9sBuATjpetGGoj0mgHF/01rlxq GZ3MGa/Be8gH6K/lZnwwbTGVp+u7HKVowvjMPTUdz+RuikJ1JkKq8/76V/yvL8vWin97 9Ln7AQdI6WoQs9SMBAso+x2d7yp/pv0qW66e9xTJYJtci0TWVELM1e/cz3Ltde7jY/Cq C/ElKrFdJdmn7jIiQEQjqKFAY6g0cFGsA+HZAyfjmmA+gXnTERANRA/EwtSVlFgloAKc tBbg== X-Gm-Message-State: APjAAAXXo4SO8h0Wn72xTvug6+shOHcU1L1SM6Cn2e1ErUL2J9ITI4Nu pEbSq16Es+9oYa+WNiQxjFYWhA== X-Google-Smtp-Source: APXvYqwQFM/bV7E9o7GF8b9y808ZUuX/067kGQxiGwou0V8k/OJijC/RZAi4n/zyKilRcGxTSjqglQ== X-Received: by 2002:adf:e8c6:: with SMTP id k6mr8170164wrn.78.1571409111850; Fri, 18 Oct 2019 07:31:51 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH] hw/timer/exynos4210_mct: Initialize ptimer before starting it Date: Fri, 18 Oct 2019 15:31:49 +0100 Message-Id: <20191018143149.9216-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 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: Igor Mitsyanko , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Guenter Roeck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Guenter Roeck When booting a recent Linux kernel, the qemu message "Timer with delta zero, disabling" is seen, apparently because a ptimer is started before being initialized. Fix the problem by initializing the offending ptimer before starting it. The bug is effectively harmless in the old QEMUBH setup because the sequence of events is: * the delta zero means the timer expires immediately * ptimer_reload() arranges for exynos4210_gfrc_event() to be called * ptimer_reload() notices the zero delta and disables the timer * later, the QEMUBH runs, and exynos4210_gfrc_event() correctly configures the timer and restarts it In the new transaction based API the bug is still harmless, but differences of when the callback function runs mean the message is not printed any more: * ptimer_run() does nothing as it's inside a transaction block * ptimer_transaction_commit() sees it has work to do and calls ptimer_reload() * the zero delta means the timer expires immediately * ptimer_reload() calls exynos4210_gfrc_event() directly * exynos4210_gfrc_event() configures the timer * the delta is no longer zero so ptimer_reload() doesn't complain (the zero-delta test is after the trigger-callback in the ptimer_reload() function) Regardless, the behaviour here was not intentional, and we should just program the ptimer correctly to start with. Signed-off-by: Guenter Roeck [PMM: Expansion/clarification of the commit message: the message is about a zero delta, not a zero period; added detail to the commit message of the analysis of what is happening and why the kernel boots even with the message; added note that the message goes away with the new ptimer API] Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- Philippe pointed me at this bugfix from Guenter. At one point in my working on the ptimer API changes I thought this bugfix would be necessary as a prerequisite, but in fact the issue was in my ptimer changes, and it just happened that fixing the MCT bug was a workaround for my bug. Even though the ptimer API changes actually coincidentally now suppress the annoying message about a zero delta, the behaviour is definitely not intentional, and since I spent the time working through the analysis of what was actually going on here I don't want to waste it :-) --- hw/timer/exynos4210_mct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 72257584145..944120aea59 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -1254,7 +1254,7 @@ static void exynos4210_mct_write(void *opaque, hwaddr= offset, /* Start FRC if transition from disabled to enabled */ if ((value & G_TCON_TIMER_ENABLE) > (old_val & G_TCON_TIMER_ENABLE)) { - exynos4210_gfrc_start(&s->g_timer); + exynos4210_gfrc_restart(s); } if ((value & G_TCON_TIMER_ENABLE) < (old_val & G_TCON_TIMER_ENABLE)) { --=20 2.20.1