qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/intc: Handle software disabling of APIC correctly


From: Peter Maydell
Subject: Re: [PATCH] hw/intc: Handle software disabling of APIC correctly
Date: Fri, 29 Jul 2022 18:09:01 +0100

On Tue, 12 Jul 2022 at 19:38, Jay Khandkar <jaykhandkar2002@gmail.com> wrote:
>
> When the local APIC is in a software disabled state, all local interrupt
> sources must be masked and all attempts to unmask them should be
> ignored. Currently, we don't do either. Fix this by handling it
> correctly in apic_mem_write().
>
> Signed-off-by: Jay Khandkar <jaykhandkar2002@gmail.com>
> ---
>  hw/intc/apic.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/hw/intc/apic.c b/hw/intc/apic.c
> index 3df11c34d6..493c70af62 100644
> --- a/hw/intc/apic.c
> +++ b/hw/intc/apic.c
> @@ -792,9 +792,16 @@ static void apic_mem_write(void *opaque, hwaddr addr, 
> uint64_t val,
>          s->dest_mode = val >> 28;
>          break;
>      case 0x0f:
> -        s->spurious_vec = val & 0x1ff;
> -        apic_update_irq(s);
> -        break;
> +        {
> +            s->spurious_vec = val & 0x1ff;
> +            if (!(val & APIC_SPURIO_ENABLED)) {
> +                for (int i = 0; i < APIC_LVT_NB; i++) {
> +                    s->lvt[i] |= APIC_LVT_MASKED;
> +                }
> +            }
> +            apic_update_irq(s);
> +            break;
> +        }

What are the braces for here ? There's no local variable declaration...

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]