From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IuOmQ-0007YA-2a for qemu-devel@nongnu.org; Tue, 20 Nov 2007 03:48:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IuOmP-0007Wn-BQ for qemu-devel@nongnu.org; Tue, 20 Nov 2007 03:48:25 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IuOmP-0007WX-2m for qemu-devel@nongnu.org; Tue, 20 Nov 2007 03:48:25 -0500 Received: from mis011.exch011.intermedia.net ([64.78.21.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IuOmO-0006qv-Ni for qemu-devel@nongnu.org; Tue, 20 Nov 2007 03:48:24 -0500 Message-ID: <4742999A.4010706@qumranet.com> Date: Tue, 20 Nov 2007 10:23:54 +0200 From: Izik Eidus MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] allow setting static devfn values for pci devices from the command line References: <4741B0FA.4070603@qumranet.com> <4741BF78.1040502@qumranet.com> <1195497388.31632.31.camel@jma4.dev.netgem.com> In-Reply-To: <1195497388.31632.31.camel@jma4.dev.netgem.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: l_indien@magic.fr, qemu-devel@nongnu.org Jocelyn Mayer wrote: > 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. i will check this. > 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). > so how will i inform the user with the devices name?