From: Stuart Hayes <stuart.w.hayes@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org,
Dan Williams <dan.j.williams@intel.com>
Cc: Keith Busch <kbusch@kernel.org>,
kw@linux.com, mariusz.tkaczyk@linux.intel.com,
helgaas@kernel.org, lukas@wunner.de, pavel@ucw.cz,
linux-cxl@vger.kernel.org, martin.petersen@oracle.com,
James.Bottomley@hansenpartnership.com,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Stuart Hayes <stuart.w.hayes@gmail.com>
Subject: [RFC PATCH v2 3/3] Register auxiliary device for PCIe enclosure management
Date: Wed, 2 Feb 2022 11:59:13 -0600 [thread overview]
Message-ID: <88898bbc85c85dce3c355c5f0399b593da0d4d27.1643822289.git.stuart.w.hayes@gmail.com> (raw)
In-Reply-To: <cover.1643822289.git.stuart.w.hayes@gmail.com>
This patch will register an auxiliary devivce for the pcie_em driver,
allowing it to attach and provide access to PCIe enclosure management
(LEDs), if present.
Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
---
drivers/nvme/host/pci.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index ca2ee806d74b..22ff10798333 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -27,6 +27,8 @@
#include <linux/io-64-nonatomic-hi-lo.h>
#include <linux/sed-opal.h>
#include <linux/pci-p2pdma.h>
+#include <linux/auxiliary_bus.h>
+#include <linux/pcie_em.h>
#include "trace.h"
#include "nvme.h"
@@ -159,6 +161,9 @@ struct nvme_dev {
unsigned int nr_poll_queues;
bool attrs_added;
+
+ /* auxiliary_device for pcie_em driver (LEDs) */
+ struct auxiliary_device *pcie_em_auxdev;
};
static int io_queue_depth_set(const char *val, const struct kernel_param *kp)
@@ -2838,6 +2843,11 @@ static void nvme_reset_work(struct work_struct *work)
nvme_unfreeze(&dev->ctrl);
}
+ /*
+ * register auxiliary device if this supports PCIe enclosure management
+ */
+ dev->pcie_em_auxdev = register_pcie_em_auxdev(dev->dev, dev->ctrl.instance);
+
/*
* If only admin queue live, keep it to do further investigation or
* recovery.
@@ -3135,6 +3145,7 @@ static void nvme_remove(struct pci_dev *pdev)
nvme_free_queues(dev, 0);
nvme_release_prp_pools(dev);
nvme_dev_unmap(dev);
+ unregister_pcie_em_auxdev(dev->pcie_em_auxdev);
nvme_uninit_ctrl(&dev->ctrl);
}
--
2.31.1
next prev parent reply other threads:[~2022-02-02 17:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 17:59 [RFC PATCH v2 0/3] Add PCIe enclosure management support Stuart Hayes
2022-02-02 17:59 ` [RFC PATCH v2 1/3] Add support for seven more indicators in enclosure driver Stuart Hayes
2022-02-02 23:55 ` Bjorn Helgaas
2022-02-02 17:59 ` [RFC PATCH v2 2/3] Add PCIe enclosure management auxiliary driver Stuart Hayes
2022-02-03 0:58 ` Bjorn Helgaas
2022-02-02 17:59 ` Stuart Hayes [this message]
2022-02-10 11:52 ` [RFC PATCH v2 0/3] Add PCIe enclosure management support Mariusz Tkaczyk
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=88898bbc85c85dce3c355c5f0399b593da0d4d27.1643822289.git.stuart.w.hayes@gmail.com \
--to=stuart.w.hayes@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=helgaas@kernel.org \
--cc=kbusch@kernel.org \
--cc=kw@linux.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mariusz.tkaczyk@linux.intel.com \
--cc=martin.petersen@oracle.com \
--cc=pavel@ucw.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).