From 127aa9735b07a2613bdbcfedbf741e44cf99ee9e Mon Sep 17 00:00:00 2001 From: Nicolas Benech Date: Wed, 27 Jun 2018 14:45:03 -0700 Subject: gpu: nvgpu: posix: Add low level unit test IO mocking Add an interface that the unit test modules can use to interact with nvgpu IO accessors. This interface is incredibly simple but not the easiest to use. More simple wrappers will be added later. JIRA NVGPU-1040 Change-Id: I325f09a1739a58ea6bcb1c74834037d6977ce0e8 Signed-off-by: Nicolas Benech Reviewed-on: https://git-master.nvidia.com/r/1741952 GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/posix/os_posix.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'drivers/gpu/nvgpu/os/posix/os_posix.h') diff --git a/drivers/gpu/nvgpu/os/posix/os_posix.h b/drivers/gpu/nvgpu/os/posix/os_posix.h index 955186ef..ff8c9817 100644 --- a/drivers/gpu/nvgpu/os/posix/os_posix.h +++ b/drivers/gpu/nvgpu/os/posix/os_posix.h @@ -25,8 +25,34 @@ #include "gk20a/gk20a.h" +struct nvgpu_posix_io_callbacks; + struct nvgpu_os_posix { struct gk20a g; + + + /* + * IO callbacks for handling the nvgpu IO accessors. + */ + struct nvgpu_posix_io_callbacks *callbacks; + + /* + * Memory-mapped register space for unit tests. + */ + struct nvgpu_list_node reg_space_head; + int error_code; + + + /* + * List to record sequence of register writes. + */ + struct nvgpu_list_node recorder_head; + bool recording; }; +static inline struct nvgpu_os_posix *nvgpu_os_posix_from_gk20a(struct gk20a *g) +{ + return container_of(g, struct nvgpu_os_posix, g); +} + #endif -- cgit v1.2.2