summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2014-06-24 08:41:25 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:10:17 -0400
commit7ed71374e90f8e5c8554cb7d2f14aa8e9a807862 (patch)
tree3e29602dcd521417fbc07302f524cd4bc7bd52cd /drivers/gpu/nvgpu
parent2680d6be576ce2c1b74f03e6e4cc5cbf321ef2bc (diff)
gpu: nvgpu: do not abort probe if secure page alloc fails
Do not abort GPU probe if secure page alloc fails. We can just note that this allocation failed (using bool secure_alloc_ready) and prevent further secure memory allocation if this flag is not set. Bug 1525465 Change-Id: Ie4eb6393951690174013d2de3db507876d7b657f Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/427730 GVS: Gerrit_Virtual_Submit Reviewed-by: Shridhar Rasal <srasal@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c10
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c4
3 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 4c6566a6..790b366c 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -1351,6 +1351,9 @@ int gk20a_secure_page_alloc(struct platform_device *pdev)
1351 tegra_periph_reset_deassert(platform->clk[0]); 1351 tegra_periph_reset_deassert(platform->clk[0]);
1352 } 1352 }
1353 1353
1354 if (!err)
1355 platform->secure_alloc_ready = true;
1356
1354 return err; 1357 return err;
1355} 1358}
1356 1359
@@ -1453,10 +1456,9 @@ static int gk20a_probe(struct platform_device *dev)
1453 } 1456 }
1454 1457
1455 err = gk20a_secure_page_alloc(dev); 1458 err = gk20a_secure_page_alloc(dev);
1456 if (err) { 1459 if (err)
1457 dev_err(&dev->dev, "failed to allocate secure buffer\n"); 1460 dev_err(&dev->dev,
1458 return err; 1461 "failed to allocate secure buffer %d\n", err);
1459 }
1460 1462
1461 gk20a_debug_init(dev); 1463 gk20a_debug_init(dev);
1462 1464
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
index c343ad27..231f97b3 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
@@ -108,6 +108,7 @@ struct gk20a_platform {
108 */ 108 */
109 int (*secure_page_alloc)(struct platform_device *dev); 109 int (*secure_page_alloc)(struct platform_device *dev);
110 struct secure_page_buffer secure_buffer; 110 struct secure_page_buffer secure_buffer;
111 bool secure_alloc_ready;
111 112
112 /* Device is going to be suspended */ 113 /* Device is going to be suspended */
113 int (*suspend)(struct device *); 114 int (*suspend)(struct device *);
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c
index 28f82816..148496dd 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c
@@ -135,6 +135,7 @@ static int gk20a_tegra_secure_alloc(struct platform_device *pdev,
135 struct gr_ctx_buffer_desc *desc, 135 struct gr_ctx_buffer_desc *desc,
136 size_t size) 136 size_t size)
137{ 137{
138 struct gk20a_platform *platform = platform_get_drvdata(pdev);
138 struct device *dev = &pdev->dev; 139 struct device *dev = &pdev->dev;
139 DEFINE_DMA_ATTRS(attrs); 140 DEFINE_DMA_ATTRS(attrs);
140 dma_addr_t iova; 141 dma_addr_t iova;
@@ -142,6 +143,9 @@ static int gk20a_tegra_secure_alloc(struct platform_device *pdev,
142 struct page *page; 143 struct page *page;
143 int err = 0; 144 int err = 0;
144 145
146 if (!platform->secure_alloc_ready)
147 return -EINVAL;
148
145 (void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova, 149 (void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova,
146 DMA_MEMORY_NOMAP, &attrs); 150 DMA_MEMORY_NOMAP, &attrs);
147 if (dma_mapping_error(&tegra_vpr_dev, iova)) 151 if (dma_mapping_error(&tegra_vpr_dev, iova))