]> git.ipfire.org Git - thirdparty/linux.git/commit
PCI: endpoint: pci-epf-vntb: Guard configfs writes after EPC attach
authorKoichiro Den <den@valinux.co.jp>
Wed, 13 May 2026 02:49:16 +0000 (11:49 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 22 Jun 2026 20:31:11 +0000 (15:31 -0500)
commit6c39350aaa2d6338ec30ef0a5632b0d6dad856ec
tree2f58815e1828f127568351b84dae5f2d688e7113
parentf417c400a6683c62cdead42013f60872fda84013
PCI: endpoint: pci-epf-vntb: Guard configfs writes after EPC attach

db_count controls how many doorbell slots are allocated and exposed. It is
also used by the doorbell mask helpers. After an EPC has been attached,
changing it from configfs can leave runtime paths using a different count
than the one used to set up the doorbell resources.

Reject db_count writes after EPC attach, and reject values outside
MIN_DB_COUNT..MAX_DB_COUNT before attach. Now that MIN_DB_COUNT documents
the usable doorbell floor, use it in the store path too.

While at it, apply the same after-attach guard to the other vNTB configfs
knobs. BAR choices, spad_count, memory-window counts and sizes, and the
virtual PCI IDs are also consumed during bind, so changing them later at
runtime is meaningless and unsafe.

Return -EOPNOTSUPP for after-attach writes. The value itself may be valid,
but changing it in that state is not supported.

Signed-off-by: Koichiro Den <den@valinux.co.jp>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260513024923.451765-6-den@valinux.co.jp
drivers/pci/endpoint/functions/pci-epf-vntb.c