]> rtime.felk.cvut.cz Git - jailhouse.git/log
jailhouse.git
7 years agotiny-demo inmate partially works under qemu multiboot-inmate
Michal Sojka [Fri, 20 May 2016 21:47:11 +0000 (23:47 +0200)]
tiny-demo inmate partially works under qemu

qemu-system-x86_64 -nographic -kernel tiny-demo.bin

The demo writes something to the serial port, but cannot continue,
because there is no PM_TIMER address stored in the communication area.

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 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 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.

8 years agoconfigs: fiasco: Remove irqchip out of configuration. It's enough for fiasco to have...
Maxim Baryshnikov [Sun, 24 Apr 2016 16:19:20 +0000 (18:19 +0200)]
configs: fiasco: Remove irqchip out of configuration. It's enough for fiasco to have only memreg allowed to use lAPIC.

8 years agoconfigs: fiasco: Allow memory region 0xfec00000-0xfeefffff.
Maxim Baryshnikov [Sun, 24 Apr 2016 15:45:35 +0000 (17:45 +0200)]
configs: fiasco: Allow memory region 0xfec00000-0xfeefffff.

8 years agoAdd PIC ports and IOAPIC chip to fiasco cell conf.
Maxim Baryshnikov [Sun, 24 Apr 2016 12:31:49 +0000 (14:31 +0200)]
Add PIC ports and IOAPIC chip to fiasco cell conf.

8 years agojailhouse: configs: qemu: Deny access to the 0x64 and 0x60 port.
Maxim Baryshnikov [Fri, 22 Apr 2016 01:13:39 +0000 (03:13 +0200)]
jailhouse: configs: qemu: Deny access to the 0x64 and 0x60 port.

8 years agojailhouse: configs: qemu and fiasco:
Maxim Baryshnikov [Fri, 22 Apr 2016 00:29:31 +0000 (02:29 +0200)]
jailhouse: configs: qemu and fiasco:
--reconfigure delay port on 0xed in qemu
--add pci devices for keyboard: ehci-usb
--remove virtion-9p-pci device form cfg

--enable 0x80 port back in fiasco. linux cell don't use it anymore.

8 years agojailhouse: linux-config: Use the custom version. Changes includes:
Maxim Baryshnikov [Fri, 22 Apr 2016 00:25:59 +0000 (02:25 +0200)]
jailhouse: linux-config: Use the custom version. Changes includes:
kernel hacking -> IO delay type: from 0x80 to 0xed
device drivers -> keyboard=off
       -> HW I/O ports -> i8042=off!
       -> PCI PS/2 keyboard=on

i thought the following might be unusable:
device drv -> Network devs support=off
->Input sevs supp -> mice=off
  -> misc=off
->raid and lvm support=off

8 years agoMerge branch 'master' of rtime.felk.cvut.cz:jailhouse
Maxim Baryshnikov [Mon, 18 Apr 2016 14:38:30 +0000 (16:38 +0200)]
Merge branch 'master' of rtime.felk.cvut.cz:jailhouse

8 years agojailhouse: hypervisor: x86: Debug console changed to serial1.
Maxim Baryshnikov [Mon, 18 Apr 2016 14:36:59 +0000 (16:36 +0200)]
jailhouse: hypervisor: x86: Debug console changed to serial1.

8 years agojailhouse: configs: fiasco: Delete code that makes no sence. Add commented block...
Maxim Baryshnikov [Mon, 18 Apr 2016 09:17:49 +0000 (11:17 +0200)]
jailhouse: configs: fiasco: Delete code that makes no sence. Add commented block that could be used to show PIO 0x80 problem.

8 years agoAdd permition for fiasco-cell to write in PIO 0x80.
Maxim Baryshnikov [Sat, 16 Apr 2016 13:50:19 +0000 (15:50 +0200)]
Add permition for fiasco-cell to write in PIO 0x80.

8 years agoconfigs: fiasco: fix some mistakes - keep only one memreg, no comm region, 2 cpus.
Maxim Baryshnikov [Fri, 8 Apr 2016 02:05:14 +0000 (04:05 +0200)]
configs: fiasco: fix some mistakes - keep only one memreg, no comm region, 2 cpus.

