From 312f6c2c5f8b2ad6ab95300896ec4e7be9d5f833 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Wed, 22 Nov 2017 13:20:19 +0530 Subject: gpu: nvgpu: remove dependency on linux header for sim_gk20a* This patch removes linux dependencies from sim_gk20a.h under gk20a/sim_gk20a.h. The following changes are made in this patch. 1) Created a linux based structure sim_gk20a_linux that contains a common sim_gk20a struct inside it. The common struct sim_gk20a doesn't contain any linux specific structs. 2) The common struct sim_gk20a contains an added function pointer which is used to invoke gk20a_sim_esc_readl() method. 3) sim_gk20a.c is moved to nvgpu/common/linux along with a new header sim_gk20a.h that contains the definition of struct sim_gk20a_linux. 4) struct gk20a now contains a pointer of sim_gk20a instead of the entire object. The memory for this struct is allocated and initialized during gk20a_init_support() and freed during invocation of gk20_remove_support(). 5) We first obtain the pointer for struct sim_gk20a_linux from the pointer of sim_gk20a using the container_of method in order to work on the struct. JIRA NVGPU-386 Change-Id: Ic82b8702642377f82694577a53c3ca0b9c1bb2ab Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1603073 GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/sim_gk20a.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/sim_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/sim_gk20a.h b/drivers/gpu/nvgpu/gk20a/sim_gk20a.h index 44378e7a..8f23abd8 100644 --- a/drivers/gpu/nvgpu/gk20a/sim_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/sim_gk20a.h @@ -3,7 +3,7 @@ * * GK20A sim support * - * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,25 +27,16 @@ #define __SIM_GK20A_H__ struct gk20a; -struct platform_device; struct sim_gk20a { struct gk20a *g; - struct resource *reg_mem; - void __iomem *regs; - struct { - struct page *page; - void *kvaddr; - u64 phys; - } send_bfr, recv_bfr, msg_bfr; u32 send_ring_put; u32 recv_ring_get; u32 recv_ring_put; u32 sequence_base; void (*remove_support)(struct sim_gk20a *); + int (*esc_readl)( + struct gk20a *g, char *path, u32 index, u32 *data); }; -int gk20a_init_sim_support(struct gk20a *g); -int gk20a_sim_esc_readl(struct gk20a *g, char *path, u32 index, u32 *data); - #endif /*__SIM_GK20A_H__*/ -- cgit v1.2.2