From patchwork Wed Aug 6 20:39:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 34998 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0661720523 for ; Wed, 6 Aug 2014 21:09:24 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g18sf12586479oah.6 for ; Wed, 06 Aug 2014 14:09: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=iOquUEz0OesaARmDrvXMJbKOTsxRhwV4qMr4CvF5vuc=; b=N2u4E9TH3cAMGH3RKDizEKYJ3hIXqD83tZJHtdRomqe54ZeZD3dIu9Wmcr75HiDiUR 2q/XbHtI77cjGT8aIbIZVM19GksSSz8ocH4D9vc5Yfl7Uy7fWloAbwvOyMf7fpBQjZj7 WzzNnuira1Co9TKoYPyhq1Ml1fB2p9XSi9tHlJahDnPXk0MLXBBsX6kBwX2/Cbko31TH ICTikOI85C2iLJb6HBRaMYuBjGVRCOogmN/GjWzpkB7LV49QhI5bscoFpvzn3sSyvD3o K4K5eq61cFH3HV4bS1EnmOv2/K7vq4vBLipiKm0921nxgLHTnb2NeqtqKCzelzS4Y4Tg xfHg== X-Gm-Message-State: ALoCoQnvATa/FHVNUamad0Hj+bc23QuUGhm3Th+lovlcbRL2ZVEhrHkAAFBMSMzKVRvIzrBVuxFo X-Received: by 10.42.94.69 with SMTP id a5mr7758678icn.29.1407359364620; Wed, 06 Aug 2014 14:09:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.227 with SMTP id s90ls351200qga.95.gmail; Wed, 06 Aug 2014 14:09:24 -0700 (PDT) X-Received: by 10.52.106.198 with SMTP id gw6mr10847508vdb.23.1407359364512; Wed, 06 Aug 2014 14:09:24 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id da3si960619vcb.102.2014.08.06.14.09.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Aug 2014 14:09:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ik5so4930811vcb.20 for ; Wed, 06 Aug 2014 14:09:24 -0700 (PDT) X-Received: by 10.220.116.196 with SMTP id n4mr12952327vcq.6.1407359364427; Wed, 06 Aug 2014 14:09: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 tc5csp57419vcb; Wed, 6 Aug 2014 14:09:24 -0700 (PDT) X-Received: by 10.224.30.139 with SMTP id u11mr21013266qac.77.1407359363860; Wed, 06 Aug 2014 14:09:23 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 8si3481364qah.127.2014.08.06.14.09.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 06 Aug 2014 14:09: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]:41199 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF8SZ-0000WH-2Y for patch@linaro.org; Wed, 06 Aug 2014 17:09:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF83R-0000ZP-0v for qemu-devel@nongnu.org; Wed, 06 Aug 2014 16:43:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF835-0005Oc-Ec for qemu-devel@nongnu.org; Wed, 06 Aug 2014 16:43:24 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:39650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF835-0005OM-7t for qemu-devel@nongnu.org; Wed, 06 Aug 2014 16:43:03 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Aug 2014 16:43:02 -0400 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 6 Aug 2014 16:43:00 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 7A7DB6E801A; Wed, 6 Aug 2014 16:42:49 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp22035.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s76Kh0wd4456914; Wed, 6 Aug 2014 20:43:00 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s76KgxJX001952; Wed, 6 Aug 2014 16:42:59 -0400 Received: from localhost ([9.80.101.111]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s76KgxwR001906; Wed, 6 Aug 2014 16:42:59 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 6 Aug 2014 15:39:16 -0500 Message-Id: <1407357598-21541-67-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407357598-21541-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1407357598-21541-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14080620-7182-0000-0000-00000024D49C X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.182.139 Cc: qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 066/108] 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.220.175 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 420a66d..c1d2151 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -963,16 +963,16 @@ static void 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)); } }