8 years agofiasco: jailhouse: Add the Jailhouse cell config for fiasco.
Maxim Baryshnikov [Fri, 1 Apr 2016 11:03:38 +0000 (13:03 +0200)]
fiasco: jailhouse: Add the Jailhouse cell config for fiasco.

8 years agohpet_example: Timer 2 is fully usable at this moment.
Maxim Baryshnikov [Fri, 26 Feb 2016 19:07:50 +0000 (20:07 +0100)]
hpet_example: Timer 2 is fully usable at this moment.
The feature to route timer interrupts on some IOAPIC INTIs was added.

8 years agohpet_example: Timers 0 a 1 are fully functional by now.
Maxim Baryshnikov [Wed, 24 Feb 2016 23:13:55 +0000 (00:13 +0100)]
hpet_example: Timers 0 a 1 are fully functional by now.
Interrupts are routed using IOAPIC.

8 years agoUnuseful code removed.
Maxim Baryshnikov [Tue, 23 Feb 2016 19:45:53 +0000 (20:45 +0100)]
Unuseful code removed.

8 years agohpet_example: removed some unused parts.
Maxim Baryshnikov [Tue, 23 Feb 2016 00:40:43 +0000 (01:40 +0100)]
hpet_example: removed some unused parts.

8 years agoqemu_root_conf: returned to default state.
Maxim Baryshnikov [Tue, 23 Feb 2016 00:39:49 +0000 (01:39 +0100)]
qemu_root_conf: returned to default state.

8 years agohpet_example: #VMEXIT on memory read solved with map_range(). Legacy interrupts doesn...
Maxim Baryshnikov [Tue, 23 Feb 2016 00:38:50 +0000 (01:38 +0100)]
hpet_example: #VMEXIT on memory read solved with map_range(). Legacy interrupts doesn't work.

8 years agomy tries
Maxim Baryshnikov [Thu, 18 Feb 2016 15:21:43 +0000 (16:21 +0100)]
my tries

8 years agoinmate example
Maxim Baryshnikov [Thu, 18 Feb 2016 15:11:31 +0000 (16:11 +0100)]
inmate example

8 years agox86: svm: Remove redundant error report on NPF exits
Jan Kiszka [Thu, 24 Sep 2015 08:01:18 +0000 (10:01 +0200)]
x86: svm: Remove redundant error report on NPF exits

svm_handle_apic_access and vcpu_handle_mmio_access already do the
reporting.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: svm: Do not enable incomplete AVIC support
Jan Kiszka [Thu, 24 Sep 2015 07:58:26 +0000 (09:58 +0200)]
x86: svm: Do not enable incomplete AVIC support

This breaks on hardware with the AVIC feature present.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: svm: Fix broken FS base on deactivation
Jan Kiszka [Fri, 25 Sep 2015 17:47:18 +0000 (19:47 +0200)]
x86: svm: Fix broken FS base on deactivation

After f93e23934b, we no longer call vmsave, thus will also not find the
right FS base there. This caused sporadic crashes of "jailhouse disable"
on return to userspace.

Fix it by loading the value from the corresponding MSR.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: pci: Fix format string of MMCONFIG error reporting
Jan Kiszka [Fri, 18 Sep 2015 16:06:58 +0000 (18:06 +0200)]
core: pci: Fix format string of MMCONFIG error reporting

The config space address was not printed.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: pci: Fix MMCONFIG handling for root cell
Jan Kiszka [Fri, 18 Sep 2015 16:02:10 +0000 (18:02 +0200)]
core: pci: Fix MMCONFIG handling for root cell

Reorder the initialization in pci_init so that MMCONFIG is set up before
pci_cell_init is invoked for the root cell. Calling pci_cell_init
earlier has the undesired effect that the MMCONFIG region is not
registered for the root cell, and all related accesses will fail with
generic MMIO errors.

This is a regression of e17d52525d.

