[LIBS] libfdt: Make libfdt_parse_devtree() more flexible

This patch makes libfdt_parse_devtree() API more flexible so that
it can be used to populate entire sub-trees from FDT under specified
device tree path.

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

This patch adds fdt_load sub-command to vfs command.

This new sub-command can be used to load FDT file as sub-tree
under given path of device tree.

Signed-off-by: Anup Patel <anup@brainfault.org>
[TESTS] Add DTS files for various ARM guest types

With the new "vfs fdt_load" command we can create device tree
for guest instance form FDT file (i.e. DTB file) hence this
patch adds DTS files for all types of ARM guests and also
updates Xvisor disk image creation to include guest layout
DTB file.

Signed-off-by: Anup Patel <anup@brainfault.org>
Merge remote-tracking branch 'upstream/master' into imx6
[ARM] Don't use of /templates for guest templates

This patch removes the use of /templates device tree path for
keeping guest templates. Instead we now load guest device tree
directly from FDT file on file system.

If someone wants to disable filesystem then he/she will have to
use the old method of keeping reference guest device tree under
/templates device tree path.

Signed-off-by: Anup Patel <anup@brainfault.org>
[TESTS] Make Virt-v8 guest consistent with other hypervisors

There has been on-going effort in linaro to standardize the
VM/Guest HW for KVM and Xen. As part of these effort, the
QEMU mach-virt machine model will implement this standardized
VM/Guest HW for KVM. Linaro is also putting efforts to provide
UEFI firmware for standardized VM/Guest HW.

To get the benifits of this standardized VM/Guest HW we make
Virt-v8 machine mode compatible with QEMU mach-virt machine
model. In future, we would be also having Virt-v7 machine
model similar to Virt-v8 machine model for arm32ve.

Signed-off-by: Anup Patel <anup@brainfault.org>
[TESTS] Add missing README file for all arm64 guests

The toplevel README file for all arm64 guests was somehow missing.
This patch adds it.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] Rename one_guest_virt_v8.dts to one_guest_virt-v8.dts for consistency

Signed-off-by: Anup Patel <anup@brainfault.org>
[TESTS] Add fully paravirtualized virt-v7 guest for arm32ve

This patch adds basic firmware source and linux config files for virt-v7
guest.

The virt-v7 guest is excatly same as virt-v8 guest the only difference
it that former is arm32 guest whereas later is arm64 guest. Also, both
virt-v7 and virt-v8 are compatible to standardized mach-virt guest
which Linaro is pushing for KVM and Xen.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] generic: Add DTS files for preconfigure virt-v7 guest on arm32ve boards

This patch adds reference DTS files for creating preconfigured virt-v7 guest
on vexpress-a15 and cubieboard2 boards.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Split init work into two parts

This patch splits system_init_work() into two parts that is
1. Pre-init work (i.e. original system_init_work())
2. Post-init work (i.e. system_postinit_work())

We need a separate system_postinit_work() because current
device driver framework also IO frameworks to defer device
probing using system workqueue. If IO frameworks do use the
defer probing feature then we would end-up freeing init
memory before deferred probe is called called device drivers.
We might also not see the character/rtc device because its
device probing might have been deferred.

To solve the above issue, we have separate system_postinit_work()
which is scheduled as a last step in system_init_work() hence
it will be executed after deferred device probing work. This will
ensure that when we are in system_postinit_work(), all the
deferred device probing work is also finished.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] vmm_timer: Add vmm_timer_event_pending() API

This patch adds new API vmm_timer_event_pending() to check whether
given timer event is waiting to expire.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] vmm_delay: Add new APIs vmm_usleep, vmm_msleep, and vmm_ssleep

This patch add APIs to vmm_delay for finite duration sleep.

There will always be code desiring to sleep for sometime instead
of executing arch_delay_loop() hence this patch.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] vmm_main: Add API to check whether system init is complete

This patch add vmm_init_done() API to check whether system init
is complete or not.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DAEMONS] mterm: Sleep if system initialization not complete

It might happen that system workqueue sleeps for some event and
mterm starts executing even before system is initialized hence
this patch using vmm_init_done() and vmm_msleep() APIs to sleep
untill system is initialized. If we don't do this then mterm
prints will overlap the system initialization prints.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DAEMONS] telnetd: Initialize telnetd after netstack

The telnetd daemon uses socket programming hence we should ensure
that telnetd is initialized after netstack.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] Add common psci.h for sharing between smp_psci.c and emulate_psci.c

The PSCI host (i.e. smp_psci.c) and PSCI emulation (i.e. emulate_psci.c)
should use the same defines of PSCI for consistency hence this patch
introduce common psci.h for this purpose.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Ensure that /guests and /vmm nodes are present very early

There is lot of code dependent on presence of /guests and /vmm nodes.

This patch ensures that /guests and /vmm nodes are present immediately
after vmm_devtree_init().

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] arm32ve: arm64: Remove dependency of arch_regs.h on generic_timer.h

The arch_regs.h is indirectly included at potentially everywhere. We should
have minimum dependency of arch_regs.h on other headers hence this patch.

Also, this patch makes it clear that if we want a structure instance in
arch_regs.h then the structure should be defined in arch_regs.h or the
structure instance should be a void pointer.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] vmm_timer: Querying timer event expiry time

This adds a function to return the timestamp at which
the given timer event will expire.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>