linux/include/linux/hyperv.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 *
 * Copyright (c) 2011, Microsoft Corporation.
 *
 * Authors:
 *   Haiyang Zhang <[email protected]>
 *   Hank Janssen  <[email protected]>
 *   K. Y. Srinivasan <[email protected]>
 */

#ifndef _HYPERV_H
#define _HYPERV_H

#include <uapi/linux/hyperv.h>

#include <linux/mm.h>
#include <linux/types.h>
#include <linux/scatterlist.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/interrupt.h>
#include <linux/reciprocal_div.h>
#include <asm/hyperv-tlfs.h>

#define MAX_PAGE_BUFFER_COUNT
#define MAX_MULTIPAGE_BUFFER_COUNT

#pragma pack(push, 1)

/*
 * Types for GPADL, decides is how GPADL header is created.
 *
 * It doesn't make much difference between BUFFER and RING if PAGE_SIZE is the
 * same as HV_HYP_PAGE_SIZE.
 *
 * If PAGE_SIZE is bigger than HV_HYP_PAGE_SIZE, the headers of ring buffers
 * will be of PAGE_SIZE, however, only the first HV_HYP_PAGE will be put
 * into gpadl, therefore the number for HV_HYP_PAGE and the indexes of each
 * HV_HYP_PAGE will be different between different types of GPADL, for example
 * if PAGE_SIZE is 64K:
 *
 * BUFFER:
 *
 * gva:    |--       64k      --|--       64k      --| ... |
 * gpa:    | 4k | 4k | ... | 4k | 4k | 4k | ... | 4k |
 * index:  0    1    2     15   16   17   18 .. 31   32 ...
 *         |    |    ...   |    |    |   ...    |   ...
 *         v    V          V    V    V          V
 * gpadl:  | 4k | 4k | ... | 4k | 4k | 4k | ... | 4k | ... |
 * index:  0    1    2 ... 15   16   17   18 .. 31   32 ...
 *
 * RING:
 *
 *         | header  |           data           | header  |     data      |
 * gva:    |-- 64k --|--       64k      --| ... |-- 64k --|-- 64k --| ... |
 * gpa:    | 4k | .. | 4k | 4k | ... | 4k | ... | 4k | .. | 4k | .. | ... |
 * index:  0    1    16   17   18    31   ...   n   n+1  n+16 ...         2n
 *         |         /    /          /          |         /               /
 *         |        /    /          /           |        /               /
 *         |       /    /   ...    /    ...     |       /      ...      /
 *         |      /    /          /             |      /               /
 *         |     /    /          /              |     /               /
 *         V    V    V          V               V    V               v
 * gpadl:  | 4k | 4k |   ...    |    ...        | 4k | 4k |  ...     |
 * index:  0    1    2   ...    16   ...       n-15 n-14 n-13  ...  2n-30
 */
enum hv_gpadl_type {};

/* Single-page buffer */
struct hv_page_buffer {};

/* Multiple-page buffer */
struct hv_multipage_buffer {};

/*
 * Multiple-page buffer array; the pfn array is variable size:
 * The number of entries in the PFN array is determined by
 * "len" and "offset".
 */
struct hv_mpb_array {};

/* 0x18 includes the proprietary packet header */
#define MAX_PAGE_BUFFER_PACKET
#define MAX_MULTIPAGE_BUFFER_PACKET


#pragma pack(pop)

struct hv_ring_buffer {} __packed;


/*
 * If the requested ring buffer size is at least 8 times the size of the
 * header, steal space from the ring buffer for the header. Otherwise, add
 * space for the header so that is doesn't take too much of the ring buffer
 * space.
 *
 * The factor of 8 is somewhat arbitrary. The goal is to prevent adding a
 * relatively small header (4 Kbytes on x86) to a large-ish power-of-2 ring
 * buffer size (such as 128 Kbytes) and so end up making a nearly twice as
 * large allocation that will be almost half wasted. As a contrasting example,
 * on ARM64 with 64 Kbyte page size, we don't want to take 64 Kbytes for the
 * header from a 128 Kbyte allocation, leaving only 64 Kbytes for the ring.
 * In this latter case, we must add 64 Kbytes for the header and not worry
 * about what's wasted.
 */
