From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 585D7422E34; Sun, 20 Sep 2026 11:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789904533; cv=none; b=PN+4UtA02P41G1eAh0WnQv4MLnfGlXzw1pPNM+rbdvJAq5zLd7RZafuTtP5nG22L6xLZYpcxLTt78FIY5jA9x0bZKdRKJ9rSowdYx27vLewW2+RPWLsTCeydEkpKbf89vqGC5yfUrh48mI2anMarWz3FdiX8bl6oWv2lLKf90ko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789904533; c=relaxed/simple; bh=3CbO+X138z9WBErboej9RFc9J/ikiZ8eNlVagy2nQbI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=vFHVPE92qSubywmULTv4X+gW6+PlmnVuHdyhvV1FqrHjQbodZkpPPyvckUcara0FPkjbHOj8u4kTq4KsxdBKWnxnbAN0WCJT11AsyFkOSm1VEbMwO8CcIv9MaFpHYJ1JtQl1fw03CMWG2WBK7TjgK3y2ECVrix/gftDapY+YrDc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AIckF1HI; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AIckF1HI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B37371F000FF; Sun, 20 Sep 2026 11:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789904531; bh=SuncNYeOTYCFrmur6x8EWT3Z+JU509LogGMtfMK+Q7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AIckF1HIQkb6qFGr7RTuYXXmhMjF9JAufH0GFDLcnYLngeqx9h+a3F2NIAkVi/wAq f14siGd3D40SaMdtNW75kStQnzDQIvUIgPWBTz+1RTOzyXmaxZuTSY1Vz0/gAnSCeR xD51JrVmCr64UySw47WcK4yY9BtfxHzmqcPcaO5ETi9oa3tuJopz5A6EI1ySrBcKml ABcGbSqNNiU5HfT3/HS3+KlVu88PQgAEs9AwGSOE7ogIdx3QMUjTD4MxxClw2N9tYB 1cZUEoD7Ur8ai0hrXCwhTVTO0/wmHrh77Ksjcm2T+vWN+EETB6DIcIaCM8a+ngkdl9 fHTHSF2JrpKbg== From: Leon Romanovsky To: Bjorn Helgaas , Logan Gunthorpe , Chaitanya Kulkarni , Greg Kroah-Hartman , Jens Axboe , Alex Williamson , Leon Romanovsky , Ankit Agrawal , Jason Gunthorpe , Jonathan Corbet , Shuah Khan , "Joerg Roedel (AMD)" , Will Deacon , Robin Murphy , Randy Dunlap , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, iommu@lists.linux.dev, Tushar Dave , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-rdma@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH v7 08/19] PCI/P2PDMA: Route Relaxed Ordering Completions directly Date: Sun, 20 Sep 2026 14:41:20 +0300 Message-ID: <20260920-fix-p2p-acs-v4-0-v7-8-ca0828ab697c@nvidia.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260920-fix-p2p-acs-v4-0-v7-0-ca0828ab697c@nvidia.com> References: <20260920-fix-p2p-acs-v4-0-v7-0-ca0828ab697c@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev-18f8f Content-Transfer-Encoding: 8bit From: Leon Romanovsky ACS P2P Completion Redirect leaves Completions carrying the Relaxed Ordering attribute alone. PCIe r7.0 sec 6.12.1.1 redirects only those "that do not have the Relaxed Ordering Attribute bit set", and sec 7.7.12.5 describes the enable bit as "applicable only to Completions whose Relaxed Ordering Attribute is clear". P2PDMA reports one answer for every kind of TLP, so a client whose provider returns such Completions is sent through the host bridge for a redirect that never happens to it. Add enum pci_p2pdma_tlp_flags and let a caller state that property. Reviewed-by: Logan Gunthorpe Tested-by: Tushar Dave Signed-off-by: Leon Romanovsky --- drivers/pci/p2pdma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 7e067e1331fa..3e5262a5265a 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -517,11 +517,15 @@ pci_acs_p2pdma_request(u16 ctrl, unsigned int tlp_flags) /* * Decide how a peer-to-peer Completion at an ACS-capable ingress port routes. * PCIe r7.0 sec 6.12.1.1: no ACS control other than P2P Completion Redirect - * affects a Completion. + * affects a Completion, and that one leaves Completions carrying the Relaxed + * Ordering attribute alone. */ static enum pci_acs_p2pdma_state pci_acs_p2pdma_completion(u16 ctrl, unsigned int tlp_flags) { + if (tlp_flags & PCI_P2PDMA_TLP_RELAXED_CPL) + return PCI_ACS_P2PDMA_DIRECT; + return ctrl & PCI_ACS_CR ? PCI_ACS_P2PDMA_REDIRECT : PCI_ACS_P2PDMA_DIRECT; } -- 2.55.0