virt: Add vboxguest driver for Virtual Box Guest integration
v2 cover virt: Add vboxguest driver for Virtual Box Guest integration
Hi All,
Here is v2 of my cleaned up version of the VirtualBox vboxguest driver.
Changes in v2:
-Change all uapi headers to kernel coding style: Drop struct and enum typedefs
make type and struct-member names all lowercase, enum values all uppercase.
-Remove unused struct type declarations from some headers (shaving of another
1000 lines)
-Remove or fixup doxygen style comments
-Get rid of CHECK macros, use a function taking in_ and out_size args instead -Some other small codyingstyle fixes
-Split into multiple patches
Here is (part of) the v1 cover-letter which is still relevant:
VirtualBox upstream has declared the ioctl API for the /dev/vboxguest device as being stable now, so once this passes review this is ready for merging.
I'm only submitting the vboxguest driver for now, as the vboxsf driver depends on this and it easier to first just get the vboxguest driver upstream.
I've removed all depenencies on vbox's OS-independent runtime and the runtime itself, reducing the vboxguest driver from 100000+ lines of code to aprox. 4300 lines. This reduces the non debug vboxguest.ko size from 450kB to less then 100 kB. I've also cleaned up various other warts such as doing hardware init in module_init rather then in a pci_probe callback.
The vboxguest driver introduces a new userspace API + ABI in the form of ioctls on a character device. VirtualBox upstream not willing to commit to keeping this ABI stable was one of the things which has kept this driver driver out of mainline sofar. I've been talking to VirtualBox upstream about mainlining the guest drivers and VirtualBox upstream has agreed to consider the userspace ABI stable and only extend it in a backwards compatible manner from now on.
Regards,
Hans
PATCH v2 1/3 virt: Add vboxguest driver for Virtual Box Guest integration UAPI
This commit adds the headers describing the ioctl API for the /dev/vboxguest device used by the Virtual Box Guest Additions in Virtual Box virtual machines.
The driver providing the /dev/vboxguest device will allow Virtual Box Guest Additions features such as copy-and-paste, seamless mode and OpenGL pass-through.
---
Changes in v2:
-Change all uapi headers to kernel coding style: Drop struct and enum typedefs
make type and struct-member names all lowercase, enum values all uppercase.
-Remove unused struct type declarations from some headers (shaving of another
1000 lines)
-Remove or fixup doxygen style comments
-Get rid of CHECK macros, use a function taking in_ and out_size args instead -Some other small codyingstyle fixes
-Split into multiple patches
--- MAINTAINERS | 7 + include/uapi/linux/vbox_err.h | 170 ++++++++++++++++ include/uapi/linux/vbox_vmmdev_types.h | 237 +++++++++++++++++++++++ include/uapi/linux/vboxguest.h | 341 +++++++++++++++++++++++++++++++++ 4 files changed, 755 insertions(+) create mode 100644 include/uapi/linux/vbox_err.h create mode 100644 include/uapi/linux/vbox_vmmdev_types.h create mode 100644 include/uapi/linux/vboxguest.h
MAINTAINERS +7 -0
@@ -14363,6 +14363,13 @@ S: Maintained F: drivers/virtio/virtio_input.c F: include/uapi/linux/virtio_input.h +VIRTUAL BOX GUEST DEVICE DRIVER +M: Hans de Goede <[email protected]> +M: Arnd Bergmann <[email protected]> +M: Greg Kroah-Hartman <[email protected]> +S: Maintained +F: include/uapi/linux/vbox*.h + VIRTUAL SERIO DEVICE DRIVER M: Stephen Chandler Paul <[email protected]> S: Maintained
include/uapi/linux/vbox_err.h new file +170 -0
170 lines not on this page · raw message
include/uapi/linux/vbox_vmmdev_types.h new file +237 -0
237 lines not on this page · raw message
include/uapi/linux/vboxguest.h new file +341 -0
341 lines not on this page · raw message
Signature · 1 line
2.14.2
PATCH v2 2/3 virt: Add vboxguest VMMDEV communication code
In reply to Hans de GoedeThis commits adds a header describing the hardware interface for the Virtual Box Guest PCI device used in Virtual Box virtual machines and utility functions for talking to the Virtual Box hypervisor over this interface.
These utility functions will used both by the vboxguest driver for the PCI device which offers the /dev/vboxguest ioctl API and by the vboxfs driver which offers folder sharing support.
---
Changes in v2:
-Change all uapi headers to kernel coding style: Drop struct and enum typedefs
make type and struct-member names all lowercase, enum values all uppercase.
-Remove unused struct type declarations from some headers (shaving of another
1000 lines)
-Remove or fixup doxygen style comments
-Get rid of CHECK macros, use a function taking in_ and out_size args instead -Some other small codyingstyle fixes
-Split into multiple patches
--- MAINTAINERS | 2 + drivers/virt/vboxguest/vboxguest_utils.c | 811 +++++++++++++++++++++++++++++++ drivers/virt/vboxguest/vmmdev.h | 460 ++++++++++++++++++ include/linux/vbox_utils.h | 92 ++++ 4 files changed, 1365 insertions(+) create mode 100644 drivers/virt/vboxguest/vboxguest_utils.c create mode 100644 drivers/virt/vboxguest/vmmdev.h create mode 100644 include/linux/vbox_utils.h
MAINTAINERS +2 -0
@@ -14368,7 +14368,9 @@ M: Hans de Goede <[email protected]> M: Arnd Bergmann <[email protected]> M: Greg Kroah-Hartman <[email protected]> S: Maintained +F: include/linux/vbox_utils.h F: include/uapi/linux/vbox*.h +F: drivers/virt/vboxguest/ VIRTUAL SERIO DEVICE DRIVER M: Stephen Chandler Paul <[email protected]>
drivers/virt/vboxguest/vboxguest_utils.c new file +811 -0
811 lines not on this page · raw message
drivers/virt/vboxguest/vmmdev.h new file +460 -0
460 lines not on this page · raw message
include/linux/vbox_utils.h new file +92 -0
92 lines not on this page · raw message
Signature · 1 line
2.14.2
PATCH v2 3/3 virt: Add vboxguest driver for Virtual Box Guest integration
In reply to Hans de GoedeThis commit adds a driver for the Virtual Box Guest PCI device used in Virtual Box virtual machines. Enabling this driver will add support for Virtual Box Guest integration features such as copy-and-paste, seamless mode and OpenGL pass-through.
This driver also offers vboxguest IPC functionality which is needed for the vboxfs driver which offers folder sharing support.
---
Changes in v2:
-Change all uapi headers to kernel coding style: Drop struct and enum typedefs
make type and struct-member names all lowercase, enum values all uppercase.
-Remove unused struct type declarations from some headers (shaving of another
1000 lines)
-Remove or fixup doxygen style comments
-Get rid of CHECK macros, use a function taking in_ and out_size args instead -Some other small codyingstyle fixes
-Split into multiple patches
--- drivers/virt/Kconfig | 1 + drivers/virt/Makefile | 1 + drivers/virt/vboxguest/Kconfig | 16 + drivers/virt/vboxguest/Makefile | 3 + drivers/virt/vboxguest/vboxguest_core.c | 1577 ++++++++++++++++++++++++++++ drivers/virt/vboxguest/vboxguest_core.h | 187 ++++ drivers/virt/vboxguest/vboxguest_linux.c | 469 +++++++++ drivers/virt/vboxguest/vboxguest_version.h | 18 + 8 files changed, 2272 insertions(+) create mode 100644 drivers/virt/vboxguest/Kconfig create mode 100644 drivers/virt/vboxguest/Makefile create mode 100644 drivers/virt/vboxguest/vboxguest_core.c create mode 100644 drivers/virt/vboxguest/vboxguest_core.h create mode 100644 drivers/virt/vboxguest/vboxguest_linux.c create mode 100644 drivers/virt/vboxguest/vboxguest_version.h
drivers/virt/Kconfig +1 -0
@@ -30,4 +30,5 @@ config FSL_HV_MANAGER 4) A kernel interface for receiving callbacks when a managed partition shuts down. +source "drivers/virt/vboxguest/Kconfig" endif
drivers/virt/Makefile +1 -0
@@ -3,3 +3,4 @@ # obj-$(CONFIG_FSL_HV_MANAGER) += fsl_hypervisor.o +obj-y += vboxguest/
drivers/virt/vboxguest/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +config VBOXGUEST + tristate "Virtual Box Guest integration support" + depends on X86 && PCI && INPUT + help + This is a driver for the Virtual Box Guest PCI device used in + Virtual Box virtual machines. Enabling this driver will add + support for Virtual Box Guest integration features such as + copy-and-paste, seamless mode and OpenGL pass-through. + + This driver also offers vboxguest IPC functionality which is needed + for the vboxfs driver which offers folder sharing support. + + Although it is possible to build this module in, it is advised + to build this driver as a module, so that it can be updated + independently of the kernel. Select M to build this driver as a + module.
drivers/virt/vboxguest/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +vboxguest-y := vboxguest_linux.o vboxguest_core.o vboxguest_utils.o + +obj-$(CONFIG_VBOXGUEST) += vboxguest.o
drivers/virt/vboxguest/vboxguest_core.c new file +1577 -0
1,577 lines not on this page · raw message
drivers/virt/vboxguest/vboxguest_core.h new file +187 -0
187 lines not on this page · raw message
drivers/virt/vboxguest/vboxguest_linux.c new file +469 -0
469 lines not on this page · raw message
drivers/virt/vboxguest/vboxguest_version.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* VBox Guest additions version info, this is used by the host to determine +* supported guest-addition features in some cases. So this will need to be +* synced with vbox upstreams versioning scheme when we implement / port +* new features from the upstream out-of-tree vboxguest driver. +*/ + +#ifndef __VBOX_VERSION_H__ +#define __VBOX_VERSION_H__ + +/* Last synced October 4th 2017 */ +#define VBG_VERSION_MAJOR 5 +#define VBG_VERSION_MINOR 2 +#define VBG_VERSION_BUILD 0 +#define VBG_SVN_REV 68940 +#define VBG_VERSION_STRING "5.2.0" + +#endif
Signature · 1 line
2.14.2