state = active
io 0x70-0x77
irq 8
     �ÅÄÆ      File not found.
     ˆÃÈ„^yÿÁÄÆ ?÷     /* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_VDPA_H
#define _LINUX_VDPA_H

#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/vhost_iotlb.h>
#include <linux/virtio_net.h>
#include <linux/if_ether.h>

/**
 * struct vdpa_callback - vDPA callback definition.
 * @callback: interrupt callback function
 * @private: the data passed to the callback function
 * @trigger: the eventfd for the callback (Optional).
 *           When it is set, the vDPA driver must guarantee that
 *           signaling it is functional equivalent to triggering
 *           the callback. Then vDPA parent can signal it directly
 *           instead of triggering the callback.
 */
struct vdpa_callback {
	irqreturn_t (*callback)(void *data);
	void *private;
	struct eventfd_ctx *trigger;
};

/**
 * struct vdpa_notification_area - vDPA notification area
 * @addr: base address of the notification area
 * @size: size of the notification area
 */
struct vdpa_notification_area {
	resource_size_t addr;
	resource_size_t size;
};

/**
 * struct vdpa_vq_state_split - vDPA split virtqueue state
 * @avail_index: available index
 */
struct vdpa_vq_state_split {
	u16	avail_index;
};

/**
 * struct vdpa_vq_state_packed - vDPA packed virtqueue state
 * @last_avail_counter: last driver ring wrap counter observed by device
 * @last_avail_idx: device available index
 * @last_used_counter: device ring wrap counter
 * @last_used_idx: used index
 */
struct vdpa_vq_state_packed {
	u16	last_avail_counter:1;
	u16	last_avail_idx:15;
	u16	last_used_counter:1;
	u16	last_used_idx:15;
};

struct vdpa_vq_state {
	union {
		struct vdpa_vq_state_split split;
		struct vdpa_vq_state_packed packed;
	};
};

struct vdpa_mgmt_dev;

/**
 * struct vdpa_device - representation of a vDPA device
 * @dev: underlying device
 * @dma_dev: the actual device that is performing DMA
 * @driver_override: driver name to force a match; do not set directly,
 *                   because core frees it; use driver_set_override() to
 *                   set or clear it.
 * @config: the configuration ops for this device.
 * @cf_lock: Protects get and set access to configuration layout.
 * @index: device index
 * @features_valid: were features initialized? for legacy guests
 * @ngroups: the number of virtqueue groups
 * @nas: the number of address spaces
 * @use_va: indicate whether virtual address must be used by this device
 * @nvqs: maximum number of supported virtqueues
 * @mdev: management device pointer; caller must setup when registering device as part
 *	  of dev_add() mgmtdev ops callback before invoking _vdpa_register_device().
 */
struct vdpa_device {
	struct device dev;
	struct device *dma_dev;
	const char *driver_override;
	const struct vdpa_config_ops *config;
	struct rw_semaphore cf_lock; /* Protects get/set config */
	unsigned int index;
	bool features_valid;
	bool use_va;
	u32 nvqs;
	struct vdpa_mgmt_dev *mdev;
	unsigned int ngroups;
	unsigned int nas;
};

/**
 * struct vdpa_iova_range - the IOVA range support by the device
 * @first: start of the IOVA range
 * @last: end of the IOVA range
 */
struct vdpa_iova_range {
	u64 first;
	u64 last;
};

struct vdpa_dev_set_config {
	u64 device_features;
	struct {
		u8 mac[ETH_ALEN];
		u16 mtu;
		u16 max_vq_pairs;
	} net;
	u64 mask;
};

/**
 * struct vdpa_map_file - file area for device memory mapping
 * @file: vma->vm_file for the mapping
 * @offset: mapping offset in the vm_file
 */
struct vdpa_map_file {
	struct file *file;
	u64 offset;
};

/**
 * struct vdpa_config_ops - operations for configuring a vDPA device.
 * Note: vDPA device drivers are required to implement all of the
 * operations unless it is mentioned to be optional in the following
 * list.
 *
 * @set_vq_address:		Set the address of virtqueue
 *				@vdev: vdpa device
 *				@idx: virtqueue index
 *				@desc_area: address of desc area
 *				@driver_area: address of driver area
 *				@device_area: address of device area
 *				Returns intege