All of lore.kernel.org
 help / color / mirror / Atom feed
From: Blazej Kucman <blazej.kucman@intel.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, ilpo.jarvinen@linux.intel.com,
	mariusz.tkaczyk@linux.intel.com, ernel.org
Subject: [PATCH] PCI: pciehp_hpc: Fix set raw indicator status
Date: Mon, 22 Jul 2024 16:14:40 +0200	[thread overview]
Message-ID: <20240722141440.7210-1-blazej.kucman@intel.com> (raw)

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


             reply	other threads:[~2024-07-22 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-22 14:14 Blazej Kucman [this message]
2024-07-25 21:59 ` [PATCH] PCI: pciehp_hpc: Fix set raw indicator status Bjorn Helgaas

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=20240722141440.7210-1-blazej.kucman@intel.com \
    --to=blazej.kucman@intel.com \
    --cc=bhelgaas@google.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=mariusz.tkaczyk@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.