diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 4 |
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)) |