All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Turton <nturton@solarflare.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] Make MSI-X work with 64-bit BARs
Date: Wed, 14 May 2008 14:09:33 +0100	[thread overview]
Message-ID: <482AE48D.4040402@solarflare.com> (raw)

[-- 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

             reply	other threads:[~2008-05-14 13:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14 13:09 Neil Turton [this message]
2008-05-14 15:51 ` [PATCH] Make MSI-X work with 64-bit BARs Haitao Shan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=482AE48D.4040402@solarflare.com \
    --to=nturton@solarflare.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.