]> rtime.felk.cvut.cz Git - jailhouse.git/log
jailhouse.git
7 years agojailhouse: inmates: bench: Add -R option -- repeats count. master
Maxim Baryshnikov [Wed, 10 Aug 2016 17:35:22 +0000 (19:35 +0200)]
jailhouse: inmates: bench: Add -R option -- repeats count.

7 years agoEnhance the benchmark code a little. Add image_end symbol.
Maxim Baryshnikov [Tue, 9 Aug 2016 19:22:19 +0000 (21:22 +0200)]
Enhance the benchmark code a little. Add image_end symbol.

7 years agojailhouse: inmates: add Membench inmate and tune inmates' linker sript according...
Maxim Baryshnikov [Fri, 5 Aug 2016 09:38:11 +0000 (11:38 +0200)]
jailhouse: inmates: add Membench inmate and tune inmates' linker sript according to it.

7 years agojailhouse: configs: Add bench cell configuration and tune novabox configuration accor...
Maxim Baryshnikov [Fri, 5 Aug 2016 09:37:20 +0000 (11:37 +0200)]
jailhouse: configs: Add bench cell configuration and tune novabox configuration according to it

7 years agoAdd membench inmate. It has not worked properly yet.
Maxim Baryshnikov [Sat, 30 Jul 2016 17:04:20 +0000 (19:04 +0200)]
Add membench inmate. It has not worked properly yet.

7 years agoinmates: hpet-demo: avoid warning on the unused func
Maxim Baryshnikov [Wed, 27 Jul 2016 18:53:12 +0000 (20:53 +0200)]
inmates: hpet-demo: avoid warning on the unused func

7 years agoconfigs: update configs to achieve the compatibility with the new JH version
Maxim Baryshnikov [Wed, 27 Jul 2016 18:52:20 +0000 (20:52 +0200)]
configs: update configs to achieve the compatibility with the new JH version

7 years agoMerge remote-tracking branch 'kiszka/master'
Maxim Baryshnikov [Wed, 27 Jul 2016 14:56:47 +0000 (16:56 +0200)]
Merge remote-tracking branch 'kiszka/master'

# Conflicts:
# hypervisor/arch/x86/dbg-write.c -- solved, remote version was choosen.

7 years agotools: config-create: Do not enter infinite over disabled PCI devices
Jan Kiszka [Tue, 28 Jun 2016 15:11:00 +0000 (17:11 +0200)]
tools: config-create: Do not enter infinite over disabled PCI devices

If a PCI device is disabled, e.g. a secondary GPU, we may not see its
config space anymore while it is still listed. With config all 0xff, we
will then enter an infinite loop while trying to make sense of the
capability list. Prevent this, issuing a warning that we will skip this
device.

Reported-by: Thomas Pettinger <thomas.pettinger@tum.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Rework interrupt affinity management on cell creation
Jan Kiszka [Mon, 27 Jun 2016 06:41:14 +0000 (08:41 +0200)]
arm: Rework interrupt affinity management on cell creation

So far, we only ensured that the affinities of interrupts given to new
cells match with the corresponding CPU set. However, we also need to
check that Linux properly adjusted the affinity of all its remaining
interrupts properly.

This introduces a new irqchip callback adjust_irq_target which performs
the check and the potential adjustment to the first CPU of a cell on a
per-interrupt basis. A single loop in irqchip_cell_init triggers them.
gic_target_spis and gic_route_spis become obsolete.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Validate ARE-NS being enabled with GICv3
Jan Kiszka [Mon, 27 Jun 2016 06:37:38 +0000 (08:37 +0200)]
arm: Validate ARE-NS being enabled with GICv3

Linux does enable Affinity Routing, but better check because the code
depends on this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Factor out gic_targets_in_cell
Jan Kiszka [Sun, 26 Jun 2016 13:49:49 +0000 (15:49 +0200)]
arm: Factor out gic_targets_in_cell

We will reuse it for affinity adjustments on cell creation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Fold irqchip_root_cell_shrink into irqchip_cell_init
Jan Kiszka [Sun, 26 Jun 2016 10:34:58 +0000 (12:34 +0200)]
arm: Fold irqchip_root_cell_shrink into irqchip_cell_init

Simplifies the code.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove SPI target reset on cell destruction
Jan Kiszka [Sun, 26 Jun 2016 10:10:25 +0000 (12:10 +0200)]
arm: Remove SPI target reset on cell destruction

