@@ -479,6 +479,13 @@ Description:
The file is writable if the PF is bound to a driver that
implements ->sriov_set_msix_vec_count().
+What: /sys/bus/pci/devices/.../cor_err_reporting_enable
+Date: December 2024
+Contact: Linux PCI developers <linux-pci@vger.kernel.org>
+Description:
+ This file exposes a bit to control sending of Correctable Error
+ Messages. The value comes from the Device Control register.
+
What: /sys/bus/pci/devices/.../resourceN_resize
Date: September 2022
Contact: Alex Williamson <alex.williamson@redhat.com>
@@ -186,6 +186,47 @@ static ssize_t resource_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(resource);
+static ssize_t cor_err_reporting_enable_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ u16 reg;
+ int err;
+
+ err = pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, ®);
+
+ if (err)
+ return pcibios_err_to_errno(err);
+
+ return sysfs_emit(buf, "%u\n", reg & PCI_EXP_DEVCTL_CERE);
+}
+
+static ssize_t cor_err_reporting_enable_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ u16 reg;
+ u8 val;
+ int err;
+
+ if (kstrtou8(buf, 0, &val) < 0)
+ return -EINVAL;
+
+ pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, ®);
+
+ reg &= ~PCI_EXP_DEVCTL_CERE;
+ reg |= val;
+ err = pcie_capability_write_word(pdev, PCI_EXP_DEVCTL, reg);
+
+ if (err)
+ return pcibios_err_to_errno(err);
+
+ return count;
+}
+static DEVICE_ATTR_RW(cor_err_reporting_enable);
+
static ssize_t max_link_speed_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -659,6 +700,7 @@ static struct attribute *pcie_dev_attrs[] = {
&dev_attr_current_link_width.attr,
&dev_attr_max_link_width.attr,
&dev_attr_max_link_speed.attr,
+ &dev_attr_cor_err_reporting_enable.attr,
NULL,
};
In some cases, the number of Correctable Error messages is overwhelming, and even with the rate limit imposed, they fill up the logs. The system cannot do much about such errors, so a user might wish to silence them completely. Add a sysfs attribute to control reporting of the Correctable Error Messages per device. Signed-off-by: Karolina Stolarek <karolina.stolarek@oracle.com> --- Documentation/ABI/testing/sysfs-bus-pci | 7 +++++ drivers/pci/pci-sysfs.c | 42 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+)