162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2018-2021 Advanced Micro Devices, Inc. All rights reserved.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy
562306a36Sopenharmony_ci * of this software and associated documentation files (the "Software"), to deal
662306a36Sopenharmony_ci * in the Software without restriction, including without limitation the rights
762306a36Sopenharmony_ci * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
862306a36Sopenharmony_ci * copies of the Software, and to permit persons to whom the Software is
962306a36Sopenharmony_ci * furnished to do so, subject to the following conditions:
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1262306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1762306a36Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1862306a36Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1962306a36Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2062306a36Sopenharmony_ci * THE SOFTWARE.
2162306a36Sopenharmony_ci */
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#ifndef AMDGV_SRIOV_MSG__H_
2462306a36Sopenharmony_ci#define AMDGV_SRIOV_MSG__H_
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* unit in kilobytes */
2762306a36Sopenharmony_ci#define AMD_SRIOV_MSG_VBIOS_OFFSET	     0
2862306a36Sopenharmony_ci#define AMD_SRIOV_MSG_VBIOS_SIZE_KB	     64
2962306a36Sopenharmony_ci#define AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB AMD_SRIOV_MSG_VBIOS_SIZE_KB
3062306a36Sopenharmony_ci#define AMD_SRIOV_MSG_DATAEXCHANGE_SIZE_KB   4
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci/*
3362306a36Sopenharmony_ci * layout
3462306a36Sopenharmony_ci * 0           64KB        65KB        66KB
3562306a36Sopenharmony_ci * |   VBIOS   |   PF2VF   |   VF2PF   |   Bad Page   | ...
3662306a36Sopenharmony_ci * |   64KB    |   1KB     |   1KB     |
3762306a36Sopenharmony_ci */
3862306a36Sopenharmony_ci#define AMD_SRIOV_MSG_SIZE_KB                   1
3962306a36Sopenharmony_ci#define AMD_SRIOV_MSG_PF2VF_OFFSET_KB           AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB
4062306a36Sopenharmony_ci#define AMD_SRIOV_MSG_VF2PF_OFFSET_KB           (AMD_SRIOV_MSG_PF2VF_OFFSET_KB + AMD_SRIOV_MSG_SIZE_KB)
4162306a36Sopenharmony_ci#define AMD_SRIOV_MSG_BAD_PAGE_OFFSET_KB        (AMD_SRIOV_MSG_VF2PF_OFFSET_KB + AMD_SRIOV_MSG_SIZE_KB)
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/*
4462306a36Sopenharmony_ci * PF2VF history log:
4562306a36Sopenharmony_ci * v1 defined in amdgim
4662306a36Sopenharmony_ci * v2 current
4762306a36Sopenharmony_ci *
4862306a36Sopenharmony_ci * VF2PF history log:
4962306a36Sopenharmony_ci * v1 defined in amdgim
5062306a36Sopenharmony_ci * v2 defined in amdgim
5162306a36Sopenharmony_ci * v3 current
5262306a36Sopenharmony_ci */
5362306a36Sopenharmony_ci#define AMD_SRIOV_MSG_FW_VRAM_PF2VF_VER 2
5462306a36Sopenharmony_ci#define AMD_SRIOV_MSG_FW_VRAM_VF2PF_VER 3
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define AMD_SRIOV_MSG_RESERVE_UCODE 24
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define AMD_SRIOV_MSG_RESERVE_VCN_INST 4
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_cienum amd_sriov_ucode_engine_id {
6162306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_VCE = 0,
6262306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_UVD,
6362306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_MC,
6462306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_ME,
6562306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_PFP,
6662306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_CE,
6762306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_RLC,
6862306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_RLC_SRLC,
6962306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_RLC_SRLG,
7062306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_RLC_SRLS,
7162306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_MEC,
7262306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_MEC2,
7362306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_SOS,
7462306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_ASD,
7562306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_TA_RAS,
7662306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_TA_XGMI,
7762306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_SMC,
7862306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_SDMA,
7962306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_SDMA2,
8062306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_VCN,
8162306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID_DMCU,
8262306a36Sopenharmony_ci	AMD_SRIOV_UCODE_ID__MAX
8362306a36Sopenharmony_ci};
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci#pragma pack(push, 1) // PF2VF / VF2PF data areas are byte packed
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ciunion amd_sriov_msg_feature_flags {
8862306a36Sopenharmony_ci	struct {
8962306a36Sopenharmony_ci		uint32_t error_log_collect : 1;
9062306a36Sopenharmony_ci		uint32_t host_load_ucodes  : 1;
9162306a36Sopenharmony_ci		uint32_t host_flr_vramlost : 1;
9262306a36Sopenharmony_ci		uint32_t mm_bw_management  : 1;
9362306a36Sopenharmony_ci		uint32_t pp_one_vf_mode	   : 1;
9462306a36Sopenharmony_ci		uint32_t reg_indirect_acc  : 1;
9562306a36Sopenharmony_ci		uint32_t av1_support       : 1;
9662306a36Sopenharmony_ci		uint32_t reserved	   : 25;
9762306a36Sopenharmony_ci	} flags;
9862306a36Sopenharmony_ci	uint32_t all;
9962306a36Sopenharmony_ci};
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ciunion amd_sriov_reg_access_flags {
10262306a36Sopenharmony_ci	struct {
10362306a36Sopenharmony_ci		uint32_t vf_reg_access_ih 	 : 1;
10462306a36Sopenharmony_ci		uint32_t vf_reg_access_mmhub : 1;
10562306a36Sopenharmony_ci		uint32_t vf_reg_access_gc 	 : 1;
10662306a36Sopenharmony_ci		uint32_t reserved	         : 29;
10762306a36Sopenharmony_ci	} flags;
10862306a36Sopenharmony_ci	uint32_t all;
10962306a36Sopenharmony_ci};
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ciunion amd_sriov_msg_os_info {
11262306a36Sopenharmony_ci	struct {
11362306a36Sopenharmony_ci		uint32_t windows  : 1;
11462306a36Sopenharmony_ci		uint32_t reserved : 31;
11562306a36Sopenharmony_ci	} info;
11662306a36Sopenharmony_ci	uint32_t all;
11762306a36Sopenharmony_ci};
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_cistruct amd_sriov_msg_uuid_info {
12062306a36Sopenharmony_ci	union {
12162306a36Sopenharmony_ci		struct {
12262306a36Sopenharmony_ci			uint32_t did	: 16;
12362306a36Sopenharmony_ci			uint32_t fcn	: 8;
12462306a36Sopenharmony_ci			uint32_t asic_7 : 8;
12562306a36Sopenharmony_ci		};
12662306a36Sopenharmony_ci		uint32_t time_low;
12762306a36Sopenharmony_ci	};
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci	struct {
13062306a36Sopenharmony_ci		uint32_t time_mid  : 16;
13162306a36Sopenharmony_ci		uint32_t time_high : 12;
13262306a36Sopenharmony_ci		uint32_t version   : 4;
13362306a36Sopenharmony_ci	};
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci	struct {
13662306a36Sopenharmony_ci		struct {
13762306a36Sopenharmony_ci			uint8_t clk_seq_hi : 6;
13862306a36Sopenharmony_ci			uint8_t variant    : 2;
13962306a36Sopenharmony_ci		};
14062306a36Sopenharmony_ci		union {
14162306a36Sopenharmony_ci			uint8_t clk_seq_low;
14262306a36Sopenharmony_ci			uint8_t asic_6;
14362306a36Sopenharmony_ci		};
14462306a36Sopenharmony_ci		uint16_t asic_4;
14562306a36Sopenharmony_ci	};
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci	uint32_t asic_0;
14862306a36Sopenharmony_ci};
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_cistruct amd_sriov_msg_pf2vf_info_header {
15162306a36Sopenharmony_ci	/* the total structure size in byte */
15262306a36Sopenharmony_ci	uint32_t size;
15362306a36Sopenharmony_ci	/* version of this structure, written by the HOST */
15462306a36Sopenharmony_ci	uint32_t version;
15562306a36Sopenharmony_ci	/* reserved */
15662306a36Sopenharmony_ci	uint32_t reserved[2];
15762306a36Sopenharmony_ci};
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (48)
16062306a36Sopenharmony_cistruct amd_sriov_msg_pf2vf_info {
16162306a36Sopenharmony_ci	/* header contains size and version */
16262306a36Sopenharmony_ci	struct amd_sriov_msg_pf2vf_info_header header;
16362306a36Sopenharmony_ci	/* use private key from mailbox 2 to create checksum */
16462306a36Sopenharmony_ci	uint32_t checksum;
16562306a36Sopenharmony_ci	/* The features flags of the HOST driver supports */
16662306a36Sopenharmony_ci	union amd_sriov_msg_feature_flags feature_flags;
16762306a36Sopenharmony_ci	/* (max_width * max_height * fps) / (16 * 16) */
16862306a36Sopenharmony_ci	uint32_t hevc_enc_max_mb_per_second;
16962306a36Sopenharmony_ci	/* (max_width * max_height) / (16 * 16) */
17062306a36Sopenharmony_ci	uint32_t hevc_enc_max_mb_per_frame;
17162306a36Sopenharmony_ci	/* (max_width * max_height * fps) / (16 * 16) */
17262306a36Sopenharmony_ci	uint32_t avc_enc_max_mb_per_second;
17362306a36Sopenharmony_ci	/* (max_width * max_height) / (16 * 16) */
17462306a36Sopenharmony_ci	uint32_t avc_enc_max_mb_per_frame;
17562306a36Sopenharmony_ci	/* MEC FW position in BYTE from the start of VF visible frame buffer */
17662306a36Sopenharmony_ci	uint64_t mecfw_offset;
17762306a36Sopenharmony_ci	/* MEC FW size in BYTE */
17862306a36Sopenharmony_ci	uint32_t mecfw_size;
17962306a36Sopenharmony_ci	/* UVD FW position in BYTE from the start of VF visible frame buffer */
18062306a36Sopenharmony_ci	uint64_t uvdfw_offset;
18162306a36Sopenharmony_ci	/* UVD FW size in BYTE */
18262306a36Sopenharmony_ci	uint32_t uvdfw_size;
18362306a36Sopenharmony_ci	/* VCE FW position in BYTE from the start of VF visible frame buffer */
18462306a36Sopenharmony_ci	uint64_t vcefw_offset;
18562306a36Sopenharmony_ci	/* VCE FW size in BYTE */
18662306a36Sopenharmony_ci	uint32_t vcefw_size;
18762306a36Sopenharmony_ci	/* Bad pages block position in BYTE */
18862306a36Sopenharmony_ci	uint32_t bp_block_offset_low;
18962306a36Sopenharmony_ci	uint32_t bp_block_offset_high;
19062306a36Sopenharmony_ci	/* Bad pages block size in BYTE */
19162306a36Sopenharmony_ci	uint32_t bp_block_size;
19262306a36Sopenharmony_ci	/* frequency for VF to update the VF2PF area in msec, 0 = manual */
19362306a36Sopenharmony_ci	uint32_t vf2pf_update_interval_ms;
19462306a36Sopenharmony_ci	/* identification in ROCm SMI */
19562306a36Sopenharmony_ci	uint64_t uuid;
19662306a36Sopenharmony_ci	uint32_t fcn_idx;
19762306a36Sopenharmony_ci	/* flags to indicate which register access method VF should use */
19862306a36Sopenharmony_ci	union amd_sriov_reg_access_flags reg_access_flags;
19962306a36Sopenharmony_ci	/* MM BW management */
20062306a36Sopenharmony_ci	struct {
20162306a36Sopenharmony_ci		uint32_t decode_max_dimension_pixels;
20262306a36Sopenharmony_ci		uint32_t decode_max_frame_pixels;
20362306a36Sopenharmony_ci		uint32_t encode_max_dimension_pixels;
20462306a36Sopenharmony_ci		uint32_t encode_max_frame_pixels;
20562306a36Sopenharmony_ci	} mm_bw_management[AMD_SRIOV_MSG_RESERVE_VCN_INST];
20662306a36Sopenharmony_ci	/* UUID info */
20762306a36Sopenharmony_ci	struct amd_sriov_msg_uuid_info uuid_info;
20862306a36Sopenharmony_ci	/* PCIE atomic ops support flag */
20962306a36Sopenharmony_ci	uint32_t pcie_atomic_ops_support_flags;
21062306a36Sopenharmony_ci	/* reserved */
21162306a36Sopenharmony_ci	uint32_t reserved[256 - AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE];
21262306a36Sopenharmony_ci};
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_cistruct amd_sriov_msg_vf2pf_info_header {
21562306a36Sopenharmony_ci	/* the total structure size in byte */
21662306a36Sopenharmony_ci	uint32_t size;
21762306a36Sopenharmony_ci	/* version of this structure, written by the guest */
21862306a36Sopenharmony_ci	uint32_t version;
21962306a36Sopenharmony_ci	/* reserved */
22062306a36Sopenharmony_ci	uint32_t reserved[2];
22162306a36Sopenharmony_ci};
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci#define AMD_SRIOV_MSG_VF2PF_INFO_FILLED_SIZE (70)
22462306a36Sopenharmony_cistruct amd_sriov_msg_vf2pf_info {
22562306a36Sopenharmony_ci	/* header contains size and version */
22662306a36Sopenharmony_ci	struct amd_sriov_msg_vf2pf_info_header header;
22762306a36Sopenharmony_ci	uint32_t checksum;
22862306a36Sopenharmony_ci	/* driver version */
22962306a36Sopenharmony_ci	uint8_t driver_version[64];
23062306a36Sopenharmony_ci	/* driver certification, 1=WHQL, 0=None */
23162306a36Sopenharmony_ci	uint32_t driver_cert;
23262306a36Sopenharmony_ci	/* guest OS type and version */
23362306a36Sopenharmony_ci	union amd_sriov_msg_os_info os_info;
23462306a36Sopenharmony_ci	/* guest fb information in the unit of MB */
23562306a36Sopenharmony_ci	uint32_t fb_usage;
23662306a36Sopenharmony_ci	/* guest gfx engine usage percentage */
23762306a36Sopenharmony_ci	uint32_t gfx_usage;
23862306a36Sopenharmony_ci	/* guest gfx engine health percentage */
23962306a36Sopenharmony_ci	uint32_t gfx_health;
24062306a36Sopenharmony_ci	/* guest compute engine usage percentage */
24162306a36Sopenharmony_ci	uint32_t compute_usage;
24262306a36Sopenharmony_ci	/* guest compute engine health percentage */
24362306a36Sopenharmony_ci	uint32_t compute_health;
24462306a36Sopenharmony_ci	/* guest avc engine usage percentage. 0xffff means N/A */
24562306a36Sopenharmony_ci	uint32_t avc_enc_usage;
24662306a36Sopenharmony_ci	/* guest avc engine health percentage. 0xffff means N/A */
24762306a36Sopenharmony_ci	uint32_t avc_enc_health;
24862306a36Sopenharmony_ci	/* guest hevc engine usage percentage. 0xffff means N/A */
24962306a36Sopenharmony_ci	uint32_t hevc_enc_usage;
25062306a36Sopenharmony_ci	/* guest hevc engine usage percentage. 0xffff means N/A */
25162306a36Sopenharmony_ci	uint32_t hevc_enc_health;
25262306a36Sopenharmony_ci	/* combined encode/decode usage */
25362306a36Sopenharmony_ci	uint32_t encode_usage;
25462306a36Sopenharmony_ci	uint32_t decode_usage;
25562306a36Sopenharmony_ci	/* Version of PF2VF that VF understands */
25662306a36Sopenharmony_ci	uint32_t pf2vf_version_required;
25762306a36Sopenharmony_ci	/* additional FB usage */
25862306a36Sopenharmony_ci	uint32_t fb_vis_usage;
25962306a36Sopenharmony_ci	uint32_t fb_vis_size;
26062306a36Sopenharmony_ci	uint32_t fb_size;
26162306a36Sopenharmony_ci	/* guest ucode data, each one is 1.25 Dword */
26262306a36Sopenharmony_ci	struct {
26362306a36Sopenharmony_ci		uint8_t id;
26462306a36Sopenharmony_ci		uint32_t version;
26562306a36Sopenharmony_ci	} ucode_info[AMD_SRIOV_MSG_RESERVE_UCODE];
26662306a36Sopenharmony_ci	uint64_t dummy_page_addr;
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci	/* reserved */
26962306a36Sopenharmony_ci	uint32_t reserved[256 - AMD_SRIOV_MSG_VF2PF_INFO_FILLED_SIZE];
27062306a36Sopenharmony_ci};
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci/* mailbox message send from guest to host  */
27362306a36Sopenharmony_cienum amd_sriov_mailbox_request_message {
27462306a36Sopenharmony_ci	MB_REQ_MSG_REQ_GPU_INIT_ACCESS = 1,
27562306a36Sopenharmony_ci	MB_REQ_MSG_REL_GPU_INIT_ACCESS,
27662306a36Sopenharmony_ci	MB_REQ_MSG_REQ_GPU_FINI_ACCESS,
27762306a36Sopenharmony_ci	MB_REQ_MSG_REL_GPU_FINI_ACCESS,
27862306a36Sopenharmony_ci	MB_REQ_MSG_REQ_GPU_RESET_ACCESS,
27962306a36Sopenharmony_ci	MB_REQ_MSG_REQ_GPU_INIT_DATA,
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci	MB_REQ_MSG_LOG_VF_ERROR = 200,
28262306a36Sopenharmony_ci};
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci/* mailbox message send from host to guest  */
28562306a36Sopenharmony_cienum amd_sriov_mailbox_response_message {
28662306a36Sopenharmony_ci	MB_RES_MSG_CLR_MSG_BUF = 0,
28762306a36Sopenharmony_ci	MB_RES_MSG_READY_TO_ACCESS_GPU = 1,
28862306a36Sopenharmony_ci	MB_RES_MSG_FLR_NOTIFICATION,
28962306a36Sopenharmony_ci	MB_RES_MSG_FLR_NOTIFICATION_COMPLETION,
29062306a36Sopenharmony_ci	MB_RES_MSG_SUCCESS,
29162306a36Sopenharmony_ci	MB_RES_MSG_FAIL,
29262306a36Sopenharmony_ci	MB_RES_MSG_QUERY_ALIVE,
29362306a36Sopenharmony_ci	MB_RES_MSG_GPU_INIT_DATA_READY,
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci	MB_RES_MSG_TEXT_MESSAGE = 255
29662306a36Sopenharmony_ci};
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci/* version data stored in MAILBOX_MSGBUF_RCV_DW1 for future expansion */
29962306a36Sopenharmony_cienum amd_sriov_gpu_init_data_version {
30062306a36Sopenharmony_ci	GPU_INIT_DATA_READY_V1 = 1,
30162306a36Sopenharmony_ci};
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci#pragma pack(pop) // Restore previous packing option
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci/* checksum function between host and guest */
30662306a36Sopenharmony_ciunsigned int amd_sriov_msg_checksum(void *obj, unsigned long obj_size, unsigned int key,
30762306a36Sopenharmony_ci				    unsigned int checksum);
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci/* assertion at compile time */
31062306a36Sopenharmony_ci#ifdef __linux__
31162306a36Sopenharmony_ci#define stringification(s)  _stringification(s)
31262306a36Sopenharmony_ci#define _stringification(s) #s
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci_Static_assert(
31562306a36Sopenharmony_ci	sizeof(struct amd_sriov_msg_vf2pf_info) == AMD_SRIOV_MSG_SIZE_KB << 10,
31662306a36Sopenharmony_ci	"amd_sriov_msg_vf2pf_info must be " stringification(AMD_SRIOV_MSG_SIZE_KB) " KB");
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci_Static_assert(
31962306a36Sopenharmony_ci	sizeof(struct amd_sriov_msg_pf2vf_info) == AMD_SRIOV_MSG_SIZE_KB << 10,
32062306a36Sopenharmony_ci	"amd_sriov_msg_pf2vf_info must be " stringification(AMD_SRIOV_MSG_SIZE_KB) " KB");
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci_Static_assert(AMD_SRIOV_MSG_RESERVE_UCODE % 4 == 0,
32362306a36Sopenharmony_ci	       "AMD_SRIOV_MSG_RESERVE_UCODE must be multiple of 4");
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci_Static_assert(AMD_SRIOV_MSG_RESERVE_UCODE > AMD_SRIOV_UCODE_ID__MAX,
32662306a36Sopenharmony_ci	       "AMD_SRIOV_MSG_RESERVE_UCODE must be bigger than AMD_SRIOV_UCODE_ID__MAX");
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci#undef _stringification
32962306a36Sopenharmony_ci#undef stringification
33062306a36Sopenharmony_ci#endif
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci#endif /* AMDGV_SRIOV_MSG__H_ */
333