linux-yocto/drivers/pci
Takashi Iwai d555ed45a5 PCI: Restore original INTX_DISABLE bit by pcim_intx()
pcim_intx() tries to restore the INTx bit at removal via devres, but there
is a chance that it restores a wrong value.

Because the value to be restored is blindly assumed to be the negative of
the enable argument, when a driver calls pcim_intx() unnecessarily for the
already enabled state, it'll restore to the disabled state in turn.  That
is, the function assumes the case like:

  // INTx == 1
  pcim_intx(pdev, 0); // old INTx value assumed to be 1 -> correct

but it might be like the following, too:

  // INTx == 0
  pcim_intx(pdev, 0); // old INTx value assumed to be 1 -> wrong

Also, when a driver calls pcim_intx() multiple times with different enable
argument values, the last one will win no matter what value it is.  This
can lead to inconsistency, e.g.

  // INTx == 1
  pcim_intx(pdev, 0); // OK
  ...
  pcim_intx(pdev, 1); // now old INTx wrongly assumed to be 0

This patch addresses those inconsistencies by saving the original INTx
state at the first pcim_intx() call.  For that, get_or_create_intx_devres()
is folded into pcim_intx() caller side; it allows us to simply check the
already allocated devres and record the original INTx along with the
devres_alloc() call.

Link: https://lore.kernel.org/r/20241031134300.10296-1-tiwai@suse.de
Fixes: 25216afc9d ("PCI: Add managed pcim_intx()")
Link: https://lore.kernel.org/87v7xk2ps5.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Philipp Stanner <pstanner@redhat.com>
Cc: stable@vger.kernel.org	# v6.11+
2025-01-27 12:55:12 -06:00
..
controller pci-v6.14-changes 2025-01-25 16:03:40 -08:00
endpoint Merge branch 'pci/endpoint-test' 2025-01-23 13:04:53 -06:00
hotplug PCI/ACPI: Constify 'struct bin_attribute' 2024-12-10 13:00:50 -06:00
msi PCI: Remove devres from pci_intx() 2025-01-18 14:38:49 -06:00
pcie pci-v6.14-changes 2025-01-25 16:03:40 -08:00
pwrctrl pci-v6.13-changes 2024-11-26 18:05:44 -08:00
switch PCI: switchtec: Add Microchip PCI100X device IDs 2025-01-21 10:47:28 -06:00
access.c PCI: Revert the cfg_access_lock lockdep mechanism 2024-06-04 12:10:05 -05:00
ats.c PCI: Store number of supported End-End TLP Prefixes 2025-01-14 17:47:39 -06:00
bus.c Merge branch 'pci/pwrctl' 2024-11-25 13:40:54 -06:00
devres.c PCI: Restore original INTX_DISABLE bit by pcim_intx() 2025-01-27 12:55:12 -06:00
doe.c PCI/DOE: Poll DOE Busy bit for up to 1 second in pci_doe_send_req() 2024-10-13 10:55:39 -05:00
ecam.c PCI: Use resource_set_{range,size}() helpers 2024-10-10 17:44:57 -05:00
host-bridge.c
iomap.c PCI: Fix typos 2024-09-19 14:24:00 -05:00
iov.c PCI: Batch BAR sizing operations 2025-01-23 11:05:20 -06:00
irq.c PCI: Place interrupt related code into irq.c 2024-01-29 17:01:31 -06:00
Kconfig Merge branch 'pci/tph' 2024-11-25 13:40:55 -06:00
Makefile Merge branch 'pci/tph' 2024-11-25 13:40:55 -06:00
mmap.c PCI/sysfs: Compile pci-sysfs.c only if CONFIG_SYSFS=y 2024-03-05 16:08:43 -06:00
npem.c PCI/NPEM: Add _DSM PCIe SSD status LED management 2024-09-06 11:37:24 -05:00
of_property.c PCI: of_property: Rename struct of_pci_range to of_pci_range_entry 2025-01-18 15:18:38 -06:00
of.c PCI: of: Simplify devm_of_pci_get_host_bridge_resources() interface 2025-01-15 15:26:51 -06:00
p2pdma.c PCI/P2PDMA: Constify 'struct bin_attribute' 2024-12-03 15:29:59 -06:00
pci-acpi.c ACPI: RISC-V: Implement PCI related functionality 2024-08-27 15:48:35 +02:00
pci-bridge-emul.c PCI: Rename CRS Completion Status to RRS 2024-09-10 19:52:30 -05:00
pci-bridge-emul.h
pci-driver.c PCI: hookup irq_get_affinity callback 2024-12-23 08:17:23 -07:00
pci-label.c
pci-mid.c PCI/PM: Switch to new Intel CPU model defines 2024-06-11 17:08:14 -05:00
pci-pf-stub.c PCI: Add missing MODULE_DESCRIPTION() macros 2024-07-08 08:35:35 +00:00
pci-stub.c PCI: Add missing MODULE_DESCRIPTION() macros 2024-07-08 08:35:35 +00:00
pci-sysfs.c Merge branch 'pci/misc' 2025-01-23 13:05:06 -06:00
pci.c pci-v6.14-changes 2025-01-25 16:03:40 -08:00
pci.h Merge branch 'pci/pci-sysfs' 2025-01-23 13:04:51 -06:00
probe.c Merge branch 'pci/err' 2025-01-23 13:04:50 -06:00
proc.c
quirks.c Merge branch 'pci/switchtec' 2025-01-23 13:04:52 -06:00
remove.c PCI/pwrctrl: Unregister platform device only if one actually exists 2024-11-30 11:41:25 -06:00
rom.c
search.c
setup-bus.c PCI: Improve pdev_sort_resources() warning message 2024-10-18 18:41:11 -05:00
setup-res.c PCI: Use resource_set_{range,size}() helpers 2024-10-10 17:44:57 -05:00
slot.c Merge branch 'pci/misc' 2024-11-25 13:41:00 -06:00
syscall.c
tph.c PCI/TPH: Add Steering Tag support 2024-10-02 16:23:10 -05:00
vc.c
vgaarb.c
vpd.c PCI/VPD: Constify 'struct bin_attribute' 2024-12-03 15:25:41 -06:00
xen-pcifront.c