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>
This commit is contained in:
Deepak Nibade
2014-06-24 18:11:25 +05:30
committed by Dan Willemsen
parent 2680d6be57
commit 7ed71374e9
3 changed files with 11 additions and 4 deletions

View File

@@ -1351,6 +1351,9 @@ int gk20a_secure_page_alloc(struct platform_device *pdev)
tegra_periph_reset_deassert(platform->clk[0]); tegra_periph_reset_deassert(platform->clk[0]);
} }
if (!err)
platform->secure_alloc_ready = true;
return err; return err;
} }
@@ -1453,10 +1456,9 @@ static int gk20a_probe(struct platform_device *dev)
} }
err = gk20a_secure_page_alloc(dev); err = gk20a_secure_page_alloc(dev);
if (err) { if (err)
dev_err(&dev->dev, "failed to allocate secure buffer\n"); dev_err(&dev->dev,
return err; "failed to allocate secure buffer %d\n", err);
}
gk20a_debug_init(dev); gk20a_debug_init(dev);

View File

@@ -108,6 +108,7 @@ struct gk20a_platform {
*/ */
int (*secure_page_alloc)(struct platform_device *dev); int (*secure_page_alloc)(struct platform_device *dev);
struct secure_page_buffer secure_buffer; struct secure_page_buffer secure_buffer;
bool secure_alloc_ready;
/* Device is going to be suspended */ /* Device is going to be suspended */
int (*suspend)(struct device *); int (*suspend)(struct device *);

View File

@@ -135,6 +135,7 @@ static int gk20a_tegra_secure_alloc(struct platform_device *pdev,
struct gr_ctx_buffer_desc *desc, struct gr_ctx_buffer_desc *desc,
size_t size) size_t size)
{ {
struct gk20a_platform *platform = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
DEFINE_DMA_ATTRS(attrs); DEFINE_DMA_ATTRS(attrs);
dma_addr_t iova; dma_addr_t iova;
@@ -142,6 +143,9 @@ static int gk20a_tegra_secure_alloc(struct platform_device *pdev,
struct page *page; struct page *page;
int err = 0; int err = 0;
if (!platform->secure_alloc_ready)
return -EINVAL;
(void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova, (void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova,
DMA_MEMORY_NOMAP, &attrs); DMA_MEMORY_NOMAP, &attrs);
if (dma_mapping_error(&tegra_vpr_dev, iova)) if (dma_mapping_error(&tegra_vpr_dev, iova))