From patchwork Fri Feb 25 08:30:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: andrzej zaborowski X-Patchwork-Id: 84520 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2E0DBB70E1 for ; Fri, 25 Feb 2011 19:31:31 +1100 (EST) Received: from localhost ([127.0.0.1]:44317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pst4v-0003jQ-DA for incoming@patchwork.ozlabs.org; Fri, 25 Feb 2011 03:31:09 -0500 Received: from [140.186.70.92] (port=56305 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pst46-0003iF-Gt for qemu-devel@nongnu.org; Fri, 25 Feb 2011 03:30:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pst45-0003Gd-5f for qemu-devel@nongnu.org; Fri, 25 Feb 2011 03:30:18 -0500 Received: from mail-qy0-f173.google.com ([209.85.216.173]:33295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pst45-0003GT-3K for qemu-devel@nongnu.org; Fri, 25 Feb 2011 03:30:17 -0500 Received: by qyk36 with SMTP id 36so245139qyk.4 for ; Fri, 25 Feb 2011 00:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=OusWZTRVsqmT2/dfjKROiHjCubeIRwUB4c5YfDRqf6c=; b=v31dal3cEYKgKyhdUUEcW3wFRVO0qoVtZPyCZz7MviQCeEnniTSOBn+le52xmXLDh5 eJX/kJu4VpsmPzf7UDVedrDvfc8++kJ+ANAxyukjkl2ylYfLJ6Mqm0Kn0PmTzC9M5uAh LHL/9KJUhDMxmBNPnVCpxmy1ughZFxERGVWOE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BSeErnccp0vC2PZxXsvmClZUpZs+9x/NDNnf8ZiH4gjB1pIqh4kLDsi8PvVl+GWL9S mR2srUz+/mqOqMnNYVXJ2HtkEhjh9ZCq9R2Vtm2vXfSXwry7k8chLjWruq5HlxVjEqcb qonbuxXcDLwLE9DiPqudTJP636mebxXCmmcFQ= MIME-Version: 1.0 Received: by 10.229.186.2 with SMTP id cq2mr1620875qcb.109.1298622615835; Fri, 25 Feb 2011 00:30:15 -0800 (PST) Received: by 10.229.65.85 with HTTP; Fri, 25 Feb 2011 00:30:15 -0800 (PST) In-Reply-To: <1297862553-9491-1-git-send-email-dbaryshkov@gmail.com> References: <1297862553-9491-1-git-send-email-dbaryshkov@gmail.com> Date: Fri, 25 Feb 2011 09:30:15 +0100 Message-ID: Subject: Re: [Qemu-devel] [PATCH] mst_fpga: correct irq level settings From: andrzej zaborowski To: Dmitry Eremin-Solenikov X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.173 Cc: qemu-devel@nongnu.org X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 16 February 2011 14:22, Dmitry Eremin-Solenikov wrote: > Final corrections for IRQ levels that are set by mst_fpga: > > * Don't retranslate IRQ if previously IRQ was masked. > * After setting or clearing IRQs through register, apply mask >  before setting parent IRQ level. Thanks, applied this change. However now to have a completely correct behaviour, I think we need something like the following, what do you think? (prev_level is now unused, but the main change is not masking 1u << irq) Cheers diff --git a/hw/mst_fpga.c b/hw/mst_fpga.c index 407bac9..f66de69 100644 --- a/hw/mst_fpga.c +++ b/hw/mst_fpga.c @@ -31,7 +31,6 @@ typedef struct mst_irq_state{ qemu_irq parent; - uint32_t prev_level; uint32_t leddat1; uint32_t leddat2; uint32_t ledctrl; @@ -53,11 +52,6 @@ mst_fpga_set_irq(void *opaque, int irq, int level) uint32_t oldint = s->intsetclr & s->intmskena; if (level) - s->prev_level |= 1u << irq; - else - s->prev_level &= ~(1u << irq); - - if ((s->intmskena & (1u << irq)) && level) s->intsetclr |= 1u << irq; if (oldint != (s->intsetclr & s->intmskena)) @@ -193,12 +187,11 @@ static int mst_fpga_init(SysBusDevice *dev) static VMStateDescription vmstate_mst_fpga_regs = { .name = "mainstone_fpga", - .version_id = 0, - .minimum_version_id = 0, - .minimum_version_id_old = 0, + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, .post_load = mst_fpga_post_load, .fields = (VMStateField []) { - VMSTATE_UINT32(prev_level, mst_irq_state), VMSTATE_UINT32(leddat1, mst_irq_state), VMSTATE_UINT32(leddat2, mst_irq_state), VMSTATE_UINT32(ledctrl, mst_irq_state),