1 /* 2 * Copyright (C) 2020-2022 Intel Corporation. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef IVSHMEM_H 8 #define IVSHMEM_H 9 10 #define IVSHMEM_VENDOR_ID 0x1af4U 11 #define IVSHMEM_DEVICE_ID 0x1110U 12 #define IVSHMEM_INTEL_SUBVENDOR_ID 0x8086U 13 #ifdef CONFIG_IVSHMEM_ENABLED 14 15 /* 16 * Max number of peers for each ivshmem region, and 17 * VM ID is used as peer IDs of this VM's ivshmem devices. 18 */ 19 #define MAX_IVSHMEM_PEER_NUM (CONFIG_MAX_VM_NUM) 20 21 /* Max number of MSIX table entries of shmem device. */ 22 #define MAX_IVSHMEM_MSIX_TBL_ENTRY_NUM 8U 23 struct ivshmem_shm_region { 24 char name[32]; 25 uint16_t region_id; 26 uint8_t reserved[6]; 27 uint64_t hpa; 28 uint64_t size; 29 struct ivshmem_device *doorbell_peers[MAX_IVSHMEM_PEER_NUM]; 30 }; 31 32 extern const struct pci_vdev_ops vpci_ivshmem_ops; 33 34 /** 35 * @brief Initialize ivshmem shared memory regions 36 * 37 * Initialize ivshmem shared memory regions based on user configuration. 38 */ 39 void init_ivshmem_shared_memory(void); 40 41 int32_t create_ivshmem_vdev(struct acrn_vm *vm, struct acrn_vdev *dev); 42 int32_t destroy_ivshmem_vdev(struct pci_vdev *vdev); 43 #endif /* CONFIG_IVSHMEM_ENABLED */ 44 45 #endif /* IVSHMEM_H */ 46