Messages in this thread |  | | Date | Thu, 4 Dec 2025 23:28:40 -0600 | | Subject | Re: [PROBLEM] c5.metal on AWS fails to kexec after "PCI: Explicitly put devices into D0 when initializing" | | From | Mario Limonciello <> |
| |
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
|  |