On Fri, Oct 01, 2021 at 01:11:19PM +0100, Daniel P. Berrangé wrote:
> On Mon, Sep 27, 2021 at 10:30:51PM +0300, Dmitrii Shcherbakov wrote:
> > * XML serialization and deserialization of PCI VPD resources;
> > * PCI VPD capability flags added and used in relevant places;
> > * XML to XML tests for the added capability.
> > 
> > Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherba...@canonical.com>
> 
> 
> > diff --git a/tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml 
> > b/tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml
> > new file mode 100644
> > index 0000000000..831b6feb24
> > --- /dev/null
> > +++ b/tests/nodedevschemadata/pci_0000_42_00_0_vpd.xml
> > @@ -0,0 +1,33 @@
> > +<device>
> > +  <name>pci_0000_42_00_0</name>
> > +  <capability type='pci'>
> > +    <class>0x020000</class>
> > +    <domain>0</domain>
> > +    <bus>66</bus>
> > +    <slot>0</slot>
> > +    <function>0</function>
> > +    <product id='0xa2d6'>MT42822 BlueField-2 integrated ConnectX-6 Dx 
> > network controller</product>
> > +    <vendor id='0x15b3'>Mellanox Technologies</vendor>
> > +    <capability type='virt_functions' maxCount='16'/>
> > +    <capability type='vpd'>
> > +      <resource type='string'>BlueField-2 DPU 25GbE Dual-Port SFP56, 
> > Crypto Enabled, 16GB on-board DDR, 1GbE OOB management, Tall 
> > Bracket</resource>
> > +      <resource type='vpd-r'>
> > +        <field keyword='EC'>B1</field>
> > +        <field keyword='PN'>MBF2H332A-AEEOT</field>
> > +        <field keyword='SN'>MT2113X00000</field>
> > +        <field keyword='V0'>PCIeGen4 x8</field>
> > +        <field keyword='V2'>MBF2H332A-AEEOT</field>
> > +        <field keyword='V3'>3c53d07eec484d8aab34dabd24fe575aa</field>
> > +        <field 
> > keyword='VA'>MLX:MN=MLNX:CSKU=V2:UUID=V3:PCI=V0:MODL=BF2H332A</field>
> 
> I've got a general comment about what do any of these 2-letter
> keywords actually mean. I presume they are explaned in the
> PCI spec, but AFAICT the spec is not publically available for
> free.
> 
> So at the very least we need to document each one's meaning
> in libvirt docs IMHO.
> 
> If I had insight into what they meant, then I might also
> suggest giving them meaningful names in libvirt. These two
> level codes are presumably chosen for reasons of space
> efficiency at the low level. This is not a constraint
> we especially care about in libvirt, where ease of
> understanding is usually more important.

Ok, I found a copy of the PCI spec

I see the data is classified at 2 levels, with the first
level being:

String Tag: This tag is the first item in the VPD storage
            component.  It contains the name of the add-in card
            in alphanumeric characters.

VPD-R Tag: This tag contains the read only VPD keywords for an
           add-in card.

VPD-W Tag: This tag contains the read/write VPD keywords for
           an add-in card


Then for VPD-R, the next level

   PN: Add-in Card Part Number
   EC: Engineering change level of the card
   FG: Fabric Geography
   LC: Location
   MN: Manufacture ID
   PG: PCI Geography
   SN: Serial number
   Vx: Vendor string (Repeated many times for 'x' in range 0-9, A-Z)
   CP: Extended capability
   RV: Checksum + reserved space

I don't see a need to report the "CP" and "RV" tags in the XML.


Then for VPD-W,the next level

   Vx: Vendor string (Repeated many times for 'x' in range 0-9, A-Z)
   Sx: System string (Repeated many times for 'x' in range 0-9, B-Z)
   YA: Asset tag

With all this in mind, I think we a better to represent
these all as meaingfully named elements

  <capability type="vpd">
    <name>BlueField-2 DPU 25GbE Dual-Port SFP56, Crypto Enabled, 16GB on-board 
DDR, 1GbE OOB management, Tall Bracket</name>
    <tags access="readonly">
       <change_level>B1</change_level>
       <part_number>MBF2H332A-AEEOT</part_number>
       <serial_number>MT2113X00000</serial_number>
       <vendor_string index="0">PCIeGen4 x8</vendor_string>
       <vendor_string index="2">MBF2H332A-AEEOT</vendor_string>
       <vendor_string 
index="3">3c53d07eec484d8aab34dabd24fe575aa</vendor_string>
    </tags>
    <tags access="readwrite">
       ...
    </tags>
  </capability>


> > +    <capability type='vpd'>
> > +      <resource type='string'>BlueField-2 DPU 25GbE Dual-Port SFP56, 
> > Crypto Enabled, 16GB on-board DDR, 1GbE OOB management, Tall 
> > Bracket</resource>
> > +      <resource type='vpd-r'>
> > +        <field keyword='EC'>B1</field>
> > +        <field keyword='PN'>MBF2H332A-AEEOT</field>
> > +        <field keyword='SN'>MT2113X00000</field>
> > +        <field keyword='V0'>PCIeGen4 x8</field>
> > +        <field keyword='V2'>MBF2H332A-AEEOT</field>
> > +        <field keyword='V3'>3c53d07eec484d8aab34dabd24fe575aa</field>


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