summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2015-02-26 06:17:06 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-04-04 21:08:54 -0400
commit45e261ac190f26ea6b1286c7153b5ef9481f454f (patch)
tree5e9f807f8a02f7c531648bed84efd4207b08cb6a
parent99c707842f9eb036100b0eb96cd84fc3ab97508e (diff)
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 <dnibade@nvidia.com> Reviewed-on: http://git-master/r/711615 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c9
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c4
4 files changed, 11 insertions, 8 deletions
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)
1629 * 1629 *
1630 * In success, this call MUST be balanced by caller with __gk20a_do_unidle() 1630 * In success, this call MUST be balanced by caller with __gk20a_do_unidle()
1631 */ 1631 */
1632int __gk20a_do_idle(struct platform_device *pdev) 1632int __gk20a_do_idle(struct platform_device *pdev, bool force_reset)
1633{ 1633{
1634 struct gk20a *g = get_gk20a(pdev); 1634 struct gk20a *g = get_gk20a(pdev);
1635 struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); 1635 struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev);
@@ -1648,6 +1648,9 @@ int __gk20a_do_idle(struct platform_device *pdev)
1648 if (platform->is_railgated(pdev)) 1648 if (platform->is_railgated(pdev))
1649 return 0; 1649 return 0;
1650 1650
1651 /* check if global force_reset flag is set */
1652 force_reset |= platform->force_reset_in_do_idle;
1653
1651 /* prevent suspend by incrementing usage counter */ 1654 /* prevent suspend by incrementing usage counter */
1652 pm_runtime_get_noresume(&pdev->dev); 1655 pm_runtime_get_noresume(&pdev->dev);
1653 1656
@@ -1674,7 +1677,7 @@ int __gk20a_do_idle(struct platform_device *pdev)
1674 */ 1677 */
1675 pm_runtime_put_sync(&pdev->dev); 1678 pm_runtime_put_sync(&pdev->dev);
1676 1679
1677 if (platform->can_railgate && !platform->force_reset_in_do_idle) { 1680 if (platform->can_railgate && !force_reset) {
1678 /* add sufficient delay to allow GPU to rail gate */ 1681 /* add sufficient delay to allow GPU to rail gate */
1679 msleep(platform->railgate_delay); 1682 msleep(platform->railgate_delay);
1680 1683
@@ -1727,7 +1730,7 @@ int gk20a_do_idle(void)
1727 of_find_matching_node(NULL, tegra_gk20a_of_match); 1730 of_find_matching_node(NULL, tegra_gk20a_of_match);
1728 struct platform_device *pdev = of_find_device_by_node(node); 1731 struct platform_device *pdev = of_find_device_by_node(node);
1729 1732
1730 int ret = __gk20a_do_idle(pdev); 1733 int ret = __gk20a_do_idle(pdev, true);
1731 1734
1732 of_node_put(node); 1735 of_node_put(node);
1733 1736
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);
776void gk20a_disable(struct gk20a *g, u32 units); 776void gk20a_disable(struct gk20a *g, u32 units);
777void gk20a_enable(struct gk20a *g, u32 units); 777void gk20a_enable(struct gk20a *g, u32 units);
778void gk20a_reset(struct gk20a *g, u32 units); 778void gk20a_reset(struct gk20a *g, u32 units);
779int __gk20a_do_idle(struct platform_device *pdev); 779int __gk20a_do_idle(struct platform_device *pdev, bool force_reset);
780int __gk20a_do_unidle(struct platform_device *pdev); 780int __gk20a_do_unidle(struct platform_device *pdev);
781 781
782const struct firmware * 782const 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 @@
3 * 3 *
4 * GK20A Graphics 4 * GK20A Graphics
5 * 5 *
6 * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. 6 * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License, 9 * under the terms and conditions of the GNU General Public License,
@@ -562,7 +562,7 @@ static ssize_t force_idle_store(struct device *device,
562 if (g->forced_idle) 562 if (g->forced_idle)
563 return count; /* do nothing */ 563 return count; /* do nothing */
564 else { 564 else {
565 err = __gk20a_do_idle(ndev); 565 err = __gk20a_do_idle(ndev, false);
566 if (!err) { 566 if (!err) {
567 g->forced_idle = 1; 567 g->forced_idle = 1;
568 dev_info(device, "gpu is idle : %d\n", 568 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 @@
3 * 3 *
4 * GK20A Tegra Platform Interface 4 * GK20A Tegra Platform Interface
5 * 5 *
6 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. 6 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License, 9 * under the terms and conditions of the GNU General Public License,
@@ -597,7 +597,7 @@ struct gk20a_platform gm20b_tegra_platform = {
597 .enable_elpg = true, 597 .enable_elpg = true,
598 .enable_aelpg = true, 598 .enable_aelpg = true,
599 599
600 .force_reset_in_do_idle = true, 600 .force_reset_in_do_idle = false,
601 601
602 .default_big_page_size = SZ_128K, 602 .default_big_page_size = SZ_128K,
603 603