mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-16 09:46:09 +00:00
- Supporting multiple instances of ivShMem virtual devices. - Introduces DT based configuration for ivShMem devices. - Add DTS overlay file to test new multiple ivshmem instance capability. - Enable BDF unspecified device initialization. (limited to one instance. An improved version of pcie_bdf_lookup() will come soon that fixes this limitation) - Make PCIE DTS file macros available for a proper ivshmem device properties parsing. Sample for dts file: pcie0 { label = "PCIE_0"; #address-cells = <1>; #size-cells = <1>; compatible = "intel,pcie"; ranges; ivshmem0: ivshmem@800 { compatible = "qemu,ivshmem"; reg = <PCIE_BDF_NONE PCIE_ID(0x1af4,0x1110)>; label = "IVSHMEM"; status = "okay"; }; }; Signed-off-by: Michael Schmidt <michael1.schmidt@intel.com>
48 lines
1020 B
C
48 lines
1020 B
C
/*
|
|
* 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_
|
|
|
|
#include <drivers/pcie/pcie.h>
|
|
#include <drivers/pcie/msi.h>
|
|
|
|
#define IVSHMEM_VENDOR_ID 0x1AF4
|
|
#define IVSHMEM_DEVICE_ID 0x1110
|
|
|
|
#define IVSHMEM_PCIE_REG_BAR_IDX 0
|
|
#define IVSHMEM_PCIE_SHMEM_BAR_IDX 2
|
|
|
|
struct ivshmem_param {
|
|
const struct device *dev;
|
|
struct k_poll_signal *signal;
|
|
uint8_t vector;
|
|
};
|
|
|
|
struct ivshmem {
|
|
DEVICE_MMIO_RAM;
|
|
pcie_bdf_t bdf;
|
|
uint32_t dev_ven_id;
|
|
uintptr_t shmem;
|
|
size_t size;
|
|
#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
|
|
};
|
|
|
|
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))
|
|
|
|
#endif /* ZEPHYR_DRIVERS_VIRTUALIZATION_VIRT_IVSHMEM_H_ */
|