[DRIVERS] Differentiate between memmaped & I/O Mapped device

Check the address_type field in DTS to differentiate between
memory mapped and IO mapped device. Then call the devtree
functions accordingly.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[x86] Add address type for 8250 type UART

Mark address type as IO.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[DRIVERS] net: ethernet: Minor MAC address fixes in allwinner sun4i-emac

This patch adds Functions -
 eth_hw_addr_random() to generate random MAC addresses.
 print_mac_address_fmt() to print buffer in MAC format.

Fixes sun4i-emac.c to use above mentioned functions.
Also adds net_device name setting in sun4i-emac.c,
which was not getting set earlier resulting in garbage name display in
net ports command.

Signed-off-by: Pranavkumar Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] include: linux: Add MISC linux-like API's

This patch adds:

In core/include/vmm_macros.h
  - Add linux-lke macro uninitialized_var(x)

In drivers/include/linux/of.h
 - Add linux-like of_phandle_xxx functionality.

In drivers/include/linux/of_address.h
 - Add of_iomap() function.

In drivers/include/linux/slab.h
 - Add placeholder macro for linux-like kmalloc_track_caller()

In drivers/include/linux/string.h
 - Add linux-like kstrdup(), kstrndup(), kmemdup() functions.

Signed-off-by: Pranavkumar Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] include: linux: Add linux-like ioreadxx and iowritexx functionality.

This patch adds linux-like iowritexx and ioreadxx functions.

Signed-off-by: Pranavkumar Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] include: linux: Add placeholder macro for mutex_destroy()

Add placeholder for linux-like mutex_destroy().

Signed-off-by: Pranavkumar Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] include: linux: Add placeholder for linux compiler.h and debugfs.h

This patch adds placeholder headers for linux/compiler.h and linux/debugfs.h

Signed-off-by: Pranavkumar Sawargaonkar <pranav.sawargaonkar@gmail.com>
[LIBS] Adding Radix Tree Implementation.

This patch adds Radix Tree Implementation ported from Linux.

Main differences from linux Radix-Tree Implementation are:
 a. This version of radix-tree does not support linux feature of
    tag in radix tree node. (Can be added/implemented later)
 b. Does not have linux feature of gfp_mask information.
 c. No RCU locks used, instead of that reader-writer locks are used.

This is still an experimental version and will be improved as we use and
test it more in future.

Signed-off-by: Pranavkumar Sawargaonkar <pranav.sawargaonkar@gmail.com>
[LIBS] netstack: lwip: Fix compilation errors for size_t redefinitation.

Since now we have size_t in vmm_types.h there is no need to include stddef.h
to have size_t in lwip.

Signed-off-by: Pranavkumar Sawargaonkar <pranav.sawargaonkar@gmail.com>
[CORE] Extend heap APIs to ease heap creation, and create DMA heap.

This patch modifies heap APIs to ease heap creation, and creates DMA heap in
addtion to normal heap. Now, drivers can allocate dmable memory using
vmm_dma_malloc, and free using vmm_dma_free.

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] arm32: Make max L1TBL and L2TBL counts independent of VAPOOL size

Currently, maximum number of L1TBL is dependent on CONFIG_MAX_VCPU_COUNT
whereas maximum number of L2TBL is dependent on maximum number of L1TBL
and CONFIG_VAPOOL_SIZE_MB. This means if VAPOOL is very small then we
we might endup with very few L2TBLs.

Ideally, maximum number of L1TBL and L2TBL should only be related to the
CONFIG_MAX_VCPU_COUNT.

This patch update arm32 MMU as-per above and also force compile error if
sufficient space is not available for TTBL pool.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] generic: Reduce max VCPU count for ARMv5, ARMv6, and ARMv7

For processors without virtualization extensions our VAPOOL size
cannot be increased beyond 12 MB because Linux ARM has only 12 MB
of empty/unused/reserved virtual address space where Xvisor can run.

Having max VCPU count of 64 for ARMv5, ARMv6, and ARMv7 means TTBL
pool will consume 2 MB which is too much for 12 MB of VAPOOL.

This patch reduces max VCPU count to 48 in generic-v5-defconfig,
generic-v6-defconfig, and generic-v7-defconfig so that TTBL pool
burden on VAPOOL reduces.

Signed-off-by: Anup Patel <anup@brainfault.org>
[x86] Add guest copy of control registers

o Add control registers for guest.
o Update the guest copy on CRn r/w.
o Update CPU registers accordingly.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[x86] Auto-creation of guest in DTS.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[x86] Switch the debug and regular interrupt stack.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[x86] Fix guest virtual to physical and add other sibling

o Fixes the guest virtual to physical function.
o Add guest physical to host physical address.
o Some documentation around it.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[x86] Use the new guest virtual to physical family of functions.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[x86] Reload TSS after VMExit

On vmexit, CPU doesn't reload the host TR back.
It is required because in LM mode its required and
in addition to that we use it for multiple interrupt
stacks.

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