Reported-by: Yijun Zhu <zhuyijun@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: x86: Switch apic-demo to TSC time measurement
Jan Kiszka [Wed, 16 Sep 2015 07:41:28 +0000 (09:41 +0200)]
inmates: x86: Switch apic-demo to TSC time measurement

Removes chipset-related latency sources from the APIC timer interrupt
benchmark, enabling extremely low jitters (e.g. < 1µs on a Xeon D-1540).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: x86: Add support for TSC-based timing
Jan Kiszka [Wed, 16 Sep 2015 07:22:23 +0000 (09:22 +0200)]
inmates: x86: Add support for TSC-based timing

Provide a service to calibrate the TSC against the PM timer and read out
the current time in nanoseconds. This service is much faster than the
slow PM timer, and it's also not affected by chipset-induced delays.

Note that the simplistic algorithm only supports measuring relative time
spans of a couple of seconds.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: x86: Make pm_timer_read SMP-safe
Jan Kiszka [Wed, 16 Sep 2015 06:57:19 +0000 (08:57 +0200)]
inmates: x86: Make pm_timer_read SMP-safe

Enable parallel usage of pm_timer_read on different cell CPUs by making
the last value and the overflow sum per-cpu variables.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Fixed typos in documentation
Christian Loehle [Mon, 14 Sep 2015 13:23:07 +0000 (15:23 +0200)]
core: Fixed typos in documentation

Signed-off-by: Christian Loehle <cloehle@linutronix.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoDocumentation: Document running/locked in sysfs-entries.txt
Christian Loehle [Mon, 14 Sep 2015 13:22:39 +0000 (15:22 +0200)]
Documentation: Document running/locked in sysfs-entries.txt

Signed-off-by: Christian Loehle <cloehle@linutronix.de>
[Jan: wrap long line]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: add missing include to control.h
Antonios Motakis [Wed, 12 Aug 2015 16:22:01 +0000 (18:22 +0200)]
core: add missing include to control.h

Add a missing include to hypervisor/includes/jailhouse/control.h

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: add missing include to irqchip.h
Antonios Motakis [Wed, 12 Aug 2015 16:22:00 +0000 (18:22 +0200)]
core: add missing include to irqchip.h

Add a missing include to irqchip.h

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
[Jan: adjust to alphabetic ordering]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: arm: add missing include to gic-common.c
Antonios Motakis [Wed, 12 Aug 2015 16:21:59 +0000 (18:21 +0200)]
core: arm: add missing include to gic-common.c

Add a missing include to gic-common.c

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Clean up asm/bitops.h inclusions
Jan Kiszka [Wed, 19 Aug 2015 21:52:45 +0000 (14:52 -0700)]
core: Clean up asm/bitops.h inclusions

No asm/spinlock.h header need it anymore. If we remove it, we need to
convert the implicit inclusion in arm/mmio.c into an explicit one.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: printk: include asm/bitops.h directly
Antonios Motakis [Wed, 12 Aug 2015 16:21:58 +0000 (18:21 +0200)]
core: printk: include asm/bitops.h directly

Currently the implementation in hypervisor/printk.c assumes asm/bitops.h
will be included by asm/spinlock.h. Since this implementation is using
bitops directly, we include the right header file.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
[Jan: adjust to alphabetic ordering]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agohypervisor, driver: Added signature for .cell files
Ralf Ramsauer [Thu, 13 Aug 2015 23:23:58 +0000 (01:23 +0200)]
hypervisor, driver: Added signature for .cell files

Inserted signature field in struct jailhouse_cell_desc and
jailhouse_system. Jailhouse kernel driver will refuse loading
a system configuration as a cell configuration et vice versa.

Signed-off-by: Ralf Ramsauer <ralf@ramses-pyramidenbau.de>
[Jan: also adjust Linux loader script]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Migrate irqchips to generic MMIO dispatcher
Jan Kiszka [Wed, 5 Aug 2015 10:05:20 +0000 (12:05 +0200)]
arm: Migrate irqchips to generic MMIO dispatcher

