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

Logan Gunthorpe <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.linux-doc,org.kernel.vger.linux-pci
Message-ID <[email protected]>

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.

> @@ -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 <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.