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

From: Leon Romanovsky

Date: Wed Aug 05 2026 - 05:07:01 EST


On Tue, Aug 04, 2026 at 04:07:27PM -0600, Logan Gunthorpe wrote:
>
>
> On 2026-08-02 09:09, Leon Romanovsky wrote:
>
> > static enum pci_acs_p2pdma_state
> > pci_acs_p2pdma_state(struct pci_dev *pdev, struct pci_dev *target)
> > {
> > - int pos, ret;
> > + int egress = 0;
> > u16 ctrl;
> >
> > - pos = pdev->acs_cap;
> > - if (!pos)
> > + if (!pdev->acs_cap)
> > return PCI_ACS_P2PDMA_DIRECT;
>
> I don't necessarily disagree with the change, but removing pos in this
> patch seems unnecessary and makes the patch more difficult to review
> than it needed to be.

I usually combine small cleanups, but I'll restore pos here in
the next version if I repost this patch.

>
> > @@ -1046,6 +1047,22 @@ resource_size_t pci_min_window_alignment(struct pci_bus *bus,
> > void pci_acs_init(struct pci_dev *dev);
> > void pci_enable_acs(struct pci_dev *dev);
> > int pci_acs_egress_ctrl_set(struct pci_dev *pdev, struct pci_dev *target);
> > +
> > +/*
> > + * Peer-to-peer routing decision for an ACS-capable ingress port, per
> > + * PCIe r7.0, sec 6.12.3, table 6-11.
> > + */
> > +enum pci_acs_p2pdma_state {
> > + PCI_ACS_P2PDMA_DIRECT, /* peer-to-peer permitted directly */
> > + PCI_ACS_P2PDMA_REDIRECT, /* redirected upstream to host bridge */
> > + PCI_ACS_P2PDMA_NOT_SUPPORTED, /* no usable peer-to-peer route */
> > +};
> > +
> > +#if IS_ENABLED(CONFIG_KUNIT)
> > +bool pci_acs_egress_port_valid(u16 acs_caps, u8 target_port);
> > +enum pci_acs_p2pdma_state pci_acs_p2pdma_decision(u16 ctrl, bool has_target,
> > + int egress);
> > +#endif
>
> One minor weird whitespace issue here. Probably the empty line should
> come after #endif
>
>
> But both of these are very minor points, so:
>
> Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>

Thanks

>
>
>