Commit 964234ab authored by Koby Elbaz's avatar Koby Elbaz Committed by Oded Gabbay

accel/habanalabs: rename security functions related arguments

Make the argument names specify the registers array represent
registers that should be unsecured so the user can access them.
Signed-off-by: default avatarKoby Elbaz <kelbaz@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 9ec7639b
...@@ -284,14 +284,14 @@ void hl_secure_block(struct hl_device *hdev, ...@@ -284,14 +284,14 @@ void hl_secure_block(struct hl_device *hdev,
* @instance_offset: offset between instances * @instance_offset: offset between instances
* @pb_blocks: blocks array * @pb_blocks: blocks array
* @blocks_array_size: blocks array size * @blocks_array_size: blocks array size
* @regs_array: register array * @user_regs_array: unsecured register array
* @regs_array_size: register array size * @user_regs_array_size: unsecured register array size
* @mask: enabled instances mask: 1- enabled, 0- disabled * @mask: enabled instances mask: 1- enabled, 0- disabled
*/ */
int hl_init_pb_with_mask(struct hl_device *hdev, u32 num_dcores, int hl_init_pb_with_mask(struct hl_device *hdev, u32 num_dcores,
u32 dcore_offset, u32 num_instances, u32 instance_offset, u32 dcore_offset, u32 num_instances, u32 instance_offset,
const u32 pb_blocks[], u32 blocks_array_size, const u32 pb_blocks[], u32 blocks_array_size,
const u32 *regs_array, u32 regs_array_size, u64 mask) const u32 *user_regs_array, u32 user_regs_array_size, u64 mask)
{ {
int i, j; int i, j;
struct hl_block_glbl_sec *glbl_sec; struct hl_block_glbl_sec *glbl_sec;
...@@ -303,8 +303,8 @@ int hl_init_pb_with_mask(struct hl_device *hdev, u32 num_dcores, ...@@ -303,8 +303,8 @@ int hl_init_pb_with_mask(struct hl_device *hdev, u32 num_dcores,
return -ENOMEM; return -ENOMEM;
hl_secure_block(hdev, glbl_sec, blocks_array_size); hl_secure_block(hdev, glbl_sec, blocks_array_size);
hl_unsecure_registers(hdev, regs_array, regs_array_size, 0, pb_blocks, hl_unsecure_registers(hdev, user_regs_array, user_regs_array_size, 0,
glbl_sec, blocks_array_size); pb_blocks, glbl_sec, blocks_array_size);
/* Fill all blocks with the same configuration */ /* Fill all blocks with the same configuration */
for (i = 0 ; i < num_dcores ; i++) { for (i = 0 ; i < num_dcores ; i++) {
...@@ -336,19 +336,19 @@ int hl_init_pb_with_mask(struct hl_device *hdev, u32 num_dcores, ...@@ -336,19 +336,19 @@ int hl_init_pb_with_mask(struct hl_device *hdev, u32 num_dcores,
* @instance_offset: offset between instances * @instance_offset: offset between instances
* @pb_blocks: blocks array * @pb_blocks: blocks array
* @blocks_array_size: blocks array size * @blocks_array_size: blocks array size
* @regs_array: register array * @user_regs_array: unsecured register array
* @regs_array_size: register array size * @user_regs_array_size: unsecured register array size
* *
*/ */
int hl_init_pb(struct hl_device *hdev, u32 num_dcores, u32 dcore_offset, int hl_init_pb(struct hl_device *hdev, u32 num_dcores, u32 dcore_offset,
u32 num_instances, u32 instance_offset, u32 num_instances, u32 instance_offset,
const u32 pb_blocks[], u32 blocks_array_size, const u32 pb_blocks[], u32 blocks_array_size,
const u32 *regs_array, u32 regs_array_size) const u32 *user_regs_array, u32 user_regs_array_size)
{ {
return hl_init_pb_with_mask(hdev, num_dcores, dcore_offset, return hl_init_pb_with_mask(hdev, num_dcores, dcore_offset,
num_instances, instance_offset, pb_blocks, num_instances, instance_offset, pb_blocks,
blocks_array_size, regs_array, regs_array_size, blocks_array_size, user_regs_array,
ULLONG_MAX); user_regs_array_size, ULLONG_MAX);
} }
/** /**
...@@ -364,15 +364,15 @@ int hl_init_pb(struct hl_device *hdev, u32 num_dcores, u32 dcore_offset, ...@@ -364,15 +364,15 @@ int hl_init_pb(struct hl_device *hdev, u32 num_dcores, u32 dcore_offset,
* @instance_offset: offset between instances * @instance_offset: offset between instances
* @pb_blocks: blocks array * @pb_blocks: blocks array
* @blocks_array_size: blocks array size * @blocks_array_size: blocks array size
* @regs_range_array: register range array * @user_regs_range_array: unsecured register range array
* @regs_range_array_size: register range array size * @user_regs_range_array_size: unsecured register range array size
* @mask: enabled instances mask: 1- enabled, 0- disabled * @mask: enabled instances mask: 1- enabled, 0- disabled
*/ */
int hl_init_pb_ranges_with_mask(struct hl_device *hdev, u32 num_dcores, int hl_init_pb_ranges_with_mask(struct hl_device *hdev, u32 num_dcores,
u32 dcore_offset, u32 num_instances, u32 instance_offset, u32 dcore_offset, u32 num_instances, u32 instance_offset,
const u32 pb_blocks[], u32 blocks_array_size, const u32 pb_blocks[], u32 blocks_array_size,
const struct range *regs_range_array, u32 regs_range_array_size, const struct range *user_regs_range_array,
u64 mask) u32 user_regs_range_array_size, u64 mask)
{ {
int i, j, rc = 0; int i, j, rc = 0;
struct hl_block_glbl_sec *glbl_sec; struct hl_block_glbl_sec *glbl_sec;
...@@ -384,8 +384,8 @@ int hl_init_pb_ranges_with_mask(struct hl_device *hdev, u32 num_dcores, ...@@ -384,8 +384,8 @@ int hl_init_pb_ranges_with_mask(struct hl_device *hdev, u32 num_dcores,
return -ENOMEM; return -ENOMEM;
hl_secure_block(hdev, glbl_sec, blocks_array_size); hl_secure_block(hdev, glbl_sec, blocks_array_size);
rc = hl_unsecure_registers_range(hdev, regs_range_array, rc = hl_unsecure_registers_range(hdev, user_regs_range_array,
regs_range_array_size, 0, pb_blocks, glbl_sec, user_regs_range_array_size, 0, pb_blocks, glbl_sec,
blocks_array_size); blocks_array_size);
if (rc) if (rc)
goto free_glbl_sec; goto free_glbl_sec;
...@@ -422,19 +422,20 @@ int hl_init_pb_ranges_with_mask(struct hl_device *hdev, u32 num_dcores, ...@@ -422,19 +422,20 @@ int hl_init_pb_ranges_with_mask(struct hl_device *hdev, u32 num_dcores,
* @instance_offset: offset between instances * @instance_offset: offset between instances
* @pb_blocks: blocks array * @pb_blocks: blocks array
* @blocks_array_size: blocks array size * @blocks_array_size: blocks array size
* @regs_range_array: register range array * @user_regs_range_array: unsecured register range array
* @regs_range_array_size: register range array size * @user_regs_range_array_size: unsecured register range array size
* *
*/ */
int hl_init_pb_ranges(struct hl_device *hdev, u32 num_dcores, int hl_init_pb_ranges(struct hl_device *hdev, u32 num_dcores,
u32 dcore_offset, u32 num_instances, u32 instance_offset, u32 dcore_offset, u32 num_instances, u32 instance_offset,
const u32 pb_blocks[], u32 blocks_array_size, const u32 pb_blocks[], u32 blocks_array_size,
const struct range *regs_range_array, u32 regs_range_array_size) const struct range *user_regs_range_array,
u32 user_regs_range_array_size)
{ {
return hl_init_pb_ranges_with_mask(hdev, num_dcores, dcore_offset, return hl_init_pb_ranges_with_mask(hdev, num_dcores, dcore_offset,
num_instances, instance_offset, pb_blocks, num_instances, instance_offset, pb_blocks,
blocks_array_size, regs_range_array, blocks_array_size, user_regs_range_array,
regs_range_array_size, ULLONG_MAX); user_regs_range_array_size, ULLONG_MAX);
} }
/** /**
...@@ -447,14 +448,14 @@ int hl_init_pb_ranges(struct hl_device *hdev, u32 num_dcores, ...@@ -447,14 +448,14 @@ int hl_init_pb_ranges(struct hl_device *hdev, u32 num_dcores,
* @instance_offset: offset between instances * @instance_offset: offset between instances
* @pb_blocks: blocks array * @pb_blocks: blocks array
* @blocks_array_size: blocks array size * @blocks_array_size: blocks array size
* @regs_array: register array * @user_regs_array: unsecured register array
* @regs_array_size: register array size * @user_regs_array_size: unsecured register array size
* *
*/ */
int hl_init_pb_single_dcore(struct hl_device *hdev, u32 dcore_offset, int hl_init_pb_single_dcore(struct hl_device *hdev, u32 dcore_offset,
u32 num_instances, u32 instance_offset, u32 num_instances, u32 instance_offset,
const u32 pb_blocks[], u32 blocks_array_size, const u32 pb_blocks[], u32 blocks_array_size,
const u32 *regs_array, u32 regs_array_size) const u32 *user_regs_array, u32 user_regs_array_size)
{ {
int i, rc = 0; int i, rc = 0;
struct hl_block_glbl_sec *glbl_sec; struct hl_block_glbl_sec *glbl_sec;
...@@ -466,8 +467,8 @@ int hl_init_pb_single_dcore(struct hl_device *hdev, u32 dcore_offset, ...@@ -466,8 +467,8 @@ int hl_init_pb_single_dcore(struct hl_device *hdev, u32 dcore_offset,
return -ENOMEM; return -ENOMEM;
hl_secure_block(hdev, glbl_sec, blocks_array_size); hl_secure_block(hdev, glbl_sec, blocks_array_size);
rc = hl_unsecure_registers(hdev, regs_array, regs_array_size, 0, rc = hl_unsecure_registers(hdev, user_regs_array, user_regs_array_size,
pb_blocks, glbl_sec, blocks_array_size); 0, pb_blocks, glbl_sec, blocks_array_size);
if (rc) if (rc)
goto free_glbl_sec; goto free_glbl_sec;
...@@ -495,8 +496,8 @@ int hl_init_pb_single_dcore(struct hl_device *hdev, u32 dcore_offset, ...@@ -495,8 +496,8 @@ int hl_init_pb_single_dcore(struct hl_device *hdev, u32 dcore_offset,
* @instance_offset: offset between instances * @instance_offset: offset between instances
* @pb_blocks: blocks array * @pb_blocks: blocks array
* @blocks_array_size: blocks array size * @blocks_array_size: blocks array size
* @user_regs_range_array: register range array * @user_regs_range_array: unsecured register range array
* @user_regs_range_array_size: register range array size * @user_regs_range_array_size: unsecured register range array size
* *
*/ */
int hl_init_pb_ranges_single_dcore(struct hl_device *hdev, u32 dcore_offset, int hl_init_pb_ranges_single_dcore(struct hl_device *hdev, u32 dcore_offset,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment