Merge tag 'pci-v5.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas:
"Enumeration:
- Remove unnecessary locking around _OSC (Bjorn Helgaas)
- Clarify message about _OSC failure (Bjorn Helgaas)
- Remove notification of PCIe bandwidth changes (Bjorn Helgaas)
- Tidy checking of syscall user config accessors (Heiner Kallweit)
Resource management:
- Decline to resize resources if boot config must be preserved (Ard
Biesheuvel)
- Fix pci_register_io_range() memory leak (Geert Uytterhoeven)
Error handling (Keith Busch):
- Clear error status from the correct device
- Retain error recovery status so drivers can use it after reset
- Log the type of Port (Root or Switch Downstream) that we reset
- Always request a reset for Downstream Ports in frozen state
Endpoint framework and NTB (Kishon Vijay Abraham I):
- Make *_get_first_free_bar() take into account 64 bit BAR
- Add helper API to get the 'next' unreserved BAR
- Make *_free_bar() return error codes on failure
- Remove unused pci_epf_match_device()
- Add support to associate secondary EPC with EPF
- Add support in configfs to associate two EPCs with EPF
- Add pci_epc_ops to map MSI IRQ
- Add pci_epf_ops to expose function-specific attrs
- Allow user to create sub-directory of 'EPF Device' directory
- Implement ->msi_map_irq() ops for cadence
- Configure LM_EP_FUNC_CFG based on epc->function_num_map for cadence
- Add EP function driver to provide NTB functionality
- Add support for EPF PCI Non-Transparent Bridge
- Add specification for PCI NTB function device
- Add PCI endpoint NTB function user guide
- Add configfs binding documentation for pci-ntb endpoint function
Broadcom STB PCIe controller driver:
- Add support for BCM4908 and external PERST# signal controller
(Rafał Miłecki)
Cadence PCIe controller driver:
- Retrain Link to work around Gen2 training defect (Nadeem Athani)
- Fix merge botch in cdns_pcie_host_map_dma_ranges() (Krzysztof
Wilczyński)
Freescale Layerscape PCIe controller driver:
- Add LX2160A rev2 EP mode support (Hou Zhiqiang)
- Convert to builtin_platform_driver() (Michael Walle)
MediaTek PCIe controller driver:
- Fix OF node reference leak (Krzysztof Wilczyński)
Microchip PolarFlare PCIe controller driver:
- Add Microchip PolarFire PCIe controller driver (Daire McNamara)
Qualcomm PCIe controller driver:
- Use PHY_REFCLK_USE_PAD only for ipq8064 (Ansuel Smith)
- Add support for ddrss_sf_tbu clock for sm8250 (Dmitry Baryshkov)
Renesas R-Car PCIe controller driver:
- Drop PCIE_RCAR config option (Lad Prabhakar)
- Always allocate MSI addresses in 32bit space (Marek Vasut)
Rockchip PCIe controller driver:
- Add FriendlyARM NanoPi M4B DT binding (Chen-Yu Tsai)
- Make 'ep-gpios' DT property optional (Chen-Yu Tsai)
Synopsys DesignWare PCIe controller driver:
- Work around ECRC configuration hardware defect (Vidya Sagar)
- Drop support for config space in DT 'ranges' (Rob Herring)
- Change size to u64 for EP outbound iATU (Shradha Todi)
- Add upper limit address for outbound iATU (Shradha Todi)
- Make dw_pcie ops optional (Jisheng Zhang)
- Remove unnecessary dw_pcie_ops from al driver (Jisheng Zhang)
Xilinx Versal CPM PCIe controller driver:
- Fix OF node reference leak (Pan Bian)
Miscellaneous:
- Remove tango host controller driver (Arnd Bergmann)
- Remove IRQ handler & data together (altera-msi, brcmstb, dwc)
(Martin Kaiser)
- Fix xgene-msi race in installing chained IRQ handler (Martin
Kaiser)
- Apply CONFIG_PCI_DEBUG to entire drivers/pci hierarchy (Junhao He)
- Fix pci-bridge-emul array overruns (Russell King)
- Remove obsolete uses of WARN_ON(in_interrupt()) (Sebastian Andrzej
Siewior)"
* tag 'pci-v5.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (69 commits)
PCI: qcom: Use PHY_REFCLK_USE_PAD only for ipq8064
PCI: qcom: Add support for ddrss_sf_tbu clock
dt-bindings: PCI: qcom: Document ddrss_sf_tbu clock for sm8250
PCI: al: Remove useless dw_pcie_ops
PCI: dwc: Don't assume the ops in dw_pcie always exist
PCI: dwc: Add upper limit address for outbound iATU
PCI: dwc: Change size to u64 for EP outbound iATU
PCI: dwc: Drop support for config space in 'ranges'
PCI: layerscape: Convert to builtin_platform_driver()
PCI: layerscape: Add LX2160A rev2 EP mode support
dt-bindings: PCI: layerscape: Add LX2160A rev2 compatible strings
PCI: dwc: Work around ECRC configuration issue
PCI/portdrv: Report reset for frozen channel
PCI/AER: Specify the type of Port that was reset
PCI/ERR: Retain status from error notification
PCI/AER: Clear AER status from Root Port when resetting Downstream Port
PCI/ERR: Clear status of the reporting device
dt-bindings: arm: rockchip: Add FriendlyARM NanoPi M4B
PCI: rockchip: Make 'ep-gpios' DT property optional
Documentation: PCI: Add PCI endpoint NTB function user guide
...
This commit is contained in:
@@ -133,14 +133,6 @@ config PCIE_PTM
|
||||
This is only useful if you have devices that support PTM, but it
|
||||
is safe to enable even if you don't.
|
||||
|
||||
config PCIE_BW
|
||||
bool "PCI Express Bandwidth Change Notification"
|
||||
depends on PCIEPORTBUS
|
||||
help
|
||||
This enables PCI Express Bandwidth Change Notification. If
|
||||
you know link width or rate changes occur only to correct
|
||||
unreliable links, you may answer Y.
|
||||
|
||||
config PCIE_EDR
|
||||
bool "PCI Express Error Disconnect Recover support"
|
||||
depends on PCIE_DPC && ACPI
|
||||
|
||||
@@ -12,5 +12,4 @@ obj-$(CONFIG_PCIEAER_INJECT) += aer_inject.o
|
||||
obj-$(CONFIG_PCIE_PME) += pme.o
|
||||
obj-$(CONFIG_PCIE_DPC) += dpc.o
|
||||
obj-$(CONFIG_PCIE_PTM) += ptm.o
|
||||
obj-$(CONFIG_PCIE_BW) += bw_notification.o
|
||||
obj-$(CONFIG_PCIE_EDR) += edr.o
|
||||
|
||||
@@ -1388,7 +1388,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
|
||||
if (type == PCI_EXP_TYPE_RC_END)
|
||||
root = dev->rcec;
|
||||
else
|
||||
root = dev;
|
||||
root = pcie_find_root_port(dev);
|
||||
|
||||
/*
|
||||
* If the platform retained control of AER, an RCiEP may not have
|
||||
@@ -1414,7 +1414,8 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
|
||||
}
|
||||
} else {
|
||||
rc = pci_bus_error_reset(dev);
|
||||
pci_info(dev, "Root Port link has been reset (%d)\n", rc);
|
||||
pci_info(dev, "%s Port link has been reset (%d)\n",
|
||||
pci_is_root_bus(dev->bus) ? "Root" : "Downstream", rc);
|
||||
}
|
||||
|
||||
if ((host->native_aer || pcie_ports_native) && aer) {
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* PCI Express Link Bandwidth Notification services driver
|
||||
* Author: Alexandru Gagniuc <mr.nuke.me@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2019, Dell Inc
|
||||
*
|
||||
* The PCIe Link Bandwidth Notification provides a way to notify the
|
||||
* operating system when the link width or data rate changes. This
|
||||
* capability is required for all root ports and downstream ports
|
||||
* supporting links wider than x1 and/or multiple link speeds.
|
||||
*
|
||||
* This service port driver hooks into the bandwidth notification interrupt
|
||||
* and warns when links become degraded in operation.
|
||||
*/
|
||||
|
||||
#define dev_fmt(fmt) "bw_notification: " fmt
|
||||
|
||||
#include "../pci.h"
|
||||
#include "portdrv.h"
|
||||
|
||||
static bool pcie_link_bandwidth_notification_supported(struct pci_dev *dev)
|
||||
{
|
||||
int ret;
|
||||
u32 lnk_cap;
|
||||
|
||||
ret = pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnk_cap);
|
||||
return (ret == PCIBIOS_SUCCESSFUL) && (lnk_cap & PCI_EXP_LNKCAP_LBNC);
|
||||
}
|
||||
|
||||
static void pcie_enable_link_bandwidth_notification(struct pci_dev *dev)
|
||||
{
|
||||
u16 lnk_ctl;
|
||||
|
||||
pcie_capability_write_word(dev, PCI_EXP_LNKSTA, PCI_EXP_LNKSTA_LBMS);
|
||||
|
||||
pcie_capability_read_word(dev, PCI_EXP_LNKCTL, &lnk_ctl);
|
||||
lnk_ctl |= PCI_EXP_LNKCTL_LBMIE;
|
||||
pcie_capability_write_word(dev, PCI_EXP_LNKCTL, lnk_ctl);
|
||||
}
|
||||
|
||||
static void pcie_disable_link_bandwidth_notification(struct pci_dev *dev)
|
||||
{
|
||||
u16 lnk_ctl;
|
||||
|
||||
pcie_capability_read_word(dev, PCI_EXP_LNKCTL, &lnk_ctl);
|
||||
lnk_ctl &= ~PCI_EXP_LNKCTL_LBMIE;
|
||||
pcie_capability_write_word(dev, PCI_EXP_LNKCTL, lnk_ctl);
|
||||
}
|
||||
|
||||
static irqreturn_t pcie_bw_notification_irq(int irq, void *context)
|
||||
{
|
||||
struct pcie_device *srv = context;
|
||||
struct pci_dev *port = srv->port;
|
||||
u16 link_status, events;
|
||||
int ret;
|
||||
|
||||
ret = pcie_capability_read_word(port, PCI_EXP_LNKSTA, &link_status);
|
||||
events = link_status & PCI_EXP_LNKSTA_LBMS;
|
||||
|
||||
if (ret != PCIBIOS_SUCCESSFUL || !events)
|
||||
return IRQ_NONE;
|
||||
|
||||
pcie_capability_write_word(port, PCI_EXP_LNKSTA, events);
|
||||
pcie_update_link_speed(port->subordinate, link_status);
|
||||
return IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
static irqreturn_t pcie_bw_notification_handler(int irq, void *context)
|
||||
{
|
||||
struct pcie_device *srv = context;
|
||||
struct pci_dev *port = srv->port;
|
||||
struct pci_dev *dev;
|
||||
|
||||
/*
|
||||
* Print status from downstream devices, not this root port or
|
||||
* downstream switch port.
|
||||
*/
|
||||
down_read(&pci_bus_sem);
|
||||
list_for_each_entry(dev, &port->subordinate->devices, bus_list)
|
||||
pcie_report_downtraining(dev);
|
||||
up_read(&pci_bus_sem);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int pcie_bandwidth_notification_probe(struct pcie_device *srv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Single-width or single-speed ports do not have to support this. */
|
||||
if (!pcie_link_bandwidth_notification_supported(srv->port))
|
||||
return -ENODEV;
|
||||
|
||||
ret = request_threaded_irq(srv->irq, pcie_bw_notification_irq,
|
||||
pcie_bw_notification_handler,
|
||||
IRQF_SHARED, "PCIe BW notif", srv);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pcie_enable_link_bandwidth_notification(srv->port);
|
||||
pci_info(srv->port, "enabled with IRQ %d\n", srv->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pcie_bandwidth_notification_remove(struct pcie_device *srv)
|
||||
{
|
||||
pcie_disable_link_bandwidth_notification(srv->port);
|
||||
free_irq(srv->irq, srv);
|
||||
}
|
||||
|
||||
static int pcie_bandwidth_notification_suspend(struct pcie_device *srv)
|
||||
{
|
||||
pcie_disable_link_bandwidth_notification(srv->port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pcie_bandwidth_notification_resume(struct pcie_device *srv)
|
||||
{
|
||||
pcie_enable_link_bandwidth_notification(srv->port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pcie_port_service_driver pcie_bandwidth_notification_driver = {
|
||||
.name = "pcie_bw_notification",
|
||||
.port_type = PCIE_ANY_PORT,
|
||||
.service = PCIE_PORT_SERVICE_BWNOTIF,
|
||||
.probe = pcie_bandwidth_notification_probe,
|
||||
.suspend = pcie_bandwidth_notification_suspend,
|
||||
.resume = pcie_bandwidth_notification_resume,
|
||||
.remove = pcie_bandwidth_notification_remove,
|
||||
};
|
||||
|
||||
int __init pcie_bandwidth_notification_init(void)
|
||||
{
|
||||
return pcie_port_service_register(&pcie_bandwidth_notification_driver);
|
||||
}
|
||||
@@ -198,8 +198,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
|
||||
pci_dbg(bridge, "broadcast error_detected message\n");
|
||||
if (state == pci_channel_io_frozen) {
|
||||
pci_walk_bridge(bridge, report_frozen_detected, &status);
|
||||
status = reset_subordinates(bridge);
|
||||
if (status != PCI_ERS_RESULT_RECOVERED) {
|
||||
if (reset_subordinates(bridge) != PCI_ERS_RESULT_RECOVERED) {
|
||||
pci_warn(bridge, "subordinate device reset failed\n");
|
||||
goto failed;
|
||||
}
|
||||
@@ -231,15 +230,14 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
|
||||
pci_walk_bridge(bridge, report_resume, &status);
|
||||
|
||||
/*
|
||||
* If we have native control of AER, clear error status in the Root
|
||||
* Port or Downstream Port that signaled the error. If the
|
||||
* platform retained control of AER, it is responsible for clearing
|
||||
* this status. In that case, the signaling device may not even be
|
||||
* visible to the OS.
|
||||
* If we have native control of AER, clear error status in the device
|
||||
* that detected the error. If the platform retained control of AER,
|
||||
* it is responsible for clearing this status. In that case, the
|
||||
* signaling device may not even be visible to the OS.
|
||||
*/
|
||||
if (host->native_aer || pcie_ports_native) {
|
||||
pcie_clear_device_status(bridge);
|
||||
pci_aer_clear_nonfatal_status(bridge);
|
||||
pcie_clear_device_status(dev);
|
||||
pci_aer_clear_nonfatal_status(dev);
|
||||
}
|
||||
pci_info(bridge, "device recovery successful\n");
|
||||
return status;
|
||||
|
||||
@@ -53,12 +53,6 @@ int pcie_dpc_init(void);
|
||||
static inline int pcie_dpc_init(void) { return 0; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCIE_BW
|
||||
int pcie_bandwidth_notification_init(void);
|
||||
#else
|
||||
static inline int pcie_bandwidth_notification_init(void) { return 0; }
|
||||
#endif
|
||||
|
||||
/* Port Type */
|
||||
#define PCIE_ANY_PORT (~0)
|
||||
|
||||
|
||||
@@ -153,7 +153,8 @@ static void pcie_portdrv_remove(struct pci_dev *dev)
|
||||
static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev,
|
||||
pci_channel_state_t error)
|
||||
{
|
||||
/* Root Port has no impact. Always recovers. */
|
||||
if (error == pci_channel_io_frozen)
|
||||
return PCI_ERS_RESULT_NEED_RESET;
|
||||
return PCI_ERS_RESULT_CAN_RECOVER;
|
||||
}
|
||||
|
||||
@@ -255,7 +256,6 @@ static void __init pcie_init_services(void)
|
||||
pcie_pme_init();
|
||||
pcie_dpc_init();
|
||||
pcie_hp_init();
|
||||
pcie_bandwidth_notification_init();
|
||||
}
|
||||
|
||||
static int __init pcie_portdrv_init(void)
|
||||
|
||||
Reference in New Issue
Block a user