From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAH7e-0005j8-Hz for qemu-devel@nongnu.org; Wed, 01 Jul 2015 08:28:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAH7b-000524-1T for qemu-devel@nongnu.org; Wed, 01 Jul 2015 08:28:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAH7a-00051x-Sg for qemu-devel@nongnu.org; Wed, 01 Jul 2015 08:28:10 -0400 Date: Wed, 1 Jul 2015 14:28:08 +0200 From: "Michael S. Tsirkin" Message-ID: <20150701142749-mutt-send-email-mst@redhat.com> References: <1435653553-7728-1-git-send-email-kraxel@redhat.com> <1435653553-7728-8-git-send-email-kraxel@redhat.com> <20150701133437-mutt-send-email-mst@redhat.com> <1435753442.4160.35.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435753442.4160.35.camel@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 07/22] virtio: find version 1.0 virtio capabilities List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: seabios@seabios.org, qemu-devel@nongnu.org On Wed, Jul 01, 2015 at 02:24:02PM +0200, Gerd Hoffmann wrote: > Hi, > > > Hmm this seems to violate this rule in the spec: > > > > > > The driver SHOULD use the first instance of each virtio structure type > > they can support. > > > > "can support" here means that bios was able to allocate > > it during enumeration. > > > > For example there could be both IO and memory, in this order > > you need to check that IO/memory got enabled (in theory, > > also that they are within parent bridge's windows - used > > by some guests, but > > seabios doesn't disable memmory/io in this strange way). > > Yes, seabios always allocates both mem and io. What if it can't? E.g. too many devices. > So this incremental fix ... > > @@ -234,7 +234,7 @@ void vp_init_simple(struct vp_device *vp, struct > pci_device *pci) > vp_cap = NULL; > break; > } > - if (vp_cap) { > + if (vp_cap && !vp_cap->cap) { > vp_cap->cap = cap; > vp_cap->bar = pci_config_readb(pci->bdf, cap + > offsetof(struct > virtio_pci_cap, bar)); > > ... makes seabios use the first not the last and should do the trick, > right? > > cheers, > Gerd >