diff --git a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c index d19653062..616749118 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c @@ -66,6 +66,7 @@ #include "common/vgpu/perf/cyclestats_snapshot_vgpu.h" #include "common/vgpu/ptimer/ptimer_vgpu.h" #include "common/vgpu/init/init_vgpu.h" +#include "vgpu_hal_gp10b.h" #include "gp10b/gp10b.h" #include "gp10b/hal_gp10b.h" diff --git a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.h b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.h new file mode 100644 index 000000000..f16b54359 --- /dev/null +++ b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019, 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef VGPU_HAL_GP10B_H +#define VGPU_HAL_GP10B_H + +struct gk20a; + +int vgpu_gp10b_init_hal(struct gk20a *g); + +#endif diff --git a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c index a74ce35ca..1cbb2861d 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c @@ -84,6 +84,7 @@ #include "common/vgpu/perf/cyclestats_snapshot_vgpu.h" #include "common/vgpu/fifo/vgpu_fifo_gv11b.h" #include "common/vgpu/ptimer/ptimer_vgpu.h" +#include "vgpu_hal_gv11b.h" #include #include diff --git a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.h b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.h new file mode 100644 index 000000000..5b038b9ce --- /dev/null +++ b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019, 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef VGPU_HAL_GV11B_H +#define VGPU_HAL_GV11B_H + +struct gk20a; + +int vgpu_gv11b_init_hal(struct gk20a *g); + +#endif diff --git a/drivers/gpu/nvgpu/common/vgpu/mm/mm_vgpu.c b/drivers/gpu/nvgpu/common/vgpu/mm/mm_vgpu.c index 1754a6a4b..b1c70ade2 100644 --- a/drivers/gpu/nvgpu/common/vgpu/mm/mm_vgpu.c +++ b/drivers/gpu/nvgpu/common/vgpu/mm/mm_vgpu.c @@ -133,24 +133,6 @@ u64 vgpu_mm_bar1_map_userd(struct gk20a *g, struct nvgpu_mem *mem, u32 offset) addr = 0; } else { addr = p->gpu_va; - - /* Server returns gpu_va assuming full BAR1 range. - * In case of reduced BAR1 configuration, we only map - * the portion of BAR1 reserved for this guest. - * As a result, we need to use the offset from the start - * of this range, instead of the gpu_va. - * - * offset - * <----> - * Guest IPA +========+ - * : X : - * BAR1 PA +----+========+-----------+ - * <---------> - * gpu_va - */ - if (vgpu_is_reduced_bar1(g)) { - addr = offset; - } } return addr; diff --git a/drivers/gpu/nvgpu/common/vgpu/mm/mm_vgpu.h b/drivers/gpu/nvgpu/common/vgpu/mm/mm_vgpu.h index d62f09e77..eb88ac25c 100644 --- a/drivers/gpu/nvgpu/common/vgpu/mm/mm_vgpu.h +++ b/drivers/gpu/nvgpu/common/vgpu/mm/mm_vgpu.h @@ -63,5 +63,6 @@ u64 vgpu_locked_gmmu_map(struct vm_gk20a *vm, struct vm_gk20a_mapping_batch *batch, enum nvgpu_aperture aperture); int vgpu_init_mm_support(struct gk20a *g); +u64 vgpu_mm_bar1_map_userd(struct gk20a *g, struct nvgpu_mem *mem, u32 offset); #endif /* NVGPU_MM_VGPU_H */ diff --git a/drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h b/drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h index ca49260a7..743e530d3 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h +++ b/drivers/gpu/nvgpu/include/nvgpu/vgpu/vgpu.h @@ -29,11 +29,7 @@ #include #include -struct device; -struct nvgpu_mem; struct gk20a; -struct vm_gk20a; -struct nvgpu_gr_ctx; struct vgpu_ecc_stat; struct vgpu_priv_data { @@ -61,11 +57,4 @@ static inline u64 vgpu_get_handle(struct gk20a *g) return priv->virt_handle; } -u64 vgpu_mm_bar1_map_userd(struct gk20a *g, struct nvgpu_mem *mem, u32 offset); - -int vgpu_gp10b_init_hal(struct gk20a *g); -int vgpu_gv11b_init_hal(struct gk20a *g); - -bool vgpu_is_reduced_bar1(struct gk20a *g); - #endif /* NVGPU_VGPU_H */ diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c index 97021ce21..50ae13e48 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c +++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c @@ -35,6 +35,8 @@ #include #include +#include + #include "vgpu_linux.h" #include "common/vgpu/gr/fecs_trace_vgpu.h" #include "common/vgpu/clk_vgpu.h" @@ -467,15 +469,6 @@ int vgpu_remove(struct platform_device *pdev) return 0; } -bool vgpu_is_reduced_bar1(struct gk20a *g) -{ - struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); - struct fifo_gk20a *f = &g->fifo; - u32 size = f->num_channels * f->userd_entry_size; - - return resource_size(l->bar1_mem) == size; -} - int vgpu_tegra_suspend(struct device *dev) { struct tegra_vgpu_cmd_msg msg = {}; diff --git a/drivers/gpu/nvgpu/os/posix/posix-vgpu.c b/drivers/gpu/nvgpu/os/posix/posix-vgpu.c index 1f9a61e86..5277c3108 100644 --- a/drivers/gpu/nvgpu/os/posix/posix-vgpu.c +++ b/drivers/gpu/nvgpu/os/posix/posix-vgpu.c @@ -25,6 +25,7 @@ #include #include #include +#include struct vgpu_priv_data *vgpu_get_priv_data(struct gk20a *g) { @@ -32,12 +33,6 @@ struct vgpu_priv_data *vgpu_get_priv_data(struct gk20a *g) return NULL; } -bool vgpu_is_reduced_bar1(struct gk20a *g) -{ - BUG(); - return false; -} - int vgpu_ivc_init(struct gk20a *g, u32 elems, const size_t *queue_sizes, u32 queue_start, u32 num_queues) {