linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Bayer <gbayer@linux.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Jay Cornwall <Jay.Cornwall@amd.com>,
	Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>,
	Alexander Schmidt	 <alexs@linux.ibm.com>,
	netdev <netdev@vger.kernel.org>,
	linux-rdma	 <linux-rdma@vger.kernel.org>,
	linux-pci <linux-pci@vger.kernel.org>,
	Gerd Bayer	 <gbayer@linux.ibm.com>
Subject: Re: Q: Usage of pci_enable_atomic_ops_to_root()
Date: Mon, 03 Nov 2025 13:16:40 +0100	[thread overview]
Message-ID: <9c7c4217171fb56c505dc90b8c73b2ce079207a9.camel@linux.ibm.com> (raw)
In-Reply-To: <fbe34de16f5c0bf25a16f9819a57fdd81e5bb08c.camel@linux.ibm.com>

On Fri, 2025-10-24 at 19:18 +0200, Gerd Bayer wrote:
> Hi all,
> 
> I stumbled over mlx5's usage of pci_enable_atomic_ops_to_root() at
> 
> https://elixir.bootlin.com/linux/v6.18-rc2/source/drivers/net/ethernet/mellanox/mlx5/core/main.c#L937
> 
> and was wondering if its repeated calls with the 3 available sizes gave
> it the intended result.
> 
> I assume the intent was to enable requesting AtomicOps only if all
> three sizes 32/64/128-bit were supported at the root-complex. However,
> pci_enable_atomic_ops_to_root() would enable the request at the PCIe
> level, even if just 32-bit sized Ops was supported at the root-complex.

Looks like I might just send out an RFC patch for review by the
Mellanox/NVidia folks? Not sure if I can find a test-setup for this,
though...

> So I checked other users in the kernel and found an inconclusive
> picture:
> The AMD GPU that this was originally introduced for [0] checks for a
> combination of two sizes, while a few infiniband/ethernet and the vfio-
> pci driver do variations of sequential checks (potentially enabling
> requests that they don't want to)
> 
> Now the PCIe Spec Rev. 7.0 has also a mixed bag. Section 6.15.3.1
> mandates for Root Ports:
> 
> > If a Root Port implements any AtomicOp Completer capability for host
> > memory access, it must implement all 32-bit and 64-bit AtomicOp
> > Completer capabilities. Implementing 128-bit CAS Completer capability
> > is optional.
> 
> While this is specific, marking the CAS Op Completions in the 128-bit
> variant optional, the Capability bits just specify 128-bit AtomicOps
> (all AtomicOps: FetchAdd, Swap, CAS). Strictly interpreted, this would
> require root port implementors to announce all-or-nothing of 32/64/128-
> bit AtomicOps - which kind of makes the size-granularity of the
> capability bits useless - and leave the endpoint device (and its
> driver) attempting to use 128-bit CAS in the dark...

I guess I need to ask the folks at PCI SIG?

> [0]: https://lore.kernel.org/linux-pci/1515113100-4718-1-git-send-email-Felix.Kuehling@amd.com/
> 
> Can anybody shed some light on this?
> Thank you,
> Gerd


      reply	other threads:[~2025-11-03 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24 17:18 Q: Usage of pci_enable_atomic_ops_to_root() Gerd Bayer
2025-11-03 12:16 ` Gerd Bayer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c7c4217171fb56c505dc90b8c73b2ce079207a9.camel@linux.ibm.com \
    --to=gbayer@linux.ibm.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Jay.Cornwall@amd.com \
    --cc=alexs@linux.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=schnelle@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).