diff options
author | Debarshi Dutta <ddutta@nvidia.com> | 2017-11-13 03:21:48 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-23 06:03:36 -0500 |
commit | 536ec21b565ab1368b53a26d6ec7ed05857f0775 (patch) | |
tree | 5f385385ae730dd2d98463502d249150262f8b9b /drivers/gpu/nvgpu/gk20a/regops_gk20a.c | |
parent | ba2e59dc41f593bb011e0ec58c969337a35f4cf1 (diff) |
gpu: nvgpu: remove dependency on linux header for regops_gk20a*
This patch removes the dependency on the header file "uapi/linux/nvgpu.h"
for regops_gk20a.c. The original structure and definitions in the
uapi/linux/nvgpu.h is maintained for userspace libnvrm_gpu.h. The
following changes are made in this patch.
1) Defined common versions of the NVGPU_DBG_GPU_REG_OP* definitions inside
regops_gk20a.h.
2) Defined common version of struct nvgpu_dbg_gpu_reg_op inside
regops_gk20a.h naming it struct nvgpu_dbg_reg_op.
3) Constructed APIs to convert the NVGPU_DBG_GPU_REG_OP* definitions from
linux versions to common and vice versa.
4) Constructed APIs to convert from struct nvgpu_dbg_gpu_reg_op to
struct nvgpu_dbg_reg_op and vice versa.
5) The ioctl handler nvgpu_ioctl_channel_reg_ops first copies from
userspace into a local storage based on struct nvgpu_dbg_gpu_reg_op which
is copied into the struct nvgpu_dbg_reg_op using the APIs above and
after executing the regops handler passes the data back into userspace
by copying back data from struct nvgpu_dbg_reg_op to struct
nvgpu_dbg_gpu_reg_opi.
JIRA NVGPU-417
Change-Id: I23bad48d2967a629a6308c7484f3741a89db6537
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1596972
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/regops_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/regops_gk20a.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c index f0cf5205..06cd5051 100644 --- a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c | |||
@@ -22,9 +22,6 @@ | |||
22 | * DEALINGS IN THE SOFTWARE. | 22 | * DEALINGS IN THE SOFTWARE. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/err.h> | ||
26 | #include <uapi/linux/nvgpu.h> | ||
27 | |||
28 | #include "gk20a.h" | 25 | #include "gk20a.h" |
29 | #include "gr_gk20a.h" | 26 | #include "gr_gk20a.h" |
30 | #include "dbg_gpu_gk20a.h" | 27 | #include "dbg_gpu_gk20a.h" |
@@ -377,12 +374,12 @@ static const u32 gk20a_qctl_whitelist_ranges_count = | |||
377 | 374 | ||
378 | static bool validate_reg_ops(struct dbg_session_gk20a *dbg_s, | 375 | static bool validate_reg_ops(struct dbg_session_gk20a *dbg_s, |
379 | u32 *ctx_rd_count, u32 *ctx_wr_count, | 376 | u32 *ctx_rd_count, u32 *ctx_wr_count, |
380 | struct nvgpu_dbg_gpu_reg_op *ops, | 377 | struct nvgpu_dbg_reg_op *ops, |
381 | u32 op_count); | 378 | u32 op_count); |
382 | 379 | ||
383 | 380 | ||
384 | int exec_regops_gk20a(struct dbg_session_gk20a *dbg_s, | 381 | int exec_regops_gk20a(struct dbg_session_gk20a *dbg_s, |
385 | struct nvgpu_dbg_gpu_reg_op *ops, | 382 | struct nvgpu_dbg_reg_op *ops, |
386 | u64 num_ops) | 383 | u64 num_ops) |
387 | { | 384 | { |
388 | int err = 0; | 385 | int err = 0; |
@@ -519,7 +516,7 @@ int exec_regops_gk20a(struct dbg_session_gk20a *dbg_s, | |||
519 | 516 | ||
520 | 517 | ||
521 | static int validate_reg_op_info(struct dbg_session_gk20a *dbg_s, | 518 | static int validate_reg_op_info(struct dbg_session_gk20a *dbg_s, |
522 | struct nvgpu_dbg_gpu_reg_op *op) | 519 | struct nvgpu_dbg_reg_op *op) |
523 | { | 520 | { |
524 | int err = 0; | 521 | int err = 0; |
525 | 522 | ||
@@ -559,7 +556,7 @@ static int validate_reg_op_info(struct dbg_session_gk20a *dbg_s, | |||
559 | } | 556 | } |
560 | 557 | ||
561 | static bool check_whitelists(struct dbg_session_gk20a *dbg_s, | 558 | static bool check_whitelists(struct dbg_session_gk20a *dbg_s, |
562 | struct nvgpu_dbg_gpu_reg_op *op, u32 offset) | 559 | struct nvgpu_dbg_reg_op *op, u32 offset) |
563 | { | 560 | { |
564 | struct gk20a *g = dbg_s->g; | 561 | struct gk20a *g = dbg_s->g; |
565 | bool valid = false; | 562 | bool valid = false; |
@@ -630,7 +627,7 @@ static bool check_whitelists(struct dbg_session_gk20a *dbg_s, | |||
630 | 627 | ||
631 | /* note: the op here has already been through validate_reg_op_info */ | 628 | /* note: the op here has already been through validate_reg_op_info */ |
632 | static int validate_reg_op_offset(struct dbg_session_gk20a *dbg_s, | 629 | static int validate_reg_op_offset(struct dbg_session_gk20a *dbg_s, |
633 | struct nvgpu_dbg_gpu_reg_op *op) | 630 | struct nvgpu_dbg_reg_op *op) |
634 | { | 631 | { |
635 | int err; | 632 | int err; |
636 | u32 buf_offset_lo, buf_offset_addr, num_offsets, offset; | 633 | u32 buf_offset_lo, buf_offset_addr, num_offsets, offset; |
@@ -689,7 +686,7 @@ static int validate_reg_op_offset(struct dbg_session_gk20a *dbg_s, | |||
689 | 686 | ||
690 | static bool validate_reg_ops(struct dbg_session_gk20a *dbg_s, | 687 | static bool validate_reg_ops(struct dbg_session_gk20a *dbg_s, |
691 | u32 *ctx_rd_count, u32 *ctx_wr_count, | 688 | u32 *ctx_rd_count, u32 *ctx_wr_count, |
692 | struct nvgpu_dbg_gpu_reg_op *ops, | 689 | struct nvgpu_dbg_reg_op *ops, |
693 | u32 op_count) | 690 | u32 op_count) |
694 | { | 691 | { |
695 | u32 i; | 692 | u32 i; |