Register the GIC distributor and, for the GICv3, also the redistributor
regions with the generic MMIO dispatcher. This allows to drop the GIC-
specific MMIO dispatching from arch_handle_dabt.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Remove return codes from gic[v3]_handle_sgir_write
Jan Kiszka [Wed, 5 Aug 2015 10:03:01 +0000 (12:03 +0200)]
arm: Remove return codes from gic[v3]_handle_sgir_write

Those services always succeed.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Move gic_handle_redist_access unmodified
Jan Kiszka [Wed, 5 Aug 2015 09:58:06 +0000 (11:58 +0200)]
arm: Move gic_handle_redist_access unmodified

We will need it earlier in the module.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Migrate SMP mailbox to generic MMIO dispatcher
Jan Kiszka [Wed, 5 Aug 2015 09:51:36 +0000 (11:51 +0200)]
arm: Migrate SMP mailbox to generic MMIO dispatcher

Where needed, register the SMP mailbox MMIO page with the generic
dispatcher and remove the SMP-specific dispatcher invocation from
arch_handle_dabt.

This further concentrates the Versatile Express-specific SMP services in
that module.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Prepare generic MMIO dispatching
Jan Kiszka [Wed, 5 Aug 2015 09:44:53 +0000 (11:44 +0200)]
arm: Prepare generic MMIO dispatching

Hook up the generic MMIO dispatcher into arch_handle_dabt without
removing existing handlers. This allows for a step-wise migration of
subsystems to the new dispatcher.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: pci: Remove list of MSI-X devices
Jan Kiszka [Wed, 5 Aug 2015 09:30:03 +0000 (11:30 +0200)]
core: pci: Remove list of MSI-X devices

No longer used.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore, x86: pci: Migrate MSI-X emulation to generic MMIO dispatcher
Jan Kiszka [Wed, 5 Aug 2015 09:25:49 +0000 (11:25 +0200)]
core, x86: pci: Migrate MSI-X emulation to generic MMIO dispatcher

Register the MMIO BARs of PCI devices with the generic MMIO dispatcher
and remove direct invocation of pci_mmio_access_handler from
vcpu_handle_mmio_access. This particularly avoid having to scan all
PCI devices of a cell with MSI-X support to find out the target of an
MSI-X access.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: pci: Migrate MMCONFIG access handling to the new MMIO dispatcher
Jan Kiszka [Wed, 5 Aug 2015 09:16:32 +0000 (11:16 +0200)]
core: pci: Migrate MMCONFIG access handling to the new MMIO dispatcher

Register the MMCONFIG memory region, if available, with the generic MMIO
dispatcher and drop the related handler invocation from
pci_mmio_access_handler.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: pci: Drop list of virtual devices
Jan Kiszka [Wed, 5 Aug 2015 09:24:02 +0000 (11:24 +0200)]
core: pci: Drop list of virtual devices

No longer used.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: ivshmem: Migrate to generic MMIO dispatcher
Jan Kiszka [Wed, 5 Aug 2015 09:08:40 +0000 (11:08 +0200)]
core: ivshmem: Migrate to generic MMIO dispatcher

This only migrates the ivshmem parts of the PCI subsystem to the new
MMIO dispatcher, namely its MMIO BAR 0 and the MSI-X BAR 4.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: ivshmem: Move functions unmodified
Jan Kiszka [Mon, 6 Jul 2015 07:20:03 +0000 (09:20 +0200)]
core: ivshmem: Move functions unmodified

We will need ivshmem_write_doorbell, ivshmem_register_mmio and
ivshmem_msix_mmio earlier in the code. Move them up unmodified to
prepare this. No functional change.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Migrate VT-d interrupt remapping emulation to generic MMIO dispatcher
Jan Kiszka [Wed, 5 Aug 2015 08:53:04 +0000 (10:53 +0200)]
x86: Migrate VT-d interrupt remapping emulation to generic MMIO dispatcher

