From 7ed71374e90f8e5c8554cb7d2f14aa8e9a807862 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 24 Jun 2014 18:11:25 +0530 Subject: 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 Reviewed-on: http://git-master/r/427730 GVS: Gerrit_Virtual_Submit Reviewed-by: Shridhar Rasal Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a.c | 10 ++++++---- drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 1 + drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') 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) tegra_periph_reset_deassert(platform->clk[0]); } + if (!err) + platform->secure_alloc_ready = true; + return err; } @@ -1453,10 +1456,9 @@ static int gk20a_probe(struct platform_device *dev) } err = gk20a_secure_page_alloc(dev); - if (err) { - dev_err(&dev->dev, "failed to allocate secure buffer\n"); - return err; - } + if (err) + dev_err(&dev->dev, + "failed to allocate secure buffer %d\n", err); gk20a_debug_init(dev); 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 { */ int (*secure_page_alloc)(struct platform_device *dev); struct secure_page_buffer secure_buffer; + bool secure_alloc_ready; /* Device is going to be suspended */ 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, struct gr_ctx_buffer_desc *desc, size_t size) { + struct gk20a_platform *platform = platform_get_drvdata(pdev); struct device *dev = &pdev->dev; DEFINE_DMA_ATTRS(attrs); dma_addr_t iova; @@ -142,6 +143,9 @@ static int gk20a_tegra_secure_alloc(struct platform_device *pdev, struct page *page; int err = 0; + if (!platform->secure_alloc_ready) + return -EINVAL; + (void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova, DMA_MEMORY_NOMAP, &attrs); if (dma_mapping_error(&tegra_vpr_dev, iova)) -- cgit v1.2.2