#define VMBUS_HEADER_ADJ(payload_sz)

/* Calculate the proper size of a ringbuffer, it must be page-aligned */
#define VMBUS_RING_SIZE(payload_sz)

struct hv_ring_buffer_info {};


static inline u32 hv_get_bytes_to_read(const struct hv_ring_buffer_info *rbi)
{}

static inline u32 hv_get_bytes_to_write(const struct hv_ring_buffer_info *rbi)
{}

static inline u32 hv_get_avail_to_write_percent(
		const struct hv_ring_buffer_info *rbi)
{}

/*
 * VMBUS version is 32 bit entity broken up into
 * two 16 bit quantities: major_number. minor_number.
 *
 * 0 . 13 (Windows Server 2008)
 * 1 . 1  (Windows 7, WS2008 R2)
 * 2 . 4  (Windows 8, WS2012)
 * 3 . 0  (Windows 8.1, WS2012 R2)
 * 4 . 0  (Windows 10)
 * 4 . 1  (Windows 10 RS3)
 * 5 . 0  (Newer Windows 10)
 * 5 . 1  (Windows 10 RS4)
 * 5 . 2  (Windows Server 2019, RS5)
 * 5 . 3  (Windows Server 2022)
 *
 * The WS2008 and WIN7 versions are listed here for
 * completeness but are no longer supported in the
 * Linux kernel.
 */

#define VERSION_WS2008
#define VERSION_WIN7
#define VERSION_WIN8
#define VERSION_WIN8_1
#define VERSION_WIN10
#define VERSION_WIN10_V4_1
#define VERSION_WIN10_V5
#define VERSION_WIN10_V5_1
#define VERSION_WIN10_V5_2
#define VERSION_WIN10_V5_3

/* Make maximum size of pipe payload of 16K */
#define MAX_PIPE_DATA_PAYLOAD

/* Define PipeMode values. */
#define VMBUS_PIPE_TYPE_BYTE
#define VMBUS_PIPE_TYPE_MESSAGE

/* The size of the user defined data buffer for non-pipe offers. */
#define MAX_USER_DEFINED_BYTES

/* The size of the user defined data buffer for pipe offers. */
#define MAX_PIPE_USER_DEFINED_BYTES

/*
 * At the center of the Channel Management library is the Channel Offer. This
 * struct contains the fundamental information about an offer.
 */
struct vmbus_channel_offer {} __packed;

/* Server Flags */
#define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE
#define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES
#define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS
#define VMBUS_CHANNEL_NAMED_PIPE_MODE
#define VMBUS_CHANNEL_LOOPBACK_OFFER
#define VMBUS_CHANNEL_PARENT_OFFER
#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION
#define VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER

struct vmpacket_descriptor {} __packed;

struct vmpacket_header {} __packed;

struct vmtransfer_page_range {} __packed;

struct vmtransfer_page_packet_header {} __packed;

struct vmgpadl_packet_header {} __packed;

struct vmadd_remove_transfer_page_set {} __packed;

/*
 * This structure defines a range in guest physical space that can be made to
 * look virtually contiguous.
 */
struct gpa_range {};

/*
 * This is the format for an Establish Gpadl packet, which contains a handle by
 * which this GPADL will be known and a set of GPA ranges associated with it.
 * This can be converted to a MDL by the guest OS.  If there are multiple GPA
 * ranges, then the resulting MDL will be "chained," representing multiple VA
 * ranges.
 */
struct vmestablish_gpadl {} __packed;

/*
 * This is the format for a Teardown Gpadl packet, which indicates that the
 * GPADL handle in the Establish Gpadl packet will never be referenced again.
 */
struct vmteardown_gpadl {} __packed;

/*
 * This is the format for a GPA-Direct packet, which contains a set of GPA
 * ranges, in addition to commands and/or data.
 */
struct vmdata_gpa_direct {} __packed;

/* This is the format for a Additional Data Packet. */
struct vmadditional_data {} __packed;

