Contributors: 10
| Author |
Tokens |
Token Proportion |
Commits |
Commit Proportion |
| Junyuan Wang |
128 |
58.99% |
1 |
8.33% |
| Tadeusz Struk |
58 |
26.73% |
3 |
25.00% |
| Laurent M Coquerel |
12 |
5.53% |
1 |
8.33% |
| Shashank Gupta |
6 |
2.76% |
1 |
8.33% |
| Maksim Lukoshkov |
5 |
2.30% |
1 |
8.33% |
| Suman Kumar Chakraborty |
2 |
0.92% |
1 |
8.33% |
| Damian Muszynski |
2 |
0.92% |
1 |
8.33% |
| Bruce W Allan |
2 |
0.92% |
1 |
8.33% |
| Giovanni Cabiddu |
1 |
0.46% |
1 |
8.33% |
| Luis R. Rodriguez |
1 |
0.46% |
1 |
8.33% |
| Total |
217 |
|
12 |
|
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2026 Intel Corporation */
#include <linux/dma-mapping.h>
#include "adf_admin.h"
#include "adf_cfg_services.h"
#include "adf_common_drv.h"
#include "adf_kpt.h"
static bool adf_kpt_supported(struct adf_accel_dev *accel_dev)
{
struct adf_hw_device_data *hw_data = GET_HW_DATA(accel_dev);
return hw_data->accel_capabilities_mask & ICP_ACCEL_CAPABILITIES_KPT;
}
int adf_enable_kpt(struct adf_accel_dev *accel_dev)
{
struct adf_kpt_interface_data *user_data = GET_KPT_USER_DATA(accel_dev);
struct adf_hw_device_data *hw_data = GET_HW_DATA(accel_dev);
dma_addr_t paddr;
void *vaddr;
int ret;
int svc;
/* Return 0 if KPT is not supported by the hardware */
if (!adf_kpt_supported(accel_dev))
return 0;
if (!user_data->enable) {
/* Disable KPT capability if user has not enabled it */
hw_data->accel_capabilities_mask &= ~ICP_ACCEL_CAPABILITIES_KPT;
return 0;
}
svc = adf_get_service_enabled(accel_dev);
if (svc < 0)
return svc;
if (svc != SVC_ASYM) {
dev_err(&GET_DEV(accel_dev),
"KPT can only be enabled when service is configured as 'asym'\n");
return -EINVAL;
}
vaddr = dma_alloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, &paddr,
GFP_KERNEL);
if (!vaddr)
return -ENOMEM;
ret = adf_send_admin_kpt_init(accel_dev, vaddr, PAGE_SIZE, paddr);
dma_free_coherent(&GET_DEV(accel_dev), PAGE_SIZE, vaddr, paddr);
return ret;
}