There is no point in updating the SPI routing on cell destruction: all
CPUs the cell owned will be given back to the root cell. So any
previously written valid target configuration remain valid.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agocore: Introduce first_cpu
Jan Kiszka [Sun, 26 Jun 2016 09:38:24 +0000 (11:38 +0200)]
core: Introduce first_cpu

Extracted from patch of Antonios Motakis: Avoid the barely readable
"for_each_cpu(...) break;" pattern.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Rework spi_in_cell to irqchip_irq_in_cell
Jan Kiszka [Sun, 26 Jun 2016 08:14:34 +0000 (10:14 +0200)]
arm: Rework spi_in_cell to irqchip_irq_in_cell

Make use of the the fully populated irq_bitmap and enhance spi_in_cell
to consider SGIs and PPIs as well. This allows to simplify
restrict_bitmask_access.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Print IRQ number rather than SPI on handle_irq_target errors
Jan Kiszka [Sun, 26 Jun 2016 08:02:23 +0000 (10:02 +0200)]
arm: Print IRQ number rather than SPI on handle_irq_target errors

Configuration and other reportings are based on absolute IDs as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Rename reg parameter of handle_irq_target to irq
Jan Kiszka [Sun, 26 Jun 2016 08:01:07 +0000 (10:01 +0200)]
arm: Rename reg parameter of handle_irq_target to irq

Reflects better what this is about.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoconfig: Correct / comment GIC irqchip addresses
Jan Kiszka [Sun, 26 Jun 2016 05:31:24 +0000 (07:31 +0200)]
config: Correct / comment GIC irqchip addresses

We will soon evaluate them, so their correct value starts to matter.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Use full bitmap to manage per-cell interrupt access
Jan Kiszka [Sat, 25 Jun 2016 18:34:27 +0000 (20:34 +0200)]
arm: Use full bitmap to manage per-cell interrupt access

7 years agoconfig, core: Improve irqchip configuration
Jan Kiszka [Sat, 25 Jun 2016 15:59:35 +0000 (17:59 +0200)]
config, core: Improve irqchip configuration

This aims at supporting irqchips with more than 64 pins. The idea is to
use multiple entries in this case, each describing a distinct set of the
pins. Therefore, a pin_base field is introduced to jailhouse_irqchip.
Moreover, we expand the number of pins for each entry to 128.

We do not exploit the extended pin number on ARM yet, but stick with
64 pins for now. Succeeding change sets will tackle it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove unused struct pending_irq
Jan Kiszka [Sat, 25 Jun 2016 10:04:31 +0000 (12:04 +0200)]
arm: Remove unused struct pending_irq

Leftover of 8b121b498b.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: hide TLB flush behind a macro
Antonios Motakis [Thu, 12 May 2016 13:00:59 +0000 (15:00 +0200)]
arm: hide TLB flush behind a macro

Hide TLB flushes issues by the MMU code behind a macro, so we can
increase our chances of reusing some of this code.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: put the value of VTCR for cells in a define
Antonios Motakis [Thu, 12 May 2016 13:00:59 +0000 (15:00 +0200)]
arm: put the value of VTCR for cells in a define

We can reuse the code under hypervisor/arch/arm/mmu_cell.c for the
AArch64 port, save for the value we use for the VTCRL. AArch64 will
need in addition to the flags set by the AArch32 port, to set the
size of the address space.

We put this behind a define in asm/paging.h to allow this reuse.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: prepare port for 48 bit PARange support
Antonios Motakis [Thu, 12 May 2016 13:00:59 +0000 (15:00 +0200)]
arm: prepare port for 48 bit PARange support

We currently support 3 levels of page tables for a 39 bits PA range
on ARM. This patch implements support for 4 level page tables,
and 3 level page tables with a concatenated level 1 root page
table.

On AArch32 we stick with the current restriction of building for
a 39 bit physical address space; however this change will allow
us to support a 40 to 48 bit PARange on AArch64.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: move the handle_irq_route function to the GICv3 module
Antonios Motakis [Tue, 14 Jun 2016 12:16:44 +0000 (14:16 +0200)]
arm: move the handle_irq_route function to the GICv3 module

The handle_irq_route function is not needed with the GICv2.

