public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Matthew Ruffell <matthew.ruffell@canonical.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>,
	Jay Vosburgh <jay.vosburgh@canonical.com>
Subject: Re: [PROBLEM] c5.metal on AWS fails to kexec after "PCI: Explicitly put devices into D0 when initializing"
Date: Thu, 4 Dec 2025 23:28:40 -0600	[thread overview]
Message-ID: <2f0d1cc9-d93d-4d24-bb4a-edec89e7bbde@amd.com> (raw)
In-Reply-To: <CAKAwkKu4bePg_NJ9SORcvwgkKyrr7yhGVjFyDQR+d18MtrbyDA@mail.gmail.com>



On 12/4/2025 9:06 PM, Matthew Ruffell wrote:
> Hi Mario,
> 
> Again, thank you for your prompt response.
> 
>> That's at least what it seems like.  And I guess trying to set D0
>> without bus mastering enabling is causing a problem.
>>
>> Could you try adding a pci_set_master() call to pci_power_up()?  This is
>> what I have in mind (only compile tested):
>>
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index b14dd064006c..68661e333032 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -1323,6 +1323,7 @@ int pci_power_up(struct pci_dev *dev)
>>                   return -EIO;
>>           }
>>
>> +       pci_set_master(dev);
>>           pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
>>           if (PCI_POSSIBLE_ERROR(pmcsr)) {
>>                   pci_err(dev, "Unable to change power state from %s to
>> D0, device inaccessible\n",
> 
> I built a test kernel, using the very same git hash as yesterday,
> 51ab33fc0a8bef9454849371ef897a1241911b37
> with this pci_set_master(dev) applied, and yes, kexec succeeds and the
> system boots normally.
> 
> Would you do a global pci_set_master(dev) like this, or would you gate
> it behind a check to see if the system is being kexec'd?

Well - the problem is kexec_in_progress() is only set on the way down.
You don't get any indication that you're booting /through/ kexec.

Furthermore as you point out elsewhere in this thread a crash that jumps 
into a crash kernel kdump doesn't ever set kexec_in_progress on the way 
down.

So considering that I /think/ this points at an assumption failure 
during bootup about bus mastering.

Bjorn,

How do you feel about calling pci_set_master() in the startup train 
somewhere?  In addition to Matthew's testing, I tried on a few systems 
of mine and it seems to work fine with calling pci_set_master() at that 
above specific location.  I checked with that on top of 6.18:

* Regular Reboot
* Kexec Reboot
* Shutdown / power up

      parent reply	other threads:[~2025-12-05  5:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19  3:52 [PROBLEM] c5.metal on AWS fails to kexec after "PCI: Explicitly put devices into D0 when initializing" Matthew Ruffell
2025-09-19  5:02 ` Mario Limonciello
2025-12-04  5:04   ` Matthew Ruffell
2025-12-04  5:29     ` Mario Limonciello
2025-12-05  3:06       ` Matthew Ruffell
2025-12-05  3:10         ` Matthew Ruffell
2025-12-05  5:31           ` Mario Limonciello
2026-01-06  6:06             ` Mario Limonciello
2026-02-13  5:54               ` Matthew Ruffell
2026-02-13 19:26                 ` Bjorn Helgaas
2026-02-17 14:36                   ` Mario Limonciello
2026-02-23  6:04                     ` Mario Limonciello
2026-02-25  5:21                       ` Matthew Ruffell
2026-02-25  5:42                         ` Mario Limonciello
2025-12-05  5:28         ` Mario Limonciello [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=2f0d1cc9-d93d-4d24-bb4a-edec89e7bbde@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=bhelgaas@google.com \
    --cc=jay.vosburgh@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew.ruffell@canonical.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