From: Jonathan Derrick <jonathan.derrick@linux.dev>
To: Vidya Sagar <vidyas@nvidia.com>
Cc: "Manivannan Sadhasivam" <mani@kernel.org>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Bjorn Helgaas" <helgaas@kernel.org>,
linux-pci@vger.kernel.org, "Lukas Wunner" <lukas@wunner.de>,
"Pali Rohár" <pali@kernel.org>,
"Jonathan Derrick" <jonathan.derrick@linux.dev>
Subject: [PATCH v2 0/7] PCIe Hotplug Slot Emulation driver
Date: Thu, 10 Nov 2022 12:50:08 -0700 [thread overview]
Message-ID: <20221110195015.207-1-jonathan.derrick@linux.dev> (raw)
Please see note [1] about v2
This set adds an emulation driver for PCIe Hotplug. There may be platforms with
specific configurations that can support hotplug but don't provide the logical
slot hotplug hardware. For instance, the platform may use an
electrically-tolerant interposer between the slot and the device.
This driver utilizes the pci-bridge-emul architecture to manage register reads
and writes. The underlying functionality of the hotplug emulation driver uses
the Data Link Layer Link Active Reporting mechanism in a polling loop, but can
tolerate other event sources such as AER or DPC.
When enabled and a slot is managed by the driver, all port services are managed
by the kernel. This is done to ensure that firmware hotplug and error
architecture does not (correctly) halt/machine check the system when hotplug is
performed on a non-hotplug slot.
The driver offers two active mode: Auto and Force.
auto: The driver will bind to non-hotplug slots
force: The driver will bind to all slots and overrides the slot's services
There are three kernel params:
pciehp.pciehp_emul_mode={off, auto, force}
pciehp.pciehp_emul_time=<msecs polling time> (def 1000, min 100, max 60000)
pciehp.pciehp_emul_ports=<PCI [S]BDF/ID format string>
The pciehp_emul_ports kernel parameter takes a semi-colon tokenized string
representing PCI [S]BDFs and IDs. The pciehp_emul_mode will then be applied to
only those slots, leaving other slots unmanaged by pciehp_emul.
The string follows the pci_dev_str_match() format:
[<domain>:]<bus>:<device>.<func>[/<device>.<func>]*
pci:<vendor>:<device>[:<subvendor>:<subdevice>]
When using the path format, the path for the device can be obtained
using 'lspci -t' and further specified using the upstream bridge and the
downstream port's device-function to be more robust against bus
renumbering.
When using the vendor-device format, a value of '0' in any field acts as
a wildcard for that field, matching all values.
The driver is enabled with CONFIG_HOTPLUG_PCI_PCIE_EMUL=y.
The driver should be considered 'use at own risk' unless the platform/hardware
vendor recommends this mode.
[1]
The main intent of posting v2 is to help Vidya further along with his
GPIO-based hotplug driver. I have no direct need for a DLLSC-based emulated
mode, and I'm not certain the model is appropriate. The GPIO-based model could
modify some of the logic in patch 6 to check for GPIO instead of DLLSC.
v1->v2: Indirects capacibility accessors instead of filtering pciehp slot operations
Jonathan Derrick (7):
PCI: Allow for indirecting capability registers
PCI: Add pcie_port_slot_emulated stub
PCI: pciehp: Expose the poll loop to other drivers
PCI: Move pci_dev_str_match to search.c
PCI: pci-bridge-emul: Provide a helper to set behavior
PCI: pciehp: Add hotplug slot emulation driver
PCI: pciehp: Wire up pcie_port_emulate_slot and
drivers/pci/access.c | 29 +++
drivers/pci/hotplug/Makefile | 4 +
drivers/pci/hotplug/pciehp.h | 20 ++
drivers/pci/hotplug/pciehp_emul.c | 380 ++++++++++++++++++++++++++++++
drivers/pci/hotplug/pciehp_hpc.c | 19 +-
drivers/pci/pci-acpi.c | 3 +
drivers/pci/pci-bridge-emul.c | 19 ++
drivers/pci/pci-bridge-emul.h | 10 +
drivers/pci/pci.c | 163 -------------
drivers/pci/pcie/Kconfig | 13 +
drivers/pci/pcie/portdrv_core.c | 12 +-
drivers/pci/probe.c | 2 +-
drivers/pci/search.c | 162 +++++++++++++
include/linux/pci.h | 22 ++
14 files changed, 688 insertions(+), 170 deletions(-)
create mode 100644 drivers/pci/hotplug/pciehp_emul.c
--
2.30.2
next reply other threads:[~2022-11-10 19:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 19:50 Jonathan Derrick [this message]
2022-11-10 19:50 ` [PATCH v2 1/7] PCI: Allow for indirecting capability registers Jonathan Derrick
2022-11-10 21:10 ` Pali Rohár
2022-11-10 19:50 ` [PATCH v2 2/7] PCI: Add pcie_port_slot_emulated stub Jonathan Derrick
2022-11-10 19:50 ` [PATCH v2 3/7] PCI: pciehp: Expose the poll loop to other drivers Jonathan Derrick
2022-11-10 19:50 ` [PATCH v2 4/7] PCI: Move pci_dev_str_match to search.c Jonathan Derrick
2022-11-10 19:50 ` [PATCH v2 5/7] PCI: pci-bridge-emul: Provide a helper to set behavior Jonathan Derrick
2022-11-10 21:02 ` Pali Rohár
2022-11-10 19:50 ` [PATCH v2 6/7] PCI: pciehp: Add hotplug slot emulation driver Jonathan Derrick
2022-11-10 19:50 ` [PATCH v2 7/7] PCI: pciehp: Wire up pcie_port_emulate_slot and Jonathan Derrick
2022-11-10 21:17 ` [PATCH v2 0/7] PCIe Hotplug Slot Emulation driver Pali Rohár
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=20221110195015.207-1-jonathan.derrick@linux.dev \
--to=jonathan.derrick@linux.dev \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=lukas@wunner.de \
--cc=mani@kernel.org \
--cc=pali@kernel.org \
--cc=vidyas@nvidia.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 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).