/* * Copyright (c) 2018-2021 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef AMDGV_SRIOV_MSG__H_ #define AMDGV_SRIOV_MSG__H_ /* unit in kilobytes */ #define AMD_SRIOV_MSG_VBIOS_OFFSET … #define AMD_SRIOV_MSG_VBIOS_SIZE_KB … #define AMD_SRIOV_MSG_DATAEXCHANGE_OFFSET_KB … #define AMD_SRIOV_MSG_DATAEXCHANGE_SIZE_KB … /* * layout * 0 64KB 65KB 66KB * | VBIOS | PF2VF | VF2PF | Bad Page | ... * | 64KB | 1KB | 1KB | */ #define AMD_SRIOV_MSG_SIZE_KB … #define AMD_SRIOV_MSG_PF2VF_OFFSET_KB … #define AMD_SRIOV_MSG_VF2PF_OFFSET_KB … #define AMD_SRIOV_MSG_BAD_PAGE_OFFSET_KB … /* * PF2VF history log: * v1 defined in amdgim * v2 current * * VF2PF history log: * v1 defined in amdgim * v2 defined in amdgim * v3 current */ #define AMD_SRIOV_MSG_FW_VRAM_PF2VF_VER … #define AMD_SRIOV_MSG_FW_VRAM_VF2PF_VER … #define AMD_SRIOV_MSG_RESERVE_UCODE … #define AMD_SRIOV_MSG_RESERVE_VCN_INST … enum amd_sriov_ucode_engine_id { … }; #pragma pack(push, 1) // PF2VF / VF2PF data areas are byte packed amd_sriov_msg_feature_flags; amd_sriov_reg_access_flags; amd_sriov_msg_os_info; struct amd_sriov_msg_uuid_info { … }; struct amd_sriov_msg_pf2vf_info_header { … }; #define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE … struct amd_sriov_msg_pf2vf_info { … }; struct amd_sriov_msg_vf2pf_info_header { … }; #define AMD_SRIOV_MSG_VF2PF_INFO_FILLED_SIZE … struct amd_sriov_msg_vf2pf_info { … }; /* mailbox message send from guest to host */ enum amd_sriov_mailbox_request_message { … }; /* mailbox message send from host to guest */ enum amd_sriov_mailbox_response_message { … }; /* version data stored in MAILBOX_MSGBUF_RCV_DW1 for future expansion */ enum amd_sriov_gpu_init_data_version { … }; #pragma pack(pop) // Restore previous packing option /* checksum function between host and guest */ unsigned int amd_sriov_msg_checksum(void *obj, unsigned long obj_size, unsigned int key, unsigned int checksum); /* assertion at compile time */ #ifdef __linux__ #define stringification … #define _stringification … _Static_assert …; _Static_assert …; _Static_assert …; _Static_assert …; #undef _stringification #undef stringification #endif #endif /* AMDGV_SRIOV_MSG__H_ */