From patchwork Tue Nov 19 06:18:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 21596 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7857B20972 for ; Tue, 19 Nov 2013 06:17:07 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id lx4sf3458594iec.6 for ; Mon, 18 Nov 2013 22:17:07 -0800 (PST) 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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=odsjq/hg4CWA2Hv5VOGG+S5SV61zeovXgS/AAPX1xQY=; b=fy53v6enuKEHKpBUgX/3pMCXFq/7cb0/UH6qSeQXziD/BQqevS3/jjARx9IvBnq1hD R10mlix/9d9sv8gxltfSza8KkhfEIecFFrB4I7HLGA1y46g/vkr89rTQjzUBsLCafkAI 6nr+xZtiiWnP7s1W8VNI9GAtEAwYWusiyipYiyE89ITdbMgfi0n10I7LhI7KFAoeYr1j y8XHEGe2G7PdG6tdY3OVtuHZE3HS/+YBvD//Jjye/cxHiMttl7eda5MOh0tDGyvbNTde togQfpU5elBrbb7srGW6s78gEyZ1cFMmNjGDtzmBi+mbwW2J0xWS7hFpDrzfD2kam/Q3 cnaw== X-Gm-Message-State: ALoCoQk3WW69gzGBzLYgrL34I25Otemq2hoZZNz6Yq6hHUZbxL6BkByd5ltW3OBPfy1ll/Eq7lhH X-Received: by 10.42.112.138 with SMTP id y10mr170027icp.28.1384841827122; Mon, 18 Nov 2013 22:17:07 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.119.9 with SMTP id kq9ls3022638qeb.48.gmail; Mon, 18 Nov 2013 22:17:07 -0800 (PST) X-Received: by 10.58.39.97 with SMTP id o1mr19535644vek.15.1384841827040; Mon, 18 Nov 2013 22:17:07 -0800 (PST) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id gs7si7915178veb.15.2013.11.18.22.17.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:17:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id i3so3373831vbh.5 for ; Mon, 18 Nov 2013 22:17:07 -0800 (PST) X-Received: by 10.52.160.130 with SMTP id xk2mr5648402vdb.24.1384841826960; Mon, 18 Nov 2013 22:17:06 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp255361vcz; Mon, 18 Nov 2013 22:17:06 -0800 (PST) X-Received: by 10.68.137.138 with SMTP id qi10mr16989786pbb.113.1384841825971; Mon, 18 Nov 2013 22:17:05 -0800 (PST) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx.google.com with ESMTPS id vs7si11223683pbc.175.2013.11.18.22.17.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:17:05 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.49 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.220.49; Received: by mail-pa0-f49.google.com with SMTP id kx10so1463512pab.36 for ; Mon, 18 Nov 2013 22:17:05 -0800 (PST) X-Received: by 10.68.110.196 with SMTP id ic4mr16902014pbb.84.1384841825456; Mon, 18 Nov 2013 22:17:05 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id rz6sm19165159pab.22.2013.11.18.22.17.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:17:04 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [RFC PATCH v3 01/10] hw: arm_gic: Fix gic_set_irq handling Date: Mon, 18 Nov 2013 22:18:07 -0800 Message-Id: <1384841896-19566-2-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1384841896-19566-1-git-send-email-christoffer.dall@linaro.org> References: <1384841896-19566-1-git-send-email-christoffer.dall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , For some reason only edge-triggered or enabled level-triggered interrupts would set the pending state of a raised IRQ. This is not in compliance with the specs, which indicate that the pending state is separate from the enabled state, which only controls if a pending interrupt is actually forwarded to the CPU interface. Therefore, simply always set the pending state on a rising edge, but only clear the pending state of falling edge if the interrupt is level triggered. Changelog [v2]: - Fix bisection issue, by not using gic_clear_pending yet. Signed-off-by: Christoffer Dall --- hw/intc/arm_gic.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index d431b7a..c7a24d5 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -128,11 +128,12 @@ static void gic_set_irq(void *opaque, int irq, int level) if (level) { GIC_SET_LEVEL(irq, cm); - if (GIC_TEST_TRIGGER(irq) || GIC_TEST_ENABLED(irq, cm)) { - DPRINTF("Set %d pending mask %x\n", irq, target); - GIC_SET_PENDING(irq, target); - } + DPRINTF("Set %d pending mask %x\n", irq, target); + GIC_SET_PENDING(irq, target); } else { + if (!GIC_TEST_TRIGGER(irq)) { + GIC_CLEAR_PENDING(irq, target); + } GIC_CLEAR_LEVEL(irq, cm); } gic_update(s);