vmpacket_largest_possible_header;

#define VMPACKET_DATA_START_ADDRESS(__packet)

#define VMPACKET_DATA_LENGTH(__packet)

#define VMPACKET_TRANSFER_MODE(__packet)

enum vmbus_packet_type {};

#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED


/* Version 1 messages */
enum vmbus_channel_message_type {};

/* Hyper-V supports about 2048 channels, and the RELIDs start with 1. */
#define INVALID_RELID

struct vmbus_channel_message_header {} __packed;

/* Query VMBus Version parameters */
struct vmbus_channel_query_vmbus_version {} __packed;

/* VMBus Version Supported parameters */
struct vmbus_channel_version_supported {} __packed;

/* Offer Channel parameters */
struct vmbus_channel_offer_channel {} __packed;

/* Rescind Offer parameters */
struct vmbus_channel_rescind_offer {} __packed;

/*
 * Request Offer -- no parameters, SynIC message contains the partition ID
 * Set Snoop -- no parameters, SynIC message contains the partition ID
 * Clear Snoop -- no parameters, SynIC message contains the partition ID
 * All Offers Delivered -- no parameters, SynIC message contains the partition
 *		           ID
 * Flush Client -- no parameters, SynIC message contains the partition ID
 */

/* Open Channel parameters */
struct vmbus_channel_open_channel {} __packed;

/* Open Channel Result parameters */
struct vmbus_channel_open_result {} __packed;

/* Modify Channel Result parameters */
struct vmbus_channel_modifychannel_response {} __packed;

/* Close channel parameters; */
struct vmbus_channel_close_channel {} __packed;

/* Channel Message GPADL */
#define GPADL_TYPE_RING_BUFFER
#define GPADL_TYPE_SERVER_SAVE_AREA
#define GPADL_TYPE_TRANSACTION

/*
 * The number of PFNs in a GPADL message is defined by the number of
 * pages that would be spanned by ByteCount and ByteOffset.  If the
 * implied number of PFNs won't fit in this packet, there will be a
 * follow-up packet that contains more.
 */
struct vmbus_channel_gpadl_header {} __packed;

/* This is the followup packet that contains more PFNs. */
struct vmbus_channel_gpadl_body {} __packed;

struct vmbus_channel_gpadl_created {} __packed;

struct vmbus_channel_gpadl_teardown {} __packed;

struct vmbus_channel_gpadl_torndown {} __packed;

struct vmbus_channel_relid_released {} __packed;

struct vmbus_channel_initiate_contact {} __packed;

/* Hyper-V socket: guest's connect()-ing to host */
struct vmbus_channel_tl_connect_request {} __packed;

/* Modify Channel parameters, cf. vmbus_send_modifychannel() */
struct vmbus_channel_modifychannel {} __packed;

struct vmbus_channel_version_response {} __packed;

enum vmbus_channel_state {};

/*
 * Represents each channel msg on the vmbus connection This is a
 * variable-size data structure depending on the msg type itself
 */
struct vmbus_channel_msginfo {};

struct vmbus_close_msg {};

/* Define connection identifier type. */
hv_connection_id;

enum vmbus_device_type {};

/*
 * Provides request ids for VMBus. Encapsulates guest memory
 * addresses and stores the next available slot in req_arr
 * to generate new ids in constant time.
 */
struct vmbus_requestor {};

#define VMBUS_NO_RQSTOR
#define VMBUS_RQST_ERROR
#define VMBUS_RQST_ADDR_ANY
/* NetVSC-specific */
#define VMBUS_RQST_ID_NO_RESPONSE
/* StorVSC-specific */
#define VMBUS_RQST_INIT
#define VMBUS_RQST_RESET

struct vmbus_device {};

#define VMBUS_DEFAULT_MAX_PKT_SIZE

struct vmbus_gpadl {};

struct vmbus_channel {};

#define lock_requestor(channel, flags)

static __always_inline void unlock_requestor(struct vmbus_channel *channel,
					     unsigned long flags)
{}

