Re: [PATCH] Extending kernel option pci=resource_alignment to be able to specify PCI device/vendor IDs

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

 



Hi Bjorn,

can you please comment on that?
> > > Signed-off-by: Mathias Koehrer <mathias.koehrer@xxxxxxxx>
> > >
> > > ---
> > >  Documentation/kernel-parameters.txt |    2 +
> > >  drivers/pci/pci.c                   |   66 +++++++++++++++++++++++++-----------
> > >  2 files changed, 49 insertions(+), 19 deletions(-)
> >
> > This looks better, but wow, messy.  I'll defer to the PCI maintainer
> > and developers now, this is in their camp, not mine :)
> It looks messy as I had to change the indentation of existing code...
> A "diff -u -w" on pci.c delivers a much simpler diff:
> 
> --- pci.c.orig	2016-05-29 16:29:24.000000000 +0000
> +++ pci.c	2016-06-08 06:08:05.000000000 +0000
> @@ -4755,6 +4755,7 @@
>  static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev)
> {
>  	int seg, bus, slot, func, align_order, count;
> +	unsigned short vendor, device, subsystem_vendor, subsystem_device;
>  	resource_size_t align = 0;
>  	char *p;
> 
> @@ -4768,6 +4769,32 @@
>  		} else {
>  			align_order = -1;
>  		}
> +		if (strncmp(p, "pci:", 4) == 0) {
> +			/* PCI vendor/device (subvendor/subdevice) ids are
> specified */
> +			p += 4;
> +			if (sscanf(p, "%hx:%hx:%hx:%hx%n",
> +				&vendor, &device, &subsystem_vendor,
> &subsystem_device, &count) != 4) {
> +				if (sscanf(p, "%hx:%hx%n", &vendor, &device,
> &count) != 2) {
> +					printk(KERN_ERR "PCI: Can't parse
> resource_alignment parameter: pci:%s\n",
> +						p);
> +					break;
> +				}
> +				subsystem_vendor = subsystem_device = 0;
> +			}
> +			p += count;
> +			if ((!vendor || (vendor == dev->vendor)) &&
> +				(!device || (device == dev->device)) &&
> +				(!subsystem_vendor || (subsystem_vendor ==
> dev->subsystem_vendor)) &&
> +				(!subsystem_device || (subsystem_device ==
> dev->subsystem_device))) {
> +				if (align_order == -1)
> +					align = PAGE_SIZE;
> +				else
> +					align = 1 << align_order;
> +				/* Found */
> +				break;
> +			}
> +		}
> +		else {
>  		if (sscanf(p, "%x:%x:%x.%x%n",
>  			&seg, &bus, &slot, &func, &count) != 4) {
>  			seg = 0;
> @@ -4791,6 +4818,7 @@
>  			/* Found */
>  			break;
>  		}
> +		}
>  		if (*p != ';' && *p != ',') {
>  			/* End of param or invalid format */
>  			break;
> 
> 
Thanks
Mathias
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux