From nobody Sun May 5 01:25:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520342681564590.3692227918506; Tue, 6 Mar 2018 05:24:41 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6AF9322283518; Tue, 6 Mar 2018 05:18:25 -0800 (PST) Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5099F22283514 for ; Tue, 6 Mar 2018 05:18:22 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id z12so20929736wrg.4 for ; Tue, 06 Mar 2018 05:24:36 -0800 (PST) Received: from localhost.localdomain ([160.168.113.39]) by smtp.gmail.com with ESMTPSA id f127sm7673346wmg.46.2018.03.06.05.24.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 05:24:34 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=2zfTgYV/PzzZw8sM4yF1MdxXODrroFppyIRWWrIsTXw=; b=C4e6cbD+BMBgq4XiLy4iLztabZAaRG/Yrnjy4jTGNNPeAkozm20o03oKHzqG6YjGfG +5AywPcTvJrnKLMfze0JwaPUnFEPRng2jliSvyjjrFrubaqzDyFDmo5XqtpKOi7o4ixd NQOBYtdc6k7QxJ+ikLq/2DjHWPjrXRn0lu81M= 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; bh=2zfTgYV/PzzZw8sM4yF1MdxXODrroFppyIRWWrIsTXw=; b=K4HJo3lOVTArrurNkcrQ72kBldmGyhiJq9yv31ZxCcFHoELPUqPVU0Q1+l+rHu+3gM MhiWeyAQAormWwcAZ0YpjPaFbM0OBmL+9V/rpgyn9HUqqpVQf7bhg7iUmaap+rki4Nxf Zvv1L77C7RYMfUNjFyAQo11peN89tDHdDFq4Tu6qK7iRjNRqK7lSdbpcjur4XzGOs63S KQ4pZoeOZDCUUc2BXwqEoEIR/K41UA8JCByskLsO4/It3E7U2wfJj1VvB/+3bIhFzVV+ QUCVss2jEEtFY96HFBU8VKZ24KGRNXg1MlTKLgQ9NknWj6cjFxNO2CrjwvbIm1S6E3or 1U3w== X-Gm-Message-State: APf1xPD6XbOg8BXP5FFWU6bWj9hLb6M8c/xW5oogOra3BPvQQ46wShHo qLaxzoFWa63FBWe4e/4xJ/EPwteFITU= X-Google-Smtp-Source: AG47ELvAsk7w560+wYivXvyqV/Ymx0rKesTgJ3rvFR8VpfZr0KkJZgyWBwfnRH9TVOt4QdC/l+WmIQ== X-Received: by 10.223.153.230 with SMTP id y93mr15345357wrb.215.1520342675068; Tue, 06 Mar 2018 05:24:35 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 6 Mar 2018 13:24:24 +0000 Message-Id: <20180306132424.25961-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [edk2] [PATCH] ArmPkg/TimerDxe: Always perform an EOI, even for spurious interrupts X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marc.zyngier@arm.com, leif.lindholm@linaro.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc Zyngier The generic timer driver only EOIs the timer interrupt if the ISTATUS bit is set. This is completely fine if you pretend that spurious interrupts do not exist. But as a matter of fact, they do, and the first one will leave the interrupt activated at the GIC level, making sure that no other interrupt can make it anymore. Making sure that each interrupt Ack is paired with an EOI is the way to go. Oh, and enabling the interrupt each time it is taken is completely pointless. We entered this function for a good reason... Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marc Zyngier Reviewed-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmPkg/Drivers/TimerDxe/TimerDxe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/T= imerDxe.c index 2416c90f5545..33d7c922221f 100644 --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c @@ -306,12 +306,13 @@ TimerInterruptHandler ( // OriginalTPL =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); =20 + // Signal end of interrupt early to help avoid losing subsequent ticks + // from long duration handlers + gInterrupt->EndOfInterrupt (gInterrupt, Source); + // Check if the timer interrupt is active if ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) { =20 - // Signal end of interrupt early to help avoid losing subsequent ticks= from long duration handlers - gInterrupt->EndOfInterrupt (gInterrupt, Source); - if (mTimerNotifyFunction) { mTimerNotifyFunction (mTimerPeriod * mElapsedPeriod); } @@ -339,9 +340,6 @@ TimerInterruptHandler ( ArmGenericTimerEnableTimer (); } =20 - // Enable timer interrupts - gInterrupt->EnableInterruptSource (gInterrupt, Source); - gBS->RestoreTPL (OriginalTPL); } =20 --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel