gpu: nvgpu: use correct flags for secure allocs

The gfp_t argument for dma_alloc_attrs() cannot take DMA_MEMORY_NOMAP -
it's interpreted as __GFP_RECLAIMABLE which has the same integer value.
Use GFP_KERNEL for the flag argument and set DMA_ATTR_NO_KERNEL_MAPPING
for dma attrs which the code was trying to do with the flag that is
meant for the coherent allocation API.

Bug 200299572

Change-Id: Ie4d988fbeeb954f6f7ccd4f9fb438968d76f0c6c
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1468315
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Holtta
2017-04-24 10:14:24 +03:00
committed by mobile promotions
parent 71af78d2c2
commit cacd455dfd

View File

@@ -106,6 +106,7 @@ static void gk20a_tegra_secure_page_destroy(struct device *dev,
struct secure_page_buffer *secure_buffer)
{
DEFINE_DMA_ATTRS(attrs);
dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs));
dma_free_attrs(&tegra_vpr_dev, secure_buffer->size,
(void *)(uintptr_t)secure_buffer->iova,
secure_buffer->iova, __DMA_ATTR(attrs));
@@ -123,8 +124,9 @@ int gk20a_tegra_secure_page_alloc(struct device *dev)
if (g->is_fmodel)
return -EINVAL;
dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs));
(void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova,
DMA_MEMORY_NOMAP, __DMA_ATTR(attrs));
GFP_KERNEL, __DMA_ATTR(attrs));
if (dma_mapping_error(&tegra_vpr_dev, iova))
return -ENOMEM;
@@ -142,6 +144,7 @@ static void gk20a_tegra_secure_destroy(struct gk20a *g,
if (desc->mem.priv.sgt) {
phys_addr_t pa = sg_phys(desc->mem.priv.sgt->sgl);
dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs));
dma_free_attrs(&tegra_vpr_dev, desc->mem.size,
(void *)(uintptr_t)pa,
pa, __DMA_ATTR(attrs));
@@ -164,8 +167,9 @@ int gk20a_tegra_secure_alloc(struct device *dev,
if (!platform->secure_alloc_ready)
return -EINVAL;
dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs));
(void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova,
DMA_MEMORY_NOMAP, __DMA_ATTR(attrs));
GFP_KERNEL, __DMA_ATTR(attrs));
if (dma_mapping_error(&tegra_vpr_dev, iova))
return -ENOMEM;