From patchwork Tue Mar 6 13:24:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130800 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3934696lja; Tue, 6 Mar 2018 05:24:40 -0800 (PST) X-Google-Smtp-Source: AG47ELvZkX4Y+jjHsugP/7uQQaIdSDBAkbV2LkPwjndCy+cavgZmoDbfHSRHHY49D8aWTdtGqFVc X-Received: by 10.98.63.147 with SMTP id z19mr18650058pfj.221.1520342680187; Tue, 06 Mar 2018 05:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520342680; cv=none; d=google.com; s=arc-20160816; b=j7QG/5K68lV90kmHqVK9/MKG7jebn8KWtFLc4lceL8iDjAvJYq/wc12K8D27l4Igf6 TNSXOgm8qBhSzsTfUnq0Rdhu7PudS5FU9OivonbS0h1DqT5p9rK/X9uIJUwXah4GtfMj OZB9tPDO7/rqA+tVCa+vtGnsPsZDR9M8M5rrL6OdloxVYwKMnyywC3TqayzYN0g629r3 TfHljp9SWJK12voPjiEKmHe4nUJ3QvX9y4r56QrZCsgVfk6haqzrtzjcFADTkErxiP42 P0hef/LSJ7fYP5VxB8LINaH0/YQiwHUeKWOHOkJnq3HhXKbKSrqdy0SxLuKuq3BJvobg h6Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=4wbHuvMcULEEiEiB7XhpX9JTwYp2ChRsj1ZbnIhPzZI=; b=ixe+a8xLcOSFeIxYF0bswVJGhi2o22T6HrWGE1o0K6vVlosD7GZgSwWWBmlWZv4ofr 7xnnRJW82OfUfZ+SC5DmysfeCBHir13PDPxK1ZSkmQVVkUUC9ZYH4Q0304tZFurGojAG PxVRLQ5/g1M5jmgsEdTEht7hsbRQJX1Q8hyiAd10cSpTGxjDMDclzvB5IDMq8JX4UiVQ c5fTLOPWiUoRZ4q2nXhCs/OsQmsbdVswmNG0DsVXBKLD7JQkSyX6O8k4o8VWVveOAiIp 9N5TIuLLZBrxruTPX+OjZqkxOP1GWjiJcTweJ9h39m24jAlhPmWjX6kpJ4vyIXIN7YJy 3LFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=C4e6cbD+; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id d2-v6si1130991plh.192.2018.03.06.05.24.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 05:24:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=C4e6cbD+; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.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 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) 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-Received: by 10.223.153.230 with SMTP id y93mr15345357wrb.215.1520342675068; Tue, 06 Mar 2018 05:24:35 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmPkg/Drivers/TimerDxe/TimerDxe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c index 2416c90f5545..33d7c922221f 100644 --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c @@ -306,12 +306,13 @@ TimerInterruptHandler ( // OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL); + // 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) { - // 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 (); } - // Enable timer interrupts - gInterrupt->EnableInterruptSource (gInterrupt, Source); - gBS->RestoreTPL (OriginalTPL); }