Re: [PATCH 10/13] PCI/P2PDMA: Extract pure ACS routing decision helpers

[email protected] Sun, 02 Aug 2026 15:55:52 +0000
Newsgroups org.kernel.vger.linux-pci
Message-ID <[email protected]>
> From: Leon Romanovsky <[email protected]>
> 
> The ACS Egress Control routing decision (PCIe r7.0, sec 6.12.3,
> table 6-11) and the Egress Control Vector Size rule were embedded in
> functions that also perform config-space I/O and walk the PCIe
> hierarchy.  That made the branch-heavy logic -- in particular the paths
> that require an Egress Control Vector, which are unreachable on most
> hardware -- difficult to exercise in isolation.
> 
> Factor the logic into two pure helpers:
> 
>   - pci_acs_p2pdma_decision() maps the ACS control word, whether the
>     target port is known, and the target's Egress Control Vector bit to
>     a routing state.
> 
>   - pci_acs_egress_port_valid() applies the "a vector size of 0 encodes
>     256 bits" rule to decide whether a target port is within the vector.
> 
> pci_acs_p2pdma_state() and pci_acs_egress_ctrl_set() now call these.  No
> functional change intended: pci_acs_egress_ctrl_set() still checks the
> port range before reading the vector DWORD.
> 
> The helpers are exposed under CONFIG_KUNIT via VISIBLE_IF_KUNIT so the
> following patch can unit-test them.
> 
> Signed-off-by: Leon Romanovsky <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=10