include/linux/arm_ffa.h

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

File Facts

System
Linux kernel
Corpus path
include/linux/arm_ffa.h
Extension
.h
Size
16278 bytes
Lines
516
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: operation-table or driver-model contract
Status
pattern 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 device_driver driver;
};

#define to_ffa_driver(d) container_of_const(d, struct ffa_driver, driver)

static inline void ffa_dev_set_drvdata(struct ffa_device *fdev, void *data)
{
	dev_set_drvdata(&fdev->dev, data);
}

static inline void *ffa_dev_get_drvdata(struct ffa_device *fdev)
{
	return dev_get_drvdata(&fdev->dev);
}

struct ffa_partition_info;

#if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT)
struct ffa_device *
ffa_device_register(const struct ffa_partition_info *part_info,
		    const struct ffa_ops *ops, struct device *parent);
void ffa_device_unregister(struct ffa_device *ffa_dev);
int ffa_driver_register(struct ffa_driver *driver, struct module *owner,
			const char *mod_name);
void ffa_driver_unregister(struct ffa_driver *driver);
void ffa_devices_unregister(void);
bool ffa_device_is_valid(struct ffa_device *ffa_dev);

#else
static inline struct ffa_device *
ffa_device_register(const struct ffa_partition_info *part_info,
		    const struct ffa_ops *ops, struct device *parent)
{
	return NULL;
}

static inline void ffa_device_unregister(struct ffa_device *dev) {}

static inline void ffa_devices_unregister(void) {}

static inline int
ffa_driver_register(struct ffa_driver *driver, struct module *owner,
		    const char *mod_name)
{
	return -EINVAL;
}

static inline void ffa_driver_unregister(struct ffa_driver *driver) {}

static inline
bool ffa_device_is_valid(struct ffa_device *ffa_dev) { return false; }

#endif /* CONFIG_ARM_FFA_TRANSPORT */

#define ffa_register(driver) \
	ffa_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
#define ffa_unregister(driver) \
	ffa_driver_unregister(driver)

/**
 * module_ffa_driver() - Helper macro for registering a psa_ffa driver
 * @__ffa_driver: ffa_driver structure
 *
 * Helper macro for psa_ffa drivers to set up proper module init / exit
 * functions.  Replaces module_init() and module_exit() and keeps people from
 * printing pointless things to the kernel log when their driver is loaded.
 */
#define module_ffa_driver(__ffa_driver)	\
	module_driver(__ffa_driver, ffa_register, ffa_unregister)

extern const struct bus_type ffa_bus_type;

/* The FF-A 1.0 partition structure lacks the uuid[4] */
#define FFA_1_0_PARTITON_INFO_SZ	(8)

/* FFA transport related */
struct ffa_partition_info {
	u16 id;
	u16 exec_ctxt;
/* partition supports receipt of direct requests */
#define FFA_PARTITION_DIRECT_RECV	BIT(0)
/* partition can send direct requests. */
#define FFA_PARTITION_DIRECT_SEND	BIT(1)
/* partition can send and receive indirect messages. */
#define FFA_PARTITION_INDIRECT_MSG	BIT(2)
/* partition can receive notifications */
#define FFA_PARTITION_NOTIFICATION_RECV	BIT(3)
/* partition runs in the AArch64 execution state. */
#define FFA_PARTITION_AARCH64_EXEC	BIT(8)
/* partition supports receipt of direct request2 */

Annotation

Implementation Notes