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

From: Logan Gunthorpe

Date: Tue Aug 04 2026 - 18:38:12 EST




On 2026-08-02 09:09, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@xxxxxxxxxx>
>
> 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 <leonro@xxxxxxxxxx>
> Assisted-by: Claude Opus 4.8 <noreply@xxxxxxxxxxxxx>

Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>