diff options
Diffstat (limited to 'include/linux/hyperv.h')
| -rw-r--r-- | include/linux/hyperv.h | 45 | 
1 files changed, 44 insertions, 1 deletions
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 6256cc34c4a6..b4a017093b69 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -245,7 +245,10 @@ struct vmbus_channel_offer {  		} pipe;  	} u;  	/* -	 * The sub_channel_index is defined in win8. +	 * The sub_channel_index is defined in Win8: a value of zero means a +	 * primary channel and a value of non-zero means a sub-channel. +	 * +	 * Before Win8, the field is reserved, meaning it's always zero.  	 */  	u16 sub_channel_index;  	u16 reserved3; @@ -423,6 +426,9 @@ enum vmbus_channel_message_type {  	CHANNELMSG_COUNT  }; +/* Hyper-V supports about 2048 channels, and the RELIDs start with 1. */ +#define INVALID_RELID	U32_MAX +  struct vmbus_channel_message_header {  	enum vmbus_channel_message_type msgtype;  	u32 padding; @@ -934,6 +940,11 @@ static inline bool is_hvsock_channel(const struct vmbus_channel *c)  		  VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER);  } +static inline bool is_sub_channel(const struct vmbus_channel *c) +{ +	return c->offermsg.offer.sub_channel_index != 0; +} +  static inline void set_channel_affinity_state(struct vmbus_channel *c,  					      enum hv_numa_policy policy)  { @@ -1149,6 +1160,9 @@ struct hv_driver {  	int (*remove)(struct hv_device *);  	void (*shutdown)(struct hv_device *); +	int (*suspend)(struct hv_device *); +	int (*resume)(struct hv_device *); +  };  /* Base device object */ @@ -1578,4 +1592,33 @@ hv_pkt_iter_next(struct vmbus_channel *channel,  	for (pkt = hv_pkt_iter_first(channel); pkt; \  	    pkt = hv_pkt_iter_next(channel, pkt)) +/* + * Interface for passing data between SR-IOV PF and VF drivers. The VF driver + * sends requests to read and write blocks. Each block must be 128 bytes or + * smaller. Optionally, the VF driver can register a callback function which + * will be invoked when the host says that one or more of the first 64 block + * IDs is "invalid" which means that the VF driver should reread them. + */ +#define HV_CONFIG_BLOCK_SIZE_MAX 128 + +int hyperv_read_cfg_blk(struct pci_dev *dev, void *buf, unsigned int buf_len, +			unsigned int block_id, unsigned int *bytes_returned); +int hyperv_write_cfg_blk(struct pci_dev *dev, void *buf, unsigned int len, +			 unsigned int block_id); +int hyperv_reg_block_invalidate(struct pci_dev *dev, void *context, +				void (*block_invalidate)(void *context, +							 u64 block_mask)); + +struct hyperv_pci_block_ops { +	int (*read_block)(struct pci_dev *dev, void *buf, unsigned int buf_len, +			  unsigned int block_id, unsigned int *bytes_returned); +	int (*write_block)(struct pci_dev *dev, void *buf, unsigned int len, +			   unsigned int block_id); +	int (*reg_blk_invalidate)(struct pci_dev *dev, void *context, +				  void (*block_invalidate)(void *context, +							   u64 block_mask)); +}; + +extern struct hyperv_pci_block_ops hvpci_block_ops; +  #endif /* _HYPERV_H */  |