Update to 6.3

Signed-off-by: Tom Rix <Tom.Rix@amd.com>
This commit is contained in:
2024-12-07 07:02:39 -08:00
parent a185aac95f
commit 899bc4792f
4 changed files with 74 additions and 71 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/amdsmi-6.2.0.tar.gz
/esmi_pkg_ver-3.0.3.tar.gz
/amdsmi-6.2.1.tar.gz
/amdsmi-6.3.0.tar.gz

View File

@@ -1,6 +1,6 @@
From 9831c2ea09f63cf140d42061171b3b5a642d539d Mon Sep 17 00:00:00 2001
From 3edf0f4ab02edac50223fae8290df1356c9cc0b7 Mon Sep 17 00:00:00 2001
From: Tom Rix <Tom.Rix@amd.com>
Date: Wed, 7 Aug 2024 18:08:20 -0700
Date: Sat, 7 Dec 2024 05:47:55 -0800
Subject: [PATCH] Do not automatically download kernel header amd_hsmp.h
First look locally following these heuristics
@@ -12,71 +12,64 @@ When these fail, download from the upstream kernel
Signed-off-by: Tom Rix <Tom.Rix@amd.com>
---
CMakeLists.txt | 42 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
CMakeLists.txt | 43 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 882ab7a1839a..7ef97847bbff 100755
index d2c118b072ab..e31dbc7e0b74 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,16 +115,56 @@ 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(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
@@ -128,9 +128,48 @@ if(ENABLE_ESMI_LIB)
execute_process(COMMAND git clone --depth=1 -b esmi_pkg_ver-3.0.3 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
+
+ # Need to find the correct amd_hsmp.h to use
+ # Use can specify on the cmd line with -DBUILD_KERNEL_ASM_DIR=/usr/include/asm
+ set(BUILD_KERNEL_ASM_DIR ""
+ CACHE PATH "Location of the kernel's asm dir ex/ usr/include/asm")
+ set(AMD_HSMP "")
+ if (NOT ${BUILD_KERNEL_ASM_DIR} STREQUAL "")
+ if (EXISTS ${BUILD_KERNEL_ASM_DIR}/amd_hsmp.h)
+ set(AMD_HSMP ${BUILD_KERNEL_ASM_DIR}/amd_hsmp.h)
+ else()
+ message("Check the value of -DBUILD_KERNEL_ASM_DIR=${BUILD_KERNEL_ASM_DIR}")
+ message(FATAL_ERROR "Could not find ${BUILD_KERNEL_ASM_DIR}/amd_hsmp.h")
+ endif()
+ # Need to find the correct amd_hsmp.h to use
+ # Use can specify on the cmd line with -DBUILD_KERNEL_ASM_DIR=/usr/include/asm
+ set(BUILD_KERNEL_ASM_DIR ""
+ CACHE PATH "Location of the kernel's asm dir ex/ usr/include/asm")
+ set(AMD_HSMP "")
+ if (NOT ${BUILD_KERNEL_ASM_DIR} STREQUAL "")
+ if (EXISTS ${BUILD_KERNEL_ASM_DIR}/amd_hsmp.h)
+ set(AMD_HSMP ${BUILD_KERNEL_ASM_DIR}/amd_hsmp.h)
+ else()
+ message("Check the value of -DBUILD_KERNEL_ASM_DIR=${BUILD_KERNEL_ASM_DIR}")
+ message(FATAL_ERROR "Could not find ${BUILD_KERNEL_ASM_DIR}/amd_hsmp.h")
+ endif()
+ if (NOT EXISTS ${AMD_HSMP})
+ # Look for the headers in the running kernel, to do this make sure the correct kernel headers
+ # are install. Do something like what is done for fedora
+ # sudo dnf install "kernel-devel-uname-r == $(uname -r)"
+ execute_process(COMMAND uname -r OUTPUT_VARIABLE KERNEL_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND realpath /lib/modules/${KERNEL_RELEASE}/build OUTPUT_VARIABLE KERNEL_RELEASE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (EXISTS ${KERNEL_RELEASE_PATH}/arch/x86/include/uapi/asm/amd_hsmp.h)
+ set(AMD_HSMP ${INSTALLED_KERNEL_BUILD_DIR}/arch/x86/include/uapi/asm/amd_hsmp.h)
+ endif()
+ endif()
+ if (NOT EXISTS ${AMD_HSMP})
+ # Look for the headers in the running kernel, to do this make sure the correct kernel headers
+ # are install. Do something like what is done for fedora
+ # sudo dnf install "kernel-devel-uname-r == $(uname -r)"
+ execute_process(COMMAND uname -r OUTPUT_VARIABLE KERNEL_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND realpath /lib/modules/${KERNEL_RELEASE}/build OUTPUT_VARIABLE KERNEL_RELEASE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (EXISTS ${KERNEL_RELEASE_PATH}/arch/x86/include/uapi/asm/amd_hsmp.h)
+ set(AMD_HSMP ${INSTALLED_KERNEL_BUILD_DIR}/arch/x86/include/uapi/asm/amd_hsmp.h)
+ endif()
+ if (NOT EXISTS ${AMD_HSMP})
+ # Look in some obvious places
+ find_path(AMD_HSMP_DIR amd_hsmp.h HINTS /usr/include/asm)
+ if (EXISTS ${AMD_HSMP_DIR}/amd_hsmp.h)
+ set(AMD_HSMP ${AMD_HSMP_DIR}/amd_hsmp.h)
+ endif()
+ endif()
+ if (NOT EXISTS ${AMD_HSMP})
+ # Look in some obvious places
+ find_path(AMD_HSMP_DIR amd_hsmp.h HINTS /usr/include/asm)
+ if (EXISTS ${AMD_HSMP_DIR}/amd_hsmp.h)
+ set(AMD_HSMP ${AMD_HSMP_DIR}/amd_hsmp.h)
+ endif()
+ endif()
+
+ if (EXISTS ${AMD_HSMP})
+ message(STATUS "Copying amd_hsmp.h from ${AMD_HSMP}")
+ file(COPY ${AMD_HSMP} DESTINATION ${PROJECT_SOURCE_DIR}/esmi_ib_library/include/asm/amd_hsmp.h)
+ else()
+ message(STATUS "Downloading 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()
+ if (EXISTS ${AMD_HSMP})
+ message(STATUS "Copying amd_hsmp.h from ${AMD_HSMP}")
+ file(COPY ${AMD_HSMP} DESTINATION ${PROJECT_SOURCE_DIR}/esmi_ib_library/include/asm/amd_hsmp.h)
+ else()
+ message(STATUS "Downloading 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
- ${PROJECT_SOURCE_DIR}/esmi_ib_library/include/asm/amd_hsmp.h)
+ https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/plain/arch/x86/include/uapi/asm/amd_hsmp.h
+ ${PROJECT_SOURCE_DIR}/esmi_ib_library/include/asm/amd_hsmp.h)
+ endif()
endif()
+
add_definitions("-DENABLE_ESMI_LIB=1")
set(ESMI_INC_DIR "${PROJECT_SOURCE_DIR}/esmi_ib_library/include")
set(ESMI_SRC_DIR "${PROJECT_SOURCE_DIR}/esmi_ib_library/src")
--
2.46.0
2.47.1

View File

@@ -1,5 +1,5 @@
%global rocm_release 6.2
%global rocm_patch 1
%global rocm_release 6.3
%global rocm_patch 0
%global rocm_version %{rocm_release}.%{rocm_patch}
%global upstreamname amdsmi
@@ -7,18 +7,19 @@
# Testing also depends on having AMD hardware cpu and/or gpu installed.
# Not suitable for a general %check
#
# Non root result for gfx1100 and this kernel 6.11.0-0.rc2.23.fc41.x86_64
# Non root result for gfx1100 and this kernel 6.13.0-0.rc0.20241126git7eef7e306d3c.10.fc42.x86_64
# 25 pass, 5 fail
# No oops
%bcond_with test
%if %{with test}
%global build_test ON
%else
%global build_test OFF
%endif
Name: amdsmi
Version: %{rocm_version}
%if 0%{?suse_version} || 0%{?rhel} && 0%{?rhel} < 10
Release: 1%{?dist}
%else
Release: %autorelease
%endif
Summary: AMD System Management Interface
License: NCSA AND MIT AND BSD-3-Clause
@@ -80,12 +81,14 @@ chmod a-x README.md
# bdf_regex = "(?:[0-6]?[0-9a-fA-F]{1,4}:)?[0-2]?[0-9a-fA-F]{1,2}:[0-9a-fA-F]{1,2}\.[0-7]"
sed -i -e 's@bdf_regex = "@bdf_regex = r"@' amdsmi_cli/BDF.py
# Install local gtests in same dir as tests
sed -i -e 's@${CPACK_PACKAGING_INSTALL_PREFIX}/lib@${SHARE_INSTALL_PREFIX}/tests@' tests/amd_smi_test/CMakeLists.txt
%build
%cmake \
-DBUILD_KERNEL_ASM_DIR=/usr/include/asm \
%if %{with test}
-DBUILD_TESTS=ON \
%endif
-DCMAKE_SKIP_INSTALL_RPATH=TRUE \
-DBUILD_TESTS=%build_test
%cmake_build
@@ -94,7 +97,6 @@ sed -i -e 's@bdf_regex = "@bdf_regex = r"@' amdsmi_cli/BDF.py
mkdir -p %{buildroot}/%{python3_sitelib}
mv %{buildroot}/usr/share/amdsmi %{buildroot}/%{python3_sitelib}
mv %{buildroot}/usr/share/setup.cfg %{buildroot}/%{python3_sitelib}/amdsmi/
mv %{buildroot}/usr/share/pyproject.toml %{buildroot}/%{python3_sitelib}/amdsmi/
# Remove some things
@@ -113,6 +115,9 @@ fi
if [ -f %{buildroot}%{_datadir}/_version.py ]; then
rm %{buildroot}%{_datadir}/_version.py
fi
if [ -f %{buildroot}%{_datadir}/setup.py ]; then
rm %{buildroot}%{_datadir}/setup.py
fi
# W: unstripped-binary-or-object /usr/lib/python3.13/site-packages/amdsmi/libamd_smi.so
# Does an explict open, so can not just rm it
@@ -126,18 +131,22 @@ rm %{buildroot}%{_libdir}/cmake/amd_smi/amd_smi-config.cmake
%files
%doc README.md
%license License.txt
%license LICENSE
%license esmi_ib_library_License.txt
%{_libdir}/libamd_smi.so.*
%{_libdir}/libgoamdsmi_shim64.so.*
%{_bindir}/amd-smi
%{_libexecdir}/amdsmi_cli
%{python3_sitelib}/amdsmi
%files devel
%{_includedir}/amd_smi
%dir %{_includedir}/amd_smi
%dir %{_libdir}/cmake/amd_smi
%{_includedir}/amd_smi/*.h
%{_includedir}/*.h
%{_libdir}/libamd_smi.so
%{_libdir}/cmake/amd_smi
%{_libdir}/libgoamdsmi_shim64.so
%{_libdir}/cmake/amd_smi/*.cmake
%if %{with test}
%files test
@@ -145,11 +154,10 @@ rm %{buildroot}%{_libdir}/cmake/amd_smi/amd_smi-config.cmake
%endif
%changelog
%if 0%{?suse_version}
* Sat Dec 7 2024 Tom Rix <Tom.Rix@amd.com> - 6.3.0-1
- Update to 6.3
* Sun Nov 3 2024 Tom Rix <Tom.Rix@amd.com> - 6.2.1-1
- Stub for tumbleweed
%else
%autochangelog
%endif

View File

@@ -1,2 +1,3 @@
SHA512 (amdsmi-6.2.1.tar.gz) = aa7349a84b85c914ecade91d16421fa885f15ce827f7186f404039e1f6a888e5a0ad0b6808e487d9ccbba9184504b4bfa0ab9c7623452c3ef050ddba96159cbe
SHA512 (esmi_pkg_ver-3.0.3.tar.gz) = dc485d1d5c3538c4006b3af471761f46e9db1cefd679986b1cecc9c5e6462ffb41993ef0c04c5af0f2742b13bd58f58b6ac352e5bf547e02dff949a0c3973726
SHA512 (amdsmi-6.3.0.tar.gz) = 9ac0486e411d7adf6ecfbc9657affede582297bdbe2441589b2203d6df08427e1ff5bb878ddc7e27ad259cf5b49daf7d8b874e97797b4c23695b4c9711a1bc63