mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 02:52:51 +03:00
gpu: nvgpu: add fault injection for nvgpu_readl
Add fault injection handling for nvgpu_readl() API. Function return zero on fault injection. Jira NVGPU-4453 Change-Id: If1b131811bde38e9a22f02e48f53726a03f51d08 Signed-off-by: vinodg <vinodg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2265045 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -123,4 +123,17 @@ void nvgpu_posix_io_record_access(struct gk20a *g,
|
||||
bool nvgpu_posix_io_check_sequence(struct gk20a *g,
|
||||
struct nvgpu_reg_access *sequence, u32 size, bool strict);
|
||||
|
||||
#ifdef NVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT
|
||||
/**
|
||||
* @brief Get fault injection structure.
|
||||
*
|
||||
* @param void.
|
||||
*
|
||||
* Returns the reference to nvgpu_readl fault injection structure.
|
||||
*
|
||||
* @return Pointer to nvgpu_readl fault injection structure.
|
||||
*/
|
||||
struct nvgpu_posix_fault_inj *nvgpu_readl_get_fault_injection(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -601,6 +601,7 @@ nvgpu_rbtree_search
|
||||
nvgpu_rbtree_unlink
|
||||
nvgpu_readl
|
||||
nvgpu_readl_impl
|
||||
nvgpu_readl_get_fault_injection
|
||||
nvgpu_request_firmware
|
||||
nvgpu_runlist_cleanup_sw
|
||||
nvgpu_runlist_construct_locked
|
||||
|
||||
@@ -25,10 +25,21 @@
|
||||
#include <nvgpu/bug.h>
|
||||
|
||||
#include <nvgpu/posix/io.h>
|
||||
#include <nvgpu/posix/posix-fault-injection.h>
|
||||
|
||||
#include "os_posix.h"
|
||||
|
||||
|
||||
#ifdef NVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT
|
||||
struct nvgpu_posix_fault_inj *nvgpu_readl_get_fault_injection(void)
|
||||
{
|
||||
struct nvgpu_posix_fault_inj_container *c =
|
||||
nvgpu_posix_fault_injection_get_container();
|
||||
|
||||
return &c->nvgpu_readl_fi;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function sets the IO callbacks to the passed set of callbacks. It
|
||||
* returns the value of the old IO callback struct pointer. This function
|
||||
@@ -80,6 +91,13 @@ u32 nvgpu_readl(struct gk20a *g, u32 r)
|
||||
.value = 0L
|
||||
};
|
||||
|
||||
#ifdef NVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT
|
||||
if (nvgpu_posix_fault_injection_handle_call(
|
||||
nvgpu_readl_get_fault_injection()) == true) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (callbacks == NULL || callbacks->readl == NULL) {
|
||||
BUG();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user