Skip to content

Commit

Permalink
configure : add options to enbale 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 e69901e commit 65f94fa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/hwloc.m4
Expand Up @@ -847,6 +847,11 @@ return 0;
])
fi
AS_IF([test "x$enable_32bits_pci_domain" = "xyes"], [
AC_DEFINE([HAVE_32BITS_PCI_DOMAIN], 1,
[Define to 1 if --enable-32bits-pci-domain is called.])
])
# PCI support via libpciaccess. NOTE: we do not support
# libpci/pciutils because that library is GPL and is incompatible
# with our BSD license.
Expand Down
5 changes: 5 additions & 0 deletions config/hwloc_internal.m4
Expand Up @@ -89,6 +89,11 @@ AC_DEFUN([HWLOC_DEFINE_ARGS],[
AS_HELP_STRING([--disable-nvml],
[Disable the NVML device discovery]))
# 32bits_pci_domain?
AC_ARG_ENABLE([32bits-pci-domain],
AS_HELP_STRING([--enable-32bits-pci-domain],
[Enable 32 bits PCI domains (domains > 16bits are ignored by default). WARNING: This breaks the library ABI, don't enable unless really needed.]))
# GL/Display
AC_ARG_ENABLE([gl],
AS_HELP_STRING([--disable-gl],
Expand Down
2 changes: 2 additions & 0 deletions hwloc/topology-linux.c
Expand Up @@ -6485,13 +6485,15 @@ hwloc_linuxfs_pci_look_pcidevices(struct hwloc_backend *backend)
if (sscanf(dirent->d_name, "%x:%02x:%02x.%01x", &domain, &bus, &dev, &func) != 4)
continue;

#ifndef HAVE_32BITS_PCI_DOMAIN
if (domain > 0xffff) {
static int warned = 0;
if (!warned)
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;
}
#endif

/* initialize the config space in case we fail to read it (missing permissions, etc). */
memset(config_space_cache, 0xff, CONFIG_SPACE_CACHESIZE);
Expand Down
2 changes: 2 additions & 0 deletions hwloc/topology-pci.c
Expand Up @@ -200,13 +200,15 @@ hwloc_look_pci(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus)
dev = pcidev->dev;
func = pcidev->func;

#ifndef HAVE_32BITS_PCI_DOMAIN
if (domain > 0xffff) {
static int warned = 0;
if (!warned)
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;
}
#endif

/* initialize the config space in case we fail to read it (missing permissions, etc). */
memset(config_space_cache, 0xff, CONFIG_SPACE_CACHESIZE);
Expand Down
4 changes: 4 additions & 0 deletions include/hwloc.h
Expand Up @@ -617,7 +617,11 @@ union hwloc_obj_attr_u {
} group;
/** \brief PCI Device specific Object Attributes */
struct hwloc_pcidev_attr_s {
#ifndef HAVE_32BITS_PCI_DOMAIN

This comment has been minimized.

Copy link
@sthibaul

sthibaul Mar 11, 2020

Contributor

Using HAVE_* inside public headers will not work. It needs to be defined as a HWLOC_HAVE_* macro in ./include/hwloc/autogen/config.h.in

This comment has been minimized.

Copy link
@bgoglin

bgoglin Mar 11, 2020

Contributor

Thanks, I am fixing that as well as a couple other minor bits.

unsigned short domain; /* Only 16bits PCI domains are supported by default */
#else
unsigned int domain; /* 32bits PCI domain support break the library ABI, hence it's disabled by default */
#endif
unsigned char bus, dev, func;
unsigned short class_id;
unsigned short vendor_id, device_id, subvendor_id, subdevice_id;
Expand Down

0 comments on commit 65f94fa

Please sign in to comment.