Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: pciehp_hpc: Fix set raw indicator status
@ 2024-07-22 14:14 Blazej Kucman
  2024-07-25 21:59 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Blazej Kucman @ 2024-07-22 14:14 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, ilpo.jarvinen, mariusz.tkaczyk, ernel.org

Set raw indicator status interface has been designed to respect bits
responsible for Attention and Power Indicator Control [1]. But since
abaaac4845a0 ("PCI: hotplug: Use FIELD_GET/PREP()") only processes
Attention Indicator Control bits.

Mentioned change replace direct bit shift, via macro FIELD_PREP, which
additionally performs an AND operation with the passed bitmask. The
regression results from an incorrect bitmask, the mask should include bits
responsible for Attention and Power Indicator Control, but only Attention
Indicator Control was passed. This lead to a loss of passed bits
responsible for Power Indicator control.

This fix restores Power Indicator Control bits support.

[1] 576243b3f9ea ("PCI: pciehp: Allow exclusive userspace control of indicators")

Fixes: abaaac4845a0 ("PCI: hotplug: Use FIELD_GET/PREP()")
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
---
 drivers/pci/hotplug/pciehp_hpc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 061f01f60db4..736ad8baa2a5 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -485,7 +485,9 @@ int pciehp_set_raw_indicator_status(struct hotplug_slot *hotplug_slot,
 	struct pci_dev *pdev = ctrl_dev(ctrl);
 
 	pci_config_pm_runtime_get(pdev);
-	pcie_write_cmd_nowait(ctrl, FIELD_PREP(PCI_EXP_SLTCTL_AIC, status),
+
+	/* Attention and Power Indicator Control bits are supported */
+	pcie_write_cmd_nowait(ctrl, FIELD_PREP(PCI_EXP_SLTCTL_AIC | PCI_EXP_SLTCTL_PIC, status),
 			      PCI_EXP_SLTCTL_AIC | PCI_EXP_SLTCTL_PIC);
 	pci_config_pm_runtime_put(pdev);
 	return 0;
-- 
2.35.3


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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-22 14:14 [PATCH] PCI: pciehp_hpc: Fix set raw indicator status Blazej Kucman
2024-07-25 21:59 ` Bjorn Helgaas

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