qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] hw/smbios: retrieve PCI address from specified device


From: Daniel P . Berrangé
Subject: Re: [PATCH v2 2/2] hw/smbios: retrieve PCI address from specified device for Type 41
Date: Thu, 1 Apr 2021 11:19:09 +0100
User-agent: Mutt/2.0.5 (2021-01-21)

On Thu, Apr 01, 2021 at 12:07:30PM +0200, Vincent Bernat wrote:
>  ❦  1 avril 2021 10:38 +01, Daniel P. Berrangé:
> 
> >>  hw/smbios/smbios.c | 47 +++++++++++++++++++++-------------------------
> >>  qemu-options.hx    |  2 +-
> >>  2 files changed, 22 insertions(+), 27 deletions(-)
> >
> > It doesn't really make sense to have this as a separate patch
> > when it is deleting half the code you added in the previous
> > patch. Just merge them together as one.
> 
> I'll do that.
> 
> >> +                /*
> >> +                 * TODO: Extract the appropriate value. Most of the
> >> +                 * time, this will be 0.
> >> +                 */
> >> +                t->segment_group_number = cpu_to_le16(0);
> >
> > Hmm, tricky, as it requires interpreting the PCI topology. Wonder if
> > there's any helper that can do the hard work for you
> 
> There is pci_root_bus_path(), but it returns a string which could just
> contain a segment or several segments. It seems the SMBIOS standard
> didn't account for complex topologies. I could parse the string. and
> keep only the right-most segment.
> 
> >> +                t->bus_number = pci_dev_bus_num(pdev);
> >> +                t->device_number = pdev->devfn;
> >> +            } else {
> >> +                fprintf(stderr, "%s: cannot find PCI device %s\n",
> >> +                        __func__, t41->pcidev);
> >
> > This isn't terminating execution which looks like a bug.
> 
> It was my intention. The PCI address will then be 00:00:00.0. If you
> think it's better to terminate, I can do what you suggest.

If we can't find the PCI device, that's user configuration error, and
we prefer to report those & exit, rather than continuing with likely
bogus data.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]