add rules to install RAS udev rules
- create rules to install Udev rules in configurable location - create files relating to RAS counters Change-Id: Iebd57ba2dd09494ea4586b305cd56c86a71fb8b0
This commit is contained in:
parent
e027a2653d
commit
96a7b1e066
|
@ -385,6 +385,21 @@ function(generate_l0_lib LIB_NAME MOCKABLE)
|
||||||
create_project_source_tree(${LIB_NAME})
|
create_project_source_tree(${LIB_NAME})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
option(L0_INSTALL_UDEV_RULES "Install udev rules. An attempt to automatically determine the proper location will be made if UDEV_RULES_DIR is not set." OFF)
|
||||||
|
if(L0_INSTALL_UDEV_RULES)
|
||||||
|
if(DEFINED UDEV_RULES_DIR)
|
||||||
|
set(UDEV_RULES_DIR_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${BRANCH_TYPE}/UdevRulesDir.cmake)
|
||||||
|
endif()
|
||||||
|
if(NOT UDEV_RULES_DIR_FOUND)
|
||||||
|
message(SEND_ERROR "udev rule install requested but no rules directory found")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(DONT_CARE_OF_VIRTUALS)
|
if(DONT_CARE_OF_VIRTUALS)
|
||||||
generate_l0_lib(${L0_RELEASE_LIB_NAME} TRUE)
|
generate_l0_lib(${L0_RELEASE_LIB_NAME} TRUE)
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2020 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
#
|
||||||
|
|
||||||
|
set(UDEV_RULES_DIR_FOUND FALSE)
|
||||||
|
|
||||||
|
foreach(rules_dir IN ITEMS "/lib/udev/rules.d" "/usr/lib/udev/rules.d")
|
||||||
|
if(IS_DIRECTORY ${rules_dir})
|
||||||
|
set(UDEV_RULES_DIR ${rules_dir} CACHE PATH "Install path for udev rules")
|
||||||
|
set(UDEV_RULES_DIR_FOUND TRUE)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
|
@ -17,3 +17,26 @@ endif()
|
||||||
|
|
||||||
# Make our source files visible to parent
|
# Make our source files visible to parent
|
||||||
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_RAS_LINUX ${L0_SRCS_TOOLS_SYSMAN_RAS_LINUX})
|
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_RAS_LINUX ${L0_SRCS_TOOLS_SYSMAN_RAS_LINUX})
|
||||||
|
|
||||||
|
if(L0_INSTALL_UDEV_RULES)
|
||||||
|
install(
|
||||||
|
FILES "${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/udev/99-drm_ze_intel_gpu.rules"
|
||||||
|
DESTINATION ${UDEV_RULES_DIR}
|
||||||
|
COMPONENT ${PROJECT_NAME}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(L0_INSTALL_UDEV_RULES)
|
||||||
|
foreach(counter IN ITEMS
|
||||||
|
ras_reset_count
|
||||||
|
ras_cache_error_uncorrectable
|
||||||
|
ras_cache_error_correctable
|
||||||
|
)
|
||||||
|
install(
|
||||||
|
FILES "${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/udev/counter_init"
|
||||||
|
DESTINATION "/var/lib/libze_intel_gpu/"
|
||||||
|
COMPONENT ${PROJECT_NAME}
|
||||||
|
RENAME ${counter}
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#
|
||||||
|
## Copyright (C) 2020 Intel Corporation
|
||||||
|
##
|
||||||
|
## SPDX-License-Identifier: MIT
|
||||||
|
##
|
||||||
|
#
|
||||||
|
|
||||||
|
ACTION=="change", \
|
||||||
|
SUBSYSTEM=="drm", \
|
||||||
|
ENV{RESET}=="1", \
|
||||||
|
RUN+="/bin/sh -c 'val=`cat /var/lib/libze_intel_gpu/ras_reset_count` && newval=`expr $val + 1` && echo $newval > /var/lib/libze_intel_gpu/ras_reset_count'"
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
Loading…
Reference in New Issue