Skip to contentSkip to conversation

Extending kernel option pci=resource_alignment to be able to specify PCI device/vendor IDs

PATCH New Koehrer Mathias (ETAS/ESW5) 2 participants 3 messages Aug 8, 2016 – Aug 9, 2016 PCI

lore
Share & tools
lore
#0 lore raw

Hi Bjorn,

Quoted 1 line

On Tue, Jun 07, 2016 at 02:24:17PM +0000, Koehrer Mathias (ETAS/ESW5) wro=

te:

Quoted 4 lines
Quoted 4 lines

Some uio based PCI drivers (e.g. uio_cif) do not work if the assigned PCI memory resources are not page aligned.
By using the kernel option "pci=3Dresource_alignment" it is possible to force single PCI boards to use page alignment for their memory resource=

s.

Quoted 3 lines
Quoted 3 lines

However, this is fairly cumbersome if multiple of these boards are in use as the specification of the cards has to be done via PCI bus/slot/function number which might change e.g. by adding another boar=

d.

Quoted 1 line
Quoted 1 line

This patch extends the kernel option "pci=3Dresource_alignment" to allo=

w

Quoted 1 line
Quoted 1 line

to specify the relevant boards via PCI device/vendor (and subdevice/sub=

vendor)

Quoted 11 lines

ids.

Quoted 10 lines

The specification of the devices via device/vendor is indicated by a leading string "pci:" as argument to "pci=3Dresource_alignment". The format of the specification is
pci:<vendor>:<device>[:<subvendor>:<subdevice>]

---
 Documentation/kernel-parameters.txt |    2 +

drivers/pci/pci.c | 66 +++++++++++++++++++++++++--=

---------

Quoted 5 lines
Quoted 4 lines
 2 files changed, 49 insertions(+), 19 deletions(-)

Index: linux-4.7-rc1/Documentation/kernel-parameters.txt

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Quoted 8 lines

=3D=3D=3D=3D=3D=3D=3D

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes · line 3000

Quoted 6 lines
Documentation/kernel-parameters.txt +0 -0
@@ -2998,6 +2998,8 @@ bytes respectively. Such letter suffixes
 		resource_alignment=3D
 				Format:
 				[<order of

align>@][<domain>:]<bus>:<slot>.<func>[; ...]

Quoted 4 lines

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes · line 3002

Quoted 2 lines
Documentation/kernel-parameters.txt +2 -0
+				[<order of align>@]pci:<vendor>:<device>\
+						[:<subvendor>:<subdevice>][; ...]

=20
Can you include a little example here so we know whether to use "pci:8086=

:1234" or

Quoted 3 lines

"pci:0x8086:0x1234"?
=20
Bjorn

I have provided an example and extended the docu (sent in http://marc.info=
/?l=3Dlinux-pci&m=3D146657769505684&w=3D2 and http://marc.info/?l=3Dlinux-p=
ci&m=3D146918412704107&w=3D2 ).
It would be great if you could comment on the modified patch...

Thanks=20

Best regards

Mathias

#1 lore raw
Quoted 42 lines · On Mon, Aug 08, 2016 at 07:39:01AM +0000, Koehrer Mathias (ETAS/ESW5) wrote:

Hi Bjorn,

Quoted 40 lines · On Tue, Jun 07, 2016 at 02:24:17PM +0000, Koehrer Mathias (ETAS/ESW5) wrote:
Quoted 9 lines

Some uio based PCI drivers (e.g. uio_cif) do not work if the assigned PCI memory resources are not page aligned.
By using the kernel option "pci=resource_alignment" it is possible to force single PCI boards to use page alignment for their memory resources. However, this is fairly cumbersome if multiple of these boards are in use as the specification of the cards has to be done via PCI bus/slot/function number which might change e.g. by adding another board. This patch extends the kernel option "pci=resource_alignment" to allow to specify the relevant boards via PCI device/vendor (and subdevice/subvendor)

ids.

Quoted 5 lines

The specification of the devices via device/vendor is indicated by a leading string "pci:" as argument to "pci=resource_alignment". The format of the specification is
pci:<vendor>:<device>[:<subvendor>:<subdevice>]

Quoted 9 lines
---
 Documentation/kernel-parameters.txt |    2 +
 drivers/pci/pci.c                   |   66 +++++++++++++++++++++++++-----------
 2 files changed, 49 insertions(+), 19 deletions(-)

Index: linux-4.7-rc1/Documentation/kernel-parameters.txt

============================================================
=======

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes · line 3000

Quoted 6 lines
Documentation/kernel-parameters.txt +0 -0
@@ -2998,6 +2998,8 @@ bytes respectively. Such letter suffixes
 		resource_alignment=
 				Format:
 				[<order of

align>@][<domain>:]<bus>:<slot>.<func>[; ...]

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes · line 3002

Quoted 2 lines
Documentation/kernel-parameters.txt +2 -0
+				[<order of align>@]pci:<vendor>:<device>\
+						[:<subvendor>:<subdevice>][; ...]

Can you include a little example here so we know whether to use "pci:8086:1234" or "pci:0x8086:0x1234"?

Quoted 4 lines
Quoted 1 line

Bjorn

I have provided an example and extended the docu (sent in http://marc.info/?l=linux-pci&m=146657769505684&w=2 and http://marc.info/?l=linux-pci&m=146918412704107&w=2 ). It would be great if you could comment on the modified patch...

It looks like I applied the patch, but I forgot to include the updated documentation. Can you confirm that? If you send a documentation patch to add the example, I can add that.

Bjorn

#2 lore raw

PATCH 1/1 Extending kernel option pci=resource_alignment to be able to specify PCI device/vendor IDs - Documentation

Extend the documentation for kernel option pci=resource_alignment

Some uio based PCI drivers (e.g. uio_cif) do not work if the assigned PCI memory resources are not page aligned.
By using the kernel option "pci=resource_alignment" it is possible to force single PCI boards to use page alignment for their memory resources. However, this is fairly cumbersome if multiple of these boards are in use as the specification of the cards has to be done via PCI bus/slot/function number which might change e.g. by adding another board.
This patch extends the kernel option "pci=resource_alignment" to allow to specify the relevant boards via PCI device/vendor (and subdevice/subvendor) ids. The specification of the devices via device/vendor is indicated by a leading string "pci:" as argument to "pci=resource_alignment".
The format of the specification is
pci:<vendor>:<device>[:<subvendor>:<subdevice>]

Examples:
pci=resource_alignment=4096@pci:1234:abcd:1234:bcde pci=resource_alignment=pci:1234:abcd

---
 pci/Documentation/kernel-parameters.txt |    3 +++
 1 file changed, 3 insertions(+)
pci/Documentation/kernel-parameters.txt +3 -0
Index: linux-pci-git/pci/Documentation/kernel-parameters.txt
===================================================================
@@ -3032,6 +3032,9 @@ bytes respectively. Such letter suffixes
 				PAGE_SIZE is used as alignment.
 				PCI-PCI bridge can be specified, if resource
 				windows need to be expanded.
+				To specify the alignment for certain types of devices, the
+				PCI vendor/device (and subvendor/subdevice) may be
+				specified. E.g. 4096@pci:1234:abcd:1234:bcde
 		ecrc=		Enable/disable PCIe ECRC (transaction layer
 				end-to-end CRC checking).
 				bios: Use BIOS/firmware settings. This is the