diff --git a/.gitignore b/.gitignore index 6f052a082c..9dae753e46 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,6 @@ docBin/ # Simulated SYSFS - for early development or debug device/ + +# misc +esmi_ib_library/ diff --git a/.gitmodules b/.gitmodules index 78e8455b04..e69de29bb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "e_smi_library"] - path = e_smi_library - url = ssh://gerritgit/SYS-MGMT/er/HPC/e_smi_library - branch = amd-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index 359c24bdef..8615c073dc 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ option(BUILD_WRAPPER "Rebuild AMDSMI-wrapper" OFF) option(BUILD_CLI "Build AMDSMI-CLI and install" ON) option(ENABLE_LDCONFIG "Set library links and caches using ldconfig." ON) option(ENABLE_ASAN_PACKAGING "" OFF) -option(ENABLE_ESMI_LIB "" OFF) +option(ENABLE_ESMI_LIB "" ON) # Set share path here because project name != amd_smi set(SHARE_INSTALL_PREFIX "share/${AMD_SMI}" CACHE STRING "Tests and Example install directory") @@ -95,16 +95,21 @@ set(AMDSMI_INC_DIR "${PROJECT_SOURCE_DIR}/include/amd_smi") set(ROCM_INC_DIR "${PROJECT_SOURCE_DIR}/rocm_smi/include/rocm_smi") set(SHR_MUTEX_DIR "${PROJECT_SOURCE_DIR}/third_party/shared_mutex") if(ENABLE_ESMI_LIB) -if((EXISTS ${PROJECT_SOURCE_DIR}/e_smi_library/src) AND (EXISTS ${PROJECT_SOURCE_DIR}/e_smi_library/src/e_smi_plat.c)) - set(ESMI_AVAILABLE TRUE) + if(NOT EXISTS ${PROJECT_SOURCE_DIR}/esmi_ib_library/src) + # TODO: use ExternalProject_Add instead or a submodule + # as of 2023.10.16 CI builds are broken with an updated submodule + execute_process(COMMAND git clone --depth=1 -b esmi_so_ver-3.0 https://github.com/amd/esmi_ib_library.git ${PROJECT_SOURCE_DIR}/esmi_ib_library) + endif() + if(NOT EXISTS ${PROJECT_SOURCE_DIR}/esmi_ib_library/include/asm/amd_hsmp.h) + file(DOWNLOAD + https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/plain/arch/x86/include/uapi/asm/amd_hsmp.h?h=review-ilpo + ${PROJECT_SOURCE_DIR}/esmi_ib_library/include/asm/amd_hsmp.h) + endif() add_definitions("-DENABLE_ESMI_LIB=1") -else() - message("E-smi source not found. Errors will be encountered during compilation!!!") -endif() -if(ESMI_AVAILABLE) - set(ESMI_INC_DIR "${PROJECT_SOURCE_DIR}/e_smi_library/include") - set(ESMI_SRC_DIR "${PROJECT_SOURCE_DIR}/e_smi_library/src") -endif() + set(ESMI_INC_DIR "${PROJECT_SOURCE_DIR}/esmi_ib_library/include") + set(ESMI_SRC_DIR "${PROJECT_SOURCE_DIR}/esmi_ib_library/src") + # esmi has a lot of write-strings warnings - silence them + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings") endif() pkg_check_modules(DRM REQUIRED libdrm) @@ -127,7 +132,7 @@ set(CMN_SRC_LIST "${ROCM_SRC_DIR}/rocm_smi_logger.cc" "${SHR_MUTEX_DIR}/shared_mutex.cc") -if(ESMI_AVAILABLE) +if(ENABLE_ESMI_LIB) list(APPEND CMN_SRC_LIST ${ESMI_SRC_DIR}/e_smi.c) list(APPEND CMN_SRC_LIST ${ESMI_SRC_DIR}/e_smi_monitor.c) list(APPEND CMN_SRC_LIST ${ESMI_SRC_DIR}/e_smi_plat.c) diff --git a/e_smi_library b/e_smi_library deleted file mode 160000 index 1b2de9f700..0000000000 --- a/e_smi_library +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1b2de9f700045ce83319e6a3b7193c3f4746a9d7 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 956bb98fec..3e22f52ffe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -50,7 +50,7 @@ set(INC_LIST "${PROJECT_SOURCE_DIR}/rocm_smi/include/rocm_smi/rocm_smi.h" "${PROJECT_SOURCE_DIR}/rocm_smi/include/rocm_smi/rocm_smi_utils.h") -if(ESMI_AVAILABLE) +if(ENABLE_ESMI_LIB) list(APPEND INC_LIST ${ESMI_INC_DIR}/e_smi/e_smi.h) list(APPEND INC_LIST ${ESMI_INC_DIR}/e_smi/e_smi_monitor.h) list(APPEND INC_LIST ${ESMI_INC_DIR}/e_smi/e_smi_utils.h)