From nobody Sun Feb 8 17:46:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1591779482; cv=none; d=zohomail.com; s=zohoarc; b=V6gHJqHLRIm1Kguc7PSJjCKwSzo1VteePRwi9enRk0DKSabirdGw2PaHn0HUlpA5e4g8GXyRbtWXnvoZkuZDGrEH9B57iTAiPGiGhf6yB22L87XyBv3c8bBjyj8LvsUUF4/lro+xucx0ZfQAetAmRupHrpqpo3YlTDU29f3BYVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591779482; 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; bh=+RlEiEBdFhsmyMDkaNY6bto0uDM5bKD0jNbLIi/ZHRA=; b=jREzfkCJu9+sksFHToQW3YigEtl46aX0a7dTPN/qzLpFaKG0ECpYrHAR8yryfz7gqO1IzF/+of77orsXpqm0LPfkj7SGNg50ATbgyxQuwQET/0hp2bxqAdcTJe7YonIG3F0VG9Gz2lypJiZWVqZlA+9QrTmh3J/ThJZwLepcGDg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591779482554479.62866984189395; Wed, 10 Jun 2020 01:58:02 -0700 (PDT) Received: from localhost ([::1]:43014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiwYa-0007K3-MW for importer@patchew.org; Wed, 10 Jun 2020 04:58:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiwXe-0006Rm-3M; Wed, 10 Jun 2020 04:57:03 -0400 Received: from mail.sysgo.com ([176.9.12.79]:38124) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiwXd-0000Tr-4P; Wed, 10 Jun 2020 04:57:01 -0400 Received: from vav by vav-lap with local (Exim 4.92) (envelope-from ) id 1jiwNa-0007Mi-5a; Wed, 10 Jun 2020 10:46:38 +0200 From: Vaclav Vanc To: Subject: [PATCH] hw/timer/a9gtimer: Clear pending interrupt, after the clear of Event flag Date: Wed, 10 Jun 2020 10:45:51 +0200 Message-Id: <20200610084551.28222-1-vav@sysgo.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=176.9.12.79; envelope-from=vav@vav-lap.sysgo.cz; helo=mail.sysgo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/10 04:46:39 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=_AUTOLEARN 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 , "open list:ARM cores" , "open list:All patches CC here" , Vaclav Vanc Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" A9 Global Timer is used with Edge triggered interrupts (This is true at least for Zynq and i.MX6 processors). When Event Flag is cleared in Interrupt Status Register and new interrupt was supposed to be scheduled, interrupt request is never cleared. Since interrupt in GIC is configured as Edge triggered, new interrupts are not registered (because interrupt is stuck at pending and GIC thinks it was already serviced). As a result interrupts from timer does not work anymore. Note: This happens only when interrupt was not serviced before the next interrupt is suppose to be scheduled. This happens for example during the increased load of the host system. Interrupt is now always cleared when Event Flag is cleared. This is in accordance to A9 Global Timer documentation. Signed-off-by: Vaclav Vanc --- hw/timer/a9gtimer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index 7233068a37..732889105e 100644 --- a/hw/timer/a9gtimer.c +++ b/hw/timer/a9gtimer.c @@ -206,6 +206,9 @@ static void a9_gtimer_write(void *opaque, hwaddr addr, = uint64_t value, case R_INTERRUPT_STATUS: a9_gtimer_update(s, false); gtb->status &=3D ~value; + if (gtb->status =3D=3D 0) { + qemu_set_irq(gtb->irq, 0); + } break; case R_COMPARATOR_HI: shift =3D 32; --=20 2.20.1