linux/drivers/misc/issei/host_client.h
Alexander Usyskin 2207e8d480 issei: add firmware and host clients implementation, finish character device
Add the core implementation for firmware and host client
management within the ISSEI (Intel Silicon Security Engine Interface)
subsystem support for a character device to expose the ISSEI
HECI interface to user space.
The firmware client (fw_client) and host client (host_client) modules
are responsible for managing communication between the host software
and the firmware.
The character device provides a communication channel for user-space
applications to interact with the firmware on the platform.

The client modules enable the ISSEI driver to manage multiple
host clients communicating with corresponding firmware
clients, facilitating data transfers and control operations
over the HECI interface.
The character device allows user-space applications to establish
connections to firmware clients using UUIDs, exchange messages,
and control the communication flow using standard
file operation calls.

Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Co-developed-by: Vitaly Lubart <lubvital@gmail.com>
Signed-off-by: Vitaly Lubart <lubvital@gmail.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Link: https://patch.msgid.link/20260513-issei-for-upstream-v1-2-f590038678f9@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-17 15:48:11 +02:00

76 lines
2.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2023-2026 Intel Corporation */
#ifndef _ISSEI_HOST_CLIENT_H_
#define _ISSEI_HOST_CLIENT_H_
#include <linux/types.h>
#include <linux/uuid.h>
#include <linux/wait.h>
struct file;
struct issei_device;
struct issei_fw_client;
/**
* enum issei_host_client_state - host client states
* @ISSEI_HOST_CL_STATE_DISCONNECTED: host client is disconnected
* @ISSEI_HOST_CL_STATE_CONNECTED: host client is connected
*/
enum issei_host_client_state {
ISSEI_HOST_CL_STATE_DISCONNECTED,
ISSEI_HOST_CL_STATE_CONNECTED,
};
/**
* struct issei_host_client - represents host client
* @list: link in host clients list
* @idev: issei parent device
* @id: host client id
* @fp: file associated with client
*
* @write_wait: waitqueue for pending write data
* @write_in_progress: indicator for write in process
*
* @state: host client state
* @fw_cl: pointer to firmware client, if connected
*
* @read_wait: waitqueue for read object
* @read_data: received data pointer
* @read_data_size: received data size
*/
struct issei_host_client {
struct list_head list;
struct issei_device *idev;
u16 id;
const struct file *fp;
wait_queue_head_t write_wait;
bool write_in_progress;
enum issei_host_client_state state;
struct issei_fw_client *fw_cl;
wait_queue_head_t read_wait;
u8 *read_data;
size_t read_data_size;
};
struct issei_host_client *issei_cl_create(struct issei_device *idev, struct file *fp);
void issei_cl_remove(struct issei_host_client *cl);
int issei_cl_connect(struct issei_host_client *cl, const uuid_t *uuid, u32 *mtu, u8 *ver,
u32 *flags);
int issei_cl_disconnect(struct issei_host_client *cl);
void issei_cl_all_disconnect(struct issei_device *idev);
ssize_t issei_cl_write(struct issei_host_client *cl, const u8 *buf, size_t buf_size);
int issei_cl_write_from_queue(struct issei_device *idev);
int issei_cl_read_buf(struct issei_device *idev, u16 fw_id, u16 host_id, u8 *buf, size_t buf_size);
ssize_t issei_cl_read(struct issei_host_client *cl, u8 **buf, size_t buf_size);
int issei_cl_check_read(struct issei_host_client *cl);
int issei_cl_check_write(struct issei_host_client *cl);
void issei_cl_clean_all_wbuf(struct issei_host_client *cl);
#endif /* ISSEI_HOST_CLIENT_H_ */