u64 vmbus_next_request_id(struct vmbus_channel *channel, u64 rqst_addr);
u64 __vmbus_request_addr_match(struct vmbus_channel *channel, u64 trans_id,
			       u64 rqst_addr);
u64 vmbus_request_addr_match(struct vmbus_channel *channel, u64 trans_id,
			     u64 rqst_addr);
u64 vmbus_request_addr(struct vmbus_channel *channel, u64 trans_id);

static inline bool is_hvsock_offer(const struct vmbus_channel_offer_channel *o)
{}

static inline bool is_hvsock_channel(const struct vmbus_channel *c)
{}

static inline bool is_sub_channel(const struct vmbus_channel *c)
{}

static inline void set_channel_read_mode(struct vmbus_channel *c,
					enum hv_callback_mode mode)
{}

static inline void set_per_channel_state(struct vmbus_channel *c, void *s)
{}

static inline void *get_per_channel_state(struct vmbus_channel *c)
{}

static inline void set_channel_pending_send_size(struct vmbus_channel *c,
						 u32 size)
{}

void vmbus_onmessage(struct vmbus_channel_message_header *hdr);

int vmbus_request_offers(void);

/*
 * APIs for managing sub-channels.
 */

void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,
			void (*sc_cr_cb)(struct vmbus_channel *new_sc));

void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel,
		void (*chn_rescind_cb)(struct vmbus_channel *));

/* The format must be the same as struct vmdata_gpa_direct */
struct vmbus_channel_packet_page_buffer {} __packed;

/* The format must be the same as struct vmdata_gpa_direct */
struct vmbus_channel_packet_multipage_buffer {} __packed;

/* The format must be the same as struct vmdata_gpa_direct */
struct vmbus_packet_mpb_array {} __packed;

int vmbus_alloc_ring(struct vmbus_channel *channel,
		     u32 send_size, u32 recv_size);
void vmbus_free_ring(struct vmbus_channel *channel);

int vmbus_connect_ring(struct vmbus_channel *channel,
		       void (*onchannel_callback)(void *context),
		       void *context);
int vmbus_disconnect_ring(struct vmbus_channel *channel);

extern int vmbus_open(struct vmbus_channel *channel,
			    u32 send_ringbuffersize,
			    u32 recv_ringbuffersize,
			    void *userdata,
			    u32 userdatalen,
			    void (*onchannel_callback)(void *context),
			    void *context);

extern void vmbus_close(struct vmbus_channel *channel);

extern int vmbus_sendpacket_getid(struct vmbus_channel *channel,
				  void *buffer,
				  u32 bufferLen,
				  u64 requestid,
				  u64 *trans_id,
				  enum vmbus_packet_type type,
				  u32 flags);
extern int vmbus_sendpacket(struct vmbus_channel *channel,
				  void *buffer,
				  u32 bufferLen,
				  u64 requestid,
				  enum vmbus_packet_type type,
				  u32 flags);

extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
					    struct hv_page_buffer pagebuffers[],
					    u32 pagecount,
					    void *buffer,
					    u32 bufferlen,
					    u64 requestid);

extern int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel,
				     struct vmbus_packet_mpb_array *mpb,
				     u32 desc_size,
				     void *buffer,
				     u32 bufferlen,
				     u64 requestid);

extern int vmbus_establish_gpadl(struct vmbus_channel *channel,
				      void *kbuffer,
				      u32 size,
				      struct vmbus_gpadl *gpadl);

extern int vmbus_teardown_gpadl(struct vmbus_channel *channel,
				     struct vmbus_gpadl *gpadl);

void vmbus_reset_channel_cb(struct vmbus_channel *channel);

extern int vmbus_recvpacket(struct vmbus_channel *channel,
				  void *buffer,
				  u32 bufferlen,
				  u32 *buffer_actual_len,
				  u64 *requestid);

extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
				     void *buffer,
				     u32 bufferlen,
				     u32 *buffer_actual_len,
				     u64 *requestid);

/* Base driver object */
struct hv_driver {};

/* Base device object */
struct hv_device {};


#define device_to_hv_device(d)
#define drv_to_hv_drv(d)

static inline void hv_set_drvdata(struct hv_device *dev, void *data)
{}

