cmake: Adds the necessary flags support for Qemu ivshmem feature

Depending whether doorbell or plain versions are enabled, it will set
the right flags to qemu.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2020-12-11 09:52:09 +01:00 committed by Anas Nashif
parent 4ee5101021
commit 892714f818
2 changed files with 23 additions and 0 deletions

View File

@ -44,6 +44,15 @@ config QEMU_ICOUNT_SHIFT
The virtual CPU will execute one instruction every 2^N nanoseconds The virtual CPU will execute one instruction every 2^N nanoseconds
of virtual time, where N is the value provided here. of virtual time, where N is the value provided here.
config QEMU_IVSHMEM_PLAIN_MEM_SIZE
int "QEMU ivshmem-plain shared memory size in mega-bytes"
default 1
depends on QEMU_TARGET && IVSHMEM && !IVSHMEM_DOORBELL
help
This sets the size of the shared memory when using ivshmem-plain
device in Qemu. Note that it's in mega-bytes, so 1 means 1M for Qemu
etc..
# There might not be any board options, hence the optional source # There might not be any board options, hence the optional source
osource "$(BOARD_DIR)/Kconfig" osource "$(BOARD_DIR)/Kconfig"
endmenu endmenu

View File

@ -285,6 +285,20 @@ if(CONFIG_X86_64)
) )
endif() endif()
if(CONFIG_IVSHMEM)
if(CONFIG_IVSHMEM_DOORBELL)
list(APPEND QEMU_FLAGS
-device ivshmem-doorbell,vectors=${CONFIG_IVSHMEM_MSI_X_VECTORS},chardev=ivshmem
-chardev socket,path=/tmp/ivshmem_socket,id=ivshmem
)
else()
list(APPEND QEMU_FLAGS
-device ivshmem-plain,memdev=hostmem
-object memory-backend-file,size=${CONFIG_QEMU_IVSHMEM_PLAIN_MEM_SIZE}M,share,mem-path=/dev/shm/ivshmem,id=hostmem
)
endif()
endif()
if(NOT QEMU_PIPE) if(NOT QEMU_PIPE)
set(QEMU_PIPE_COMMENT "\nTo exit from QEMU enter: 'CTRL+a, x'\n") set(QEMU_PIPE_COMMENT "\nTo exit from QEMU enter: 'CTRL+a, x'\n")
endif() endif()