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] [rfc 17/18] ioemu: sort pass-through PCI devices before inse

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [rfc 17/18] ioemu: sort pass-through PCI devices before inserting
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Tue, 17 Feb 2009 20:08:05 +1100
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Delivery-date: Tue, 17 Feb 2009 01:35:24 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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: <20090217090748.580007796@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
When passing though a milti-function device it is important that function
zero is inserted first as the multifunction bit in its PCI_HEADER_TYPE
needs to be chacked to verify that the device is multi-function and enable
probing of non-zero functions in (Linux and probably other) guests.

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

Index: ioemu-remote/hw/pass-through.c
===================================================================
--- ioemu-remote.orig/hw/pass-through.c 2009-02-17 17:51:30.000000000 +0900
+++ ioemu-remote/hw/pass-through.c      2009-02-17 17:52:08.000000000 +0900
@@ -751,6 +751,11 @@ static int cmp_php_dev(const struct php_
     return 0;
 }
 
+static int cmp_php_dev_for_qsort(const void *a, const void *b)
+{
+    return cmp_php_dev(a, b);
+}
+
 static void cpy_php_dev(struct php_dev *dst, const struct php_dev *src)
 {
     memcpy(dst, src, sizeof(*dst));
@@ -937,6 +942,7 @@ static struct php_dev *parse_bdf(const c
     }
 
     regfree(&preg);
+    qsort(list, nmemb, sizeof(*list), cmp_php_dev_for_qsort);
     return list;
 
 err:

-- 

-- 
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en


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

<Prev in Thread] Current Thread [Next in Thread>