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: Vincent Bernat
Subject: Re: [PATCH v2 2/2] hw/smbios: retrieve PCI address from specified device for Type 41
Date: Thu, 01 Apr 2021 12:07:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

 ❦  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.
-- 
Replace repetitive expressions by calls to a common function.
            - The Elements of Programming Style (Kernighan & Plauger)



reply via email to

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