From patchwork Tue Oct 22 13:30:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 177164 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp4877429ill; Tue, 22 Oct 2019 06:38:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw2bouh2UioqhxX7YClJGTcCXswup9s62GPWOb1YqAXmX7F0hcRVPrrYM1AbrqkGimf2SI X-Received: by 2002:a05:620a:1222:: with SMTP id v2mr2921418qkj.156.1571751484383; Tue, 22 Oct 2019 06:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571751484; cv=none; d=google.com; s=arc-20160816; b=TXZZt/sOer2GfN7zE85fh7bix2X6thrtYyklmDiEgL5/VANrMONQJVRihRqS/DgFRw rNidtphlQyK2PVs/BVPVVY2o1ampQOcN/IU0rASVHSncSwdX5lAtybywT8uVO3u+x4OQ Ftcsrxq0DQ3lihGoNlQ85thy3mXIXk+fqX0gEtMPOR8uY/bIli1VW0oguh9RnKZHLNE6 NDATzz55ctFGiylwNPSnX6gfWE3cShuiUrdPtyE3i7A6DUIx4171sfHKIGORXha5DLyH qkjos14mNna0PbVhIi4Sbiz0GdMzPiQR5+M/ERG4lMH8iaJ564EcHI44BusPYrmjw/4W EJcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=y6cZwi7KnbEYaso3vcojBuwQDGlT+TuR2VSfnVl/yHw=; b=hxwwfkOCV56iBs4us6JE6HKZs1QefQu7ELDeZ3f9H7tuCRVb6I6+TAH3BLOkJBPSIs /33RswtS6p2rzYWyeqUj5WuMk8MO4hxY5lG7Oj3roVnLiXZOFdL+AhqL+ul71hXjkjnH A0vOxN07o7OZFaq2tuNNPlxJmd4r5WNEEvsZaoBm08ylh593Ay4Bnr8tX9J0KEkWiEYq f4irufbuKqsauRCLm5mC2YIUrUUHuDG2QaFGSs/sdPbobe46P0qFtNAgbLGD0mkGZjiQ RIRZ0B7FmsmnEDkrk3Zmf1RtobBvef79TualUFUiTuRRzk2aHo0N4yral3pIrAHBKSyL ZA0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pu4HPBHE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f9si14624637qkl.12.2019.10.22.06.38.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Oct 2019 06:38:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pu4HPBHE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuMN-0001k2-Bd for patch@linaro.org; Tue, 22 Oct 2019 09:38:03 -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) 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-Received: by 2002:a1c:234c:: with SMTP id j73mr3290812wmj.51.1571751107457; Tue, 22 Oct 2019 06:31:47 -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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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é Tested-by: Philippe Mathieu-Daudé 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(-) -- 2.20.1 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)) {