From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6ABCECDD0F4 for ; Tue, 22 Oct 2024 21:15:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 877BD10E1B8; Tue, 22 Oct 2024 21:15:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=deltatee.com header.i=@deltatee.com header.b="Lyf9eK+Y"; dkim-atps=neutral Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by gabe.freedesktop.org (Postfix) with ESMTPS id 96A6410E0F6; Tue, 22 Oct 2024 21:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:From:References:Cc:To: MIME-Version:Date:Message-ID:content-disposition; bh=TgerkKHU+W70hpEqn7HGkgopsgSDErck10sEePVgCrE=; b=Lyf9eK+YAptXwpU2UBsLWPfxIS OomHFA+kiegXoBLOLFcQAoinNu3dT3+zXqs6YATgrGGTnCz+V6IWBv5mDp6VvVBtxBlPOofGeqKjY UTJPvq1N83wdXkMBTkYBxQGDykN7USFbP1cuOfDsOFYoL7tf4KvLjV1fPCT9LVQGyZYZXnTzj7Pg4 m6j46hyNl+Vtea6WmJ7pmaQgbwrzEbBtksswquyMxvdebtWZOK6meZI3mTR5mwW2zHSDtqhnCfX1K 9SM4g7cn7zuhC0D2uaMiokjpmLylY/HjVptH1lJImVLv+LzkW8tY1ryXBfmevNV3O7nBiN0HMmPNK G9yUPYkQ==; Received: from d104-157-31-28.abhsia.telus.net ([104.157.31.28] helo=[192.168.1.250]) by ale.deltatee.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1t3MDc-00FYLI-18; Tue, 22 Oct 2024 15:15:09 -0600 Message-ID: <26d7baf8-cfdc-4118-b423-5935128cc47f@deltatee.com> Date: Tue, 22 Oct 2024 15:15:05 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Bjorn Helgaas , Vivek Kasireddy Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org, Bjorn Helgaas , linux-pci@vger.kernel.org References: <20241022151616.GA879071@bhelgaas> Content-Language: en-CA From: Logan Gunthorpe In-Reply-To: <20241022151616.GA879071@bhelgaas> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 104.157.31.28 X-SA-Exim-Rcpt-To: helgaas@kernel.org, vivek.kasireddy@intel.com, dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org, bhelgaas@google.com, linux-pci@vger.kernel.org X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v2 1/5] PCI/P2PDMA: Don't enforce ACS check for functions of same device X-SA-Exim-Version: 4.2.1 (built Wed, 06 Jul 2022 17:57:39 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On 2024-10-22 09:16, Bjorn Helgaas wrote: > On Sun, Oct 20, 2024 at 10:21:29PM -0700, Vivek Kasireddy wrote: >> Functions of the same PCI device (such as a PF and a VF) share the >> same bus and have a common root port and typically, the PF provisions >> resources for the VF. Therefore, they can be considered compatible >> as far as P2P access is considered. >> >> Currently, although the distance (2) is correctly calculated for >> functions of the same device, an ACS check failure prevents P2P DMA >> access between them. Therefore, introduce a small function named >> pci_devs_are_p2pdma_compatible() to determine if the provider and >> client belong to the same device and facilitate P2P DMA between >> them by not enforcing the ACS check. >> >> v2: >> - Relax the enforcment of ACS check only for Intel GPU functions >> as they are P2PDMA compatible given the way the PF provisions >> the resources among multiple VFs. > > I don't want version history in the commit log. If the content is > useful, just incorporate it here directly (without the version info), > and put the version-to-version changelog below the "---". > >> Cc: Bjorn Helgaas >> Cc: Logan Gunthorpe >> Cc: >> Signed-off-by: Vivek Kasireddy >> --- >> drivers/pci/p2pdma.c | 17 +++++++++++++++-- >> 1 file changed, 15 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c >> index 4f47a13cb500..a230e661f939 100644 >> --- a/drivers/pci/p2pdma.c >> +++ b/drivers/pci/p2pdma.c >> @@ -535,6 +535,17 @@ static unsigned long map_types_idx(struct pci_dev *client) >> return (pci_domain_nr(client->bus) << 16) | pci_dev_id(client); >> } >> >> +static bool pci_devs_are_p2pdma_compatible(struct pci_dev *provider, >> + struct pci_dev *client) >> +{ >> + if (provider->vendor == PCI_VENDOR_ID_INTEL) { >> + if (pci_is_vga(provider) && pci_is_vga(client)) >> + return pci_physfn(provider) == pci_physfn(client); >> + } I'd echo many of Bjorn's concerns. In addition, I think the name of the pci_devs_are_p2pdma_compatible() isn't quite right. Specifically this is dealing with PCI functions within a single device that are known to allow P2P traffic. So I think the name should probably reflect that. Thanks, Logan