Register the VT-d unit MMIO pages with the dispatcher and drop the
direct handler invocation from vcpu_handle_mmio_access.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Migrate IOAPIC to generic MMIO dispatcher
Jan Kiszka [Wed, 5 Aug 2015 08:46:47 +0000 (10:46 +0200)]
x86: Migrate IOAPIC to generic MMIO dispatcher

Register the IOAPIC MMIO pages with the dispatcher and drop the direct
handler invocation from vcpu_handle_mmio_access.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: ioapic: Move ioapic_access_handler unmodified
Jan Kiszka [Mon, 6 Jul 2015 07:18:14 +0000 (09:18 +0200)]
x86: ioapic: Move ioapic_access_handler unmodified

We will make this function static and then need it earlier in the code.
Move it up unmodified to prepare this. No functional change.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Prepare generic MMIO dispatching
Jan Kiszka [Wed, 5 Aug 2015 08:34:19 +0000 (10:34 +0200)]
x86: Prepare generic MMIO dispatching

Hook up the generic MMIO dispatcher into vcpu_handle_mmio_access without
removing existing handlers. This allows for a step-wise migration of
subsystems to the new dispatcher. Note that the return values of current
handlers are compatible with the mmio_result enum.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Add generic MMIO access dispatching
Jan Kiszka [Wed, 5 Aug 2015 07:19:08 +0000 (09:19 +0200)]
core: Add generic MMIO access dispatching

This introduces the infrastructure for generically dispatching MMIO
accesses. Handlers can now be registered for MMIO regions on a pre-cell
basis, removing the need for probing multiple handlers that decide
themselves if they are in charge.

The backing data structures consist of two sorted tables: one is
describing the region locations and sizes, the other one is holding, in
identical order, the handler and a corresponding opaque parameter.

Dispatching works lock-free and can even run in parallel with region
registration or removal. That latter two steps are protected against
concurrent invocation via a per-cell spinlock.

In order to preallocate sufficient space during cell setup, arch
architecture has to implement arch_mmio_count_regions that calculates
the maximum number of MMIO regions a cell may register during its
lifetime, typically based on static values and the cell configuration.
So far these functions are implemented as dummies because the MMIO
infrastructure is not yet used.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Remove cpu_data parameters from trap handling paths
Jan Kiszka [Wed, 5 Aug 2015 06:50:01 +0000 (08:50 +0200)]
arm: Remove cpu_data parameters from trap handling paths

Traps handling is always CPU-local, and the cpu_data parameters were
also widely unused already.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Remove cpu_data parameters from MMIO handling paths
Jan Kiszka [Wed, 5 Aug 2015 06:39:04 +0000 (08:39 +0200)]
arm: Remove cpu_data parameters from MMIO handling paths

MMIO handling is always CPU-local, thus there is no point in passing the
per_cpu context around.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm, mmio: Introduce generic mmio_access structure
Jan Kiszka [Wed, 5 Aug 2015 06:04:19 +0000 (08:04 +0200)]
arm, mmio: Introduce generic mmio_access structure

Move ARM's mmio_access structure into the generic MMIO header and polish
it for broader use. It will become the keystone of generic MMIO access
dispatching.

No functional changes, but a lot of variable and field renamings in
order to align ARM in advance with the naming scheme's we will use
throughout the whole core soon.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Rework arch_mmio_access to arm_mmio_perform_access
Jan Kiszka [Wed, 5 Aug 2015 05:42:54 +0000 (07:42 +0200)]
arm: Rework arch_mmio_access to arm_mmio_perform_access

First, this is an ARM-specific function, so "arch" is an improper
prefix. And then we always ignored the return value anyway. Drop it and
instead report unsupported sizes via a printk (a candidate for BUG() if
we ever decide to add that).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: vtd: Use pci_get_assigned_device to look up interrupt invalidation targets
Jan Kiszka [Wed, 29 Jul 2015 07:48:09 +0000 (09:48 +0200)]
x86: vtd: Use pci_get_assigned_device to look up interrupt invalidation targets

