Skip to content

Commit

Permalink
core : accept 32 bits pci domain
Browse files Browse the repository at this point in the history
Signed-off-by: Valentin Hoyet <valentin.hoyet@inria.fr>
  • Loading branch information
Valentin Hoyet authored and bgoglin committed Mar 11, 2020
1 parent f563fb6 commit e69901e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions hwloc/topology-linux.c
Expand Up @@ -5593,7 +5593,7 @@ hwloc_linuxfs_find_osdev_parent(struct hwloc_backend *backend, int root_fd,
pcibus = _pcibus;
pcidev = _pcidev;
pcifunc = _pcifunc;
tmp += 13;
tmp = strchr(tmp+3, ':')+8;
goto nextpci;
}
if (sscanf(tmp+1, "%x:%x.%x", &_pcibus, &_pcidev, &_pcifunc) == 3) {
Expand Down Expand Up @@ -6482,13 +6482,13 @@ hwloc_linuxfs_pci_look_pcidevices(struct hwloc_backend *backend)
size_t ret;
int fd, err;

if (sscanf(dirent->d_name, "%04x:%02x:%02x.%01x", &domain, &bus, &dev, &func) != 4)
if (sscanf(dirent->d_name, "%x:%02x:%02x.%01x", &domain, &bus, &dev, &func) != 4)
continue;

if (domain > 0xffff) {
static int warned = 0;
if (!warned)
fprintf(stderr, "Ignoring PCI device with non-16bit domain\n");
fprintf(stderr, "Ignoring PCI device with non-16bit domain.\nPass --enable-32bits-pci-domain to configure to support such devices\n(warning: it would break the library ABI, don't enable unless really needed).\n");
warned = 1;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion hwloc/topology-pci.c
Expand Up @@ -203,7 +203,7 @@ hwloc_look_pci(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus)
if (domain > 0xffff) {
static int warned = 0;
if (!warned)
fprintf(stderr, "Ignoring PCI device with non-16bit domain\n");
fprintf(stderr, "Ignoring PCI device with non-16bit domain.\nPass --enable-32bits-pci-domain to configure to support such devices\n(warning: it would break the library ABI, don't enable unless really needed).\n");
warned = 1;
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions hwloc/topology-xml.c
Expand Up @@ -252,7 +252,7 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
case HWLOC_OBJ_PCI_DEVICE:
case HWLOC_OBJ_BRIDGE: {
unsigned domain, bus, dev, func;
if (sscanf(value, "%04x:%02x:%02x.%01x",
if (sscanf(value, "%x:%02x:%02x.%01x",
&domain, &bus, &dev, &func) != 4) {
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring invalid pci_busid format string %s\n",
Expand All @@ -278,7 +278,7 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
case HWLOC_OBJ_PCI_DEVICE:
case HWLOC_OBJ_BRIDGE: {
unsigned classid, vendor, device, subvendor, subdevice, revision;
if (sscanf(value, "%04x [%04x:%04x] [%04x:%04x] %02x",
if (sscanf(value, "%x [%04x:%04x] [%04x:%04x] %02x",
&classid, &vendor, &device, &subvendor, &subdevice, &revision) != 6) {
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring invalid pci_type format string %s\n",
Expand Down Expand Up @@ -342,7 +342,7 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
switch (obj->type) {
case HWLOC_OBJ_BRIDGE: {
unsigned domain, secbus, subbus;
if (sscanf(value, "%04x:[%02x-%02x]",
if (sscanf(value, "%x:[%02x-%02x]",
&domain, &secbus, &subbus) != 3) {
if (hwloc__xml_verbose())
fprintf(stderr, "%s: ignoring invalid bridge_pci format string %s\n",
Expand Down
2 changes: 1 addition & 1 deletion include/hwloc.h
Expand Up @@ -617,7 +617,7 @@ union hwloc_obj_attr_u {
} group;
/** \brief PCI Device specific Object Attributes */
struct hwloc_pcidev_attr_s {
unsigned short domain;
unsigned short domain; /* Only 16bits PCI domains are supported by default */
unsigned char bus, dev, func;
unsigned short class_id;
unsigned short vendor_id, device_id, subvendor_id, subdevice_id;
Expand Down
2 changes: 1 addition & 1 deletion utils/lstopo/lstopo.h
Expand Up @@ -237,7 +237,7 @@ static __hwloc_inline int lstopo_numa_binding(struct lstopo_output *loutput, hwl
static __hwloc_inline int lstopo_busid_snprintf(struct lstopo_output *loutput, char *text, size_t textlen, hwloc_obj_t firstobj, int collapse, unsigned needdomain)
{
hwloc_obj_t lastobj;
char domain[6] = "";
char domain[10] = "";
unsigned i;

if (needdomain)
Expand Down

0 comments on commit e69901e

Please sign in to comment.