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

[Xen-changelog] [xen staging] x86/IO-APIC: consolidate / complete #define-s



commit 839aca83f456d2ed879a8a6d395dd476c2d3ed9d
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Apr 3 10:15:20 2019 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Apr 3 10:15:20 2019 +0200

    x86/IO-APIC: consolidate / complete #define-s
    
    Drop redundant ones from apic.h. Add delivery mode mask. Use them in
    place of open coded hex numbers.
    
    Take the opportunity and modify a helper function's parameters to be
    just unsigned int. Also drop the bogus double underscore from its name,
    as it and all its callers get touched anyway.
    
    No functional change.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/io_apic.c        | 13 +++++++------
 xen/include/asm-x86/apic.h    |  4 ----
 xen/include/asm-x86/io_apic.h |  1 +
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index a5344ed727..b7f6a532e8 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -410,7 +410,8 @@ void free_ioapic_entries(struct IO_APIC_route_entry 
**ioapic_entries)
     xfree(ioapic_entries);
 }
 
-static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, 
unsigned long disable)
+static void modify_IO_APIC_irq(unsigned int irq, unsigned int enable,
+                               unsigned int disable)
 {
     struct irq_pin_list *entry = irq_2_pin + irq;
     unsigned int pin, reg;
@@ -432,25 +433,25 @@ static void __modify_IO_APIC_irq (unsigned int irq, 
unsigned long enable, unsign
 /* mask = 1 */
 static void __mask_IO_APIC_irq (unsigned int irq)
 {
-    __modify_IO_APIC_irq(irq, 0x00010000, 0);
+    modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED, 0);
 }
 
 /* mask = 0 */
 static void __unmask_IO_APIC_irq (unsigned int irq)
 {
-    __modify_IO_APIC_irq(irq, 0, 0x00010000);
+    modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_MASKED);
 }
 
 /* trigger = 0 */
 static void __edge_IO_APIC_irq (unsigned int irq)
 {
-    __modify_IO_APIC_irq(irq, 0, 0x00008000);
+    modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_LEVEL_TRIGGER);
 }
 
 /* trigger = 1 */
 static void __level_IO_APIC_irq (unsigned int irq)
 {
-    __modify_IO_APIC_irq(irq, 0x00008000, 0);
+    modify_IO_APIC_irq(irq, IO_APIC_REDIR_LEVEL_TRIGGER, 0);
 }
 
 static void mask_IO_APIC_irq(struct irq_desc *desc)
@@ -571,7 +572,7 @@ set_ioapic_affinity_irq(struct irq_desc *desc, const 
cpumask_t *mask)
             io_apic_write(entry->apic, 0x10 + 1 + pin*2, dest);
             data = io_apic_read(entry->apic, 0x10 + pin*2);
             data &= ~IO_APIC_REDIR_VECTOR_MASK;
-            data |= desc->arch.vector & 0xFF;
+            data |= MASK_INSR(desc->arch.vector, IO_APIC_REDIR_VECTOR_MASK);
             io_apic_modify(entry->apic, 0x10 + pin*2, data);
 
             if (!entry->next)
diff --git a/xen/include/asm-x86/apic.h b/xen/include/asm-x86/apic.h
index 9d7ec93042..45b3c3486b 100644
--- a/xen/include/asm-x86/apic.h
+++ b/xen/include/asm-x86/apic.h
@@ -16,10 +16,6 @@
 
 #define        SET_APIC_LOGICAL_ID(x)  (((x)<<24))
 
-#define IO_APIC_REDIR_VECTOR_MASK      0x000FF
-#define IO_APIC_REDIR_DEST_LOGICAL     0x00800
-#define IO_APIC_REDIR_DEST_PHYSICAL    0x00000
-
 /* Possible APIC states */
 enum apic_mode {
     APIC_MODE_INVALID,  /* Not set yet */
diff --git a/xen/include/asm-x86/io_apic.h b/xen/include/asm-x86/io_apic.h
index 736bb49184..5d4075f437 100644
--- a/xen/include/asm-x86/io_apic.h
+++ b/xen/include/asm-x86/io_apic.h
@@ -21,6 +21,7 @@
 
 /* I/O Unit Redirection Table */
 #define IO_APIC_REDIR_VECTOR_MASK   0x000FF
+#define IO_APIC_REDIR_DELIV_MODE_MASK 0x00700
 #define IO_APIC_REDIR_DEST_LOGICAL  0x00800
 #define IO_APIC_REDIR_DEST_PHYSICAL 0x00000
 #define IO_APIC_REDIR_SEND_PENDING  (1 << 12)
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.