Stop using the virtual device list which will be removed eventually and
switch to the pci_get_assigned_device service. It is a bit slower than
the current approach, but we don't consider the emulation of interrupt
invalidation requests as fast path. On the positive side, this change
will allow to simplify the PCI layer a bit.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Split struct cell into generic and arch-dependent parts
Jan Kiszka [Wed, 8 Jul 2015 04:45:39 +0000 (06:45 +0200)]
core: Split struct cell into generic and arch-dependent parts

ARM already did this, now also introduce this split at top level: move
all arch-specific cell states into the substructure arch_cell. This
refactoring simplifies the management of common cell states across all
architectures.

The common struct cell is now defined in jailhouse/cell.h. From now on,
asm/cell.h shall only be included directly by jailhouse/cell.h.

Generic PCI-related fields are moved into the common structure even
though ARM will not use them. That happens for two reasons:
 - 2 of the 3 fields will be removed soon and the remaining one will be
   negligible
 - ARM is expected to gain PCI support as well one day

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Rework cleanup on cell destruction
Jan Kiszka [Sun, 28 Jun 2015 16:45:09 +0000 (18:45 +0200)]
core: Rework cleanup on cell destruction

Rename destroy_cpu_set to cell_exit and move it into
cell_destroy_internal. The background is that this function will be used
for more cleanups, and the refactoring will avoid cleanup code
duplications.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Do not call vcpu_cell_exit after failing vcpu_vendor_cell_init
Jan Kiszka [Sun, 9 Aug 2015 19:41:36 +0000 (21:41 +0200)]
x86: Do not call vcpu_cell_exit after failing vcpu_vendor_cell_init

Regression of 328e10028d: vcpu_cell_init does not allocate any
resources prior to calling vcpu_vendor_cell_init. So there is no point
of calling vcpu_cell_exit if the vendor init functions failed, because
the latter is already rolling back. Even worse, the I/O bitmap will not
have been allocated, and vcpu_cell_exit will run into a NULL pointer
dereference.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agotools: add hint how to change kernel cmd line
Dmitry Voytik [Tue, 4 Aug 2015 08:43:03 +0000 (10:43 +0200)]
tools: add hint how to change kernel cmd line

Add hint how to modify kernel command line when memmap reservation
is less than needed.

Signed-off-by: Dmitry Voytik <dmitry.voytik@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agopci: ivshmem: Use consistent parameter names
Jan Kiszka [Wed, 15 Jul 2015 21:16:20 +0000 (23:16 +0200)]
pci: ivshmem: Use consistent parameter names

We spell out "device" everywhere.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoDocumentation: x86: Move PERCPU_SIZE_SHIFT out of documentation scope
Jan Kiszka [Wed, 15 Jul 2015 20:43:48 +0000 (22:43 +0200)]
Documentation: x86: Move PERCPU_SIZE_SHIFT out of documentation scope

This macro is not part of the per-cpu subsystem interface. Silence the
doxygen warning about lacking documentation. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoDocumentation: Improve hypercall subsystem description
Jan Kiszka [Wed, 29 Jul 2015 06:37:13 +0000 (08:37 +0200)]
Documentation: Improve hypercall subsystem description

Describe so far undocumented functions and also the communication region
structure.

For the latter, we have to expand the generic COMM_REGION_GENERIC_HEADER
macro during a doxygen run. This is achieved by including the generic
header from within the arch-specific one, but only for doxygen
processing. This special treatment is required because doxygen processes
each file directly, even if it should have been processed indirectly
already (here asm/jailhouse_hypercall.h via jailhouse/hypercall.h).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoDocumentation: Remove obsolete doxygen tags
Jan Kiszka [Wed, 15 Jul 2015 20:36:34 +0000 (22:36 +0200)]
Documentation: Remove obsolete doxygen tags

Reported by doxygen 1.8.9.1, e.g.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agogitignore: Group files according to build vs. tool outputs
Jan Kiszka [Tue, 28 Jul 2015 07:20:21 +0000 (09:20 +0200)]
gitignore: Group files according to build vs. tool outputs

