qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/6] xics: disable flags reset on xics reset
Date: Thu, 08 May 2014 13:57:11 +0200	[thread overview]
Message-ID: <536B7117.5030209@suse.de> (raw)
In-Reply-To: <1399442518-26303-4-git-send-email-aik@ozlabs.ru>

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 <aik@ozlabs.ru>
> ---
>   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);

  reply	other threads:[~2014-05-08 11:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07  6:01 [Qemu-devel] [PATCH 0/6] move interrupts from spapr to xics Alexey Kardashevskiy
2014-05-07  6:01 ` [Qemu-devel] [PATCH 1/6] xics: add flags for interrupts Alexey Kardashevskiy
2014-05-07 13:09   ` Mike Day
2014-05-09  3:12     ` Alexey Kardashevskiy
2014-05-09 12:20       ` Mike Day
2014-05-08 11:52   ` Alexander Graf
2014-05-08 12:08     ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-05-07  6:01 ` [Qemu-devel] [PATCH 2/6] xics: add find_server Alexey Kardashevskiy
2014-05-07 13:14   ` Mike Day
2014-05-07  6:01 ` [Qemu-devel] [PATCH 3/6] xics: disable flags reset on xics reset Alexey Kardashevskiy
2014-05-08 11:57   ` Alexander Graf [this message]
2014-05-07  6:01 ` [Qemu-devel] [PATCH 4/6] spapr: move interrupt allocator to xics Alexey Kardashevskiy
2014-05-07  6:01 ` [Qemu-devel] [PATCH 5/6] spapr: remove @next_irq Alexey Kardashevskiy
2014-05-07  6:01 ` [Qemu-devel] [PATCH 6/6] xics: implement xics_ics_free() Alexey Kardashevskiy
2014-05-08 12:07   ` Alexander Graf
2014-05-09  2:13     ` Alexey Kardashevskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=536B7117.5030209@suse.de \
    --to=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).