Re: [PATCH 12/13] PCI/P2PDMA: Add KUnit coverage for the ACS P2P routing walk

Logan Gunthorpe <[email protected]> Tue, 4 Aug 2026 16:37:36 -0600
Newsgroups gmane.linux.kernel.pci,gmane.linux.kernel,gmane.linux.documentation
Message-ID <[email protected]>

On 2026-08-02 09:09, Leon Romanovsky wrote:
> From: Leon Romanovsky <[email protected]>
> 
> Extend the ACS KUnit suite with end-to-end coverage of
> calc_map_type_and_dist(), the provider-to-client hierarchy walk.
> 
> A fabricated PCIe fabric (host bridge, Root Port, Switch Upstream Port,
> two Switch Downstream Ports and the provider/client endpoints) with a
> fake pci_ops backing the ACS Control, Egress Control Vector and LNKCAP
> reads lets the walk run without real hardware.  The tests assert:
> 
>   - BUS_ADDR when no port on the path enables ACS;
>   - THRU_HOST_BRIDGE when a Downstream Port's Egress Control Vector
>     routes the peer with Request Redirect clear (an ACS Violation) at the
>     path divergence, leaving only the host-bridge route;
>   - BUS_ADDR when Egress Control is enabled but the peer's vector bit is
>     clear;
>   - THRU_HOST_BRIDGE when Request Redirect redirects the request and the
>     host bridge is whitelisted.
> 
> calc_map_type_and_dist() is exposed under CONFIG_KUNIT via
> VISIBLE_IF_KUNIT.
> 
> Signed-off-by: Leon Romanovsky <[email protected]>
> Assisted-by: Claude Opus 4.8 <[email protected]>

Reviewed-by: Logan Gunthorpe <[email protected]>