Just the make sure we don't lose overview about the motivation for the
rules.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agogitignore: ignore cscope files
Dmitry Voytik [Mon, 27 Jul 2015 14:54:56 +0000 (16:54 +0200)]
gitignore: ignore cscope files

Signed-off-by: Dmitry Voytik <dmitry.voytik@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agopci: Verify for non-null pci_dev in pci_claim_release
Veaceslav Falico [Wed, 15 Jul 2015 13:56:12 +0000 (15:56 +0200)]
pci: Verify for non-null pci_dev in pci_claim_release

We might not get a valid pci device from pci_get_slot(), and thus panic:

[   95.167003] RIP: 0010:[<ffffffffa000178f>]  [<ffffffffa000178f>] jailhouse_pci_do_all_devices+0xaf/0x1a0 [jailhouse]
...
[   95.167003]  [<ffffffffa0000363>] jailhouse_cell_delete_all+0x33/0xd0 [jailhouse]
[   95.167003]  [<ffffffffa0000be5>] jailhouse_cmd_disable+0xe5/0x120 [jailhouse]
[   95.167003]  [<ffffffffa00011d5>] jailhouse_ioctl+0x65/0x90 [jailhouse]
...

Fix by verifying for non-null device.

Signed-off-by: Veaceslav Falico <veaceslav.falico@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agotools: Allow python to reside at different paths
Jan Kiszka [Wed, 15 Jul 2015 05:59:16 +0000 (07:59 +0200)]
tools: Allow python to reside at different paths

This is the more flexible shebang as it allows the interpreter binary to
be located at different paths than just /usr/bin.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Improve reporting of unhandled HYP exits
Jan Kiszka [Tue, 14 Jul 2015 05:32:52 +0000 (07:32 +0200)]
arm: Improve reporting of unhandled HYP exits

Add a simple register dump and unify the reporting format. Specifically
useful to debug hypervisor crashes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore, inmates: Move \r injection into console_write / arch_dbg_write
Jan Kiszka [Tue, 14 Jul 2015 05:16:50 +0000 (07:16 +0200)]
core, inmates: Move \r injection into console_write / arch_dbg_write

This moves the injection of \r on \n into the console_write and
arch_dbg_write implementations, causing some minor duplication but also
fixing injection for %s strings. Furthermore, this allows to skip the
injection for consoles the may not need it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Use more panic_printk for fatal error messages
Jan Kiszka [Tue, 14 Jul 2015 05:29:35 +0000 (07:29 +0200)]
arm: Use more panic_printk for fatal error messages

Fatal errors that will leave CPUs unusable and may occur in parallel on
multiple CPUs should be reported via panic_printk to maintain
readability of the output. Adjust some locations for unexpected HYP
exits and failing PSCI_CPU_OFF.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Unmap virtual GIC on cell destruction
Jan Kiszka [Mon, 13 Jul 2015 07:06:54 +0000 (09:06 +0200)]
arm: Unmap virtual GIC on cell destruction

This fixes a leak on cell destruction because we left the GICv2 mapped,
thus didn't free all paging structures. This also means we need to run
the irqchip cleanup before the cell MMU destruction.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Use paging_create instead of arch_map_memory_region for GICv2 mapping
Jan Kiszka [Mon, 13 Jul 2015 07:05:01 +0000 (09:05 +0200)]
arm: Use paging_create instead of arch_map_memory_region for GICv2 mapping

It's actually simpler to invoke paging_create directly instead of
preparing arguments for arch_map_memory_region first.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Account for errors during irqchip cell_init
Jan Kiszka [Mon, 13 Jul 2015 07:01:51 +0000 (09:01 +0200)]
arm: Account for errors during irqchip cell_init

The cell_init callback of GICv2 should report the result of the mapping
request, thus needs a channel to return an error code. Extend the call
chain accordingly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Fix arm_page_table_empty
Jan Kiszka [Mon, 13 Jul 2015 06:40:52 +0000 (08:40 +0200)]
arm: Fix arm_page_table_empty

