[LIBS] vfs: Fix compile warning for 64-bit systems

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Always print the bootcmds being executed at boot time

Some times boot commands may fail due to several possible reasons
hence we should be verbose about boot commands being executed at
booting time to help debugging.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Improve verbose message of module init

The verbose message "Initialize <module_name>" does not tell us that
we module init function of module <module_name> is called hence this
patch makes this verbose message as "Module Init <module_name>".

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] Enrich RBD driver

This patch adds more useful APIs such as rbd_count(), rbd_get(), and
rbd_find() for the RBD (RAM backed block device) driver.

Signed-off-by: Anup Patel <anup@brainfault.org>
[COMMANDS] Add rbd command for managing RBD instances

We introduce 'rbd' command for listing, creating, and destroying
RBD instances from command line.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] Enable RBD driver for all ARM host

Gradually we move towards loading guest images from disk. There
would be many ARM host not having disk access hence for such
ARM host we will use RAM backed block device as disk containing
guest images.

Due to above, we enable RBD driver by default for all ARM hosts
via their defconfigs.

Signed-off-by: Anup Patel <anup@brainfault.org>
[LIBS] vfs: Minor bug fix in vfs_fd_alloc()

We have to set bit in fb bitmap after allocating new fd.

This patch fixes this bug in vfs_fd_alloc().

Signed-off-by: Anup Patel <anup@brainfault.org>
[COMMANDS] vfs: Add 'host_load_list' and 'guest_load_list' sub-commands

Quite often we would frequently load multiple files for host or guest
hence having sub-commands to pick-up list of files to be loaded from
text file can be quite useful.

This patch adds sub-commands 'host_load_list' and 'guest_load_list'
for the above purpose.

Signed-off-by: Anup Patel <anup@brainfault.org>
Merge remote-tracking branch 'upstream/master' into A20

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>

Conflicts:
	arch/arm/configs/sun4i-defconfig
[CORE] vmm_blockdev: Minor fix in submit_request() and abort_request()

We typically clear 'bdev' field of vmm_request upon request completion
or request failure. In other words, 'bdev' field of vmm_request is not
NULL only when vmm_request is queued to some request queue.

Now if we have a block devices (such as RBD block device) that completes
request in make_request() itself then for SMP host current submit_request()
hangs after returning from make_request() because complete_request() clears
'bdev' field of vmm_request.

This patch fixes submit_request() and abort_request() for above described
issue.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Improve sanity checks in vmm_host_ram and vmm_host_vapool APIs

Minor improvements in sanity checks of vmm_host_ram_reserve(),
vmm_host_ram_free(), vmm_host_ram_isfree(), vmm_host_vapool_reserve(),
vmm_host_vapool_free(), and vmm_host_vapool_isfree().

Signed-off-by: Anup Patel <anup@brainfault.org>
[COMMANDS] vfs: Beautify prints from xxx_load and xxx_load_list sub-commands

Minor beautification of prints from host_load, guest_load, host_load_list,
and guest_load_list sub-commands.

Signed-off-by: Anup Patel <anup@brainfault.org>
Merge remote-tracking branch 'upstream/master' into A20
[TESTS] Make autoexec command of basic firmware robust

Currently, the 'autoexec' command of basic firmware looks for command
list in Guest NOR flash at offset 0xFF000 terminating with NULL character.

The above approach is flawed because Guest NOR flash can contain garbage
non-ascii (on non-printable) characters which can cause 'autoexec' command
to detect command list with garbage characters.

This patch fixes 'autoexec' command of basic firmware by looking only for
ascii (or printable) characters at 0xFF000 offset of Guest NOR flash.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] Load guest images from disk for pre-configured guests

Currently, we depend upon bootloaders to load guest images for all
pre-configured guests created via bootcmd. This approach makes Xvisor
depend too much upon bootloaders to load files and number of files
to be loaded by bootloaders also increases with increasing number of
pre-configured guests.

This patch introduces new approach of loading guest images for all
pre-configured guests from some kind of disk (or block device) and
there-by making our guest image loading more concrete and scalable
to increasing number of guests. For ARM host not having any HW disk
(or HW block device), we use RAM backed block device (i.e. RBD device)
as disk containing guest images.

As per the new approach, Xvisor ARM booting will always require three
things for booting:
1. Xvisor binary (vmm.bin or uvmm.bin)
2. Xvisor host flattened device tree binary (i.e. DTB)
3. Xvisor disk containing guest images (i.e. RBD or SD or MMC or SATA)

Please note Xvisor host flattened device tree can also be compiled and
linked to Xvisor binary itself.

The new approach is not mandatory and folks can still use old method
of depending on bootloaders to load guest images.

Signed-off-by: Anup Patel <anup@brainfault.org>
Merge remote-tracking branch 'upstream/master' into A20
[CORE] Allow vmm_vcpu_irq_wait_timeout only when no irqs are pending

It can happen that someone assert irq to VCPU while the VCPU is trying to
do wait-for-interrupt. If this situation is not handled then a VCPU might
be paused even with irqs pending.

This patch fixes vmm_vcpu_irq_wait_timeout() so that 'execute_pending' is
ensured to zero before VCPU is paused.

Signed-off-by: Anup Patel <anup@brainfault.org>
[EMULATORS] virtio_queue: Add virtio_queue_setup_done() API

Having a mechanism to check whether given VirtIO queue is configured/setup
by Guest or not can be quite useful in developing VirtIO device emulators.

This patch adds virtio_queue_setup_done() for this purpose.

Signed-off-by: Anup Patel <anup@brainfault.org>
[EMULATORS] virtio_blk: Abort all pending block IO requests upon reset

We have to abort all pending block IO requests upon virtio_blk
device reset so that we can free-up resources associated with each
virtio_blk_dev_req hence this patch.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] Add debug prints to trace mmc block read/write

Tracing mmc block read/write requests can be quite useful for
debugging mmc host controller drivers hence this patch adds
debug prints for __mmc_write_blocks() and __mmc_read_blocks().

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