From patchwork Thu Sep 26 21:03:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 20649 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8A41823A4E for ; Thu, 26 Sep 2013 21:03:39 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id cm18sf1724858qab.8 for ; Thu, 26 Sep 2013 14:03:39 -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: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=cRkpKisQD4SHaSAz6v6YA/FMX1vxu2tomA2wsW9hOHc=; b=XzNdWF6lZU39hwTlBANkARI/07ZypsfczsIVPwXbJKIx1Q0BlJdCxyxlrYB2UGOiey 32ROtgjYgg8z5JVy98bO5pHmyKiPTH1d1Th92bT6U9i4mj9ibTQovHxXjgNajaFAytAJ ivUx0+8cIHluVBftOu5fnWEHo1cz5haME6eN3QufATy9PTshy+m/soLd+wsSHSQ6/Ejw ZJzSLweFEkUjCro/XJIUr9+MBxssekXl2sDf1JNv1/nGI1+5fSMSXogNd2MpJ+bys7aP FvPNMB74miqR2mYILoZ9LofiRyxfgQuSyl8p0giHVFmSDkdVl5sRfEJkXId83EcvRJkE r/aA== X-Gm-Message-State: ALoCoQmNe7Mrbmxw8502H15d/qg8t9/4SisIHblzqQYlOVTLOBdKEzhQmSX/cBpBaxbBGXE6Jq00 X-Received: by 10.236.26.202 with SMTP id c50mr630318yha.14.1380229419156; Thu, 26 Sep 2013 14:03:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.58.148 with SMTP id r20ls1112367qeq.3.gmail; Thu, 26 Sep 2013 14:03:39 -0700 (PDT) X-Received: by 10.52.75.228 with SMTP id f4mr2077048vdw.6.1380229419040; Thu, 26 Sep 2013 14:03:39 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id tj1si896565vdc.27.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:39 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id c14so1393263vea.10 for ; Thu, 26 Sep 2013 14:03:09 -0700 (PDT) X-Received: by 10.52.26.69 with SMTP id j5mr2104653vdg.21.1380229388944; Thu, 26 Sep 2013 14:03:08 -0700 (PDT) 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 u4csp388810vcz; Thu, 26 Sep 2013 14:03:08 -0700 (PDT) X-Received: by 10.66.163.38 with SMTP id yf6mr4051954pab.190.1380229388045; Thu, 26 Sep 2013 14:03:08 -0700 (PDT) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by mx.google.com with ESMTPS id qc9si4932565pac.211.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.220.42; Received: by mail-pa0-f42.google.com with SMTP id lj1so1856359pab.29 for ; Thu, 26 Sep 2013 14:03:07 -0700 (PDT) X-Received: by 10.68.229.2 with SMTP id sm2mr3482254pbc.68.1380229387635; Thu, 26 Sep 2013 14:03:07 -0700 (PDT) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id 7sm7385572paf.22.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:06 -0700 (PDT) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [RFC PATCH v2 1/6] hw: arm_gic: Fix gic_set_irq handling Date: Thu, 26 Sep 2013 14:03:01 -0700 Message-Id: <1380229386-24166-2-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1380229386-24166-1-git-send-email-christoffer.dall@linaro.org> References: <1380229386-24166-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.128.179 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);