The size of a pt_entry_t is a reference to an entry, not the entry type
itself. So we were calculating with an entry size of 4 instead of 8,
overrunning the table during empty checks. This specifically caused
page leakages during cell destruction.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: smp: Remove unused type field from smp_ops
Jan Kiszka [Sun, 12 Jul 2015 09:07:07 +0000 (11:07 +0200)]
arm: smp: Remove unused type field from smp_ops

Was never read and actually initialized incorrectly for sun7i and
tegra124.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: smp: Concentrate non-PSCI logic in Versatile Express module
Jan Kiszka [Sun, 12 Jul 2015 08:25:21 +0000 (10:25 +0200)]
arm: smp: Concentrate non-PSCI logic in Versatile Express module

We only keep the non-PSCI CPU hotplug support around for the sake of
old Versatile Express boards/models. No new boards will be accepted that
do not support the PSCI standard. Therefore, concentrate all functions
that were once considered reusable in the smp-vexpress module, folding
them into their only callers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Fix comment of switch_exception_level
Jan Kiszka [Sun, 12 Jul 2015 08:24:00 +0000 (10:24 +0200)]
arm: Fix comment of switch_exception_level

The referenced function is actually called setup_mmu_el2.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Move cpu_switch_el2 into calling module
Jan Kiszka [Sun, 12 Jul 2015 08:20:23 +0000 (10:20 +0200)]
arm: Move cpu_switch_el2 into calling module

Uninlined functions should not be defined in headers. No functional
changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Fix coding style of asm blocks
Jan Kiszka [Sun, 12 Jul 2015 08:22:46 +0000 (10:22 +0200)]
arm: Fix coding style of asm blocks

This aligns them with our (kernel) coding style: indent multi-line asm
blocks, end each line with \n\t in multi-line blocks, remove the ending
in single-line statements. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Fix header_check errors
Jan Kiszka [Wed, 8 Jul 2015 09:02:33 +0000 (11:02 +0200)]
arm: Fix header_check errors

Add missing includes and struct cell forward declaration.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: vmx: Remove some no longer needed includes
Jan Kiszka [Wed, 8 Jul 2015 04:27:49 +0000 (06:27 +0200)]
x86: vmx: Remove some no longer needed includes

These headers no longer contribute anything vmx.c depends on - or never
did at all.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: pci: Add support for devices with more than 16 MSI-X vectors
Jan Kiszka [Fri, 10 Jul 2015 20:21:43 +0000 (22:21 +0200)]
core: pci: Add support for devices with more than 16 MSI-X vectors

There are PCI devices with way more than 16 MSI-X vectors on the field,
some users reported up to 80. We don't want to increase the statically
allocated MSI-X shadow table that much as it would quickly increase the
memory usage.

Instead, implement an on-demand allocation pattern like we already use
for CPU bitmaps: up to 16 vectors are allocated statically, if more are
needed, allocation switches to a dynamic scheme.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: ivshmem: Remove redundant pci_device::cell initialization
Jan Kiszka [Sun, 5 Jul 2015 14:04:31 +0000 (16:04 +0200)]
core: ivshmem: Remove redundant pci_device::cell initialization

Already done in the PCI layer.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: ivshmem: Remove unneeded curly braces
Jan Kiszka [Sat, 4 Jul 2015 20:09:32 +0000 (22:09 +0200)]
core: ivshmem: Remove unneeded curly braces

Only single-line statements in the conditional blocks.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: ivshmem: Convert static virt_pci_bar information into constants
Jan Kiszka [Sat, 4 Jul 2015 20:04:28 +0000 (22:04 +0200)]
core: ivshmem: Convert static virt_pci_bar information into constants

There is no need to carry the virt_pci_bar array in each endpoint
structure. The flags field is unused, and the sizes can easily be
expressed as constants - they do not change.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: ivshmem: Simplify condition in pci_ivshmem_exit
Jan Kiszka [Sat, 4 Jul 2015 21:37:55 +0000 (23:37 +0200)]
core: ivshmem: Simplify condition in pci_ivshmem_exit

We already have the cell number available thanks to ivshmem_find and can
evaluate it directly. Makes the code clearer.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>