Patchwork [2/3] kvm-unit-tests: do not set level sensitive irq when initializing the PIC

login
register
mail settings
Submitter Anthony Liguori
Date Feb. 24, 2011, 9:48 p.m.
Message ID <1298584085-13129-3-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/84494/
State New
Headers show

Comments

Anthony Liguori - Feb. 24, 2011, 9:48 p.m.
I'm not sure if this was intentional but the QEMU i8259 does not support this
flag.  I haven't observed any issues with this but I'll happily admit that
I'm not very aware of what I'm doing here.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Avi Kivity - Feb. 27, 2011, 12:46 p.m.
On 02/24/2011 11:48 PM, Anthony Liguori wrote:
> I'm not sure if this was intentional but the QEMU i8259 does not support this
> flag.  I haven't observed any issues with this but I'll happily admit that
> I'm not very aware of what I'm doing here.
>
> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
>
>   static u32 xapic_read(unsigned reg)
>   {
>       return *(volatile u32 *)(g_apic + reg);
> @@ -133,7 +129,7 @@ void ioapic_write_redir(unsigned line, ioapic_redir_entry_t e)
>   void enable_apic(void)
>   {
>       printf("enabling apic\n");
> -    xapic_write(0xf0, 0x1ff); /* spurious vector register */
> +    xapic_write(0xf0, 0x1f7); /* spurious vector register */
>   }

Not sure what you're doing here.  You're changing the APIC Spurious 
Vector from 0xff to 0xf7?  This has nothing to do with the i8259 or 
level triggeredness as far as I can tell - it just enables the APIC (bit 
8) and selects a vector for reporting spurious interrupts (0xff happens 
to be the reset value).

Patch

diff --git a/lib/x86/apic.c b/lib/x86/apic.c
index 7bb98ed..2c2afb7 100644
--- a/lib/x86/apic.c
+++ b/lib/x86/apic.c
@@ -1,5 +1,6 @@ 
 #include "libcflat.h"
 #include "apic.h"
+#include "io.h"
 
 static void *g_apic = (void *)0xfee00000;
 static void *g_ioapic = (void *)0xfec00000;
@@ -11,11 +12,6 @@  struct apic_ops {
     u32 (*id)(void);
 };
 
-static void outb(unsigned char data, unsigned short port)
-{
-    asm volatile ("out %0, %1" : : "a"(data), "d"(port));
-}
-
 static u32 xapic_read(unsigned reg)
 {
     return *(volatile u32 *)(g_apic + reg);
@@ -133,7 +129,7 @@  void ioapic_write_redir(unsigned line, ioapic_redir_entry_t e)
 void enable_apic(void)
 {
     printf("enabling apic\n");
-    xapic_write(0xf0, 0x1ff); /* spurious vector register */
+    xapic_write(0xf0, 0x1f7); /* spurious vector register */
 }
 
 void mask_pic_interrupts(void)