From nobody Thu Dec 18 19:34:28 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=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571751445; cv=none; d=zoho.com; s=zohoarc; b=k69XkLCNrKOauzmICjpHk47MUoasi4jfxREPQ0eqSJOrpKKdDojqt7VxT1ImhzLUFAw3rFX4t88cuY+o3tHG53PqsUYC28jTFdclvCQ34eouf7mtiwqUDa3m1t7MIzajAcwlu+EKqSW42qiKiDn5TKpSom70VZVficT58jRu25E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571751445; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y6cZwi7KnbEYaso3vcojBuwQDGlT+TuR2VSfnVl/yHw=; b=jRqW0SD4slVHloF+7E6IEwwCo5ZOc8V+PbnJVxT5Ys4/TvU3lbnn1Q4C8sz3+CTONN8QJaZgoQklakJ+RVmKKYBY+eSM0+ONH5pueTPDUn2mC1hBZl11IvJY5wJ0H0i/UEHEu/+4INAKg2l6coCQB/8m14jclp0hJ0HMaLM4Qa0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; 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=pass 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 1571751445222345.22492994426057; Tue, 22 Oct 2019 06:37:25 -0700 (PDT) Received: from localhost ([::1]:57446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuLh-0008VN-Vx for importer@patchew.org; Tue, 22 Oct 2019 09:37:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36602) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuGM-0002Aj-NG for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:31:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMuGL-00019r-D7 for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:31:50 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:50811) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMuGL-00019b-6s for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:31:49 -0400 Received: by mail-wm1-x344.google.com with SMTP id q13so7247837wmj.0 for ; Tue, 22 Oct 2019 06:31:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id r2sm20263856wma.1.2019.10.22.06.31.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 06:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=y6cZwi7KnbEYaso3vcojBuwQDGlT+TuR2VSfnVl/yHw=; b=Pu4HPBHE6wh6yIGgJmQGtkbOOqdp+absTXqhV56SuiWz64OmSCLI+dovTvV8nZuYQG i0UV1f+YQKz9DvGq+AuWw7ozk3579dnR6Jg2m67mDOr//czPGLoZXeZhGCzQDYdME5I+ 7oS1AHHYlKeSsbWu0jm+0DYWmnQeNgxJSemSsClYMyssA1R4ApjX+NiOmL9vCcunkfB+ kvrfhtcu7SNKwgRadzQfhghNQ9QymPGaRJp3WOTTbcCwDp2gw+dq3Xd9GcHK8SpjpRZO U2m20DNs0K15w0FH+Urd+F0N16zcYf/zKgxDsukrrVfu7zu1P+D1kvq8bBv0+qa3cifB lixQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y6cZwi7KnbEYaso3vcojBuwQDGlT+TuR2VSfnVl/yHw=; b=k/l5fZCDs/j8aI8SFXJFLunU9me+e4MLSz+eEAoP2UZ03gFrTGEi/zYjSegXndTb+8 PBL6dJG7kNmEhlxd/mQcINP9udv2f6ZM7rrIGstul0qnM5EViLEbGEAwyXLm3TQWjC0P r26wDkyTEZAeV0vQ4U4kNviwH2pCYZmCGXObbFHCD+17B33/uX/87NZ70ZhYKMnNwkf4 qhTk+ClEQLOyxQFjInUzM8XlLJpoGWpws5aDxm02jLJqv4HCOmSJC9bLMy3ufbEHnkNk 8X9ASO3hTeVOuBBrmCxjodgsBOXhXVsH82CYtSzHcvnX+2C1owRoMDIIKE4EkDZI4t8k j5ww== X-Gm-Message-State: APjAAAUDX43a3csm8gq5a0eahWBmHQdDdP+vKhQU3BRlXz8lkM+lMGGN SPgK8yjqWAOdnzNUdLbzUf+Y7pf6abQ= X-Google-Smtp-Source: APXvYqzQ6Rt26WlSYDjAViSo0SR6oe8n7E+5iRRdvfiQZ+glSiTd0bp9OBSafWZtW1TVB93aGQanwA== X-Received: by 2002:a1c:234c:: with SMTP id j73mr3290812wmj.51.1571751107457; Tue, 22 Oct 2019 06:31:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/41] hw/timer/exynos4210_mct: Initialize ptimer before starting it Date: Tue, 22 Oct 2019 14:30:56 +0100 Message-Id: <20191022133134.14487-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191022133134.14487-1-peter.maydell@linaro.org> References: <20191022133134.14487-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::344 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell Message-id: 20191018143149.9216-1-peter.maydell@linaro.org [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 --- 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