Re: [PATCH v3 1/3] PCI: Make specifying PCI devices in kernel parameters reusable
From: Logan Gunthorpe
Date: Mon Jun 18 2018 - 17:50:13 EST
On 6/18/2018 3:44 PM, Alex Williamson wrote:
>> + *
>> + * The second format matches devices using IDs in the configuration
>> + * space which may match multiple devices in the system. A value of 0
>> + * for any field will match all devices.
>
> I realize this is not a change in behavior, but since we're spelling it
> out in a proper comment rather than burying it in the implementation,
> using 0 as a wildcard is rather questionable behavior. It always
> surprises me when I read this because pci_match_one_device() uses
> PCI_ANY_ID (~0) as a wildcard and as a result of struct pci_device_id
> using __u32 for these fields, we actually need to specify ffffffff on
> the commandline to get a wildcard match for dynamic ids. The latter is
> tedious to use, but I think it's more correct, and the use of a __u32 is
> probably attributed to the fact that 0xffff is only reserved for vendor
> ID, the spec doesn't seem to reserve any entries from the vendor's
> device ID range.
>
> There's probably really no path to resolve these, but acknowledging the
> difference in this comment block might be helpful in the future.
Ok, I'll add a note in the comment.
>> + ret = pci_dev_str_match(dev, p, &p);
>> + if (ret == 1) {
>> + *resize = true;
>> + if (align_order == -1)
>> + align = PAGE_SIZE;
>> + else
>> + align = 1 << align_order;
>> + break;
>> + } else if (ret < 0) {
>> + pr_info("PCI: Can't parse resource_alignment parameter: pci:%s\n",
>
>
> The "pci:" prefix on %s doesn't make sense now, it was used above when
> the pointer was already advanced past this token, now I believe it would
> lead to "pci:pci:xxxx:yyyy" or "pci:xx:yy.z". Thanks,
Yup, nice catch. I'll fix it for v4.
Logan