mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Prica, Nikola" <nikola.prica@amd.com>
To: "Christian König" <christian.koenig@amd.com>,
	"Gerd Bayer" <gbayer@linux.ibm.com>,
	"Nikola Prica" <nikprica@amd.com>,
	bhelgaas@google.com, "Niklas Schnelle" <schnelle@linux.ibm.com>,
	"Alexander Schmidt" <alexs@linux.ibm.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	jerry.jiang@amd.com, haijun.chang@amd.com, andy.zhang@amd.com,
	jim.chow@broadcom.com, matthew.mcclure@broadcom.com
Subject: Re: [PATCH v2] PCI: Accept AtomicOps already enabled by the hypervisor
Date: Fri, 18 Sep 2026 11:07:33 +0200	[thread overview]
Message-ID: <97aa96e8-b553-47a2-aeea-e5d830ab0184@amd.com> (raw)
In-Reply-To: <2631bfe3-7123-4f44-b34e-8fd697c7dd2e@amd.com>

Hi Christian, Gerd,

Yes, this fixes a recent regression that we recognized with 6.8.0-135-generic kernel release. And it is the commit that Gerd referenced. I'll add Fixes tag.

Thanks for your attention and help!

Regards,
Nikola

On 9/14/2026 3:54 PM, Christian König wrote:
> On 9/14/26 15:41, Gerd Bayer wrote:
>>
>> On Mon, 2026-09-07 at 18:17 +0200, Nikola Prica wrote:
>>> From: Nikola Prica <nikola.prica@amd.com>
>>>
>>> pci_enable_atomic_ops_to_root() currently fails when no root port is
>>> visible. That is common in passthrough guests (ESXi, Hyper-V): the
>>> endpoint is assigned to the VM, but the guest topology has no root
>>> port above it.
>>>
>>> In those setups the hypervisor may already have enabled AtomicOp
>>> requester enable on the device. If PCI_EXP_DEVCTL2_ATOMIC_REQ is set,
>>> treat AtomicOps as already enabled and return success instead of
>>> failing the Root Port walk.
>>
>> Hi Nikola,
>>
>> your patch got me interested, since it touches those parts of
>> pci_enable_atomic_ops_to_root() that commit 1ae8c4ce1570 ("PCI: Enable
>> AtomicOps only if Root Port supports them") has modified.
>>
>> I like your solution for putting the hypervisor in control of the
>> enablement of Atomic Ops on root-less PCI functions and did test your
>> change on s390/Connect-X, successfully.
>>
>>> Signed-off-by: Nikola Prica <nikola.prica@amd.com>
>>
>> If that commit of mine regressed your use-cases, you might even want to
>> add a Fixes: tag?
> 
> Oh, that's an interesting point. I wasn't aware that the root complex check was added so recently.
> 
> So indeed question @Nikola did that worked out of the box before kernel 7.1? If yes then that would be a regression.
> 
> Regards,
> Christian.
> 
>>
>>> ---
>>> Changes in v2:
>>> - Be more strict and only apply logic in headless device case.
>>>
>>>   drivers/pci/pci.c | 12 +++++++++++-
>>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>>> index b2879a6be5f8..62729ade496f 100644
>>> --- a/drivers/pci/pci.c
>>> +++ b/drivers/pci/pci.c
>>> @@ -3769,8 +3769,18 @@ int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask)
>>>        }
>>>
>>>        root = pcie_find_root_port(dev);
>>> -     if (!root)
>>> +     if (!root) {
>>> +             /*
>>> +              * A hypervisor may expose a headless topology with no
>>> +              * visible root port.  If it has already set AtomicOp
>>> +              * Requester Enable, there is nothing more to do.
>>> +              */
>>> +             pcie_capability_read_dword(dev, PCI_EXP_DEVCTL2, &ctl2);
>>> +             if (ctl2 & PCI_EXP_DEVCTL2_ATOMIC_REQ)
>>> +                     return 0;
>>> +
>>>                return -EINVAL;
>>> +     }
>>>
>>>        pcie_capability_read_dword(root, PCI_EXP_DEVCAP2, &cap);
>>>        if ((cap & cap_mask) != cap_mask)
>>
>> At any rate, feel free to add my
>>
>> Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com>
>> Tested-by: Gerd Bayer <gbayer@linux.ibm.com>
> 


  reply	other threads:[~2026-09-18  9:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260903121217.23F751F000E9@smtp.kernel.org>
2026-09-07 16:17 ` Nikola Prica
2026-09-08  8:47   ` Christian König
2026-09-11 14:09     ` Prica, Nikola
2026-09-14 13:41   ` Gerd Bayer
2026-09-14 13:54     ` Christian König
2026-09-18  9:07       ` Prica, Nikola [this message]
2026-09-18  9:28         ` [PATCH v3] " Nikola Prica
2026-09-18 12:07           ` Christian König

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=97aa96e8-b553-47a2-aeea-e5d830ab0184@amd.com \
    --to=nikola.prica@amd.com \
    --cc=alexs@linux.ibm.com \
    --cc=andy.zhang@amd.com \
    --cc=bhelgaas@google.com \
    --cc=christian.koenig@amd.com \
    --cc=gbayer@linux.ibm.com \
    --cc=haijun.chang@amd.com \
    --cc=jerry.jiang@amd.com \
    --cc=jim.chow@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew.mcclure@broadcom.com \
    --cc=nikprica@amd.com \
    --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

all inboxes | Powered by JetHome®