Linux PCI subsystem development
 help / color / mirror / Atom feed
* REGRESSION with pcim_intx()
@ 2024-07-24  4:56 Damien Le Moal
  2024-07-24  5:13 ` Damien Le Moal
  0 siblings, 1 reply; 3+ messages in thread
From: Damien Le Moal @ 2024-07-24  4:56 UTC (permalink / raw)
  To: linux-pci@vger.kernel.org, Philipp Stanner,
	Krzysztof Wilczyński, Bjorn Helgaas


Commit 25216afc9db5 ("PCI: Add managed pcim_intx()") is causing a regression,
which is easy to see using qemu with an AHCI device and the ahci driver
compiled as a module.

1) Boot qemu: the AHCI controller is initialized and the drive(s) attached to
it visible.
2) Run "rmmod ahci": the drives go away, all normal
3) Re-initialize the AHCI adapter and rescan the drives by running "modprobe
ahci". That fails with the message "pci 0000:00:1f.2: Resources present before
probing"

The reason is that before commit 25216afc9db5, pci_intx(dev, 0) was called to
disable INTX as MSI are used for the adapter, and for that case, pci_intx()
would NOT allocate a device resource if the INTX enable/disable state was not
being changed:

	if (new != pci_command) {
		struct pci_devres *dr;

		pci_write_config_word(pdev, PCI_COMMAND, new);

		dr = find_pci_dr(pdev);
		if (dr && !dr->restore_intx) {
			dr->restore_intx = 1;
			dr->orig_intx = !enable;
		}
	}

The former code was only looking for the resource and not allocating it.

Now, with pcim_intx() being used, the intx resource is *always* allocated,
including when INTX is disabled when the device is being disabled on rmmod.
This leads to the device resource list to always have the intx resource
remaining and thus causes the modprobe error.

Reverting Commit 25216afc9db5 is one solution to fix this, and I can send a
patch for that, unless someone has an idea how to fix this ? I tried but I do
not see a clean way of fixing this...
Thoughts ?

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-25 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-24  4:56 REGRESSION with pcim_intx() Damien Le Moal
2024-07-24  5:13 ` Damien Le Moal
2024-07-25 10:25   ` Philipp Stanner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox