On Wednesday 19 January 2022 10:22:00 Stefan Roese wrote: > With this change, AER is now enabled on all PCIe devices, also when the > PCIe device is hot-plugged. > > Please note that this change is quite invasive, as with this patch > applied, AER now will be enabled in the Device Control registers of all > available PCIe Endpoints, which currently is not the case. > > When "pci=noaer" is selected, AER stays disabled of course. Hello Stefan! I was thinking more about this change and I'm not sure what happens if AER-capable PCIe device is hotplugged into some PCIe switch connected in the PCIe hierarchy where Root Port is not AER-capable (e.g. current linux implementation of pci-aardvark.c and pci-mvebu.c). My feeling is that in this case AER should not be enabled as there is nobody who can deliver AER interrupt to the OS. But I really do not know what is supposed from kernel AER driver, so lets wait for Bjorn reply. And when you opened this issue with hotplugging, another thing for followup changes in future is calling pcie_set_ecrc_checking() function to align ECRC state of newly hotplugged device with "pci=ecrc=..." cmdline option. As currently it is done only at that function set_device_error_reporting(). > Signed-off-by: Stefan Roese <sr@xxxxxxx> > Cc: Bjorn Helgaas <helgaas@xxxxxxxxxx> > Cc: Pali Rohár <pali@xxxxxxxxxx> > Cc: Bharat Kumar Gogada <bharat.kumar.gogada@xxxxxxxxxx> > Cc: Michal Simek <michal.simek@xxxxxxxxxx> > Cc: Yao Hongbo <yaohongbo@xxxxxxxxxxxxxxxxx> > Cc: Naveen Naidu <naveennaidu479@xxxxxxxxx> > --- > v3: > - New patch, replacing the "old" 2/2 patch > Now enabling of AER for each PCIe device is done in pci_aer_init(), > which also makes sure that AER is enabled in each PCIe device even when > it's hot-plugged. > > drivers/pci/pcie/aer.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > index 9fa1f97e5b27..01a25e4a5168 100644 > --- a/drivers/pci/pcie/aer.c > +++ b/drivers/pci/pcie/aer.c > @@ -387,6 +387,10 @@ void pci_aer_init(struct pci_dev *dev) > pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_ERR, sizeof(u32) * n); > > pci_aer_clear_status(dev); > + > + /* Enable AER if requested */ > + if (pci_aer_available()) > + pci_enable_pcie_error_reporting(dev); > } > > void pci_aer_exit(struct pci_dev *dev) > -- > 2.34.1 >