]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
gpu: nvgpu: do not abort probe if secure page alloc fails
authorDeepak Nibade <dnibade@nvidia.com>
Tue, 24 Jun 2014 12:41:25 +0000 (18:11 +0530)
committerHarshada Kale <hkale@nvidia.com>
Thu, 26 Jun 2014 16:34:47 +0000 (09:34 -0700)
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
(cherry picked from commit e7e47bb45d5ff5dcb48d8a961e9908b71db9e02f)
Reviewed-on: http://git-master/r/428306
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
drivers/gpu/nvgpu/gk20a/gk20a.c
drivers/gpu/nvgpu/gk20a/platform_gk20a.h
drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c

index c1ba88926a4bec79dd8a462873684bb994f6016b..f3dbf31ed2b818c6c2e17fbd68e8b4ffe0729281 100644 (file)
@@ -1296,6 +1296,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;
 }
 
@@ -1398,10 +1401,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);
 
index f34dfe9a8e1995c151e5cc4c3128502431982896..50358af6f11dd54f88736582b24233fa64138425 100644 (file)
@@ -93,6 +93,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 *);
index 417112e712b4428dc2f90f33badecaa25947595f..a20ad8f116a1a857fc1958f87a2bbc1e8d5bded0 100644 (file)
@@ -134,6 +134,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;
@@ -141,6 +142,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))