[CORE] Don't compile vmm_modules if CONFIG_MODULES is not set

Also changed MODULES to CONFIG_MODULES in the menuconfig.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
[TOOLS] openconf: Depend on CONFIG_MODULES symbol instead of MODULES

We should be using CONFIG_MODULES symbol for runtime loadable module
for consistency accross Xvisor code hence we update openconf to look
for CONFIG_MODULES symbol instead of MODULES symbol for tristate
options.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARCH] Rename MODULES=y to CONFIG_MODULES=y in all defconfigs

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Only disable runtime module loading/unloading when CONFIG_MODULES=n

Currently, if we disable runtime module loading/unloading (i.e.
CONFIG_MODULES=n) then vmm_modules.c is not compiled at all. This
means no modules will be initialized at boot-time even if the modules
are meant to be built-in. Also, Xvisor ARM crashes because it tries to
call RTC APIs without initializing RTC module.

The linux-compatible meaning of CONFIG_MODULES=n is to only disable
runtime module loading/unloading but built-in modules are still allowed.

This patch selectively compiles out lot of code when CONFIG_MODULES=n
instead of not compiling vmm_modules.c. This saves us roughly 40-50KB
on Xvisor ARM when CONFIG_MODULES=n and also allows built-in modules
when CONFIG_MODULES=n.

Signed-off-by: Anup Patel <anup@brainfault.org>
Merge remote-tracking branch 'upstream/master' into imx6
[CORE] vmm_host_irq: Process multiple active IRQs from vmm_host_irq_exec()

Currently, we only process on interrupt in vmm_host_irq_exec(). This is
not optimal because we might have multiple interrupts pending in irqchip.

This patch renames vmm_host_irq_exec() to vmm_host_active_irq_exec() and
improves it to process all pending interrupts in irqchip.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] irqchip: Use EOImode for GIC with virtualization extensions

We need to support host-to-guest irq routing in VGIC. To do that, the
GICv2 spec recommends us to use EOImode. To enable EOImode, we need to
set GICC_CTRL.EOImodeNS bit for each acitive GIC CPU interface.

When GICC_CTRL.EOImodeNS==1, the end-of-interrupt is divided into two
steps, which are:
1. De-prioritize the interrupt by writing the irq number to GICC_EOI
register
2. De-activate the interrupt by writing the irq number to GICC_DIR
register

When GICC_CTRL.EOImodeNS==0, the end-of-interrupt is just one step
that is writing irq number to GICC_EOI register.

For rounting irq from host to guest, we need to do the following:
1. Take interrupt in hypervisor with EOImode enabled (i.e.
GICC_CTRL.EOImode==1)
2. Upon receipt of routed host irq, only de-prioritize it but don't
de-activate it. (i.e. only write host irq number to GICC_EOI register)
3. Queue the host irq as virtual guest irq with maintainence interrupt
enabled using GICH_LRx registers.
4. When guest writes to GICV_EOI register after handling guest irq
we will get maintainence interrupt.
5. Upon receipt of maintainence interrupt for guest irq, de-activate
the host irq by writing host irq number to GICC_DIR register.

This patch changes the GIC driver to use EOImode for GIC with
virtualization extensions so that we can implement host-to-guest
irq routing in VGIC driver.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Use unsigned long instead of u32 for vmm_delay APIs

Currently, we use u32 parameters for vmm_delay APIs which means
even on 64bit host we will endup implementing arch_delay_xxxx()
using 32bit registers.

This patch updates all vmm_delay APIs to use unsiged long instead
of u32 so that we can use unsigned long for arch_delay_xxxx(). This
will help us use 64bit registers on 64bit host for implementing
arch_delay_xxxx() functions.

Signed-off-by: Anup Patel <anup@brainfault.org>
Merge remote-tracking branch 'upstream/master' into imx6
[DRIVERS] irqchip: Reduce dependency of GIC driver on irq_start parameter

Currently, the GIC irqchip driver depends more on irq_start parameter
passed via device tree node. This irq_start parameter/attribute is
non-standard and can be assumed based on GIC instance is primary
or secondary. For example, if GIC is primary interrupt controller
then irq_start can be safely assumed to be 16 whereas for secondary
GIC irq_start can be assumed to be 32.

This patch simplifies GIC irqchip driver to reduce dependency on the
irq_start parameter/attribute.

Signed-off-by: Anup Patel <anup@brainfault.org>
Merge remote-tracking branch 'upstream/master' into imx6
[ARM] vgic: Don't use maintainence interrupt for EOIed LRs

Currently, we programme LR registers such that we get maintainence
interrupt for EOIed level-triggered interrupt. Unfortunately most
of the ARM Guest interrupts are generally level-triggered hence
we get a maintainence interrupt for every interrupt injected to
Guest VCPU and we re-claime EOIed LRs when processing maintainence
interrupt. Due to this kind of maintainence interrupt usage we
end-up wasting lot of CPU time in processing maintainence interrupt.

This patch improves the VGIC code by avoiding usage of maintainence
interrupt for re-claiming EOIed LRs. Now instead of maintainence
interrupt we re-claim EOIed LRs when injecting virtual interrupt
in vgic_handle_irq().

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] generic: sun4i: Move aliases node to sun4i-a10.dtsi

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] generic: sun7i: Reorganize DTS files to support multiple sun7i boards

This patch mostly reorganizes DTS files for sun7i soc such that we can add
more DTS board specific DTS files later.

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