From 58735e45bfd0810f4237d3b003952b620c641c2c Mon Sep 17 00:00:00 2001 From: Arto Merilainen Date: Mon, 22 Jan 2018 15:41:56 +0200 Subject: video: tegra: host: Skip GoS if ctxs are isolated Currently GoS is enabled always for the devices that support GoS, however, this is not required in cases where engine channel submission mode is enabled: All waits in this scneario are done on Host1x and the engine does not need to access the GoS or syncpoint<->MSS interface. Further, if context isolation is enabled as part of using channel submission mode, the GoS mappings are not available thereby causing invalid memory accesses if attempted. This change modifies GoS code to skip over allocation of syncpoint GoS backing if context isolation is enabled for a device. Bug 2007922 Change-Id: I7b0eaf6e5fea1fe2266220682d0fee27674405a4 Signed-off-by: Arto Merilainen Reviewed-on: https://git-master.nvidia.com/r/1643630 Reviewed-by: Mikko Perttunen Reviewed-by: Deepak Nibade Reviewed-by: Prashant Gaikwad Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/video/tegra/host/nvhost_syncpt_unit_interface.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/video/tegra/host/nvhost_syncpt_unit_interface.c b/drivers/video/tegra/host/nvhost_syncpt_unit_interface.c index 086299f2f..a860ee1dc 100644 --- a/drivers/video/tegra/host/nvhost_syncpt_unit_interface.c +++ b/drivers/video/tegra/host/nvhost_syncpt_unit_interface.c @@ -183,6 +183,7 @@ int nvhost_syncpt_get_gos(struct platform_device *engine_pdev, dma_addr_t nvhost_syncpt_gos_address(struct platform_device *engine_pdev, u32 syncpt_id) { + struct nvhost_device_data *pdata = platform_get_drvdata(engine_pdev); u32 gos_id, gos_offset; struct cv_dev_info *cv_dev_info; struct sg_table *sgt; @@ -193,6 +194,10 @@ dma_addr_t nvhost_syncpt_gos_address(struct platform_device *engine_pdev, if (err) return 0; + /* if context isolation is enabled, GoS is not supported */ + if (pdata->isolate_contexts) + return 0; + cv_dev_info = nvmap_fetch_cv_dev_info(&engine_pdev->dev); if (!cv_dev_info) return 0; @@ -249,6 +254,7 @@ static void nvhost_syncpt_insert_syncpt_backing(struct rb_root *root, int nvhost_syncpt_alloc_gos_backing(struct platform_device *engine_pdev, u32 syncpt_id) { + struct nvhost_device_data *pdata = platform_get_drvdata(engine_pdev); struct nvhost_master *host = nvhost_get_host(engine_pdev); struct syncpt_gos_backing *syncpt_gos_backing; struct cv_dev_info *cv_dev_info; @@ -261,6 +267,10 @@ int nvhost_syncpt_alloc_gos_backing(struct platform_device *engine_pdev, if (!cv_dev_info) return -EFAULT; + /* if context isolation is enabled, GoS is not supported */ + if (pdata->isolate_contexts) + return -EINVAL; + /* check if backing already exists */ syncpt_gos_backing = nvhost_syncpt_find_gos_backing(host, syncpt_id); if (syncpt_gos_backing) -- cgit v1.2.2