habanalabs: add generic security module
authorOfir Bitton <obitton@habana.ai>
Sun, 26 Jun 2022 18:24:50 +0000 (21:24 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 12 Jul 2022 06:09:27 +0000 (09:09 +0300)
commite392d1bd0437d7ac3c945ccdb5362b775c207d67
tree30eb7e0d947fc3ee2073380126fac593b6e9884b
parentc47082c22db17115ae3312474e0c552bbbe37b52
habanalabs: add generic security module

As the ASICs become more complex and have many more registers, we need
a better way to configure the security properties.

As a reminder, we have two dedicated mechanisms for security:
Range Registers and Protection bits. Those mechanisms protect sensitive
memory and configuration areas inside the device.

The generic module handles the low-level part of the configuration,
because the configuration mechanism is identical in all ASICs. The
difference is the address ranges and register names.

Any ASIC that use this block should first block all the register
blocks in the ASIC. Then, it should open only the registers that
need to be accessed by the user (This is opposed to Goya and Gaudi,
where we blocked only what should not be accesses by the user).

The module contains several functions, to unblock single register,
multiple registers, entire blocks, ranges, ranges with mask.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/Makefile
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/common/security.c [new file with mode: 0644]