All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make MSI-X work with 64-bit BARs
@ 2008-05-14 13:09 Neil Turton
  2008-05-14 15:51 ` Haitao Shan
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Turton @ 2008-05-14 13:09 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

The code for working out the base address of a 64-bit BAR currently puts
the two halves together in the wrong order and leaves the type bits in
the resulting value.   It also treats PCI_BASE_ADDRESS_MEM_TYPE_64 as an
flag rather than an enumeration value.  This patch fixes these issues.

Signed-off-by: Neil Turton <nturton@solarflare.com>


[-- Attachment #2: msix.patch --]
[-- Type: text/plain, Size: 1233 bytes --]

diff -r 810d8c3ac992 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Thu May 08 16:58:33 2008 +0100
+++ b/xen/arch/x86/msi.c	Wed May 14 13:44:34 2008 +0100
@@ -521,17 +521,20 @@ static u64 pci_resource_start(struct pci
 static u64 pci_resource_start(struct pci_dev *dev, u8 bar_index)
 {
     u64 bar_base;
+    u32 reg_val;
     u8 bus = dev->bus;
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
 
-    bar_base = pci_conf_read32(bus, slot, func,
-                               PCI_BASE_ADDRESS_0 + 4 * bar_index);
-    if ( bar_base & PCI_BASE_ADDRESS_MEM_TYPE_64 )
-    {
-        bar_base <<= 32;
-        bar_base += pci_conf_read32(bus, slot, func,
-                               PCI_BASE_ADDRESS_0 + 4 * (bar_index + 1));
+    reg_val = pci_conf_read32(bus, slot, func,
+                              PCI_BASE_ADDRESS_0 + 4 * bar_index);
+    bar_base = reg_val & PCI_BASE_ADDRESS_MEM_MASK;
+    if ( ( reg_val & PCI_BASE_ADDRESS_MEM_TYPE_MASK ) ==
+         PCI_BASE_ADDRESS_MEM_TYPE_64 )
+    {
+        reg_val = pci_conf_read32(bus, slot, func,
+                                  PCI_BASE_ADDRESS_0 + 4 * (bar_index + 1));
+        bar_base |= ((u64)reg_val) << 32;
     }
 
     return bar_base;


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

end of thread, other threads:[~2008-05-14 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-14 13:09 [PATCH] Make MSI-X work with 64-bit BARs Neil Turton
2008-05-14 15:51 ` Haitao Shan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.