From aaf11d61f18bc13191cecf3d9caa981732f84152 Mon Sep 17 00:00:00 2001 From: Shridhar Rasal Date: Thu, 5 Dec 2019 18:21:39 +0800 Subject: [PATCH] video: tegra: host: nvdla: set EMC rate on device open Currently, - On device node close, nvhost ACM updates clock rate to default rate. - DLA default rate is set to UINT_MAX. - These causes max rate requests from DLA on device node close. Fix, - Set default rate for DLA as zero. On device node close, aggregrate requests capped. - On device node open, keep EMC requests to max. so DLA inference doesn't impact for perf. Bug 2769574 Change-Id: Icdaa8943ee143a5fa8c7310db9b7fac636c5be50 Signed-off-by: Shridhar Rasal Signed-off-by: nmalwade Reviewed-on: https://git-master.nvidia.com/r/2255718 GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/video/tegra/host/nvdla/nvdla_ioctl.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/video/tegra/host/nvdla/nvdla_ioctl.c b/drivers/video/tegra/host/nvdla/nvdla_ioctl.c index a9bb63b8..f0b234ae 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_ioctl.c +++ b/drivers/video/tegra/host/nvdla/nvdla_ioctl.c @@ -1125,7 +1125,7 @@ static int nvdla_open(struct inode *inode, struct file *file) struct platform_device *pdev = pdata->pdev; struct nvdla_device *nvdla_dev = pdata->private_data; struct nvdla_private *priv; - int err = 0; + int err = 0, index; priv = kmalloc(sizeof(*priv), GFP_KERNEL); if (unlikely(priv == NULL)) { @@ -1143,6 +1143,22 @@ static int nvdla_open(struct inode *inode, struct file *file) if (err < 0) goto err_add_client; + /* set rate for EMC to max + * on device release ACM sets to default rate + */ + for (index = 0; index < NVHOST_MODULE_MAX_CLOCKS; index++) { + struct nvhost_clock *clock = &pdata->clocks[index]; + + if (clock->moduleid == + NVHOST_MODULE_ID_EXTERNAL_MEMORY_CONTROLLER) { + err = nvhost_module_set_rate(pdev, priv, UINT_MAX, + index, clock->bwmgr_request_type); + if (err < 0) + goto err_alloc_queue; + break; + } + } + priv->queue = nvdla_queue_alloc(nvdla_dev->pool, MAX_NVDLA_TASK_COUNT, nvdla_dev->submit_mode == NVDLA_SUBMIT_MODE_CHANNEL);