On Thu, 22 Jun 2017 09:28:31 +0000
"Chang, Cunyin" <cunyin.ch...@intel.com> wrote:

> I think the series patches does not cover all area which need to adapt to u32 
> PCI domain,
> We still need some other work to do:
> we need define another macro such as PCI_PRI_FMT. Something like:
> #define PCI_XXX_PRI_FMT "%.5" PRIx32 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
> 
> PCI_PRI_STR_SIZE also need to be modified:
> #define PCI_PRI_STR_SIZE sizeof("XXXXX:XX:XX.X")
> 
> The macro PCI_PRI_FMT will not works if
> The domain exceed 16bits. It will impact the following functions:
> 1  RTE_LOG function, there a lots of RTE_LOG such as:
> RTE_LOG(WARNING, EAL,
>                       "Requested device " PCI_PRI_FMT " cannot be used\n",
>                       addr->domain, addr->bus, addr->devid, addr->function);
> 2  pci_dump_one_device().
> 3 rte_eal_pci_device_name()
> 4 pci_update_device()
> 5 pci_ioport_map()
> 6 pci_get_uio_dev()
> 7 pci_uio_map_resource_by_index()
> 8 pci_uio_ioport_map()
> 9 pci_vfio_map_resource()
> 10 pci_vfio_unmap_resource()
> All the above functions will related with the macro PCI_PRI_FMT, so I think 
> they need to be modified too.
> 
> There are some other code need modify:
> In function rte_eal_compare_pci_addr(), we need do the following work:
> dev_addr = ((uint64_t)addr->domain << 24) | ((uint64_t)addr->bus << 16) |
>                               ((uint64_t)addr->devid << 8) | 
> (uint64_t)addr->function;
> dev_addr2 = ((uint64_t)addr2->domain << 24) | ((uint64_t)addr2->bus << 16) |
>                               ((uint64_t)addr2->devid << 8) | 
> (uint64_t)addr2->function;
> 
> In function eal_parse_pci_BDF(), we need do the following work:
> GET_PCIADDR_FIELD(input, dev_addr->domain, UINT32_MAX, ':');

Good catch, the string size must be increased.

It turns out that you don't need to change the PCI print format. Printing the 
domain with %.4x
works correctly with 32 bit. It just gets wider. This is how pciutils works, so 
no change
is necessary there.

For normal 16 bit domain, the print will be:
        0000:05.00.0
and for these 32 bit values
        100000:05:00.0

Yes, the compare needs domain cast to 64 bit. The bus/devid/function don't need 
cast.

Reply via email to