gpu: nvgpu: vgpu: add function vgpu_is_reduced_bar1()

The implementation is os specific for now.

Jira EVLR-2364

Change-Id: I8ac390b056aa9ca5b5d4ab2ac4dbc06f6689f4a4
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1649944
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nirav Patel <nipatel@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Richard Zhao
2018-01-29 21:31:38 -08:00
committed by mobile promotions
parent 8202be50ce
commit 583c3c9dd4
3 changed files with 10 additions and 6 deletions

View File

@@ -31,9 +31,6 @@
#include "vgpu.h" #include "vgpu.h"
#include "fifo_vgpu.h" #include "fifo_vgpu.h"
#include "common/linux/channel.h"
#include "common/linux/os_linux.h"
#include <nvgpu/hw/gk20a/hw_fifo_gk20a.h> #include <nvgpu/hw/gk20a/hw_fifo_gk20a.h>
#include <nvgpu/hw/gk20a/hw_ram_gk20a.h> #include <nvgpu/hw/gk20a/hw_ram_gk20a.h>
@@ -265,7 +262,6 @@ clean_up_runlist:
static int vgpu_init_fifo_setup_sw(struct gk20a *g) static int vgpu_init_fifo_setup_sw(struct gk20a *g)
{ {
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
struct fifo_gk20a *f = &g->fifo; struct fifo_gk20a *f = &g->fifo;
struct vgpu_priv_data *priv = vgpu_get_priv_data(g); struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
unsigned int chid; unsigned int chid;
@@ -301,8 +297,7 @@ static int vgpu_init_fifo_setup_sw(struct gk20a *g)
/* if reduced BAR1 range is specified, use offset of 0 /* if reduced BAR1 range is specified, use offset of 0
* (server returns offset assuming full BAR1 range) * (server returns offset assuming full BAR1 range)
*/ */
if (resource_size(l->bar1_mem) == if (vgpu_is_reduced_bar1(g))
(resource_size_t)f->userd.size)
f->userd.gpu_va = 0; f->userd.gpu_va = 0;
} }

View File

@@ -99,5 +99,6 @@ int vgpu_read_ptimer(struct gk20a *g, u64 *value);
int vgpu_get_timestamps_zipper(struct gk20a *g, int vgpu_get_timestamps_zipper(struct gk20a *g,
u32 source_id, u32 count, u32 source_id, u32 count,
struct nvgpu_cpu_time_correlation_sample *samples); struct nvgpu_cpu_time_correlation_sample *samples);
bool vgpu_is_reduced_bar1(struct gk20a *g);
#endif #endif

View File

@@ -461,3 +461,11 @@ int vgpu_remove(struct platform_device *pdev)
return 0; return 0;
} }
bool vgpu_is_reduced_bar1(struct gk20a *g)
{
struct fifo_gk20a *f = &g->fifo;
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
return resource_size(l->bar1_mem) == (resource_size_t)f->userd.size;
}