x86/msi: Refactor msi_compose_message() to not require an irq_desc
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 7 Nov 2013 14:17:48 +0000 (15:17 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 7 Nov 2013 14:17:48 +0000 (15:17 +0100)
Subsequent changes will cause HPET MSIs to not have an associated IRQ.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/hpet.c
xen/arch/x86/msi.c
xen/drivers/passthrough/vtd/iommu.c
xen/include/asm-x86/msi.h

index 437379172904e76a1cf529caf71e5c7db87f60c7..3a4f7e8049e8fc065da013c6fa1c7b2c9576c583 100644 (file)
@@ -331,7 +331,7 @@ static int __hpet_setup_msi_irq(struct irq_desc *desc)
 {
     struct msi_msg msg;
 
-    msi_compose_msg(desc, &msg);
+    msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg);
     return hpet_msi_write(desc->action->dev_id, &msg);
 }
 
index b43c36a1c6f3eed15ecd7805ea0f23eaca9a0785..284042e19d6295419a24f0b6f4e214bab8023fb4 100644 (file)
@@ -124,13 +124,12 @@ static void msix_put_fixmap(struct arch_msix *msix, int idx)
 /*
  * MSI message composition
  */
-void msi_compose_msg(struct irq_desc *desc, struct msi_msg *msg)
+void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask, struct msi_msg *msg)
 {
     unsigned dest;
-    int vector = desc->arch.vector;
 
     memset(msg, 0, sizeof(*msg));
-    if ( !cpumask_intersects(desc->arch.cpu_mask, &cpu_online_map) ) {
+    if ( !cpumask_intersects(cpu_mask, &cpu_online_map) ) {
         dprintk(XENLOG_ERR,"%s, compose msi message error!!\n", __func__);
         return;
     }
@@ -138,7 +137,7 @@ void msi_compose_msg(struct irq_desc *desc, struct msi_msg *msg)
     if ( vector ) {
         cpumask_t *mask = this_cpu(scratch_mask);
 
-        cpumask_and(mask, desc->arch.cpu_mask, &cpu_online_map);
+        cpumask_and(mask, cpu_mask, &cpu_online_map);
         dest = cpu_mask_to_apicid(mask);
 
         msg->address_hi = MSI_ADDR_BASE_HI;
@@ -491,7 +490,7 @@ int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc,
 
     desc->msi_desc = msidesc;
     desc->handler = handler;
-    msi_compose_msg(desc, &msg);
+    msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg);
     return write_msi_msg(msidesc, &msg);
 }
 
index 2dbe97a7d168a9e2cd22c52664805a9a4edc3915..97d5b5e746bcc4b4402e1dad0ef6dd0d22c3dc4c 100644 (file)
@@ -1039,7 +1039,7 @@ static void dma_msi_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
         return;
     }
 
-    msi_compose_msg(desc, &msg);
+    msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg);
     /* Are these overrides really needed? */
     if (x2apic_enabled)
         msg.address_hi = dest & 0xFFFFFF00;
index 9eeef639359647e4f0ee4b62038d51bb7c2db1c4..89a9266ca9452d939cc162fc2b555128cabe9aa0 100644 (file)
@@ -231,7 +231,8 @@ struct arch_msix {
 };
 
 void early_msi_init(void);
-void msi_compose_msg(struct irq_desc *, struct msi_msg *);
+void msi_compose_msg(unsigned vector, const cpumask_t *mask,
+                     struct msi_msg *msg);
 void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable);
 void mask_msi_irq(struct irq_desc *);
 void unmask_msi_irq(struct irq_desc *);