@@ -255,6 +255,30 @@ static ssize_t ari_enabled_show(struct device *dev,
}
static DEVICE_ATTR_RO(ari_enabled);
+static ssize_t ignore_reset_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+
+ return sprintf(buf, "%u\n", pci_dev->ignore_reset);
+}
+static ssize_t ignore_reset_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ unsigned long val;
+
+ if (kstrtoul(buf, 0, &val) < 0)
+ return -EINVAL;
+
+ pdev->ignore_reset = !!val;
+
+ return count;
+}
+static DEVICE_ATTR_RW(ignore_reset);
+
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -618,6 +642,7 @@ static struct attribute *pci_dev_attrs[] = {
#endif
&dev_attr_driver_override.attr,
&dev_attr_ari_enabled.attr,
+ &dev_attr_ignore_reset.attr,
NULL,
};
@@ -508,6 +508,7 @@ struct pci_dev {
/* These methods index pci_reset_fn_methods[] */
u8 reset_methods[PCI_NUM_RESET_METHODS]; /* In priority order */
+ u8 ignore_reset; /* ignore reset control in driver */
};
static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
Some PCI devices can't do device reset in enable and disable operations. So, and ignore_reset sysfs interface to ignore reset in those operations. For example: echo 1 > /sys/bus/pci/xxxx/ignore_reset PCI drivers can ignore reset for this device based on ignore_reset. Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com> --- drivers/pci/pci-sysfs.c | 25 +++++++++++++++++++++++++ include/linux/pci.h | 1 + 2 files changed, 26 insertions(+)