[CORE] vio: Introduce virtual input device framework

This patch adds first-cut implementation of virtual input device
framework. Emulators can use this framework to create virtual keyboard
and virtual mouse instances. Daemons such as VNC server, GUI renderer,
etc can use this framework to inject keyboard events and mouse events
to virtual keyboard and virtual mouse intances.

Signed-off-by: Anup Patel <anup@brainfault.org>
[COMMANDS] Add vinput command

This patch adds vinput command to interface with the virtual
input device framework from managment terminal.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Minor typo-fix in vmm_delay

The "susbystem" should be "subsystem" in file comments.

Signed-off-by: Anup Patel <anup@brainfault.org>
[EMULATORS] gic: Fix comment referring original source

Point to correct reference source of QEMU for GIC emulator.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] vio: Add inline functions to access emulator context

Currently, we directly accessed emulator private context of vserial,
vkeyboard, and vmouse which is not easy to maintain in long-term
hence this patch introduces inline accessor functions for this.

Signed-off-by: Anup Patel <anup@brainfault.org>
[EMULATORS] Introduce PS/2 emulator and PL050 emulator

This patch introduces PS/2 based input device emulators.

It precisely adds following stuff:
1. PS/2 device emulation APIs
2. PL050 (or AMBA KMI) keyboard/mouse interface emulator

All input device emulators will have to use newly introduced
vmm_vinput framework to provide virtual input devices to Xvisor.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] sun4i: Make timer driver self initializing

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
[ARM] sun4i: Make intc driver self initializing.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
[CORE] Fix error message when starting secondary CPU fails

There was a small typo in error message printed when starting
secondary CPU fails. This patch fixes that typo.

Signed-off-by: Anup Patel <anup@brainfault.org>
[TOOLS] scripts: Introduce data to c source script

Currently, we were using "-r -b binary" options of LD to convert
binary .data files to .o files but this way of generating .o files
does not work for all ARM hosts (more specifically Cortex-A15) and
x86_64 host.

This patch introduces new mechanism of converting binary .data
file to .o files using d2c.py python scripts under tools/scripts
directory. This new mechanism of converting .data file to .o file
works for all ARM hosts and x86_64 host.

CC: Po-wen Cheng <sting.cheng@gmail.com>
Reported-by: Po-wen Cheng <sting.cheng@gmail.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
[EMULATORS] pl050: Fix compatible string.

We mostly use "primecell,arm,plxxx" type compatible string for
plxxx emulators hence this patch changes compatible string of
pl050 emulator accordingly.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] Enable virtual input emulators in defconfigs of ARM hosts

The PL050 (AMBA KMI) keyboard/mouse interface device is available
for almost all ARM32 guest types hence this patch enables vmm_vinput,
ps/2 emulation, and pl050 emulator in defconfigs of various ARM hosts.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] Select pl050 keyboard/mouse emulators in ARM guest templates

The PL050 (AMBA KMI) keyboard/mouse interface device is available
for almost all ARM32 guest types hence this patch selects pl050
emulator in almost all ARM32 guest templates.

Signed-off-by: Anup Patel <anup@brainfault.org>
[TESTS] Reduce SWIOTLB for Virt-v8 linux to 8MB

We only have VirtIO devices in Virt-v8 guest none of which require
SWIOTLB but ARM64 linux kernel has mandated SWIOTLB hence this patch
reduces expected memory for Virt-v8 linux SWIOTLB to 8 MB form default
of 64 MB.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] Fix kmi0 and kmi1 interrupt numbers in realview-eb-mpcore template

The KMI0 and KMI1 interrupt numbers were wrong in realview-eb-mpcore
guest template. The correct interrupt numbers were found while debugging.
This patch fixes these KMI0 & KMI1 interrupt numbers in guest template.

Signed-off-by: Anup Patel <anup@brainfault.org>
[COMMANDS] vinput: Add sub-commands to inject artificial events

This patch adds 'keyboard_event' and 'mouse_event' sub-commands to
vinput command for artificial injection of input events. These
sub-commands come-in handy for debugging purpose and for profiling
input event injection latency.

Signed-off-by: Anup Patel <anup@brainfault.org>
[TESTS] Enable keyboard and mouse drivers for arm32 linux guests

We have PL050 (AMBA KMI) keyboard/mouse interface emulation available
for various arm32 linux guests hence this patch updates defconfigs of
these arm32 linux guests to use keyboard/mouse drivers.

Signed-off-by: Anup Patel <anup@brainfault.org>
[TOP] Update TODO list

We have a working keyboard/mouse emulation in-place for arm32, arm32ve
and arm64 support hence remove this item from TODO list.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] Minor improvements to linux portability headers

This patch does minor improvements to linux/device.h and linux/workqueue.h
header files.

We also add linux compatible dev_notify() helper macro.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] Minor typo fixes in input configuration files.

Signed-off-by: Anup Patel <anup@brainfault.org>