All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] hw/intc: Handle software disabling of APIC correctly
@ 2022-09-07 17:44 Jay Khandkar
  2022-10-25 18:39 ` Jay Khandkar
  0 siblings, 1 reply; 2+ messages in thread
From: Jay Khandkar @ 2022-09-07 17:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, mst, Jay Khandkar

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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 3df11c34d6..be26b5c913 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -793,6 +793,11 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val,
         break;
     case 0x0f:
         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;
     case 0x10 ... 0x17:
@@ -812,6 +817,9 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val,
     case 0x32 ... 0x37:
         {
             int n = index - 0x32;
+            if (!(s->spurious_vec & APIC_SPURIO_ENABLED)) {
+                val |= APIC_LVT_MASKED;
+            }
             s->lvt[n] = val;
             if (n == APIC_LVT_TIMER) {
                 apic_timer_update(s, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
-- 
2.37.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2] hw/intc: Handle software disabling of APIC correctly
  2022-09-07 17:44 [PATCH V2] hw/intc: Handle software disabling of APIC correctly Jay Khandkar
@ 2022-10-25 18:39 ` Jay Khandkar
  0 siblings, 0 replies; 2+ messages in thread
From: Jay Khandkar @ 2022-10-25 18:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, mst

On Wed, Sep 07, 2022 at 11:14:11PM +0530, Jay Khandkar 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 | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/hw/intc/apic.c b/hw/intc/apic.c
> index 3df11c34d6..be26b5c913 100644
> --- a/hw/intc/apic.c
> +++ b/hw/intc/apic.c
> @@ -793,6 +793,11 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val,
>          break;
>      case 0x0f:
>          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;
>      case 0x10 ... 0x17:
> @@ -812,6 +817,9 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val,
>      case 0x32 ... 0x37:
>          {
>              int n = index - 0x32;
> +            if (!(s->spurious_vec & APIC_SPURIO_ENABLED)) {
> +                val |= APIC_LVT_MASKED;
> +            }
>              s->lvt[n] = val;
>              if (n == APIC_LVT_TIMER) {
>                  apic_timer_update(s, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
> -- 
> 2.37.3
> 
Ping...?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-25 18:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 17:44 [PATCH V2] hw/intc: Handle software disabling of APIC correctly Jay Khandkar
2022-10-25 18:39 ` Jay Khandkar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.