[SeaBIOS] [PATCH v2 07/22] virtio: find version 1.0 virtio capabilities

Michael S. Tsirkin mst at redhat.com
Wed Jul 1 14:28:08 CEST 2015


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
> 



More information about the SeaBIOS mailing list