Loading drivers/char/adsprpc.c +17 −5 Original line number Original line Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only /* /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ */ #include <linux/dma-buf.h> #include <linux/dma-buf.h> #include <linux/dma-mapping.h> #include <linux/dma-mapping.h> Loading Loading @@ -652,7 +652,7 @@ static inline int poll_on_early_response(struct smq_invoke_ctx *ctx) static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache) static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache) { { struct fastrpc_file *fl = buf == NULL ? NULL : buf->fl; struct fastrpc_file *fl = buf == NULL ? NULL : buf->fl; int vmid; int vmid, err = 0; if (!fl) if (!fl) return; return; Loading @@ -673,6 +673,9 @@ static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache) int destVM[1] = {VMID_HLOS}; int destVM[1] = {VMID_HLOS}; int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC}; int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC}; VERIFY(err, fl->sctx != NULL); if (err) goto bail; if (fl->sctx->smmu.cb) if (fl->sctx->smmu.cb) buf->phys &= ~((uint64_t)fl->sctx->smmu.cb << 32); buf->phys &= ~((uint64_t)fl->sctx->smmu.cb << 32); vmid = fl->apps->channel[fl->cid].vmid; vmid = fl->apps->channel[fl->cid].vmid; Loading @@ -686,6 +689,7 @@ static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache) dma_free_attrs(fl->sctx->smmu.dev, buf->size, buf->virt, dma_free_attrs(fl->sctx->smmu.dev, buf->size, buf->virt, buf->phys, buf->dma_attr); buf->phys, buf->dma_attr); } } bail: kfree(buf); kfree(buf); } } Loading Loading @@ -1195,6 +1199,12 @@ static int fastrpc_buf_alloc(struct fastrpc_file *fl, size_t size, buf->flags = rflags; buf->flags = rflags; buf->raddr = 0; buf->raddr = 0; buf->remote = 0; buf->remote = 0; VERIFY(err, fl && fl->sctx != NULL); if (err) { err = -EBADR; goto bail; } buf->virt = dma_alloc_attrs(fl->sctx->smmu.dev, buf->size, buf->virt = dma_alloc_attrs(fl->sctx->smmu.dev, buf->size, (dma_addr_t *)&buf->phys, (dma_addr_t *)&buf->phys, GFP_KERNEL, buf->dma_attr); GFP_KERNEL, buf->dma_attr); Loading Loading @@ -1904,7 +1914,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) continue; continue; if (map && map->uncached) if (map && map->uncached) continue; continue; if (ctx->fl->sctx->smmu.coherent && if (ctx->fl->sctx && ctx->fl->sctx->smmu.coherent && !(map && (map->attr & FASTRPC_ATTR_NON_COHERENT))) !(map && (map->attr & FASTRPC_ATTR_NON_COHERENT))) continue; continue; if (map && (map->attr & FASTRPC_ATTR_COHERENT)) if (map && (map->attr & FASTRPC_ATTR_COHERENT)) Loading Loading @@ -2058,7 +2068,7 @@ static void inv_args(struct smq_invoke_ctx *ctx) continue; continue; if (!rpra[over].buf.len) if (!rpra[over].buf.len) continue; continue; if (ctx->fl->sctx->smmu.coherent && if (ctx->fl && ctx->fl->sctx && ctx->fl->sctx->smmu.coherent && !(map && (map->attr & FASTRPC_ATTR_NON_COHERENT))) !(map && (map->attr & FASTRPC_ATTR_NON_COHERENT))) continue; continue; if (map && (map->attr & FASTRPC_ATTR_COHERENT)) if (map && (map->attr & FASTRPC_ATTR_COHERENT)) Loading Loading @@ -4168,8 +4178,10 @@ static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info) goto bail; goto bail; } } VERIFY(err, fl->sctx != NULL); VERIFY(err, fl->sctx != NULL); if (err) if (err) { err = -EBADR; goto bail; goto bail; } *info = (fl->sctx->smmu.enabled ? 1 : 0); *info = (fl->sctx->smmu.enabled ? 1 : 0); bail: bail: return err; return err; Loading Loading
drivers/char/adsprpc.c +17 −5 Original line number Original line Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only /* /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ */ #include <linux/dma-buf.h> #include <linux/dma-buf.h> #include <linux/dma-mapping.h> #include <linux/dma-mapping.h> Loading Loading @@ -652,7 +652,7 @@ static inline int poll_on_early_response(struct smq_invoke_ctx *ctx) static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache) static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache) { { struct fastrpc_file *fl = buf == NULL ? NULL : buf->fl; struct fastrpc_file *fl = buf == NULL ? NULL : buf->fl; int vmid; int vmid, err = 0; if (!fl) if (!fl) return; return; Loading @@ -673,6 +673,9 @@ static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache) int destVM[1] = {VMID_HLOS}; int destVM[1] = {VMID_HLOS}; int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC}; int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC}; VERIFY(err, fl->sctx != NULL); if (err) goto bail; if (fl->sctx->smmu.cb) if (fl->sctx->smmu.cb) buf->phys &= ~((uint64_t)fl->sctx->smmu.cb << 32); buf->phys &= ~((uint64_t)fl->sctx->smmu.cb << 32); vmid = fl->apps->channel[fl->cid].vmid; vmid = fl->apps->channel[fl->cid].vmid; Loading @@ -686,6 +689,7 @@ static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache) dma_free_attrs(fl->sctx->smmu.dev, buf->size, buf->virt, dma_free_attrs(fl->sctx->smmu.dev, buf->size, buf->virt, buf->phys, buf->dma_attr); buf->phys, buf->dma_attr); } } bail: kfree(buf); kfree(buf); } } Loading Loading @@ -1195,6 +1199,12 @@ static int fastrpc_buf_alloc(struct fastrpc_file *fl, size_t size, buf->flags = rflags; buf->flags = rflags; buf->raddr = 0; buf->raddr = 0; buf->remote = 0; buf->remote = 0; VERIFY(err, fl && fl->sctx != NULL); if (err) { err = -EBADR; goto bail; } buf->virt = dma_alloc_attrs(fl->sctx->smmu.dev, buf->size, buf->virt = dma_alloc_attrs(fl->sctx->smmu.dev, buf->size, (dma_addr_t *)&buf->phys, (dma_addr_t *)&buf->phys, GFP_KERNEL, buf->dma_attr); GFP_KERNEL, buf->dma_attr); Loading Loading @@ -1904,7 +1914,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) continue; continue; if (map && map->uncached) if (map && map->uncached) continue; continue; if (ctx->fl->sctx->smmu.coherent && if (ctx->fl->sctx && ctx->fl->sctx->smmu.coherent && !(map && (map->attr & FASTRPC_ATTR_NON_COHERENT))) !(map && (map->attr & FASTRPC_ATTR_NON_COHERENT))) continue; continue; if (map && (map->attr & FASTRPC_ATTR_COHERENT)) if (map && (map->attr & FASTRPC_ATTR_COHERENT)) Loading Loading @@ -2058,7 +2068,7 @@ static void inv_args(struct smq_invoke_ctx *ctx) continue; continue; if (!rpra[over].buf.len) if (!rpra[over].buf.len) continue; continue; if (ctx->fl->sctx->smmu.coherent && if (ctx->fl && ctx->fl->sctx && ctx->fl->sctx->smmu.coherent && !(map && (map->attr & FASTRPC_ATTR_NON_COHERENT))) !(map && (map->attr & FASTRPC_ATTR_NON_COHERENT))) continue; continue; if (map && (map->attr & FASTRPC_ATTR_COHERENT)) if (map && (map->attr & FASTRPC_ATTR_COHERENT)) Loading Loading @@ -4168,8 +4178,10 @@ static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info) goto bail; goto bail; } } VERIFY(err, fl->sctx != NULL); VERIFY(err, fl->sctx != NULL); if (err) if (err) { err = -EBADR; goto bail; goto bail; } *info = (fl->sctx->smmu.enabled ? 1 : 0); *info = (fl->sctx->smmu.enabled ? 1 : 0); bail: bail: return err; return err; Loading