mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +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:
@@ -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