From patchwork Tue Jul 8 17:18:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 33268 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DA4B9208CF for ; Wed, 9 Jul 2014 09:30:24 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id m5sf20734951qaj.2 for ; Wed, 09 Jul 2014 02:30:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=jtxiQBhFyraIKLFT64H5MfkJg1k8zgA9yjDKNxGRAkk=; b=B9EWU5r3gfWBqKIIpN3A2hdH97Frm6MOFGzaJzAZ3KVzRqzJHS/yAAbDXKd9RrYdFQ 7ac/wraFQyroicvrf1F13/3RNf3+7UIHjH5k64EK4zcbJq0ck1lk4cxUaJuFVMcZoKW+ 1TAQXYoKFSAZ1kI8jyHOjIukBqy302jPDgCMbEEXtpDCDeqPAsV93U6XpAo6I0So/P9G 2GRzLcVVD7j9byBlgoIPeQ8ZJWvw5S0EFVv2/GddWvpceD40PVRRYdlASs4lGfDkBIq1 h+Ois6KCJcQ+7v0B7xfQeV6zuUEIBLq4E6lwKwWZgsEa5ED+tOsjHuXDkTZLbgUAwEPS wc8Q== X-Gm-Message-State: ALoCoQlNZuK/NRTNV4nxRKJXOUENzgWF1O6FGwmE5dkvX7b3VlOr/L8Tb7crPM7adJxxanJv/C1l X-Received: by 10.58.94.166 with SMTP id dd6mr20081640veb.12.1404898224708; Wed, 09 Jul 2014 02:30:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.134 with SMTP id e6ls2494821qgf.34.gmail; Wed, 09 Jul 2014 02:30:24 -0700 (PDT) X-Received: by 10.52.182.163 with SMTP id ef3mr32095033vdc.22.1404898224621; Wed, 09 Jul 2014 02:30:24 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id bo12si21275133veb.23.2014.07.09.02.30.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Jul 2014 02:30:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id sa20so596835veb.5 for ; Wed, 09 Jul 2014 02:30:24 -0700 (PDT) X-Received: by 10.58.30.15 with SMTP id o15mr1197176veh.34.1404898224524; Wed, 09 Jul 2014 02:30:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp31102vcb; Wed, 9 Jul 2014 02:30:24 -0700 (PDT) X-Received: by 10.224.136.200 with SMTP id s8mr68029519qat.85.1404898223907; Wed, 09 Jul 2014 02:30:23 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p2si42537646qah.58.2014.07.09.02.30.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 09 Jul 2014 02:30:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:57369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4ZYI-0008TJ-7F for patch@linaro.org; Tue, 08 Jul 2014 13:51:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Z7L-0005FH-RJ for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:24:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4Z6Q-00015U-TM for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:23:47 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:49979) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Z6Q-00015E-OZ for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:22:50 -0400 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Jul 2014 13:22:50 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 8 Jul 2014 13:22:47 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 6F684C90046; Tue, 8 Jul 2014 13:22:40 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by b01cxnp23032.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s68HMk2c4587940; Tue, 8 Jul 2014 17:22:46 GMT Received: from d01av03.pok.ibm.com (localhost [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s68HMkai006778; Tue, 8 Jul 2014 13:22:46 -0400 Received: from localhost ([9.41.105.211]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s68HMkHX006758; Tue, 8 Jul 2014 13:22:46 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 8 Jul 2014 12:18:44 -0500 Message-Id: <1404839947-1086-134-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1404839947-1086-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1404839947-1086-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14070817-0320-0000-0000-000003BF1122 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.182.138 Cc: qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 133/156] target-arm: Fix errors in writes to generic timer control registers 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mdroth@linux.vnet.ibm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Peter Maydell The code for handling writes to the generic timer control registers had several bugs: * ISTATUS (bit 2) is read-only but we forced it to zero on any write * the check for "was IMASK (bit 1) toggled?" incorrectly used '&' where it should be '^' * the handling of IMASK was inverted: we should set the IRQ if ISTATUS is set and IMASK is clear, not if both are set The combination of these bugs meant that when running a Linux guest that uses the generic timers we would fairly quickly end up either forgetting that the timer output should be asserted, or failing to set the IRQ when the timer was unmasked. The result is that the guest never gets any more timer interrupts. Signed-off-by: Peter Maydell Message-id: 1401803208-1281-1-git-send-email-peter.maydell@linaro.org Cc: qemu-stable@nongnu.org (cherry picked from commit d3afacc7269fee45d54d1501a46b51f12ea7bb15) Signed-off-by: Michael Roth --- target-arm/helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index c3e4910..6e67317 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -859,16 +859,16 @@ static int gt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri, int timeridx = ri->crm & 1; uint32_t oldval = env->cp15.c14_timer[timeridx].ctl; - env->cp15.c14_timer[timeridx].ctl = value & 3; + env->cp15.c14_timer[timeridx].ctl = deposit64(oldval, 0, 2, value); if ((oldval ^ value) & 1) { /* Enable toggled */ gt_recalc_timer(cpu, timeridx); - } else if ((oldval & value) & 2) { + } else if ((oldval ^ value) & 2) { /* IMASK toggled: don't need to recalculate, * just set the interrupt line based on ISTATUS */ qemu_set_irq(cpu->gt_timer_outputs[timeridx], - (oldval & 4) && (value & 2)); + (oldval & 4) && !(value & 2)); } return 0; }