On 2025-09-03 16:30, Vivek Kasireddy wrote:
> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
> index da5657a02007..9484991c4765 100644
> --- a/drivers/pci/p2pdma.c
> +++ b/drivers/pci/p2pdma.c
> @@ -544,6 +544,18 @@ static unsigned long map_types_idx(struct pci_dev 
> *client)
>       return (pci_domain_nr(client->bus) << 16) | pci_dev_id(client);
>  }
>  
> +static bool pci_devfns_support_p2pdma(struct pci_dev *provider,
> +                                   struct pci_dev *client)
> +{
> +     if (provider->vendor == PCI_VENDOR_ID_INTEL) {
> +             if ((pci_is_vga(provider) && pci_is_vga(client)) ||
> +                 (pci_is_display(provider) && pci_is_display(client)))
> +                     return pci_physfn(provider) == pci_physfn(client);
> +     }

Do we not also need to check that the client has a vendor of
PCI_VENDOR_ID_INTEL?

> @@ -705,7 +717,9 @@ int pci_p2pdma_distance_many(struct pci_dev *provider, 
> struct device **clients,
>               return -1;
>  
>       for (i = 0; i < num_clients; i++) {
> -             pci_client = find_parent_pci_dev(clients[i]);
> +             pci_client = dev_is_pf(clients[i]) ?
> +                             pci_dev_get(to_pci_dev(clients[i])) :
> +                             find_parent_pci_dev(clients[i]);

I don't understand this hunk. Why would this need special handling if
dev_is_pf()?. find_parent_pci_dev() looks like it will do the same thing
just look at the parents if it is not a PCI devices.

Logan

Reply via email to