Re: [PATCH] PCI: endpoint: pci-epf-test: Roll back BAR mapping when subrange setup fails

From: Christian Bruel

Date: Wed Mar 18 2026 - 04:41:19 EST





I think "modify TEST_F to SKIP if ENOSPC",
since it will solve the problem for all platforms that have few inbound iATUs.

That sounds like the right direction, though I think we would first need a way
to propagate -ENOSPC back to the host side, instead of just collapsing all
EP-side setup failures into STATUS_BAR_SUBRANGE_SETUP_FAIL, which
pci_endpoint_test currently maps to -EIO.


I think the epf test function can return several bits in the status mask, in addition of STATUS_BAR_SUBRANGE_SETUP_FAIL. e.g STATUS_BAR_SUBRANGE_SETUP_SKIP, or STATUS_BAR_SUBRANGE_SETUP_NOSPC.
I prefer the former since we want to pass the cause, not the action and let the skip decision to the host


Rethinking this, having a pci_epc_feature to limit the maximum number of simultaneously allocatable BARs might be a useful addition to the EPC driver. The epc driver would need to keep track of the allocated BARs and check it before calling set_bar() for skipping or not.

Do you think this added (minor) complexity is worth it compared to simply returning ENOSPC in the status?

thank you,

Christian