From 892714f8185bf59babd5d09c06c2e5805ec60bc0 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Fri, 11 Dec 2020 09:52:09 +0100 Subject: [PATCH] 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 --- boards/Kconfig | 9 +++++++++ cmake/emu/qemu.cmake | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/boards/Kconfig b/boards/Kconfig index 5fb5cf87f9f..23bb55591ae 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -44,6 +44,15 @@ config QEMU_ICOUNT_SHIFT The virtual CPU will execute one instruction every 2^N nanoseconds 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 osource "$(BOARD_DIR)/Kconfig" endmenu diff --git a/cmake/emu/qemu.cmake b/cmake/emu/qemu.cmake index 57d8b6788fa..8866c7de759 100644 --- a/cmake/emu/qemu.cmake +++ b/cmake/emu/qemu.cmake @@ -285,6 +285,20 @@ if(CONFIG_X86_64) ) 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) set(QEMU_PIPE_COMMENT "\nTo exit from QEMU enter: 'CTRL+a, x'\n") endif()