static inline void *hv_get_drvdata(struct hv_device *dev)
{}

struct hv_ring_buffer_debug_info {};


int hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info,
				struct hv_ring_buffer_debug_info *debug_info);

bool hv_ringbuffer_spinlock_busy(struct vmbus_channel *channel);

/* Vmbus interface */
#define vmbus_driver_register(driver)
int __must_check __vmbus_driver_register(struct hv_driver *hv_driver,
					 struct module *owner,
					 const char *mod_name);
void vmbus_driver_unregister(struct hv_driver *hv_driver);

void vmbus_hvsock_device_unregister(struct vmbus_channel *channel);

int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
			resource_size_t min, resource_size_t max,
			resource_size_t size, resource_size_t align,
			bool fb_overlap_ok);
void vmbus_free_mmio(resource_size_t start, resource_size_t size);

/*
 * GUID definitions of various offer types - services offered to the guest.
 */

/*
 * Network GUID
 * {f8615163-df3e-46c5-913f-f2d2f965ed0e}
 */
#define HV_NIC_GUID

/*
 * IDE GUID
 * {32412632-86cb-44a2-9b5c-50d1417354f5}
 */
#define HV_IDE_GUID

/*
 * SCSI GUID
 * {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}
 */
#define HV_SCSI_GUID

/*
 * Shutdown GUID
 * {0e0b6031-5213-4934-818b-38d90ced39db}
 */
#define HV_SHUTDOWN_GUID

/*
 * Time Synch GUID
 * {9527E630-D0AE-497b-ADCE-E80AB0175CAF}
 */
#define HV_TS_GUID

/*
 * Heartbeat GUID
 * {57164f39-9115-4e78-ab55-382f3bd5422d}
 */
#define HV_HEART_BEAT_GUID

/*
 * KVP GUID
 * {a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}
 */
#define HV_KVP_GUID

/*
 * Dynamic memory GUID
 * {525074dc-8985-46e2-8057-a307dc18a502}
 */
#define HV_DM_GUID

/*
 * Mouse GUID
 * {cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}
 */
#define HV_MOUSE_GUID

/*
 * Keyboard GUID
 * {f912ad6d-2b17-48ea-bd65-f927a61c7684}
 */
#define HV_KBD_GUID

/*
 * VSS (Backup/Restore) GUID
 */
#define HV_VSS_GUID
/*
 * Synthetic Video GUID
 * {DA0A7802-E377-4aac-8E77-0558EB1073F8}
 */
#define HV_SYNTHVID_GUID

/*
 * Synthetic FC GUID
 * {2f9bcc4a-0069-4af3-b76b-6fd0be528cda}
 */
#define HV_SYNTHFC_GUID

/*
 * Guest File Copy Service
 * {34D14BE3-DEE4-41c8-9AE7-6B174977C192}
 */

#define HV_FCOPY_GUID

/*
 * NetworkDirect. This is the guest RDMA service.
 * {8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}
 */
#define HV_ND_GUID

/*
 * PCI Express Pass Through
 * {44C4F61D-4444-4400-9D52-802E27EDE19F}
 */

#define HV_PCIE_GUID

/*
 * Linux doesn't support these 4 devices: the first two are for
 * Automatic Virtual Machine Activation, the third is for
 * Remote Desktop Virtualization, and the fourth is Initial
 * Machine Configuration (IMC) used only by Windows guests.
 * {f8e65716-3cb3-4a06-9a60-1889c5cccab5}
 * {3375baf4-9e15-4b30-b765-67acb10d607b}
 * {276aacf4-ac15-426c-98dd-7521ad3f01fe}
 * {c376c1c3-d276-48d2-90a9-c04748072c60}
 */

#define HV_AVMA1_GUID

#define HV_AVMA2_GUID

#define HV_RDV_GUID

#define HV_IMC_GUID

/*
 * Common header for Hyper-V ICs
 */

#define ICMSGTYPE_NEGOTIATE
#define ICMSGTYPE_HEARTBEAT
#define ICMSGTYPE_KVPEXCHANGE
#define ICMSGTYPE_SHUTDOWN
#define ICMSGTYPE_TIMESYNC
#define ICMSGTYPE_VSS
#define ICMSGTYPE_FCOPY

