How to write to a PCIe config space during kernel boot up

Greg KH greg at
Wed Apr 13 03:34:02 EDT 2022

On Wed, Apr 13, 2022 at 07:01:01AM +0000, Khalid F. Sabzwari wrote:
>  Thanks Ozgur for quick reply.The link you shared below seems to work with MDIO interface.The PHY used on my board is Intel's i211 PHY which is controlled by PCIe interface.I found this link:
> I never wrote a kernel code before, and am trying to just hack for an experiment to write to config space of this PHY. so I will give it a try to see if i can read/write to i211's config space, during early kernel boot time, using pci_(read|write)_config_(byte|word|dword)

Do so in the driver that binds to the device, before it initializes it.
Not in the kernel core, otherwise in the kernel core you do not have
access to the needed pci structures.


greg k-h

More information about the Kernelnewbies mailing list