drivers/s390/crypto/vfio_ap_private.h

Source file repositories/reference/linux-study-clean/drivers/s390/crypto/vfio_ap_private.h

File Facts

System
Linux kernel
Corpus path
drivers/s390/crypto/vfio_ap_private.h
Extension
.h
Size
5902 bytes
Lines
169
Domain
Driver Families
Bucket
drivers/s390
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 ap_matrix_dev {
	struct device device;
	struct ap_config_info info;
	struct list_head mdev_list;
	struct mutex mdevs_lock; /* serializes access to each ap_matrix_mdev */
	struct ap_driver  *vfio_ap_drv;
	struct mutex guests_lock; /* serializes access to each KVM guest */
	struct mdev_parent parent;
	struct mdev_type mdev_type;
	struct mdev_type *mdev_types;
};

extern struct ap_matrix_dev *matrix_dev;

/**
 * struct ap_matrix - matrix of adapters, domains and control domains
 *
 * @apm_max: max adapter number in @apm
 * @apm: identifies the AP adapters in the matrix
 * @aqm_max: max domain number in @aqm
 * @aqm: identifies the AP queues (domains) in the matrix
 * @adm_max: max domain number in @adm
 * @adm: identifies the AP control domains in the matrix
 *
 * The AP matrix is comprised of three bit masks identifying the adapters,
 * queues (domains) and control domains that belong to an AP matrix. The bits in
 * each mask, from left to right, correspond to IDs 0 to 255. When a bit is set
 * the corresponding ID belongs to the matrix.
 */
struct ap_matrix {
	unsigned long apm_max;
	DECLARE_BITMAP(apm, AP_DEVICES);
	unsigned long aqm_max;
	DECLARE_BITMAP(aqm, AP_DOMAINS);
	unsigned long adm_max;
	DECLARE_BITMAP(adm, AP_DOMAINS);
};

/**
 * struct ap_queue_table - a table of queue objects.
 *
 * @queues: a hashtable of queues (struct vfio_ap_queue).
 */
struct ap_queue_table {
	DECLARE_HASHTABLE(queues, 8);
};

/**
 * struct ap_matrix_mdev - Contains the data associated with a matrix mediated
 *			   device.
 * @vdev:	the vfio device
 * @node:	allows the ap_matrix_mdev struct to be added to a list
 * @matrix:	the adapters, usage domains and control domains assigned to the
 *		mediated matrix device.
 * @shadow_apcb:    the shadow copy of the APCB field of the KVM guest's CRYCB
 * @kvm:	the struct holding guest's state
 * @pqap_hook:	the function pointer to the interception handler for the
 *		PQAP(AQIC) instruction.
 * @mdev:	the mediated device
 * @qtable:	table of queues (struct vfio_ap_queue) assigned to the mdev
 * @req_trigger eventfd ctx for signaling userspace to return a device
 * @cfg_chg_trigger eventfd ctx to signal AP config changed to userspace
 * @apm_add:	bitmap of APIDs added to the host's AP configuration
 * @aqm_add:	bitmap of APQIs added to the host's AP configuration
 * @adm_add:	bitmap of control domain numbers added to the host's AP
 *		configuration
 */
struct ap_matrix_mdev {
	struct vfio_device vdev;
	struct list_head node;
	struct ap_matrix matrix;
	struct ap_matrix shadow_apcb;
	struct kvm *kvm;
	crypto_hook pqap_hook;
	struct mdev_device *mdev;
	struct ap_queue_table qtable;
	struct eventfd_ctx *req_trigger;
	struct eventfd_ctx *cfg_chg_trigger;
	DECLARE_BITMAP(apm_add, AP_DEVICES);
	DECLARE_BITMAP(aqm_add, AP_DOMAINS);
	DECLARE_BITMAP(adm_add, AP_DOMAINS);
};

/**
 * struct vfio_ap_queue - contains the data associated with a queue bound to the
 *			  vfio_ap device driver
 * @matrix_mdev: the matrix mediated device
 * @saved_iova: the notification indicator byte (nib) address
 * @apqn: the APQN of the AP queue device
 * @saved_isc: the guest ISC registered with the GIB interface

Annotation

Implementation Notes