diff options
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
-rw-r--r-- | drivers/pci/pci-sysfs.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 92b6d9ab00e4..91e760f9655b 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -221,12 +221,37 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, | |||
221 | static DEVICE_ATTR_RW(enabled); | 221 | static DEVICE_ATTR_RW(enabled); |
222 | 222 | ||
223 | #ifdef CONFIG_NUMA | 223 | #ifdef CONFIG_NUMA |
224 | static ssize_t numa_node_store(struct device *dev, | ||
225 | struct device_attribute *attr, const char *buf, | ||
226 | size_t count) | ||
227 | { | ||
228 | struct pci_dev *pdev = to_pci_dev(dev); | ||
229 | int node, ret; | ||
230 | |||
231 | if (!capable(CAP_SYS_ADMIN)) | ||
232 | return -EPERM; | ||
233 | |||
234 | ret = kstrtoint(buf, 0, &node); | ||
235 | if (ret) | ||
236 | return ret; | ||
237 | |||
238 | if (!node_online(node)) | ||
239 | return -EINVAL; | ||
240 | |||
241 | add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); | ||
242 | dev_alert(&pdev->dev, FW_BUG "Overriding NUMA node to %d. Contact your vendor for updates.", | ||
243 | node); | ||
244 | |||
245 | dev->numa_node = node; | ||
246 | return count; | ||
247 | } | ||
248 | |||
224 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, | 249 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, |
225 | char *buf) | 250 | char *buf) |
226 | { | 251 | { |
227 | return sprintf(buf, "%d\n", dev->numa_node); | 252 | return sprintf(buf, "%d\n", dev->numa_node); |
228 | } | 253 | } |
229 | static DEVICE_ATTR_RO(numa_node); | 254 | static DEVICE_ATTR_RW(numa_node); |
230 | #endif | 255 | #endif |
231 | 256 | ||
232 | static ssize_t dma_mask_bits_show(struct device *dev, | 257 | static ssize_t dma_mask_bits_show(struct device *dev, |