public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MSI: check for BIOS assigned addresses
@ 2009-03-06 15:11 Daniel Yeisley
  2009-03-06 16:24 ` Ingo Molnar
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Daniel Yeisley @ 2009-03-06 15:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm

When creating MSI addresses the kernel makes them up and writes them to
the hardware without first checking for what the system BIOS may have
assigned.  The patch below checks for already assigned values, and
leaves them alone if they exist. 


Signed-off-by: Dan Yeisley <dan.yeisley@unisys.com>

---
diff -Naurp linux-2.6.29-rc5/arch/x86/kernel/io_apic.c linux-2.6.29-rc5-dpy/arch/x86/kernel/io_apic.c
--- linux-2.6.29-rc5/arch/x86/kernel/io_apic.c	2009-02-13 18:31:30.000000000 -0500
+++ linux-2.6.29-rc5-dpy/arch/x86/kernel/io_apic.c	2009-03-04 08:25:30.000000000 -0500
@@ -3258,6 +3258,7 @@ static int msi_compose_msg(struct pci_de
 	struct irq_cfg *cfg;
 	int err;
 	unsigned dest;
+	struct irq_desc *desc = irq_to_desc(irq);
 
 	cfg = irq_cfg(irq);
 	err = assign_irq_vector(irq, cfg, TARGET_CPUS);
@@ -3265,6 +3266,8 @@ static int msi_compose_msg(struct pci_de
 		return err;
 
 	dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS);
+	
+	read_msi_msg_desc(desc, msg);
 
 #ifdef CONFIG_INTR_REMAP
 	if (irq_remapped(irq)) {
@@ -3295,17 +3298,18 @@ static int msi_compose_msg(struct pci_de
 	} else
 #endif
 	{
-		msg->address_hi = MSI_ADDR_BASE_HI;
-		msg->address_lo =
-			MSI_ADDR_BASE_LO |
-			((INT_DEST_MODE == 0) ?
-				MSI_ADDR_DEST_MODE_PHYSICAL:
-				MSI_ADDR_DEST_MODE_LOGICAL) |
-			((INT_DELIVERY_MODE != dest_LowestPrio) ?
-				MSI_ADDR_REDIRECTION_CPU:
-				MSI_ADDR_REDIRECTION_LOWPRI) |
-			MSI_ADDR_DEST_ID(dest);
-
+		if (!msg->address_hi && !msg->address_lo) {
+			msg->address_hi = MSI_ADDR_BASE_HI;
+			msg->address_lo = 
+				MSI_ADDR_BASE_LO |
+				((INT_DEST_MODE == 0) ?
+					MSI_ADDR_DEST_MODE_PHYSICAL:
+					MSI_ADDR_DEST_MODE_LOGICAL) |
+				((INT_DELIVERY_MODE != dest_LowestPrio) ?
+					MSI_ADDR_REDIRECTION_CPU:
+					MSI_ADDR_REDIRECTION_LOWPRI) |
+				MSI_ADDR_DEST_ID(dest); 
+		}
 		msg->data =
 			MSI_DATA_TRIGGER_EDGE |
 			MSI_DATA_LEVEL_ASSERT |
@@ -3440,11 +3444,13 @@ static int setup_msi_irq(struct pci_dev 
 	int ret;
 	struct msi_msg msg;
 
+	set_irq_msi(irq, msidesc);
 	ret = msi_compose_msg(dev, irq, &msg);
-	if (ret < 0)
+	if (ret < 0) {
+		set_irq_msi(irq, NULL);
 		return ret;
+	}
 
-	set_irq_msi(irq, msidesc);
 	write_msi_msg(irq, &msg);
 
 #ifdef CONFIG_INTR_REMAP



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

end of thread, other threads:[~2009-03-09 15:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-06 15:11 [PATCH] MSI: check for BIOS assigned addresses Daniel Yeisley
2009-03-06 16:24 ` Ingo Molnar
2009-03-06 15:56   ` Daniel Yeisley
2009-03-06 18:09 ` [tip:x86/urgent] x86: " Daniel Yeisley
2009-03-06 18:36 ` [tip:x86/apic] " Daniel Yeisley
2009-03-06 18:45   ` Ingo Molnar
2009-03-06 18:28     ` Daniel Yeisley
2009-03-06 19:13       ` Ingo Molnar
2009-03-07  1:06         ` Yinghai Lu
2009-03-08 10:54           ` Ingo Molnar
2009-03-09 14:32             ` Daniel Yeisley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox