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:
T.J. Vivek Vilvaraj 2020-06-29 09:56:55 +00:00 committed by sys_ocldev
parent e027a2653d
commit 96a7b1e066
5 changed files with 65 additions and 0 deletions

View File

@ -385,6 +385,21 @@ function(generate_l0_lib LIB_NAME MOCKABLE)
create_project_source_tree(${LIB_NAME})
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)
generate_l0_lib(${L0_RELEASE_LIB_NAME} TRUE)
else()

View File

@ -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()

View File

@ -17,3 +17,26 @@ endif()
# Make our source files visible to parent
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()

View File

@ -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'"

View File

@ -0,0 +1 @@
0