Skip to content

Commit 6f18c7e

Browse files
abelvesagregkh
authored andcommitted
misc: fastrpc: Add fastrpc_remote_heap_alloc
Split fastrpc_buf_alloc in such a way it allows allocation of remote heap too and add fastrpc_remote_heap_alloc to do so. Co-developed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20221125071405.148786-5-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1ce91d4 commit 6f18c7e

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

drivers/misc/fastrpc.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static void fastrpc_buf_free(struct fastrpc_buf *buf)
369369
kfree(buf);
370370
}
371371

372-
static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev,
372+
static int __fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev,
373373
u64 size, struct fastrpc_buf **obuf)
374374
{
375375
struct fastrpc_buf *buf;
@@ -397,14 +397,37 @@ static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev,
397397
return -ENOMEM;
398398
}
399399

400+
*obuf = buf;
401+
402+
return 0;
403+
}
404+
405+
static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev,
406+
u64 size, struct fastrpc_buf **obuf)
407+
{
408+
int ret;
409+
struct fastrpc_buf *buf;
410+
411+
ret = __fastrpc_buf_alloc(fl, dev, size, obuf);
412+
if (ret)
413+
return ret;
414+
415+
buf = *obuf;
416+
400417
if (fl->sctx && fl->sctx->sid)
401418
buf->phys += ((u64)fl->sctx->sid << 32);
402419

403-
*obuf = buf;
404-
405420
return 0;
406421
}
407422

423+
static int fastrpc_remote_heap_alloc(struct fastrpc_user *fl, struct device *dev,
424+
u64 size, struct fastrpc_buf **obuf)
425+
{
426+
struct device *rdev = &fl->cctx->rpdev->dev;
427+
428+
return __fastrpc_buf_alloc(fl, rdev, size, obuf);
429+
}
430+
408431
static void fastrpc_channel_ctx_free(struct kref *ref)
409432
{
410433
struct fastrpc_channel_ctx *cctx;

0 commit comments

Comments
 (0)