2020-10-23 18:01:18 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Intel Corporation.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZEPHYR_DRIVERS_VIRTUALIZATION_VIRT_IVSHMEM_H_
|
|
|
|
#define ZEPHYR_DRIVERS_VIRTUALIZATION_VIRT_IVSHMEM_H_
|
|
|
|
|
2020-11-24 17:11:23 +08:00
|
|
|
#include <drivers/pcie/pcie.h>
|
|
|
|
#include <drivers/pcie/msi.h>
|
|
|
|
|
2020-10-23 18:01:18 +08:00
|
|
|
#define IVSHMEM_VENDOR_ID 0x1AF4
|
|
|
|
#define IVSHMEM_DEVICE_ID 0x1110
|
|
|
|
|
|
|
|
#define IVSHMEM_PCIE_REG_BAR_IDX 0
|
2020-11-24 17:11:23 +08:00
|
|
|
#define IVSHMEM_PCIE_SHMEM_BAR_IDX 2
|
2020-10-23 18:01:18 +08:00
|
|
|
|
2020-11-24 17:11:23 +08:00
|
|
|
struct ivshmem_param {
|
|
|
|
const struct device *dev;
|
|
|
|
struct k_poll_signal *signal;
|
|
|
|
uint8_t vector;
|
|
|
|
};
|
|
|
|
|
2020-10-23 18:01:18 +08:00
|
|
|
struct ivshmem {
|
|
|
|
DEVICE_MMIO_RAM;
|
|
|
|
pcie_bdf_t bdf;
|
2021-09-21 20:28:26 +08:00
|
|
|
uint32_t dev_ven_id;
|
2020-10-23 18:01:18 +08:00
|
|
|
uintptr_t shmem;
|
|
|
|
size_t size;
|
2020-11-24 17:11:23 +08:00
|
|
|
#ifdef CONFIG_IVSHMEM_DOORBELL
|
|
|
|
msi_vector_t vectors[CONFIG_IVSHMEM_MSI_X_VECTORS];
|
|
|
|
struct ivshmem_param params[CONFIG_IVSHMEM_MSI_X_VECTORS];
|
|
|
|
uint16_t n_vectors;
|
|
|
|
#endif
|
2020-10-23 18:01:18 +08:00
|
|
|
};
|
|
|
|
|
2020-11-24 17:11:23 +08:00
|
|
|
struct ivshmem_reg {
|
|
|
|
uint32_t int_mask;
|
|
|
|
uint32_t int_status;
|
|
|
|
uint32_t iv_position;
|
|
|
|
uint32_t doorbell;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IVSHMEM_GEN_DOORBELL(i, v) ((i << 16) | (v & 0xFFFF))
|
|
|
|
|
2020-10-23 18:01:18 +08:00
|
|
|
#endif /* ZEPHYR_DRIVERS_VIRTUALIZATION_VIRT_IVSHMEM_H_ */
|