mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Return size of ring buffer from NVGPU_CTXSW_IOCTL_RING_SETUP
NVGPU_CTXSW_IOCTL_RING_SETUP is used to setup a ring buffer of custom size for FECS tracing. It uses size field from its arguments to setup a user-mapped ring buffer for holding FECS Trace entries. The value from this field is rounded up to nearest page-size boundary. This rounded up value is supposed to be returned by the IOCTL (as per description of the field in nvgpu.h). That is currently not the case and the IOCTL just returns the same value as that was passed. This change fixes this issue by returning updated value. Bug 200469520 Change-Id: I477aefaede9a4cdba921026466db3fb8fbfd0712 Signed-off-by: Anup Mahindre <amahindre@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1955337 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
4e9e199380
commit
ae57a78c73
@@ -170,7 +170,7 @@ static int gk20a_ctxsw_dev_ioctl_trace_disable(struct gk20a_ctxsw_dev *dev)
|
||||
}
|
||||
|
||||
static int gk20a_ctxsw_dev_alloc_buffer(struct gk20a_ctxsw_dev *dev,
|
||||
size_t size)
|
||||
size_t *size)
|
||||
{
|
||||
struct gk20a *g = dev->g;
|
||||
void *buf;
|
||||
@@ -184,14 +184,14 @@ static int gk20a_ctxsw_dev_alloc_buffer(struct gk20a_ctxsw_dev *dev,
|
||||
dev->hdr = NULL;
|
||||
}
|
||||
|
||||
err = g->ops.fecs_trace.alloc_user_buffer(g, &buf, &size);
|
||||
err = g->ops.fecs_trace.alloc_user_buffer(g, &buf, size);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
dev->hdr = buf;
|
||||
dev->ents = (struct nvgpu_gpu_ctxsw_trace_entry *) (dev->hdr + 1);
|
||||
dev->size = size;
|
||||
dev->size = *size;
|
||||
dev->num_ents = dev->hdr->num_ents;
|
||||
|
||||
nvgpu_log(g, gpu_dbg_ctxsw, "size=%zu hdr=%p ents=%p num_ents=%d",
|
||||
@@ -244,9 +244,10 @@ static int gk20a_ctxsw_dev_ioctl_ring_setup(struct gk20a_ctxsw_dev *dev,
|
||||
return -EINVAL;
|
||||
|
||||
nvgpu_mutex_acquire(&dev->write_lock);
|
||||
ret = gk20a_ctxsw_dev_alloc_buffer(dev, size);
|
||||
ret = gk20a_ctxsw_dev_alloc_buffer(dev, &size);
|
||||
nvgpu_mutex_release(&dev->write_lock);
|
||||
|
||||
args->size = size;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -366,7 +367,7 @@ int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp)
|
||||
nvgpu_log(g, gpu_dbg_ctxsw, "size=%zu entries=%d ent_size=%zu",
|
||||
size, n, sizeof(struct nvgpu_gpu_ctxsw_trace_entry));
|
||||
|
||||
err = gk20a_ctxsw_dev_alloc_buffer(dev, size);
|
||||
err = gk20a_ctxsw_dev_alloc_buffer(dev, &size);
|
||||
if (!err) {
|
||||
filp->private_data = dev;
|
||||
nvgpu_log(g, gpu_dbg_ctxsw, "filp=%p dev=%p size=%zu",
|
||||
|
||||
Reference in New Issue
Block a user