WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] pt_msix_init: Error: Can't map physical MSI-X table

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] pt_msix_init: Error: Can't map physical MSI-X table: Invalid argument
From: Bruce Edge <bruce.edge@xxxxxxxxx>
Date: Fri, 16 Oct 2009 08:03:18 -0700
Delivery-date: Fri, 16 Oct 2009 08:04:37 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=tfh+hdBSiFE+Kc/dCSTcaheT515lp8SpL3HBNFadsJ4=; b=jlggb6Jr0oXtavXaMUtBks5wdFhuQbsx3nT0IoiZ5GpnJ63VeefvXNqVzBcDh4sxVk qByxou02zCpclPELlYvY0Y8+K4Phbdcid4iiBDjWt8vogRW+oTrSaqlc91NCzQt5rI0a 5ey+ZY/VObn4oiZwU2lz6uZm5BKB2wcKR2zuU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ErMdibTvVq+RQQRU6HUtgZVpw9xBLosM4G9qqz0pyRrgcopVHUekrJOl6S1JMI7KjN WqXUOjYVHVxnCNonWnHvRmeKQHr8ISBKFGohRwv9Pu4CO8GC7bSqujOhyLEaYefLVvGC tC3Cz7ojyeffyzXExVqWBqxUg7I9eR+qSrWGo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.0910161316050.17813@kaball-desktop>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <2B044E14371DA244B71F8BF2514563F503ECDB72@xxxxxxxxxxxxxxxxx> <alpine.DEB.2.00.0910141343050.11134@kaball-desktop> <45c43ef50910141541l6fe6d36te2ae4f6efb29303b@xxxxxxxxxxxxxx> <alpine.DEB.2.00.0910151106470.4001@kaball-desktop> <45c43ef50910151113n5dab68ddxed6f8c0ffa5ccb88@xxxxxxxxxxxxxx> <alpine.DEB.2.00.0910161316050.17813@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Force msi-x init mmap to a page boundary or mmap fails with.
    pt_msix_init: Error: Can't map physical MSI-X table: Invalid argument

Signed-off-by: Bruce Edge <Bruce.edge@xxxxxxx>

--- ./tools/ioemu-remote/hw/pass-through.h.orig 2009-10-15
10:22:17.000000000 -0700
+++ ./tools/ioemu-remote/hw/pass-through.h      2009-10-15
11:08:58.000000000 -0700
@@ -193,6 +193,7 @@
    int mmio_index;
    void *phys_iomem_base;
    struct msix_entry_info msix_entry[0];
+       uint32_t table_offset_adjust;   /* page align mmap */
 };

 struct pt_pm_info {


--- ./tools/ioemu-remote/hw/pt-msi.c.orig       2009-10-13
11:54:11.000000000 -0700
+++ ./tools/ioemu-remote/hw/pt-msi.c    2009-10-15 10:29:50.000000000 -0700
@@ -542,6 +542,7 @@
    int i, total_entries, table_off, bar_index;
    struct pci_dev *pd = dev->pci_dev;
    int fd;
+    int err;

    id = pci_read_byte(pd, pos + PCI_CAP_LIST_ID);

@@ -584,9 +585,15 @@
        PT_LOG("Error: Can't open /dev/mem: %s\n", strerror(errno));
        goto error_out;
    }
-    dev->msix->phys_iomem_base = mmap(0, total_entries * 16,
+    PT_LOG("table_off = %llx, total_entries = %d\n",table_off,total_entries);
+    dev->msix->table_offset_adjust = table_off & 0x0fff;
+    dev->msix->phys_iomem_base = mmap(0, total_entries * 16 +
dev->msix->table_offset_adjust,
                          PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED,
-                          fd, dev->msix->table_base + table_off);
+                          fd, dev->msix->table_base + table_off -
dev->msix->table_offset_adjust);
+    dev->msix->phys_iomem_base = (void *)((char *)dev->msix->phys_iomem_base +
+                          dev->msix->table_offset_adjust);
+    err = errno;
+    PT_LOG("errno = %d\n",err);
    if ( dev->msix->phys_iomem_base == MAP_FAILED )
    {
        PT_LOG("Error: Can't map physical MSI-X table: %s\n", strerror(errno));
@@ -612,7 +619,8 @@
    {
        PT_LOG("unmapping physical MSI-X table from %lx\n",
           (unsigned long)dev->msix->phys_iomem_base);
-        munmap(dev->msix->phys_iomem_base, dev->msix->total_entries * 16);
+        munmap(dev->msix->phys_iomem_base, dev->msix->total_entries * 16 +
+           dev->msix->table_offset_adjust);
    }

    free(dev->msix);

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