Commit 415ca964 authored by Andi Kleen's avatar Andi Kleen Committed by Greg Kroah-Hartman

[PATCH] PCI: Add sysfs file to map PCI busses to cpus

Add sysfs file to map PCI busses to cpus

Export the information from pcibus_to_cpumask() to sysfs. This
is useful for some user space programs who want to optimize their IO
using O_DIRECT.

There was some indecision on whether it's more useful to report
cpus or nodes here. In the end cpus was chosen because that is
what the existing macros report.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent e9e96e1d
......@@ -19,6 +19,7 @@
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/stat.h>
#include <linux/topology.h>
#include "pci.h"
......@@ -42,6 +43,15 @@ pci_config_attr(subsystem_device, "0x%04x\n");
pci_config_attr(class, "0x%06x\n");
pci_config_attr(irq, "%u\n");
static ssize_t local_cpus_show(struct device *dev, char *buf)
{
struct pci_dev *pdev = to_pci_dev(dev);
cpumask_t mask = pcibus_to_cpumask(pdev->bus->number);
int len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
strcat(buf,"\n");
return 1+len;
}
/* show resources */
static ssize_t
resource_show(struct device * dev, char * buf)
......@@ -71,6 +81,7 @@ struct device_attribute pci_dev_attrs[] = {
__ATTR_RO(subsystem_device),
__ATTR_RO(class),
__ATTR_RO(irq),
__ATTR_RO(local_cpus),
__ATTR_NULL,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment