From patchwork Wed Jul 1 21:15:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 490376 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 87E9F14075A for ; Thu, 2 Jul 2015 07:41:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=NET+SVrZ; dkim-atps=neutral Received: from localhost ([::1]:32993 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAPkk-0005UN-EH for incoming@patchwork.ozlabs.org; Wed, 01 Jul 2015 17:41:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAPOH-0005ba-9t for qemu-devel@nongnu.org; Wed, 01 Jul 2015 17:17:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAPOD-0002ZR-6h for qemu-devel@nongnu.org; Wed, 01 Jul 2015 17:17:57 -0400 Received: from mail-lb0-x22c.google.com ([2a00:1450:4010:c04::22c]:33944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAPOC-0002XJ-Uo for qemu-devel@nongnu.org; Wed, 01 Jul 2015 17:17:53 -0400 Received: by lbnk3 with SMTP id k3so20624057lbn.1 for ; Wed, 01 Jul 2015 14:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=cqDLDvVVVKjIYEgy2tBXxE0fYi/YCJIVQRw8K9xPclg=; b=NET+SVrZIEL1ofgM4eXiJzOYXw81EvAi7nM4b52D34Ux0Wf9ytqgAPB22gVEJMeZyb Revh/JsT5bvOZ1auMWFChpOHCpONziaTpUW4YIkpKJYOcyafVbU4WrlygMjhyVxnnOEd 4oB6EbHuaxzIiwRriOtGI8gEaLCSCiytAwGEim9drQ5F5PpSW5jY48RJd7sMF2iNUg5n W0R9m2Irf7StIDlnnC8mKedxZbgwCmvKVhINlX6g5nCtHCCqtoB1Bd1H11uIC2o7yKqk 7VN7Z+JGl6E1jvqGRdxKkzBEWgBGyALCVERY1aIIy3qWSULytOh4xtpWqBgsYmZatemM qJsw== X-Received: by 10.152.28.73 with SMTP id z9mr27146602lag.93.1435785470873; Wed, 01 Jul 2015 14:17:50 -0700 (PDT) Received: from localhost.localdomain ([46.138.6.114]) by mx.google.com with ESMTPSA id kc4sm799286lbc.39.2015.07.01.14.17.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jul 2015 14:17:50 -0700 (PDT) From: Dmitry Osipenko To: Paolo Bonzini , Peter Maydell Date: Thu, 2 Jul 2015 00:15:19 +0300 Message-Id: <1435785330-7384-1-git-send-email-digetx@gmail.com> X-Mailer: git-send-email 2.4.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22c X-Mailman-Approved-At: Wed, 01 Jul 2015 17:40:41 -0400 Cc: Dmitry Osipenko , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] arm_mptimer: Fix timer shutdown X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Timer, running in periodic mode, can't be stopped or coming one-shot tick won't be canceled because timer control code just doesn't handle timer disabling. Fix it by checking enable bit and deleting timer if bit isn't set. Signed-off-by: Dmitry Osipenko --- hw/timer/arm_mptimer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index 8b93b3c..917a10f 100644 --- a/hw/timer/arm_mptimer.c +++ b/hw/timer/arm_mptimer.c @@ -127,6 +127,9 @@ static void timerblock_write(void *opaque, hwaddr addr, tb->count = tb->load; } timerblock_reload(tb, 1); + } else if (!(value & 1)) { + /* Shutdown timer. */ + timer_del(tb->timer); } break; case 12: /* Interrupt status. */