]> xenbits.xensource.com Git - xen.git/commitdiff
x86/IRQ: flip legacy and dynamic vector ranges
authorJan Beulich <jbeulich@suse.com>
Fri, 27 Dec 2019 08:54:19 +0000 (09:54 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 27 Dec 2019 08:54:19 +0000 (09:54 +0100)
There's no reason to have the PIC vectors (which are typically entirely
unused on 64-bit systems anyway) right below the high priority ones. Put
them in the lowest possible range, and shift the dynamic vector range up
accordingly. This is to reduce the priority of PIC vectors in the LAPIC
vs all other ones.

Note that irq_move_cleanup_interrupt(), despite using
FIRST_DYNAMIC_VECTOR, does not get touched, as PIC interrupts aren't
movable.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/apic.c
xen/arch/x86/io_apic.c
xen/arch/x86/irq.c
xen/arch/x86/x86_64/entry.S
xen/include/asm-x86/mach-default/irq_vectors.h

index 50f3d305e80e953e86fdf64b7dc272f883975fb7..7e84daf32a2a05678511e90502827c6bd9f420bb 100644 (file)
@@ -528,9 +528,9 @@ void setup_local_APIC(void)
     init_apic_ldr();
 
     /*
-     * Set Task Priority to reject any interrupts below FIRST_DYNAMIC_VECTOR.
+     * Set Task Priority to reject any interrupts below FIRST_IRQ_VECTOR.
      */
-    apic_write(APIC_TASKPRI, (FIRST_DYNAMIC_VECTOR & 0xF0) - 0x10);
+    apic_write(APIC_TASKPRI, (FIRST_IRQ_VECTOR & 0xF0) - 0x10);
 
     /*
      * After a crash, we no longer service the interrupts and a pending
index 6238df494b3b80ef87f98e950aaa406e15bf6d85..9913dfde1f1aa44b72ec8fffde29fcd29c961767 100644 (file)
@@ -2388,7 +2388,9 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
         return 0;
     }
 
-    if ( desc->arch.vector <= 0 || desc->arch.vector > LAST_DYNAMIC_VECTOR )
+    if ( desc->arch.vector <= 0 || desc->arch.vector > LAST_DYNAMIC_VECTOR ||
+         (desc->arch.vector >= FIRST_LEGACY_VECTOR &&
+          desc->arch.vector <= LAST_LEGACY_VECTOR) )
     {
         int vector = desc->arch.vector;
 
index 9adad3ff04ae5ce2756ea5b2fdab7c71f97dd085..ae02cf17128a59366de6de1bc79b672f35eff3d5 100644 (file)
@@ -101,7 +101,7 @@ void unlock_vector_lock(void)
 
 static inline bool valid_irq_vector(unsigned int vector)
 {
-    return vector >= FIRST_DYNAMIC_VECTOR && vector <= LAST_HIPRIORITY_VECTOR;
+    return vector >= FIRST_IRQ_VECTOR && vector <= LAST_IRQ_VECTOR;
 }
 
 static void release_old_vec(struct irq_desc *desc)
index 11385857fa4228cc6b8de71c18e8f99555d9a231..70c0b1c0a5e7914ee4b22b1280440da4761f5108 100644 (file)
@@ -923,9 +923,9 @@ autogen_stubs: /* Automatically generated stubs. */
 
         /* Common interrupts, heading towards do_IRQ(). */
 #ifdef CONFIG_PV
-        .if vec >= FIRST_DYNAMIC_VECTOR && vec != HYPERCALL_VECTOR && vec != LEGACY_SYSCALL_VECTOR
+        .if vec >= FIRST_IRQ_VECTOR && vec != HYPERCALL_VECTOR && vec != LEGACY_SYSCALL_VECTOR
 #else
-        .if vec >= FIRST_DYNAMIC_VECTOR
+        .if vec >= FIRST_IRQ_VECTOR
 #endif
 
         ALIGN
index 992e00c44b5dbb68581d742067265a54322479f0..6824a9e30189f2c1a922479dbf03dd13e19e0aa6 100644 (file)
 /* IRQ0 (timer) is statically allocated but must be high priority. */
 #define IRQ0_VECTOR             0xf0
 
-/* Legacy PIC uses vectors 0xe0-0xef. */
-#define FIRST_LEGACY_VECTOR    0xe0
-#define LAST_LEGACY_VECTOR      0xef
+/* Legacy PIC uses vectors 0x20-0x2f. */
+#define FIRST_LEGACY_VECTOR     0x20
+#define LAST_LEGACY_VECTOR      (FIRST_LEGACY_VECTOR + 0xf)
 
 #define HYPERCALL_VECTOR       0x82
 #define LEGACY_SYSCALL_VECTOR   0x80
 
 /* Dynamically-allocated vectors available to any driver. */
-#define FIRST_DYNAMIC_VECTOR   0x20
-#define LAST_DYNAMIC_VECTOR    0xdf
+#define FIRST_DYNAMIC_VECTOR    (LAST_LEGACY_VECTOR + 1)
+#define LAST_DYNAMIC_VECTOR     0xef
 #define NR_DYNAMIC_VECTORS     (LAST_DYNAMIC_VECTOR - FIRST_DYNAMIC_VECTOR + 1)
 
 #define IRQ_MOVE_CLEANUP_VECTOR FIRST_DYNAMIC_VECTOR
 
 #define NR_VECTORS 256
 
+#define FIRST_IRQ_VECTOR        FIRST_LEGACY_VECTOR
+#define LAST_IRQ_VECTOR         LAST_HIPRIORITY_VECTOR
+
 #endif /* _ASM_IRQ_VECTORS_H */