From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiMwz-0000zw-OP for qemu-devel@nongnu.org; Thu, 08 May 2014 07:57:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiMwt-0004LA-Hu for qemu-devel@nongnu.org; Thu, 08 May 2014 07:57:21 -0400 Message-ID: <536B7117.5030209@suse.de> Date: Thu, 08 May 2014 13:57:11 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1399442518-26303-1-git-send-email-aik@ozlabs.ru> <1399442518-26303-4-git-send-email-aik@ozlabs.ru> In-Reply-To: <1399442518-26303-4-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/6] xics: disable flags reset on xics reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On 05/07/2014 08:01 AM, Alexey Kardashevskiy wrote: > Since islsi[] array has been merged into the ICSState struct, > we must not reset flags as they tell if the interrupt is in use. > > Signed-off-by: Alexey Kardashevskiy > --- > hw/intc/xics.c | 4 +++- > hw/intc/xics_kvm.c | 4 +++- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index 9314654..7a64b2e 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -522,10 +522,12 @@ static void ics_reset(DeviceState *dev) > ICSState *ics = ICS(dev); > int i; > > - memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs); > for (i = 0; i < ics->nr_irqs; i++) { > + ics->irqs[i].server = 0; > ics->irqs[i].priority = 0xff; > ics->irqs[i].saved_priority = 0xff; > + ics->irqs[i].status = 0; > + /* Do not reset @flags as IRQ might be allocated */ I think the code would be more obvious if you save the flags before you do the memset() - that would then have to move into the loop - and restore them afterwards. Alex > } > } > > diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c > index 456fc2c..a322593 100644 > --- a/hw/intc/xics_kvm.c > +++ b/hw/intc/xics_kvm.c > @@ -272,10 +272,12 @@ static void ics_kvm_reset(DeviceState *dev) > ICSState *ics = ICS(dev); > int i; > > - memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs); > for (i = 0; i < ics->nr_irqs; i++) { > + ics->irqs[i].server = 0; > ics->irqs[i].priority = 0xff; > ics->irqs[i].saved_priority = 0xff; > + ics->irqs[i].status = 0; > + /* Do not reset @flags as IRQ might be allocated */ > } > > ics_set_kvm_state(ics, 1);