diff --git a/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b.c b/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b.c index db739f734..d5af05663 100644 --- a/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b.c +++ b/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b.c @@ -34,7 +34,7 @@ void gv11b_syncpt_add_wait_cmd(struct gk20a *g, u32 id, u32 thresh, u64 gpu_va_base) { u64 gpu_va = gpu_va_base + - nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(id); + nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(g, id); u32 data[] = { /* sema_addr_lo */ 0x20010017, diff --git a/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c b/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c index bc686af9f..5dc0e3834 100644 --- a/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c +++ b/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c @@ -1,7 +1,7 @@ /* * GV11B syncpt cmdbuf * - * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2020, 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"), @@ -77,7 +77,8 @@ int gv11b_syncpt_alloc_buf(struct nvgpu_channel *c, nr_pages = DIV_ROUND_UP(g->syncpt_size, PAGE_SIZE); err = nvgpu_mem_create_from_phys(g, syncpt_buf, nvgpu_safe_add_u64(g->syncpt_unit_base, - nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(syncpt_id)), + nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(g, + syncpt_id)), nr_pages); if (err < 0) { nvgpu_err(g, "failed to create mem from physical addr"); diff --git a/drivers/gpu/nvgpu/hal/vgpu/sync/syncpt_cmdbuf_gv11b_vgpu.c b/drivers/gpu/nvgpu/hal/vgpu/sync/syncpt_cmdbuf_gv11b_vgpu.c index 8e257d713..705c040d5 100644 --- a/drivers/gpu/nvgpu/hal/vgpu/sync/syncpt_cmdbuf_gv11b_vgpu.c +++ b/drivers/gpu/nvgpu/hal/vgpu/sync/syncpt_cmdbuf_gv11b_vgpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2020, 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"), @@ -107,7 +107,8 @@ int vgpu_gv11b_syncpt_alloc_buf(struct nvgpu_channel *c, p->gpu_va = syncpt_buf->gpu_va; p->len = g->syncpt_size; p->offset = - nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(syncpt_id); + nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(g, + syncpt_id); p->prot = TEGRA_VGPU_MAP_PROT_NONE; err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); err = err ? err : msg.ret; diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvhost.h b/drivers/gpu/nvgpu/include/nvgpu/nvhost.h index 724b5f791..121605119 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvhost.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvhost.h @@ -251,13 +251,15 @@ int nvgpu_nvhost_get_syncpt_aperture( /** * @brief Get offset of the sync point from MSS aperture base. * + * @param g [in] The GPU super structure. * @param syncpt_id [in] Sync point id. * * - Multiply the id with 0x1000. * * @return Sync point offset. */ -u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id); +u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(struct gk20a *g, + u32 syncpt_id); #ifdef __KERNEL__ int nvgpu_nvhost_syncpt_init(struct gk20a *g); #endif diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/posix-nvhost.h b/drivers/gpu/nvgpu/include/nvgpu/posix/posix-nvhost.h index 8850311f3..c5c8eaa35 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/posix-nvhost.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/posix-nvhost.h @@ -47,7 +47,8 @@ int nvgpu_nvhost_get_syncpt_aperture( struct nvgpu_nvhost_dev *nvgpu_syncpt_dev, u64 *base, size_t *size); -u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id); +u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(struct gk20a *g, + u32 syncpt_id); void nvgpu_nvhost_syncpt_set_minval(struct nvgpu_nvhost_dev *nvgpu_syncpt_dev, u32 id, u32 val); diff --git a/drivers/gpu/nvgpu/os/linux/nvhost.c b/drivers/gpu/nvgpu/os/linux/nvhost.c index bd420803c..35ee8f9a8 100644 --- a/drivers/gpu/nvgpu/os/linux/nvhost.c +++ b/drivers/gpu/nvgpu/os/linux/nvhost.c @@ -224,7 +224,8 @@ int nvgpu_nvhost_get_syncpt_aperture( nvhost_dev->host1x_pdev, (phys_addr_t *)base, size); } -u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id) +u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(struct gk20a *g, + u32 syncpt_id) { return nvhost_syncpt_unit_interface_get_byte_offset(syncpt_id); } @@ -293,7 +294,7 @@ int nvgpu_nvhost_syncpt_init(struct gk20a *g) } g->syncpt_size = - nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1); + nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(g, 1); nvgpu_info(g, "syncpt_unit_base %llx syncpt_unit_size %zx size %x\n", g->syncpt_unit_base, g->syncpt_unit_size, g->syncpt_size); diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c b/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c index ce1fc7388..18c01bb8d 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c @@ -67,7 +67,8 @@ int gv11b_vgpu_probe(struct device *dev) nvgpu_err(g, "Failed to get syncpt interface"); return -ENOSYS; } - g->syncpt_size = nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1); + g->syncpt_size = + nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(g, 1); nvgpu_info(g, "syncpt_unit_base %llx syncpt_unit_size %zx size %x\n", g->syncpt_unit_base, g->syncpt_unit_size, g->syncpt_size); #endif diff --git a/drivers/gpu/nvgpu/os/posix/posix-nvhost.c b/drivers/gpu/nvgpu/os/posix/posix-nvhost.c index 68d08eae3..6b88b0e35 100644 --- a/drivers/gpu/nvgpu/os/posix/posix-nvhost.c +++ b/drivers/gpu/nvgpu/os/posix/posix-nvhost.c @@ -71,7 +71,7 @@ int nvgpu_get_nvhost_dev(struct gk20a *g) goto fail_nvgpu_get_nvhost_dev; } g->syncpt_size = - nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1); + nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(g, 1); return 0; @@ -102,7 +102,8 @@ const char *nvgpu_nvhost_syncpt_get_name( return NULL; } -u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id) +u32 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(struct gk20a *g, + u32 syncpt_id) { return nvgpu_safe_mult_u32(syncpt_id, 0x1000U); }