include/linux/tsm-mr.h

Source file repositories/reference/linux-study-clean/include/linux/tsm-mr.h

File Facts

System
Linux kernel
Corpus path
include/linux/tsm-mr.h
Extension
.h
Size
3476 bytes
Lines
90
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct tsm_measurement_register {
	const char *mr_name;
	void *mr_value;
	u32 mr_size;
	u32 mr_flags;
	enum hash_algo mr_hash;
};

#define TSM_MR_F_NOHASH 1
#define TSM_MR_F_WRITABLE 2
#define TSM_MR_F_READABLE 4
#define TSM_MR_F_LIVE 8
#define TSM_MR_F_RTMR (TSM_MR_F_LIVE | TSM_MR_F_WRITABLE)

#define TSM_MR_(mr, hash)                              \
	.mr_name = #mr, .mr_size = hash##_DIGEST_SIZE, \
	.mr_hash = HASH_ALGO_##hash, .mr_flags = TSM_MR_F_READABLE

/**
 * struct tsm_measurements - defines the CC architecture specific measurement
 * facility and methods for updating measurement registers (MRs)
 * @mrs: Array of MR definitions.
 * @nr_mrs: Number of elements in @mrs.
 * @refresh: Callback function to load/sync all MRs from TVM hardware/firmware
 *           into the kernel cache.
 * @write: Callback function to write to the MR specified by the parameter @mr.
 *         Typically, writing to an MR extends the input buffer to that MR.
 *
 * The @refresh callback is invoked when an MR with %TSM_MR_F_LIVE set is being
 * read and the cache is stale. It must reload all MRs with %TSM_MR_F_LIVE set.
 * The function parameter @tm is a pointer pointing back to this structure.
 *
 * The @write callback is invoked whenever an MR is being written. It takes two
 * additional parameters besides @tm:
 *
 * * @mr - points to the MR (an element of @tm->mrs) being written.
 * * @data - contains the bytes to write and whose size is @mr->mr_size.
 *
 * Both @refresh and @write should return 0 on success and an appropriate error
 * code on failure.
 */
struct tsm_measurements {
	const struct tsm_measurement_register *mrs;
	size_t nr_mrs;
	int (*refresh)(const struct tsm_measurements *tm);
	int (*write)(const struct tsm_measurements *tm,
		     const struct tsm_measurement_register *mr, const u8 *data);
};

const struct attribute_group *
tsm_mr_create_attribute_group(const struct tsm_measurements *tm);
void tsm_mr_free_attribute_group(const struct attribute_group *attr_grp);

#endif

Annotation

Implementation Notes