drivers/accel/habanalabs/common/security.h

Source file repositories/reference/linux-study-clean/drivers/accel/habanalabs/common/security.h

File Facts

System
Linux kernel
Corpus path
drivers/accel/habanalabs/common/security.h
Extension
.h
Size
6573 bytes
Lines
163
Domain
Driver Families
Bucket
drivers/accel
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct hl_special_block_info {
	int block_type;
	u32 base_addr;
	u32 major;
	u32 minor;
	u32 sub_minor;
	u32 major_offset;
	u32 minor_offset;
	u32 sub_minor_offset;
};

/*
 * struct hl_automated_pb_cfg - represents configurations of a particular type
 * of IP block which has protection bits.
 *
 * @addr: address details as described in hl_automation_pb_addr struct.
 * @prot_map: each bit corresponds to one among 32 protection configuration regs
 *            (e.g., SPECIAL_GLBL_PRIV). '1' means 0xffffffff and '0' means 0x0
 *            to be written into the corresponding protection configuration reg.
 *            This bit is meaningful if same bit in data_map is 0, otherwise ignored.
 * @data_map: each bit corresponds to one among 32 protection configuration regs
 *            (e.g., SPECIAL_GLBL_PRIV). '1' means corresponding protection
 *            configuration reg is to be written with a value in array pointed
 *            by 'data', otherwise the value is decided by 'prot_map'.
 * @data: pointer to data array which stores the config value(s) to be written
 *            to corresponding protection configuration reg(s).
 * @data_size: size of the data array.
 *
 * Each bit of 'data_map' and 'prot_map' fields corresponds to one among 32
 * protection configuration registers e.g., SPECIAL GLBL PRIV regs (starting at
 * offset 0xE80). '1' in 'data_map' means protection configuration to be done
 * using configuration in data array. '0' in 'data_map" means protection
 * configuration to be done as per the value of corresponding bit in 'prot_map'.
 * '1' in 'prot_map' means the register to be programmed with 0xFFFFFFFF
 * (all non-protected). '0' in 'prot_map' means the register to be programmed
 * with 0x0 (all protected).
 *
 * e.g., prot_map = 0x00000001, data_map = 0xC0000000 , data = {0xff, 0x12}
 * SPECIAL_GLBL_PRIV[0] = 0xFFFFFFFF
 * SPECIAL_GLBL_PRIV[1..29] = 0x0
 * SPECIAL_GLBL_PRIV[30] = 0xFF
 * SPECIAL_GLBL_PRIV[31] = 0x12
 */
struct hl_automated_pb_cfg {
	struct hl_special_block_info addr;
	u32 prot_map;
	u32 data_map;
	const u32 *data;
	u8 data_size;
};

/* struct hl_special_blocks_cfg - holds special blocks cfg data.
 *
 * @priv_automated_pb_cfg: points to the main privileged PB array.
 * @sec_automated_pb_cfg: points to the main secured PB array.
 * @skip_blocks_cfg: holds arrays of block types & block ranges to be excluded.
 * @priv_cfg_size: size of the main privileged PB array.
 * @sec_cfg_size: size of the main secured PB array.
 * @prot_lvl_priv: indication if it's a privileged/secured PB configurations.
 */
struct hl_special_blocks_cfg {
	struct hl_automated_pb_cfg *priv_automated_pb_cfg;
	struct hl_automated_pb_cfg *sec_automated_pb_cfg;
	struct hl_skip_blocks_cfg *skip_blocks_cfg;
	u32 priv_cfg_size;
	u32 sec_cfg_size;
	u8 prot_lvl_priv;
};

/* Automated security */

/* struct hl_skip_blocks_cfg - holds arrays of block types & block ranges to be
 * excluded from special blocks configurations.
 *
 * @block_types: an array of block types NOT to be configured.
 * @block_types_len: len of an array of block types not to be configured.
 * @block_ranges: an array of block ranges not to be configured.
 * @block_ranges_len: len of an array of block ranges not to be configured.
 * @skip_block_hook: hook that will be called before initializing special blocks.
 */
struct hl_skip_blocks_cfg {
	int *block_types;
	size_t block_types_len;
	struct range *block_ranges;
	size_t block_ranges_len;
	bool (*skip_block_hook)(struct hl_device *hdev,
				struct hl_special_blocks_cfg *special_blocks_cfg,
				u32 blk_idx, u32 major, u32 minor, u32 sub_minor);
};

Annotation

Implementation Notes