diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-11-11 07:35:10 -0500 |
---|---|---|
committer | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-11-11 07:35:10 -0500 |
commit | b6e8c7b39456e7c0a164f87c48eac2bbfd6d85f3 (patch) | |
tree | c94839c02cde83bca416221bd906e4952fbc8c53 /kmod | |
parent | b9a2e75360e14e59db651d6081894e0cf20e7c2d (diff) | |
parent | 985940e6539eaf8f41e0b6421938b5bf5c1db22c (diff) | |
download | libvfio-user-b6e8c7b39456e7c0a164f87c48eac2bbfd6d85f3.zip libvfio-user-b6e8c7b39456e7c0a164f87c48eac2bbfd6d85f3.tar.gz libvfio-user-b6e8c7b39456e7c0a164f87c48eac2bbfd6d85f3.tar.bz2 |
Merge branch 'vfio-user'
Diffstat (limited to 'kmod')
-rw-r--r-- | kmod/CMakeLists.txt | 52 | ||||
-rw-r--r-- | kmod/muser.h | 73 |
2 files changed, 0 insertions, 125 deletions
diff --git a/kmod/CMakeLists.txt b/kmod/CMakeLists.txt deleted file mode 100644 index 07e90e7..0000000 --- a/kmod/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2019 Nutanix Inc. All rights reserved. -# -# Authors: Thanos Makatos <thanos@nutanix.com> -# Swapnil Ingle <swapnil.ingle@nutanix.com> -# Felipe Franciosi <felipe@nutanix.com> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Nutanix nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -# Copy sources to build directory (avoid polluting source directory). -# TODO can we copy all source files with a wildcard? -configure_file(muser.c ${CMAKE_CURRENT_BINARY_DIR}/muser.c COPYONLY) -configure_file(muser.h ${CMAKE_CURRENT_BINARY_DIR}/muser.h COPYONLY) -# FIXME need to pass "CFLAGS_muser.o := -DDEBUG" for debug builds -set(KMOD_MAKEFILE_CONTENT "obj-m := muser.o") -IF(CMAKE_BUILD_TYPE MATCHES Debug) - set(KMOD_MAKEFILE_CONTENT "CFLAGS_muser.o := -DDEBUG\n${KMOD_MAKEFILE_CONTENT}") -ENDIF(CMAKE_BUILD_TYPE MATCHES Debug) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Kbuild ${KMOD_MAKEFILE_CONTENT}) - -# Build module using kernel's Makefile. -set(KBUILD_CMD ${CMAKE_MAKE_PROGRAM} -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR} modules) -ADD_CUSTOM_COMMAND(OUTPUT DRIVER_BIN_FILE - COMMAND ${KBUILD_CMD} - DEPENDS ${MODULE_SOURCE_FILES} VERBATIM -) -ADD_CUSTOM_TARGET(driver ALL DEPENDS DRIVER_BIN_FILE) -execute_process(COMMAND uname -r OUTPUT_VARIABLE kver OUTPUT_STRIP_TRAILING_WHITESPACE) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/muser.ko DESTINATION /lib/modules/${kver}/extra/) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/muser.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linux) diff --git a/kmod/muser.h b/kmod/muser.h deleted file mode 100644 index 65841a4..0000000 --- a/kmod/muser.h +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause -/* - * Copyright (c) 2019, Nutanix Inc. All rights reserved. - * - * Author: Thanos Makatos <thanos@nutanix.com> - * Swapnil Ingle <swapnil.ingle@nutanix.com> - * Felipe Franciosi <felipe@nutanix.com> - * - */ - -#ifndef _UAPI_LINUX_MUSER_H -#define _UAPI_LINUX_MUSER_H - -#ifndef __KERNEL__ -#include <sys/types.h> -#endif - -#include <linux/ioctl.h> -#include <linux/vfio.h> - -#define MUSER_DEVNODE "muser" - -enum muser_cmd_type { - MUSER_IOCTL = 1, - MUSER_READ, - MUSER_WRITE, - MUSER_MMAP, - MUSER_DMA_MMAP, - MUSER_DMA_MUNMAP, -}; - -struct muser_cmd_rw { - size_t count; - loff_t pos; -}; - -struct muser_cmd_ioctl { - int vfio_cmd; - union { - struct vfio_device_info dev_info; - struct vfio_region_info reg_info; - struct vfio_irq_info irq_info; - struct vfio_irq_set irq_set; - } data; -}; - -union muser_cmd_mmap { - struct { - unsigned long addr; /* iova for DMA_MAP, offset for MMAP */ - unsigned long len; - unsigned long offset; - unsigned long flags; - struct file *file; - int fd; - } request; - unsigned long response; -}; - -struct muser_cmd { - enum muser_cmd_type type; - union { - struct muser_cmd_rw rw; - struct muser_cmd_ioctl ioctl; - union muser_cmd_mmap mmap; - }; - int err; -}; - -/* ioctl cmds valid for /dev/muser/<uuid> */ -#define MUSER_DEV_CMD_WAIT _IOR('M', 1, struct muser_cmd) -#define MUSER_DEV_CMD_DONE _IOW('M', 2, struct muser_cmd) - -#endif /* _UAPI_LINUX_MUSER_H */ |