From e32f62fadfcde413bcd9b5af61ad884e27ba2bf1 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Thu, 6 Apr 2017 15:30:01 -0700 Subject: gpu: nvgpu: Move Linux nvgpu_mem fields Hide the Linux specific nvgpu_mem fields so that in subsequent patches core code can instead of using struct sg_table it can use mem_desc. Routines for accessing system specific fields will be added as needed. This is the first step in a fairly major overhaul of the GMMU mapping routines. There are numerous issues with the current design (or lack there of): massively coupled code, system dependencies, disorganization, etc. JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: I2e7d3ae3a07468cfc17c1c642d28ed1b0952474d Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1464076 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/linux/nvgpu_mem.h | 29 ++++++++++++++ drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h | 48 ++++++++++++++--------- 2 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 drivers/gpu/nvgpu/include/nvgpu/linux/nvgpu_mem.h (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/linux/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/linux/nvgpu_mem.h new file mode 100644 index 00000000..8b1e646e --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/linux/nvgpu_mem.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __NVGPU_LINUX_NVGPU_MEM_H__ +#define __NVGPU_LINUX_NVGPU_MEM_H__ + +struct page; +struct sg_table; + +struct nvgpu_mem_priv { + struct page **pages; + struct sg_table *sgt; + unsigned long flags; +}; + +#endif diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h index ae5dcc6e..1590ee7a 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h @@ -17,10 +17,11 @@ #ifndef __NVGPU_NVGPU_MEM_H__ #define __NVGPU_NVGPU_MEM_H__ -#include - +#include #include +#include + struct page; struct sg_table; @@ -39,18 +40,32 @@ enum nvgpu_aperture { }; struct nvgpu_mem { - void *cpu_va; /* sysmem only */ - struct page **pages; /* sysmem only */ - struct sg_table *sgt; - enum nvgpu_aperture aperture; - size_t size; - u64 gpu_va; - bool fixed; /* vidmem only */ - bool user_mem; /* vidmem only */ - struct nvgpu_allocator *allocator; /* vidmem only */ - struct nvgpu_list_node clear_list_entry; /* vidmem only */ - bool skip_wmb; - unsigned long flags; + /* + * Populated for all nvgpu_mem structs - vidmem or system. + */ + enum nvgpu_aperture aperture; + size_t size; + u64 gpu_va; + bool skip_wmb; + + /* + * Only populated for a sysmem allocation. + */ + void *cpu_va; + + /* + * Fields only populated for vidmem allocations. + */ + bool fixed; + bool user_mem; + struct nvgpu_allocator *allocator; + struct nvgpu_list_node clear_list_entry; + + /* + * This is defined by the system specific header. It can be empty if + * there's no system specific stuff for a given system. + */ + struct nvgpu_mem_priv priv; }; static inline struct nvgpu_mem * @@ -61,11 +76,6 @@ nvgpu_mem_from_clear_list_entry(struct nvgpu_list_node *node) clear_list_entry)); }; -struct nvgpu_mem_sub { - u32 offset; - u32 size; -}; - static inline const char *nvgpu_aperture_str(enum nvgpu_aperture aperture) { switch (aperture) { -- cgit v1.2.2