From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58418 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7vVN-0003ND-9u for qemu-devel@nongnu.org; Mon, 18 Oct 2010 15:36:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7vVJ-0004pA-Kn for qemu-devel@nongnu.org; Mon, 18 Oct 2010 15:36:18 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:61044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7vVJ-0004on-9D for qemu-devel@nongnu.org; Mon, 18 Oct 2010 15:36:17 -0400 Message-ID: <4CBCA1AB.5010701@mail.berlios.de> Date: Mon, 18 Oct 2010 21:36:11 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 1/2] pci: Automatically patch PCI vendor id and device id in PCI ROM References: <4CBC6CDB.109@redhat.com> <1287424511-22021-1-git-send-email-weil@mail.berlios.de> <20101018175821.GA27606@redhat.com> <4CBC94FE.5010003@codemonkey.ws> <20101018190325.GB27606@redhat.com> In-Reply-To: <20101018190325.GB27606@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Gerd Hoffmann , Markus Armbruster , QEMU Developers Am 18.10.2010 21:03, schrieb Michael S. Tsirkin: > On Mon, Oct 18, 2010 at 01:42:06PM -0500, Anthony Liguori wrote: >>>> +/* Patch the PCI vendor and device ids in a PCI rom image if >>>> necessary. >>>> + This is needed for an option rom which is used for more than one >>>> device. */ >>>> +static void pci_patch_ids(PCIDevice *pdev, uint8_t *ptr, int size) >>> let's return an error code on malformed roms so management can >>> detect errors? >> >> A bad/missing PnP header does not mean it's an invalid ROM. > > I don't see this as a generic capability - rather a specific > hack that helps reduce some duplication for eepro100 and friends. > As such, if we can't patch the id we know it's an invalid file. There is already some kind of error feedback: the rom will not work. For etherboot roms, booting from network won't work. This is a qemu internal error, so more error handling is not needed. Users who configure a device with their own rom file don't need an id patch, and their rom data will not be patched because they normally specify a rom file with correct ids. For the rare case where they configure a rom with a "wrong" id, their rom data will be patched (something they don't expect) or not modified because of the sanity checks (then the rom is ignored by the bios). Maybe a more perfect solution would only patch the preconfigured rom files but not user configured files, but I don't think we need this degree of perfection. Regards, Stefan