mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
crypto: rockchip: core: modify buffer addr_vir size to 8 PAGES
Increase the buffer size from 1 to 8 pages. Data can be copied to the buffer for hardware crypto calculation when the scatter list does not meet the alignment requirement and data length less than 8 pages. Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com> Change-Id: Id5e36f4fa7fc042ea4d117071ae9fee16ebb3494
This commit is contained in:
@@ -169,8 +169,8 @@ static int rk_load_data(struct rk_crypto_dev *rk_dev,
|
||||
alg_ctx->addr_out = sg_dma_address(sg_dst);
|
||||
}
|
||||
} else {
|
||||
count = (alg_ctx->left_bytes > PAGE_SIZE) ?
|
||||
PAGE_SIZE : alg_ctx->left_bytes;
|
||||
count = (alg_ctx->left_bytes > rk_dev->vir_max) ?
|
||||
rk_dev->vir_max : alg_ctx->left_bytes;
|
||||
|
||||
if (!sg_pcopy_to_buffer(alg_ctx->req_src, alg_ctx->src_nents,
|
||||
rk_dev->addr_vir, count,
|
||||
@@ -674,13 +674,15 @@ static int rk_crypto_probe(struct platform_device *pdev)
|
||||
goto err_crypto;
|
||||
}
|
||||
|
||||
rk_dev->addr_vir = (char *)__get_free_page(GFP_KERNEL);
|
||||
rk_dev->addr_vir = (void *)__get_free_pages(GFP_KERNEL, RK_BUFFER_ORDER);
|
||||
if (!rk_dev->addr_vir) {
|
||||
err = -ENOMEM;
|
||||
dev_err(dev, "__get_free_page failed.\n");
|
||||
goto err_crypto;
|
||||
}
|
||||
|
||||
rk_dev->vir_max = RK_BUFFER_SIZE;
|
||||
|
||||
platform_set_drvdata(pdev, rk_dev);
|
||||
|
||||
tasklet_init(&rk_dev->queue_task,
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
|
||||
#define RK_CRYPTO_PRIORITY 300
|
||||
|
||||
/* Increase the addr_vir buffer size from 1 to 8 pages */
|
||||
#define RK_BUFFER_ORDER 3
|
||||
#define RK_BUFFER_SIZE (PAGE_SIZE << RK_BUFFER_ORDER)
|
||||
|
||||
struct rk_crypto_soc_data {
|
||||
char **valid_algs_name;
|
||||
int valid_algs_num;
|
||||
@@ -66,6 +70,7 @@ struct rk_crypto_dev {
|
||||
/* the public variable */
|
||||
struct crypto_async_request *async_req;
|
||||
void *addr_vir;
|
||||
u32 vir_max;
|
||||
|
||||
bool busy;
|
||||
void (*request_crypto)(struct rk_crypto_dev *rk_dev, const char *name);
|
||||
|
||||
Reference in New Issue
Block a user