* New components
+ Add the "linuxpci" component to fallback to basic PCI discovery on
Linux when full discovery with libpciaccess or libpci isn't available.
- It misses bridges and some device attributes.
+ It misses bridges and device names.
* Misc
+ Add --with-hwloc-plugins-path to specify the install/load directories
of plugins.
On Linux, a minimalistic PCI discovery may still be performed even
if neither <tt>libpciaccess</tt> nor <tt>pciutils</tt> can be used.
It only probes PCI devices and guesses hostbridges, and it also
-misses some attributes such as PCI device names, hardware revision
-or link speed.
+misses PCI device names.
\section iodevices_hierarchy I/O object hierarchy
This component can probe PCI devices on Linux without the help of external
libraries such as libpciaccess. Its priority is lower than the pci component
since it does not detect bridges (only guesses fake hostbridges)
- and misses some device attributes.
+ and misses device names.
</dd>
<dt>opencl</dt>
<dd>
******* Linux PCI component *******
***********************************/
+#define HWLOC_PCI_REVISION_ID 0x08
+#define HWLOC_PCI_CAP_ID_EXP 0x10
+
static int
hwloc_look_linuxfs_pci(struct hwloc_backend *backend)
{
}
}
+ snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/config", dirent->d_name);
+ file = fopen(path, "r");
+ if (file) {
+#define CONFIG_SPACE_CACHESIZE_TRY 256
+ unsigned char config_space_cache[CONFIG_SPACE_CACHESIZE_TRY];
+ unsigned config_space_cachesize = CONFIG_SPACE_CACHESIZE_TRY;
+ unsigned offset;
+
+ config_space_cachesize = fread(config_space_cache, 1, CONFIG_SPACE_CACHESIZE_TRY, file);
+ fclose(file);
+ if (config_space_cachesize >= 64) {
+ /* cannot do anything without base config space */
+
+ /* get the revision */
+ obj->attr->pcidev.revision = config_space_cache[HWLOC_PCI_REVISION_ID];
+
+ /* try to get the link speed */
+ offset = hwloc_pci_find_cap(config_space_cache, config_space_cachesize, HWLOC_PCI_CAP_ID_EXP);
+ if (offset > 0)
+ hwloc_pci_find_linkspeed(config_space_cache, config_space_cachesize, offset, &obj->attr->pcidev.linkspeed);
+ }
+ }
+
/* find a hostbridge with same cpuset and domain or create one */
hostbridge = hostbridges;
while (hostbridge