On the ARMv8 port we will not assign a virt_id to each CPU,
opting to use the MPIDR as much as we can from the start.
GICv3 will need heavier refactoring for this purpose; by moving
this function we can reuse the GICv2 code on ARMv8.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
[Jan: implement stub in v2 to reduce #ifdefs]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: replace IS_PSCI_FN macro with more explicit versions
Antonios Motakis [Thu, 12 May 2016 13:00:59 +0000 (15:00 +0200)]
arm: replace IS_PSCI_FN macro with more explicit versions

The previous version of the macro allows for more false positives
than necessary.

Replace the macro with IS_PSCI_32 and IS_PSCI_UBOOT macros, that
explicitly check for the 32 bit PSCI IDs, and the PSCI 0.1 IDs
used by uboot. ARMv8 will need an additinal check for the IDs
of 64 bit PSCI functions.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: psci: support multiple affinity levels in MPIDR
Antonios Motakis [Thu, 12 May 2016 13:00:59 +0000 (15:00 +0200)]
arm: psci: support multiple affinity levels in MPIDR

PSCI actually takes CPU parameters by the MPIDR id, which may
differ from the logical id of the CPU. This patch is the first step
into properly handling the CPU affinity levels in the MPIDR.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
[Jan: add missing processor.h include to setup.c]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agocore: lib: replace ARM memcpy implementation with generic version
Claudio Fontana [Thu, 12 May 2016 13:00:59 +0000 (15:00 +0200)]
core: lib: replace ARM memcpy implementation with generic version

Remove the memcpy implementation from the ARM port, and add a
generic version to the core library for all architectures.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
[antonios.motakis@huawei.com: removed all signs of weakness!]

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agocore: Add support for aligned page allocation
Jan Kiszka [Fri, 17 Jun 2016 12:37:30 +0000 (14:37 +0200)]
core: Add support for aligned page allocation

Refactor page_alloc to page_alloc_internal which accepts an additional
constraint for its allocation: align_mask. The allocated region will now
have its start page chosen so that page_number & align_mask is zero. If
no alignment is required, align_mask just needs to be set to 0. This is
what page_alloc exploits.

However, the new function page_alloc_aligned is introduces to return
page regions aligned according to their size (num pages will be aligned
by num * PAGE_SIZE). This implied that num needs to be a power of two.

This will be used on the AArch64 port of Jailhouse to support physical
address ranges from 40 to 44 bits: in these configurations, the initial
page table level may take up multiple consecutive pages.

Based on patch by Antonios Motakis.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agocore: panic_stop: print current cell only if it has been set
Antonios Motakis [Fri, 17 Jun 2016 12:37:30 +0000 (14:37 +0200)]
core: panic_stop: print current cell only if it has been set

Currently during a panic, panic_stop will print the current cell
on the CPU where the panic occurred. However, if the hypervisor
panics sufficiently early during initialization, we may end up in
a situation where the root cell has not been initialized. This can
easily cause a trap loop, making the panic output less useful.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agocore: make phys_processor_id() return unsigned long
Antonios Motakis [Fri, 17 Jun 2016 14:38:41 +0000 (16:38 +0200)]
core: make phys_processor_id() return unsigned long

32 bits ought not be enough for anybody.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agodriver: sync I-cache, D-cache and memory
Dmitry Voytik [Fri, 17 Jun 2016 12:37:29 +0000 (14:37 +0200)]
driver: sync I-cache, D-cache and memory

Syncronize I-cache with D-cache after loading the hypervisor
image or a cell image. This must be done in arm64 according to
ARMv8 ARM spec. See page 1712, D3.4.6 "Non-cacheable accesses
and instruction caches".

This patch fixes coherency problems observed on real HW targets.
On x86 this operation is a NOP.

Signed-off-by: Dmitry Voytik <dmitry.voytik@huawei.com>
Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
[antonios.motakis@huawei.com: edited comments]

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agodriver: ioremap the hypervisor firmware to any kernel address
Antonios Motakis [Fri, 17 Jun 2016 12:37:29 +0000 (14:37 +0200)]
driver: ioremap the hypervisor firmware to any kernel address

At the moment the Linux driver maps the Jailhouse binary to
JAILHOUSE_BASE. The underlying assumption is that Linux may map the
firmware (in the Linux kernel space), to the same virtual address it
has been built to run from.

This assumption is unworkable on ARMv8 processors running in AArch64
mode. Kernel memory is allocated in a high address region, that is
not addressable from EL2, where the hypervisor will run from.

This patch removes the assumption, by introducing the
JAILHOUSE_BORROW_ROOT_PT define, which signals the behavior of the
current architectures.

We also turn the entry point in the header, into an offset from the
Jailhouse load address, so we can enter the image regardless of
where it  will be mapped.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoci: Update CA certificates to unbreak Coverity build
Jan Kiszka [Thu, 23 Jun 2016 07:08:31 +0000 (09:08 +0200)]
ci: Update CA certificates to unbreak Coverity build

See https://github.com/travis-ci/docs-travis-ci-com/pull/617

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Fix byte-wise write access to GICD_ITARGETSRn
Jan Kiszka [Thu, 23 Jun 2016 06:31:02 +0000 (08:31 +0200)]
arm: Fix byte-wise write access to GICD_ITARGETSRn

While expanding byte accesses to full words, we forgot to adjust the
address as well. This led to unaligned word accesses on writes, followed
by hypervisor aborts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agogitignore: Remove user-specific rules
Jan Kiszka [Sun, 19 Jun 2016 18:54:59 +0000 (20:54 +0200)]
gitignore: Remove user-specific rules

A project's .gitignore should be about project-specific rules, shared by
everyone compiling it. So, instead of adding more and more rules for
user-specific editors or tools, remove them completely and no longer
accept new ones. Users can easily define local rules, see gitignore man
page.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoEnforce zero warnings
Jan Kiszka [Sat, 18 Jun 2016 10:18:58 +0000 (12:18 +0200)]
Enforce zero warnings

Break the build in case of warnings. Can still be temporarily
overwritten by appending EXTRA_CFLAGS=-Wno-error to a build.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agotools: Include EXTRA_CFLAGS into build
Jan Kiszka [Sat, 18 Jun 2016 10:03:14 +0000 (12:03 +0200)]
tools: Include EXTRA_CFLAGS into build

This allows to pass in additional flags or override existing ones, just
like it is already possible for the parts under Kbuild control.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Consolidate gic_irqchip to irqchip
Jan Kiszka [Thu, 16 Jun 2016 09:24:13 +0000 (11:24 +0200)]
arm: Consolidate gic_irqchip to irqchip

Likely, we will never support alternative irqchips to the GIC (only
cascaded ones). So this copying-over is not required.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Reject unknown GIC versions
Jan Kiszka [Thu, 16 Jun 2016 09:20:37 +0000 (11:20 +0200)]
arm: Reject unknown GIC versions

We would likely crash anyway due to irqchip containing only NULL
pointers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Make cpu_init and cpu_reset callbacks mandatory
Jan Kiszka [Thu, 16 Jun 2016 09:15:03 +0000 (11:15 +0200)]
arm: Make cpu_init and cpu_reset callbacks mandatory

No need for checking them to be NULL, we need them in both
implementations.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Protect hypervisor used SGIs and PPIs from cell changes
Jan Kiszka [Thu, 16 Jun 2016 16:28:56 +0000 (18:28 +0200)]
arm: Protect hypervisor used SGIs and PPIs from cell changes

We must not allow the cells to manipulate distributor registers or
register bits related to the hypervisor SGIs or the maintenance
interrupt.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Enable / disable maintenance interrupt in distributor
Jan Kiszka [Thu, 16 Jun 2016 16:25:58 +0000 (18:25 +0200)]
arm: Enable / disable maintenance interrupt in distributor

We did not get any maintenance interrupts so far because we didn't
enable the source in the distributor so far. Fix this, but also disable
it again when shutting down.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Enable maintenance interrupt also from irqchip_set_pending
Jan Kiszka [Thu, 16 Jun 2016 14:28:19 +0000 (16:28 +0200)]
arm: Enable maintenance interrupt also from irqchip_set_pending

In case we set an interrupt pending for the local CPU and cannot queue
it with the hardware, make sure the maintenance interrupt is on.
Otherwise, we risk to delay guest interrupts or cause the guest to get
stuck.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove try_inject parameter from irqchip_set_pending
Jan Kiszka [Thu, 16 Jun 2016 14:22:49 +0000 (16:22 +0200)]
arm: Remove try_inject parameter from irqchip_set_pending

We can only perform injection (and we also always want to) if target
CPU equals caller CPU, and this is better checked inside the function.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Convert software queue of pending interrupts into a ring
Jan Kiszka [Thu, 16 Jun 2016 09:07:46 +0000 (11:07 +0200)]
arm: Convert software queue of pending interrupts into a ring

This massively simplifies the code and reduces the memory usage in
struct per_cpu. However, adding interrupt priorities later on may
require another rework.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Make sure to not queue interrupt that were rejected as duplicates
Jan Kiszka [Thu, 16 Jun 2016 08:33:33 +0000 (10:33 +0200)]
arm: Make sure to not queue interrupt that were rejected as duplicates

If the inject_irq callback detect that an interrupt is already queued
in some list register, do not insert it into the software queue, thus
coalesce the event like real hardware does.

The change in the return code of inject_irq is more cosmetic, to reflect
the meaning better.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Disable maintenance interrupt on successful injection
Jan Kiszka [Tue, 14 Jun 2016 05:30:09 +0000 (07:30 +0200)]
arm: Disable maintenance interrupt on successful injection

We enable the maintenance interrupt when all list registers are in use.
However, there was no disabling of it again. Apparently, it rarely
triggered in the field, otherwise we would have seen a lot of
maintenance interrupt storms, thus locked-up systems.

This introduces another callback to enable or disable the maintenance
interrupt. It is now controlled by irqchip_inject_pending, the function
that is also called when handling a maintenance interrupt.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove unused return code of irqchip_set_pending
Jan Kiszka [Thu, 16 Jun 2016 08:30:49 +0000 (10:30 +0200)]
arm: Remove unused return code of irqchip_set_pending

No caller evaluated it so far, and none of them has a use case for it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove return code from irqchip_inject_pending
Jan Kiszka [Thu, 16 Jun 2016 10:19:57 +0000 (12:19 +0200)]
arm: Remove return code from irqchip_inject_pending

It's always 0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove irq field from pending_irq
Jan Kiszka [Mon, 13 Jun 2016 17:17:10 +0000 (19:17 +0200)]
arm: Remove irq field from pending_irq

Always identical to virt_id.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove cpuid from pending_irq
Jan Kiszka [Mon, 13 Jun 2016 17:13:42 +0000 (19:13 +0200)]
arm: Remove cpuid from pending_irq

Was always set to 0.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove hw flag from pending_irq
Jan Kiszka [Mon, 13 Jun 2016 17:10:37 +0000 (19:10 +0200)]
arm: Remove hw flag from pending_irq

Can be derived from virt_id.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove maintenance flag from pending_irq.type.sgi
Jan Kiszka [Mon, 13 Jun 2016 17:07:36 +0000 (19:07 +0200)]
arm: Remove maintenance flag from pending_irq.type.sgi

It was always cleared.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove write-only priority field from pending_irq
Jan Kiszka [Mon, 13 Jun 2016 17:00:04 +0000 (19:00 +0200)]
arm: Remove write-only priority field from pending_irq

We do not support interrupt priorities so far, and we may have to model
them differently into queues once we do. Remove the de facto unused
field.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Un-inline spi_in_cell
Jan Kiszka [Sat, 11 Jun 2016 17:35:52 +0000 (19:35 +0200)]
arm: Un-inline spi_in_cell

To big to be inlined, and we also want to avoid dereferencing struct
cell in the header due to upcoming include reordering.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Remove unneeded include from irqchip.h
Jan Kiszka [Sat, 11 Jun 2016 17:22:03 +0000 (19:22 +0200)]
arm: Remove unneeded include from irqchip.h

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Fix build warning in gic-v3
Jan Kiszka [Tue, 14 Jun 2016 05:28:16 +0000 (07:28 +0200)]
arm: Fix build warning in gic-v3

Leftover from the mmio_perform_access refactoring.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Add missing printk.h include
Jan Kiszka [Tue, 14 Jun 2016 05:26:33 +0000 (07:26 +0200)]
arm: Add missing printk.h include

Some implicit inclusion disappeared.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoarm: Use asm-defines.h for struct per_cpu members
Jan Kiszka [Mon, 13 Jun 2016 09:47:22 +0000 (11:47 +0200)]
arm: Use asm-defines.h for struct per_cpu members

Port the logic over from x86 and also drop CHECK_ASSUMPTION here.

The only slightly ugly detail: the PERCPU_SIZE_SHIFT define is now
duplicated in both asm/percpu.h instances because there is no good
generic header yet to hold it. Can be cleaned up later on.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoDocumentation: Rewrap Banana Pi README to 80 chars
Jan Kiszka [Wed, 15 Jun 2016 17:27:36 +0000 (19:27 +0200)]
Documentation: Rewrap Banana Pi README to 80 chars

For better readability in the absence of a markdown viewer.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoDocumentation: More BananaPi documentation
cyng93 [Sat, 11 Jun 2016 00:40:46 +0000 (08:40 +0800)]
Documentation: More BananaPi documentation

This patch include more details about how to setup Jailhouse on a BananaPi-M1 board.

Basically this documentation covered:
1. Installation of Bananian(BananaPi offical OS) on BananaPi
2. Modifying U-boot configuration on BananaPi to run Jailhouse.
3. Update Bananian to newer kernel so Jailhouse could works.
    - Compiling Kernel.
    - Installing Kernel.
4. Installing Jailhouse on BananaPi.
5. Simple demo/test: Running Jailhouse with Freertos-cell on BananaPi.

Signed-off-by: CHING-YI NG <cyng93@gmail.com>
[Jan: removed external media link showing FUSE selection - not needed]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoDocumentation: Move BananaPi-related docs out
cyng93 [Sat, 11 Jun 2016 00:40:45 +0000 (08:40 +0800)]
Documentation: Move BananaPi-related docs out

This patch move BananaPi-related documentation out from `README.md` to
`Documentation/setup-on-banana-pi-arm-board.md`

Signed-off-by: CHING-YI NG <cyng93@gmail.com>
[Jan: removed some blank lines from README.md]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agox86: Add missing include to amd_iommu.h
Jan Kiszka [Sat, 11 Jun 2016 17:00:13 +0000 (19:00 +0200)]
x86: Add missing include to amd_iommu.h

Reported by header-check script: We need this in the header due to the
use of struct jailhouse_memory. Consequently, we can remove the include
from the corresponding amd_iommu.c.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agotools: simplify python statement
Ralf Ramsauer [Fri, 3 Jun 2016 19:41:20 +0000 (21:41 +0200)]
tools: simplify python statement

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoinmates/lib: cmdline.c
Xuguo Wang [Tue, 31 May 2016 03:44:16 +0000 (11:44 +0800)]
inmates/lib: cmdline.c

There is no point in checking for *p == 0 in the while loop,
after over the blanks, then checking for the parameters, if
find, return true, otherwise continue check the parameters,
if to the end of the cmdline, return false.

Signed-off-by: Xuguo Wang <huddy1985@gmail.com>
[Jan: also removed curly braces]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoconfigs: fiasco: novabox: Some little changes in configs.
Maxim Baryshnikov [Tue, 24 May 2016 23:05:07 +0000 (01:05 +0200)]
configs: fiasco: novabox: Some little changes in configs.

7 years agotools: fix missing hardware-check after make install
Georg Schiesser [Fri, 20 May 2016 18:07:06 +0000 (20:07 +0200)]
tools: fix missing hardware-check after make install

Add the new hardware-check script to the HELPERS, such that
"make install" will install it properly, just like the other
scripts, into: $DESTDIR/usr/local/libexec/jailhouse/

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoTODO: Add item for config generator refactoring
Jan Kiszka [Fri, 20 May 2016 08:29:14 +0000 (10:29 +0200)]
TODO: Add item for config generator refactoring

Based on http://thread.gmane.org/gmane.linux.jailhouse/4893.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agox86: Make SMI filter feature test of AMD IOMMU stricter
Jan Kiszka [Fri, 20 May 2016 08:27:12 +0000 (10:27 +0200)]
x86: Make SMI filter feature test of AMD IOMMU stricter

The only valid value of SmiFSup we are aware of is 01b.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agotools: Add hardware feature check
Jan Kiszka [Wed, 18 May 2016 23:17:13 +0000 (01:17 +0200)]
tools: Add hardware feature check

The hypervisor itself is not very helpful when it comes to analyzing
feature deficits of the target platform. This adds another extension
script to the jailhouse command which checks the hardware using the
same key criteria that also the hypervisor applied.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoREADME: Update and improve the configuration section
Jan Kiszka [Fri, 20 May 2016 08:26:11 +0000 (10:26 +0200)]
README: Update and improve the configuration section

We actually neglected to mention the config generator - fix this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoREADME: Update Banana Pi documentation
Jan Kiszka [Mon, 16 May 2016 17:56:55 +0000 (19:56 +0200)]
README: Update Banana Pi documentation

Add a note about the simple framebuffer pitfall that more recent U-Boot
versions create via CONFIG_VIDEO. Drop references to snapshot versions.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoREADME: Remove superfluous CPU features from QEMU command line
Jan Kiszka [Sun, 15 May 2016 15:09:36 +0000 (17:09 +0200)]
README: Remove superfluous CPU features from QEMU command line

On Intel, x2apic is set via the CPU type. On AMD, "host" pulls in svm,
and x2apic only generates warnings with latest QEMU.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoREADME: Add drive format property to QEMU command line
Jan Kiszka [Sat, 14 May 2016 06:33:37 +0000 (08:33 +0200)]
README: Add drive format property to QEMU command line

Newer QEMU versions complain about missing format property, possibly
reject such configurations eventually.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoconfigs: hpet config improved.
Maxim Baryshnikov [Fri, 13 May 2016 12:09:04 +0000 (14:09 +0200)]
configs: hpet config improved.

7 years agofix of a bad merge.
Maxim Baryshnikov [Thu, 12 May 2016 20:22:21 +0000 (22:22 +0200)]
fix of a bad merge.

7 years agoconfigs: fiasco: Remove unused code. We don't use local apic on fee00000-fee000ff...
Maxim Baryshnikov [Thu, 12 May 2016 19:41:10 +0000 (21:41 +0200)]
configs: fiasco: Remove unused code. We don't use local apic on fee00000-fee000ff anymore, fiasco remaps it. Initialization problem was solved by modifying fiasco code.

7 years agoconfigs, core, tools: Remove device_limit field from system configuration
Jan Kiszka [Thu, 12 May 2016 07:20:11 +0000 (09:20 +0200)]
configs, core, tools: Remove device_limit field from system configuration

Once introduced for AMD IOMMUs, we actually do not need it as device
table segmentation saves us in practice from allocating large tables.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoMerge branch 'master' of rtime.felk.cvut.cz:jailhouse
Maxim Baryshnikov [Thu, 12 May 2016 00:49:40 +0000 (02:49 +0200)]
Merge branch 'master' of rtime.felk.cvut.cz:jailhouse

Conflicts:
configs/novabox.c

7 years agotools: fix gcc sign-compare warnings
Georg Schiesser [Tue, 10 May 2016 21:40:10 +0000 (23:40 +0200)]
tools: fix gcc sign-compare warnings

Cosmetic change to avoid multiple gcc sign-compare warnings between
signed int argc and unsigned int arg_num, both being small and
non-negative. Alternatively, we could use unsigned int argc or
disable the warning with gcc -Wno-sign-compare.

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
[Jan: reordered lines for visual pleasure]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agotools: enable additional compiler warnings
Georg Schiesser [Tue, 10 May 2016 21:39:55 +0000 (23:39 +0200)]
tools: enable additional compiler warnings

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoconfigs: fixed typo in e1000-demo pio_bitmap
Georg Schiesser [Tue, 10 May 2016 21:39:42 +0000 (23:39 +0200)]
configs: fixed typo in e1000-demo pio_bitmap

The pio_bitmap initialization incorrectly assigns overlapping ranges to
different values, similar to commit 886ca63f.  As Jan pointed out:
"Fortunately, it was harmless because succeeding initializations
overwrote this exceeding one."

see also: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoconfigs: enable additional compiler warnings
Georg Schiesser [Tue, 10 May 2016 21:39:26 +0000 (23:39 +0200)]
configs: enable additional compiler warnings

Make it easier to spot configuration problems like commit 886ca63f.
gcc -Wextra includes -Woverride-init, which will print warnings like:

qemu-vm.c:190:3: warning: initialized field overwritten [-Woverride-init]
   [  0x78/8 ...   0x7f/7] = -1,
   [  0x80/8 ...   0x87/8] = 0xfe, /* Linux: native_io_delay() */
   ^
qemu-vm.c:190:3: warning: (near initialization for 'config.pio_bitmap[16]')

see also: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agogitignore: VIM backup and undo files
Georg Schiesser [Tue, 10 May 2016 21:38:59 +0000 (23:38 +0200)]
gitignore: VIM backup and undo files

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoconfigs: Update QEMU IOAPIC ID to upcoming VT-d IR patches
Jan Kiszka [Tue, 10 May 2016 07:09:40 +0000 (09:09 +0200)]
configs: Update QEMU IOAPIC ID to upcoming VT-d IR patches

Peter Xu's VT-d interrupt remapping patches use a different IOAPIC ID
than older patches of me. Adjust the QEMU config to be ready for them.

Tested successfully with v6 of Peter's patches and
-machine q35,kernel_irqchip=split,iommu=on,intremap=on.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agotools: fixed typo in rootcell config template pio_bitmap
Georg Schiesser [Tue, 10 May 2016 00:03:35 +0000 (02:03 +0200)]
tools: fixed typo in rootcell config template pio_bitmap

This typo was introduced with commit 598c04f6

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agox86: Block DMA from unlisted devices in AMD IOMMU
Jan Kiszka [Sat, 7 May 2016 17:02:28 +0000 (19:02 +0200)]
x86: Block DMA from unlisted devices in AMD IOMMU

Invalid device table entries in the AMD IOMMU mean that those devices
are actually allowed to perform DMA requests and issue interrupts. We
have to avoid this case because only devices listed in a config are
permitted to do so. We already achieve this effect when removing an
existing device from the table, but we have to ensure it also for any
unlisted device.

Devices with IDs not covered by any table are blocked by the IOMMU, see
AMD I/O Virtualization Technology spec, 2.2.2.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agox86: Use safer pattern with AMD IOMMU to block DMA requests
Jan Kiszka [Mon, 9 May 2016 17:55:45 +0000 (19:55 +0200)]
x86: Use safer pattern with AMD IOMMU to block DMA requests

The AMD IOMMU spec is not 100% clear if a device table entry with V=1
but TV=0 implies that DMA requests from that device are blocked. Play
safe and use the pattern that Linux uses as well: TV=1, Mode=0 and IW as
well as IR cleared.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agojailhouse: configs: Change reserved memory layout for jailhouse, so configs have...
Maxim Baryshnikov [Sun, 8 May 2016 09:55:46 +0000 (11:55 +0200)]
jailhouse: configs: Change reserved memory layout for jailhouse, so configs have to be changed.

7 years agojailhouse: configs: Change fiasco, novaboot and hpet config. Reserved memory layout...
Maxim Baryshnikov [Sun, 8 May 2016 08:59:22 +0000 (10:59 +0200)]
jailhouse: configs: Change fiasco, novaboot and hpet config. Reserved memory layout for hypervisor was changed, so some correction were done in confs.

Conflicts:
configs/novabox.c

7 years agojailhouse: config: Generate new novabox config because of HW changed.
Maxim Baryshnikov [Fri, 6 May 2016 00:46:35 +0000 (02:46 +0200)]
jailhouse: config: Generate new novabox config because of HW changed.

7 years agojailhouse: hypervisor: Debug output redirected to serial 0 back.
Maxim Baryshnikov [Wed, 4 May 2016 22:55:53 +0000 (00:55 +0200)]
jailhouse: hypervisor: Debug output redirected to serial 0 back.

7 years agojailhouse: ci: Update linux kernel config. Add kvm to kernel.
Maxim Baryshnikov [Wed, 4 May 2016 20:19:49 +0000 (22:19 +0200)]
jailhouse: ci: Update linux kernel config. Add kvm to kernel.

7 years agojailhouse: configs: Add the novaboot root cell config. It was generated using jailhou...
Maxim Baryshnikov [Wed, 4 May 2016 20:19:10 +0000 (22:19 +0200)]
jailhouse: configs: Add the novaboot root cell config. It was generated using jailhouse tools and manually adjusted.

7 years agoconfigs: qemu: Allow linux to write into seral0.
Maxim Baryshnikov [Tue, 3 May 2016 00:07:15 +0000 (02:07 +0200)]
configs: qemu: Allow linux to write into seral0.

7 years agodriver: fix unsigned long overflow in leave_hypervisor
Antonios Motakis [Thu, 28 Apr 2016 14:01:29 +0000 (16:01 +0200)]
driver: fix unsigned long overflow in leave_hypervisor

When shutting down the hypervisor, in the leave_hypervisor
function, the Linux driver touches every hypervisor page, to
ensure all pages are mapped. However, the current implementation
assumes hv_core_and_percpu_size is aligned to PAGE_SIZE. This may
not be the case, if PAGE_SIZE is different on the hypervisor side.

This can cause an unsigned long overflow, leading to an infinite
loop of touching successive pages starting from hypervisor_mem.
The loop will be broken as soon as Linux tries to touch an invalid
page, leading to a kernel crash.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agocore: map the zero page to the full hypervisor memory region
Antonios Motakis [Thu, 28 Apr 2016 14:01:28 +0000 (16:01 +0200)]
core: map the zero page to the full hypervisor memory region

During initialization, in init_early, the hypervisor maps the
memory used by the hypervisor with empty pages for the root cell.
However, if the root cell tries to access the region used by the
hypervisor, this is only safe if both sides agree on PAGE_SIZE.
It is a long shot to try to guess the granularity used by the
root cell; the safest bet is to map the full range that has been
allocated for the hypervisor to use.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
7 years agoDocumentation: articles: LJ-article-04-2015.txt
Jim Huang [Wed, 27 Apr 2016 05:29:44 +0000 (13:29 +0800)]
Documentation: articles: LJ-article-04-2015.txt

Fix indentation of the commands

Signed-off-by: Jim Huang <jserv.tw@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>