From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IuBTv-0004dc-4f for qemu-devel@nongnu.org; Mon, 19 Nov 2007 13:36:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IuBTu-0004dO-1F for qemu-devel@nongnu.org; Mon, 19 Nov 2007 13:36:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IuBTt-0004dL-RN for qemu-devel@nongnu.org; Mon, 19 Nov 2007 13:36:25 -0500 Received: from honiara.magic.fr ([195.154.193.36]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IuBTt-00039S-CM for qemu-devel@nongnu.org; Mon, 19 Nov 2007 13:36:25 -0500 Received: from [172.17.17.137] (gw.netgem.com [195.68.2.34]) by honiara.magic.fr (8.13.1/8.13.1) with ESMTP id lAJIaL2j032545 for ; Mon, 19 Nov 2007 19:36:21 +0100 Subject: Re: [Qemu-devel] [PATCH] allow setting static devfn values for pci devices from the command line From: Jocelyn Mayer In-Reply-To: <4741BF78.1040502@qumranet.com> References: <4741B0FA.4070603@qumranet.com> <4741BF78.1040502@qumranet.com> Content-Type: text/plain Date: Mon, 19 Nov 2007 19:36:28 +0100 Message-Id: <1195497388.31632.31.camel@jma4.dev.netgem.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Reply-To: l_indien@magic.fr, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Mon, 2007-11-19 at 18:53 +0200, Izik Eidus wrote: > Izik Eidus wrote: > > hi, > > this patch make it possible to define from the command line a static > > devfn value for each pci > > device. > > it was wrote for addressing a problem that right now qemu devices get > > their devfn in random way > > (almost random) > > the problem with this is that with adding and removing devices some > > devfn values can be changed > > for each device. > > this make (at least) windows unable to understand what happned to your > > device and mark it > > in yellow color. (and will want you to reinstall it) > > > > in this patch i simply use the device name that was registred with the > > pci device registration > > function. > > in case you have few devices from the same type (same name), it will > > simply increase each by one > > so in this case all you have to do is give long enough offset for the > > devfns from each other. > > > > thanks > ok here is a fix to two issues that i noticed: > 1.in one place i declared static_devfns[MAX_PCI_DEVICS][64] and in other > place: static_devfns[MAX_PCI_DEVICS][128] > > 2.in one place i did a calculation on a pointer line before i checked if > it is vaild pointer... > > anyway here it is again and fixed. It seems that you cannot impose the PCI device numbers mapping, which is likely to be architecture dependant. What you could however change is the PCI bus & slot the device is inserted into, the same way you can choose the PCI slot you put a PCI card into on a real machine. The architecture could then determine what is the corresponding PCI device number, given this PCI bus & slot numbers. For other PCI devices, like PCI bridges or other internal devices, the PCI slots / devfn are fixed by the architecture. You cannot change them in any way, then it seems pointless to have an option that would change the behavior for any of those devices. The last problem I see is that it seems very ugly to hardcode the device names the way you did in vl.c. This is even false in most cases, as most of those devices are only available for a few machines and are not tunable at all (for example macio or uninorth are only available in some Apple Mac machines, not even all). -- Jocelyn Mayer