qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Clément Chigot" <chigot@adacore.com>, qemu-devel@nongnu.org
Cc: Frederic Konrad <konrad.frederic@yahoo.fr>
Subject: Re: [PATCH v2 4/8] intc/grlib_irqmp: implements multicore irq
Date: Tue, 30 Jan 2024 09:59:54 +0100	[thread overview]
Message-ID: <3cf25250-3114-40cf-9ef8-6e400fa64d1d@linaro.org> (raw)
In-Reply-To: <20240116130213.172358-5-chigot@adacore.com>

On 16/1/24 14:02, Clément Chigot wrote:
> Now there is an ncpus property, use it in order to deliver the IRQ to
> multiple CPU.
> 
> Co-developed-by: Frederic Konrad <konrad.frederic@yahoo.fr>
> Signed-off-by: Clément Chigot <chigot@adacore.com>
> ---
>   hw/intc/grlib_irqmp.c         | 43 ++++++++++++++++++-----------------
>   hw/sparc/leon3.c              |  3 ++-
>   include/hw/intc/grlib_irqmp.h |  2 +-
>   3 files changed, 25 insertions(+), 23 deletions(-)


>   static void grlib_irqmp_check_irqs(IRQMPState *state)
>   {
> -    uint32_t      pend   = 0;
> -    uint32_t      level0 = 0;
> -    uint32_t      level1 = 0;
> +    uint32_t pend = 0;
> +    uint32_t level0 = 0;
> +    uint32_t level1 = 0;
> +    int i;
>   
>       assert(state != NULL);
>       assert(state->parent != NULL);
>   
> -    /* IRQ for CPU 0 (no SMP support) */
> -    pend = (state->pending | state->force[0])
> -        & state->mask[0];
> -
> -    level0 = pend & ~state->level;
> -    level1 = pend &  state->level;
> +    for (i = 0; i < state->parent->ncpus; i++) {
> +        pend = (state->pending | state->force[i]) & state->mask[i];
> +        level0 = pend & ~state->level;
> +        level1 = pend &  state->level;

     for (unsigned i = 0; i < state->parent->ncpus; i++) {
         uint32_t pend = (state->pending | state->force[i])
                         & state->mask[i];
         uint32_t level0 = pend & ~state->level;
         uint32_t level1 = pend &  state->level;

>   
> -    trace_grlib_irqmp_check_irqs(state->pending, state->force[0],
> -                                 state->mask[0], level1, level0);
> +        trace_grlib_irqmp_check_irqs(state->pending, state->force[i],
> +                                     state->mask[i], level1, level0);
>   
> -    /* Trigger level1 interrupt first and level0 if there is no level1 */
> -    qemu_set_irq(state->parent->irq, level1 ?: level0);
> +        /* Trigger level1 interrupt first and level0 if there is no level1 */
> +        qemu_set_irq(state->parent->irq[i], level1 ?: level0);
> +    }
>   }
>   
> -static void grlib_irqmp_ack_mask(IRQMPState *state, uint32_t mask)
> +static void grlib_irqmp_ack_mask(IRQMPState *state, int cpu, uint32_t mask)

unsigned cpu, ...

>   {
>       /* Clear registers */
>       state->pending  &= ~mask;
> -    state->force[0] &= ~mask; /* Only CPU 0 (No SMP support) */
> +    state->force[cpu] &= ~mask;
>   
>       grlib_irqmp_check_irqs(state);
>   }
>   
> -void grlib_irqmp_ack(DeviceState *dev, int intno)
> +void grlib_irqmp_ack(DeviceState *dev, int cpu, int intno)

unsigned cpu, ...

>   {
>       IRQMP        *irqmp = GRLIB_IRQMP(dev);
>       IRQMPState   *state;
> @@ -133,7 +133,7 @@ void grlib_irqmp_ack(DeviceState *dev, int intno)
>   
>       trace_grlib_irqmp_ack(intno);
>   
> -    grlib_irqmp_ack_mask(state, mask);
> +    grlib_irqmp_ack_mask(state, cpu, mask);
>   }
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



  reply	other threads:[~2024-01-30  9:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 13:02 [PATCH v2 0/8] sparc/leon3: Add support for -smp Clément Chigot
2024-01-16 13:02 ` [PATCH v2 1/8] sparc/grlib: split out the headers for each peripherals Clément Chigot
2024-01-30  8:50   ` Philippe Mathieu-Daudé
2024-01-16 13:02 ` [PATCH v2 2/8] intc/grlib_irqmp: add ncpus property Clément Chigot
2024-01-16 13:02 ` [PATCH v2 3/8] intc/grlib_irqmp: implements the multiprocessor status register Clément Chigot
2024-01-30 11:53   ` Philippe Mathieu-Daudé
2024-01-16 13:02 ` [PATCH v2 4/8] intc/grlib_irqmp: implements multicore irq Clément Chigot
2024-01-30  8:59   ` Philippe Mathieu-Daudé [this message]
2024-01-16 13:02 ` [PATCH v2 5/8] target/sparc: implement asr17 feature for smp Clément Chigot
2024-01-30 11:44   ` Philippe Mathieu-Daudé
2024-01-16 13:02 ` [PATCH v2 6/8] leon3: implement multiprocessor Clément Chigot
2024-01-30 11:43   ` Philippe Mathieu-Daudé
2024-01-30 14:07     ` Clément Chigot
2024-01-30 11:52   ` Philippe Mathieu-Daudé
2024-01-16 13:02 ` [PATCH v2 7/8] leon3: check cpu_id in the tiny bootloader Clément Chigot
2024-01-30  9:15   ` Philippe Mathieu-Daudé
2024-01-30 12:41     ` Clément Chigot
2024-01-16 13:02 ` [PATCH v2 8/8] MAINTAINERS: replace Fabien by myself as Leon3 maintainer Clément Chigot
2024-01-30  8:38 ` [PATCH v2 0/8] sparc/leon3: Add support for -smp Clément Chigot
2024-01-30 11:55 ` Philippe Mathieu-Daudé

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=3cf25250-3114-40cf-9ef8-6e400fa64d1d@linaro.org \
    --to=philmd@linaro.org \
    --cc=chigot@adacore.com \
    --cc=konrad.frederic@yahoo.fr \
    --cc=qemu-devel@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).