From 45e261ac190f26ea6b1286c7153b5ef9481f454f Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 26 Feb 2015 16:47:06 +0530 Subject: gpu: nvgpu: add flag for CAR reset in do_idle() Add "force_reset" flag to __gk20a_do_idle() For real world use cases like VPR resizing, we cannot wait for railgate_delay (which is 500 mS). Hence use CAR reset for this use case. (this is done via gk20a_do_idle() API with force_reset = true) Some of the test cases make use of sysfs "force_idle" and they expect GPU to be into really railgated state and not in CAR reset. Hence when called from sysfs, set force_reset = false. When global flag "force_reset_in_do_idle" is set, it will override local flags and force CAR reset case. This is desired in cases where railgating is not enabled Also, set force_reset_in_do_idle = false for GM20B since railgating has been enabled for GM20B Bug 1592997 Change-Id: I6c5af2977c7211ef82551a86a7c1eb51b8ccee60 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/711615 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a.c | 9 ++++++--- drivers/gpu/nvgpu/gk20a/gk20a.h | 2 +- drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c | 4 ++-- drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 76237fae..b7357c6b 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -1629,7 +1629,7 @@ void gk20a_reset(struct gk20a *g, u32 units) * * In success, this call MUST be balanced by caller with __gk20a_do_unidle() */ -int __gk20a_do_idle(struct platform_device *pdev) +int __gk20a_do_idle(struct platform_device *pdev, bool force_reset) { struct gk20a *g = get_gk20a(pdev); struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); @@ -1648,6 +1648,9 @@ int __gk20a_do_idle(struct platform_device *pdev) if (platform->is_railgated(pdev)) return 0; + /* check if global force_reset flag is set */ + force_reset |= platform->force_reset_in_do_idle; + /* prevent suspend by incrementing usage counter */ pm_runtime_get_noresume(&pdev->dev); @@ -1674,7 +1677,7 @@ int __gk20a_do_idle(struct platform_device *pdev) */ pm_runtime_put_sync(&pdev->dev); - if (platform->can_railgate && !platform->force_reset_in_do_idle) { + if (platform->can_railgate && !force_reset) { /* add sufficient delay to allow GPU to rail gate */ msleep(platform->railgate_delay); @@ -1727,7 +1730,7 @@ int gk20a_do_idle(void) of_find_matching_node(NULL, tegra_gk20a_of_match); struct platform_device *pdev = of_find_device_by_node(node); - int ret = __gk20a_do_idle(pdev); + int ret = __gk20a_do_idle(pdev, true); of_node_put(node); diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index ba7c7e97..acee2e48 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -776,7 +776,7 @@ void gk20a_idle(struct platform_device *pdev); void gk20a_disable(struct gk20a *g, u32 units); void gk20a_enable(struct gk20a *g, u32 units); void gk20a_reset(struct gk20a *g, u32 units); -int __gk20a_do_idle(struct platform_device *pdev); +int __gk20a_do_idle(struct platform_device *pdev, bool force_reset); int __gk20a_do_unidle(struct platform_device *pdev); const struct firmware * diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c index 7baadf2e..a70ce4b2 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c @@ -3,7 +3,7 @@ * * GK20A Graphics * - * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -562,7 +562,7 @@ static ssize_t force_idle_store(struct device *device, if (g->forced_idle) return count; /* do nothing */ else { - err = __gk20a_do_idle(ndev); + err = __gk20a_do_idle(ndev, false); if (!err) { g->forced_idle = 1; dev_info(device, "gpu is idle : %d\n", diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index 28b7ff7b..0d5f32dd 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c @@ -3,7 +3,7 @@ * * GK20A Tegra Platform Interface * - * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -597,7 +597,7 @@ struct gk20a_platform gm20b_tegra_platform = { .enable_elpg = true, .enable_aelpg = true, - .force_reset_in_do_idle = true, + .force_reset_in_do_idle = false, .default_big_page_size = SZ_128K, -- cgit v1.2.2