#define ICMSGHDRFLAG_TRANSACTION
#define ICMSGHDRFLAG_REQUEST
#define ICMSGHDRFLAG_RESPONSE


/*
 * While we want to handle util services as regular devices,
 * there is only one instance of each of these services; so
 * we statically allocate the service specific state.
 */

struct hv_util_service {};

struct vmbuspipe_hdr {} __packed;

struct ic_version {} __packed;

struct icmsg_hdr {} __packed;

#define IC_VERSION_NEGOTIATION_MAX_VER_COUNT
#define ICMSG_HDR
#define ICMSG_NEGOTIATE_PKT_SIZE(icframe_vercnt, icmsg_vercnt)

struct icmsg_negotiate {} __packed;

struct shutdown_msg_data {} __packed;

struct heartbeat_msg_data {} __packed;

/* Time Sync IC defs */
#define ICTIMESYNCFLAG_PROBE
#define ICTIMESYNCFLAG_SYNC
#define ICTIMESYNCFLAG_SAMPLE

#ifdef __x86_64__
#define WLTIMEDELTA
#else
#define WLTIMEDELTA
#endif

struct ictimesync_data {} __packed;

struct ictimesync_ref_data {} __packed;

struct hyperv_service_callback {};

struct hv_dma_range {};

#define MAX_SRV_VER
extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, u8 *buf, u32 buflen,
				const int *fw_version, int fw_vercnt,
				const int *srv_version, int srv_vercnt,
				int *nego_fw_version, int *nego_srv_version);

void hv_process_channel_removal(struct vmbus_channel *channel);

void vmbus_setevent(struct vmbus_channel *channel);
/*
 * Negotiated version with the Host.
 */

extern __u32 vmbus_proto_version;

int vmbus_send_tl_connect_request(const guid_t *shv_guest_servie_id,
				  const guid_t *shv_host_servie_id);
int vmbus_send_modifychannel(struct vmbus_channel *channel, u32 target_vp);
void vmbus_set_event(struct vmbus_channel *channel);

/* Get the start of the ring buffer. */
static inline void *
hv_get_ring_buffer(const struct hv_ring_buffer_info *ring_info)
{}

/*
 * Mask off host interrupt callback notifications
 */
static inline void hv_begin_read(struct hv_ring_buffer_info *rbi)
{}

/*
 * Re-enable host callback and return number of outstanding bytes
 */
static inline u32 hv_end_read(struct hv_ring_buffer_info *rbi)
{}

/*
 * An API to support in-place processing of incoming VMBUS packets.
 */

/* Get data payload associated with descriptor */
static inline void *hv_pkt_data(const struct vmpacket_descriptor *desc)
{}

/* Get data size associated with descriptor */
static inline u32 hv_pkt_datalen(const struct vmpacket_descriptor *desc)
{}

/* Get packet length associated with descriptor */
static inline u32 hv_pkt_len(const struct vmpacket_descriptor *desc)
{}

struct vmpacket_descriptor *
hv_pkt_iter_first(struct vmbus_channel *channel);

struct vmpacket_descriptor *
__hv_pkt_iter_next(struct vmbus_channel *channel,
		   const struct vmpacket_descriptor *pkt);

void hv_pkt_iter_close(struct vmbus_channel *channel);

static inline struct vmpacket_descriptor *
hv_pkt_iter_next(struct vmbus_channel *channel,
		 const struct vmpacket_descriptor *pkt)
{}

#define foreach_vmbus_pkt(pkt, channel)

/*
 * 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

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 {};

extern struct hyperv_pci_block_ops hvpci_block_ops;

static inline unsigned long virt_to_hvpfn(void *addr)
{}

#define NR_HV_HYP_PAGES_IN_PAGE
#define offset_in_hvpage(ptr)
#define HVPFN_UP(x)
#define HVPFN_DOWN(x)
#define page_to_hvpfn(page)

#endif /* _HYPERV_H */