]> rtime.felk.cvut.cz Git - jailhouse.git/log
jailhouse.git
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 agohypervisor: mmio: fix typo
Peng Fan [Tue, 19 Apr 2016 08:40:35 +0000 (16:40 +0800)]
hypervisor: mmio: fix typo

Fix typo.
Change "at the end if the list" to "at the end of the list".

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
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 agoinmates: lib: fix strncmp
peter03192003@gmail.com [Tue, 5 Apr 2016 18:01:13 +0000 (11:01 -0700)]
inmates: lib: fix strncmp

We only tested the first character of the strings so far. Make sure to
advance the pointers correctly.

Signed-off-by: ShengYen Peng <peter03192003@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agomemory-layout: fix typo
Peng Fan [Tue, 5 Apr 2016 08:10:01 +0000 (16:10 +0800)]
memory-layout: fix typo

Fix typo: change "visible it its address" to "visible in its address".

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
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 agoinmates: lib: fix command line parsing of hex ints
Antonios Motakis [Wed, 24 Feb 2016 10:07:53 +0000 (11:07 +0100)]
inmates: lib: fix command line parsing of hex ints

The cmdline_parse_int function is currently broken;
luckily, it is a simple fix.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Support updates of the VTD Fault Event shadow registers
Jan Kiszka [Fri, 18 Mar 2016 07:04:56 +0000 (08:04 +0100)]
x86: Support updates of the VTD Fault Event shadow registers

Linux may adjust the affinity of the event on CPU hotplug or other
changes. Just keep track of the changes so that we can apply them on
shutdown.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reported-and-tested-by: Magnus Thulin <magnus2lin@gmail.com>
8 years agox86: Mask VTD Fault Event interrupt before restoring
Jan Kiszka [Fri, 18 Mar 2016 10:23:30 +0000 (11:23 +0100)]
x86: Mask VTD Fault Event interrupt before restoring

To avoid delivering it to an inconsistent configuration. Theoretically,
we could lose an IR fault event during that window, but that's
negligible.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Simplify VTD Fault Event register saving/restoring
Jan Kiszka [Fri, 18 Mar 2016 10:21:27 +0000 (11:21 +0100)]
x86: Simplify VTD Fault Event register saving/restoring

Just use an array, all relevant regs are adjacent.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Fix pci_cell_init for cells without PCI devices
Jan Kiszka [Sat, 12 Mar 2016 10:28:55 +0000 (11:28 +0100)]
core: Fix pci_cell_init for cells without PCI devices

Now that page_alloc returns NULL if we request 0 pages, we need to
account for this properly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Protect against zero-length page allocations
Jan Kiszka [Sat, 12 Mar 2016 10:22:12 +0000 (11:22 +0100)]
core: Protect against zero-length page allocations

We return a non-NULL pointer so far which will cause troubles when
forwarding that to page_free.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Unify AMD page tables for CPU and IOMMU
Jan Kiszka [Tue, 1 Mar 2016 22:31:31 +0000 (23:31 +0100)]
x86: Unify AMD page tables for CPU and IOMMU

This exploits AMD's architecture feature that you can reuse the nested
page tables also for the IOMMU.

Both tables have the same depth (4), share the same address fields, the
valid bit - but all other bits are separate. Therefore, we need to
enhance the NPT paging handlers so that they fold both bit sets into an
entry.

The rewards are saving of several lines of code as well as a bunch of
hypervisor pages (typically some dozen).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Add amd_iommu pending faults check
Valentine Sinitsyn [Wed, 15 Jul 2015 19:42:36 +0000 (00:42 +0500)]
x86: Add amd_iommu pending faults check

Add iommu_pending_faults() for amd_iommu. This looks into
Hardware Event Register first, and then loops over the event log
printing what's in it. This way, we don't miss errors that happen
when event logging is unavailable.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
[Jan: Cleanups]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Implement amd_iommu event log
Valentine Sinitsyn [Wed, 15 Jul 2015 19:34:47 +0000 (00:34 +0500)]
x86: Implement amd_iommu event log

Add functions to read event logs AMD IOMMU provides and print their
contents. The latter is rather basic, but decoding all possible log
entries is hairy, so we'd better wait and collect stats which
problems occur most often.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
[Jan: Cleanups, refactored amd_iommu_print_event]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Add iommu_commit_config() for amd_iommu
Jan Kiszka [Wed, 15 Jul 2015 19:34:47 +0000 (00:34 +0500)]
x86: Add iommu_commit_config() for amd_iommu

Implement functions to apply configuration for an IOMMU.
In case something goes wrong, we need to trigger an NMI, which
amd_iommu_init_fault_nmi() configures.

Based on patch by Valentine Sinitsyn.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Factor out iommu_select_fault_reporting_cpu
Jan Kiszka [Sat, 5 Mar 2016 19:43:28 +0000 (20:43 +0100)]
x86: Factor out iommu_select_fault_reporting_cpu

The logic to pick a root cell CPU for IOMMU fault reporting will be
reused for AMD. Factor it out.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Add device management functions for amd_iommu
Jan Kiszka [Wed, 15 Jul 2015 19:13:05 +0000 (00:13 +0500)]
x86: Add device management functions for amd_iommu

Implement iommu_add_pci_device() for amd_iommu.

Basically, this is all about filling DTE entry. However, there is no way
to allocate device tables sparsely with ADM IOMMU. To save some memory,
Device Table Segmentation (Revision 2.6 and up) is used whenever possible,
and this adds some infrastructure.

Based on patch by Valentine Sinitsyn.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Implement amd_iommu command posting
Valentine Sinitsyn [Wed, 15 Jul 2015 19:13:05 +0000 (00:13 +0500)]
x86: Implement amd_iommu command posting

Add basic infrastructure (heavily influenced by Linux amd_iommu driver)
to submit commands to AMD IOMMU command buffer. For now, having only
INVALIDATE_IOMMU_PAGES and COMPLETION_WAIT seems to be sufficient.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
[Jan: Cleanups, simplification of draining]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Add amd_iommu's memory mapping functions
Valentine Sinitsyn [Wed, 15 Jul 2015 19:13:05 +0000 (00:13 +0500)]
x86: Add amd_iommu's memory mapping functions

Implement iommu_map_memory_region() and iommu_unmap_memory_region()
for amd_iommu.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
[Jan: Cleanups]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Implement amd_iommu cell management functions
Valentine Sinitsyn [Wed, 15 Jul 2015 19:10:42 +0000 (00:10 +0500)]
x86: Implement amd_iommu cell management functions

Add iommu_cell_init() and iommu_cell_destroy() for amd_iommu.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Add amd_iommu initialization code
Jan Kiszka [Tue, 14 Jul 2015 19:54:30 +0000 (00:54 +0500)]
x86: Add amd_iommu initialization code

Implement iommu_init() and iommu_shutdown() for AMD-based systems.

Based on patch by Valentine Sinitsyn.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Add amd_iommu hardware structs and definitions
Jan Kiszka [Wed, 9 Sep 2015 19:59:48 +0000 (00:59 +0500)]
x86: Add amd_iommu hardware structs and definitions

Introduce all hardware-related structures and definitions needed for
AMD IOMMU support.

Based on patch by Valentine Sinitsyn.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Extend bit range returned by x86_64_get_flags
Jan Kiszka [Tue, 1 Mar 2016 06:15:38 +0000 (07:15 +0100)]
x86: Extend bit range returned by x86_64_get_flags

In order to support also the AMD IOMMU with x86_64_paging, we extend
the set of bits returned by get_flags handler. We now include all bits
ignored by the MMU, which includes the bits relevant for the AMD IOMMU.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore, configs, tools: Add AMD-specific fields to struct jailhouse_iommu
Jan Kiszka [Fri, 13 Mar 2015 17:41:02 +0000 (22:41 +0500)]
core, configs, tools: Add AMD-specific fields to struct jailhouse_iommu

For AMD, we also need to store the PCI address, capability offset and
IOMMU feature bits coming from ACPI (overwriting what the hardware
reports) in the cell configuration file.

Based on patches by Valentine Sinitsyn.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Fold vtd.h into vtd.c
Jan Kiszka [Mon, 29 Feb 2016 08:06:44 +0000 (09:06 +0100)]
x86: Fold vtd.h into vtd.c

There is no interface specified in that header anymore. Move its used
content over to vtd.c and delete the header.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Use more BIT_MASK macro for paging tasks
Jan Kiszka [Sun, 28 Feb 2016 19:48:55 +0000 (20:48 +0100)]
x86: Use more BIT_MASK macro for paging tasks

Instead of manually defining bitmasks, use the more readable BIT_MASK
macro. No constant value is changed.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Rename i386_get_next_pt_l2 to i386_get_next_pt
Jan Kiszka [Sun, 28 Feb 2016 19:47:41 +0000 (20:47 +0100)]
x86: Rename i386_get_next_pt_l2 to i386_get_next_pt

There are no handlers for other levels.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Consolidate identical x86-64 get_next_pt handlers
Jan Kiszka [Sun, 28 Feb 2016 19:40:44 +0000 (20:40 +0100)]
x86: Consolidate identical x86-64 get_next_pt handlers

The handlers for level 4 and that for level 2/3 always contained the
same logic. Consolidate them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Filter out physical address that can't be handled by DMAR units
Jan Kiszka [Wed, 24 Feb 2016 09:19:54 +0000 (10:19 +0100)]
x86: Filter out physical address that can't be handled by DMAR units

Make sure that we do not try to program DMAR page tables with physical
addresses beyond the supported range (39 or 48 bits, depending on the
page table levels).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Account for DMAR units with multi-page register sets
Jan Kiszka [Sat, 20 Feb 2016 18:10:22 +0000 (19:10 +0100)]
x86: Account for DMAR units with multi-page register sets

The fault reporting registers we use may be placed in a 2nd or even 3rd
page. Account for such cases by using the MMIO region size now provided
via the system config.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore, configs, tools: Prepare for variable IOMMU register set sizes
Jan Kiszka [Sat, 20 Feb 2016 18:09:49 +0000 (19:09 +0100)]
core, configs, tools: Prepare for variable IOMMU register set sizes

Introduce a size field to struct jailhouse_iommu and fill it via the
config generator. The information can be retrieved from the ACPI tables
for AMD. On Intel, we need to study the Linux mappings, thus we need to
demand that DMAR is enabled now while retrieving system information.

Based on patches by Valentine Sinitsyn.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore, configs, tools: Introduce struct jailhouse_iommu
Jan Kiszka [Thu, 18 Feb 2016 06:13:02 +0000 (07:13 +0100)]
core, configs, tools: Introduce struct jailhouse_iommu

For both AMD and Intel, we need to store not only base address but also
a size to map the complete MMIO region. Moreover, AMD requires a number
of PCI device parameters for the IOMMU. Introduce struct jailhouse_iommu
that will encapsulate all required data.

Based on patches by Valentine Sinitsyn.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
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 agoTODO: Update according to latest improvements
Jan Kiszka [Tue, 9 Feb 2016 09:43:47 +0000 (10:43 +0100)]
TODO: Update according to latest improvements

ARMv7 is merged, v8 is on the way now. MMIO dispatching and sub-page
handling are both done.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoREADME.md: fix markdown
Henning Schild [Mon, 8 Feb 2016 11:54:39 +0000 (12:54 +0100)]
README.md: fix markdown

We either need to escape the asterisk or mark the whole word as code,
otherwise the asterisk makes the following text italic. (seen in vim)

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: e1000-demo: Enable queues explicitly
Jan Kiszka [Wed, 3 Feb 2016 17:55:23 +0000 (18:55 +0100)]
inmates: e1000-demo: Enable queues explicitly

Newer NICs require us to enable the RX and TX queue. Although they
should be on after reset, at least the I350 refuses to work otherwise.
As the related bit is harmless or even unused on older NICs, do this
unconditionally (just like ipxe does).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: e1000-demo: Do not set ASDE bit
Jan Kiszka [Wed, 3 Feb 2016 11:24:32 +0000 (12:24 +0100)]
inmates: e1000-demo: Do not set ASDE bit

ASDE is apparently not needed on older NICs but caused troubles on newer
ones like 82575. Remove it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: e1000-demo: Fix FRCSPD bit definition for control register
Jan Kiszka [Wed, 3 Feb 2016 10:51:53 +0000 (11:51 +0100)]
inmates: e1000-demo: Fix FRCSPD bit definition for control register

It's bit 11, in fact. Bit 12 is FRCDPLX which is cleared on reset.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: e1000-demo: Write RX tail only after enabling the queue
Jan Kiszka [Tue, 2 Feb 2016 20:52:27 +0000 (21:52 +0100)]
inmates: e1000-demo: Write RX tail only after enabling the queue

The 82575 ignores all writes prior to enabling the queue or the complete
receiver. Reorder writes, clearing the tail first - just in case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: e1000-demo: Hard-wire PHY address
Jan Kiszka [Wed, 3 Feb 2016 16:44:11 +0000 (17:44 +0100)]
inmates: e1000-demo: Hard-wire PHY address

All known e1000-compatible cards have their PHYs at address 1. Searching
for them does not work reliably, so simply hard-wire the address.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: e1000-demo: Ensure ring alignment requirements on newer NICs
Jan Kiszka [Tue, 2 Feb 2016 20:27:46 +0000 (21:27 +0100)]
inmates: e1000-demo: Ensure ring alignment requirements on newer NICs

The Intel 82575 and newer NICs require 128-byte alignment of the RX and
TX rings.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Make debug UART port configurable via system config
Jan Kiszka [Tue, 26 Jan 2016 08:27:40 +0000 (09:27 +0100)]
x86: Make debug UART port configurable via system config

We already allow to enable a VGA console via the system config, so let's
make the UART port configurable this way as well: phys_start will hold
the port, and flags must not have JAILHOUSE_MEM_IO set, in order to
differentiate us from the memory-mapped VGA console. And by leaving
phys_start at 0, we can even turn off the console now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Initialize system_config earlier
Jan Kiszka [Tue, 26 Jan 2016 08:26:11 +0000 (09:26 +0100)]
core: Initialize system_config earlier

On x86, we want to make the debug UART configurable via the system
config. That means we will need this pointer in arch_dbg_write_init
already.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoconfig: Set .debug_console for x86 targets
Jan Kiszka [Tue, 26 Jan 2016 08:24:17 +0000 (09:24 +0100)]
config: Set .debug_console for x86 targets

We will make the debug console UART port configurable via the system
config. Set the corresponding values, they will be ignored so far.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Pull usage check out of vga_write
Jan Kiszka [Sun, 24 Jan 2016 20:28:24 +0000 (21:28 +0100)]
x86: Pull usage check out of vga_write

This makes the code more regular.

Account for the additional contributor at this chance.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Remove redundant typecast
Jan Kiszka [Sun, 24 Jan 2016 20:27:48 +0000 (21:27 +0100)]
x86: Remove redundant typecast

debug_console_base is a void pointer.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Only filter out complete string from KBUILD_AFLAGS
Jan Kiszka [Tue, 26 Jan 2016 07:27:47 +0000 (08:27 +0100)]
arm: Only filter out complete string from KBUILD_AFLAGS

Otherwise we remove those words separately, destroying any
"-include header.h" addition made elsewhere.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore, driver: Pass rounded-up core size in hypervisor header
Jan Kiszka [Mon, 25 Jan 2016 17:20:37 +0000 (18:20 +0100)]
core, driver: Pass rounded-up core size in hypervisor header

Hypervisor and root kernel may have different ideas about PAGE_SIZE.
This will cause wrong hypervisor core size calculations as seen on arm64
with 64K Linux PAGE_SIZE.

Avoid this trap by moving the round-up into the hypervisor code, passing
a ready-to-be-used size value in the header.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoci: Switch to Wily for packages too old in Trusty
Jan Kiszka [Sat, 23 Jan 2016 15:54:38 +0000 (16:54 +0100)]
ci: Switch to Wily for packages too old in Trusty

Vivid is EOL soon, so move on now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoci: Work around Travis Trusty issue #5326
Jan Kiszka [Fri, 22 Jan 2016 08:52:21 +0000 (09:52 +0100)]
ci: Work around Travis Trusty issue #5326

Current Trusty beta leaves non-system installations of python in the
PATH. Therefore, we fail to find the Mako package during build.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoci: Break the build properly if anything goes wrong
Jan Kiszka [Thu, 21 Jan 2016 18:38:24 +0000 (19:38 +0100)]
ci: Break the build properly if anything goes wrong

If the make failed, we didn't bail out properly so far, leaving false
negatives of test builds behind.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoci: Update build environment to kernel 4.4
Jan Kiszka [Thu, 21 Jan 2016 16:12:12 +0000 (17:12 +0100)]
ci: Update build environment to kernel 4.4

The renovation will be needed when adding arm64 to CI.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoci: Drop COVERITY_SCAN_TOKEN from Travis configuration
Jan Kiszka [Thu, 21 Jan 2016 09:50:31 +0000 (10:50 +0100)]
ci: Drop COVERITY_SCAN_TOKEN from Travis configuration

This is better managed via the Travis CI project settings.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agovga: Add support for VGA text buffer output on x86
Daniel Sangorrin [Thu, 21 Jan 2016 01:31:26 +0000 (10:31 +0900)]
vga: Add support for VGA text buffer output on x86

Hypervisor messages are useful for debugging and are
typically handed out to the serial port. Unfortunately, x86
computers often lack of a serial port. This patch allows
hypervisor messages to be redirected to a screen by leveraging
the traditional VGA text buffer mode.

Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
[Jan: avoid row_line writeback in panic case, remove redundant braces]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoconsole: rename uart to console
Daniel Sangorrin [Thu, 21 Jan 2016 01:31:25 +0000 (10:31 +0900)]
console: rename uart to console

Jailhouse may support different console devices other than
the UART. For that reason, we adopt a more generic name.

Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoconfigs: Update Banana Pi configs to make use of unaligned MMIO regions
Jan Kiszka [Sat, 9 Jan 2016 06:15:59 +0000 (07:15 +0100)]
configs: Update Banana Pi configs to make use of unaligned MMIO regions

Split up the MMIO page 0x1c20000 on the Alwinner A20 into CCU,
interrupts controller, GPIOs and the timer. GPIOs are further broken up
to allow assigning port H to the gic-demo cell, along with the CCU (to
control the UART timing).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Add support for sub-page MMIO regions
Jan Kiszka [Fri, 8 Jan 2016 18:18:34 +0000 (19:18 +0100)]
core: Add support for sub-page MMIO regions

This allows to specify memory regions for MMIO accesses that do not
start or end on page boundaries. Instead of mapping full pages into the
cell, sub-page MMIO requires to intercept the page accesses, validate
all parameters against the target memory region and then perform the
access in hypervisor context, provided the validation was successful.

As the access can now fail in hypervisor context, we need to be more
picky: besides read/write permissions, alignment and access widths can
be checked additionally. These attributes are specified via the
JAILHOUSE_MEM_IO_* flags.

Sub-page MMIO is surely not a fast path. It not only requires world
switches between cell and hypervisor, the current implementation also
uses dynamic mappings. This is easier to implement than a static mapping
scheme, but surely not faster. We may revisit this design later on,
ideally towards a 1:1 mapping scheme.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Remove memory regions check
Jan Kiszka [Thu, 7 Jan 2016 17:21:55 +0000 (18:21 +0100)]
core: Remove memory regions check

Most of the checks will be removed when adding sub-page memory region
support. We rather need some offline validation outside the hypervisor
eventually.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Introduce and use mmio_perform_access
Jan Kiszka [Thu, 7 Jan 2016 17:17:18 +0000 (18:17 +0100)]
core: Introduce and use mmio_perform_access

Generalize arm_mmio_perform_access to mmio_perform_access which can also
be used on other architectures, including those with 64-bit MMIO
support.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoarm: Remove useless warning from arm_mmio_perform_access
Jan Kiszka [Thu, 7 Jan 2016 17:10:20 +0000 (18:10 +0100)]
arm: Remove useless warning from arm_mmio_perform_access

This functions is only called with size 1, 2 or 4. This is ensured by
arch_handle_dabt, the only (indirect) caller, which generates the size
accordingly (1 << sas) and filters out sizes > 4.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore: Introduce and use for_each_mem_region
Jan Kiszka [Tue, 5 Jan 2016 14:40:15 +0000 (15:40 +0100)]
core: Introduce and use for_each_mem_region

This iterator simplifies walking over memory regions in cell and system
configs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Add support for 32-bit displacement in mod 0
Jan Kiszka [Thu, 7 Jan 2016 08:37:17 +0000 (09:37 +0100)]
x86: Add support for 32-bit displacement in mod 0

Easy enough to add: a 32-bit address displacement follows the ModR/M
byte, and nothing else.

Turned out to be useful while testing with a sub-page HPET memory
region.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoTODO: Update CAT-related item
Jan Kiszka [Fri, 14 Aug 2015 06:34:27 +0000 (08:34 +0200)]
TODO: Update CAT-related item

CAT support is now available, but we should add CDP later on (no
hardware available so far to test it).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoconfigs: Add cache region to x86 demo cells
Jan Kiszka [Tue, 11 Aug 2015 07:20:41 +0000 (09:20 +0200)]
configs: Add cache region to x86 demo cells

Assuming we have more than 4 units of L3 cache on systems that support
L3 partitioning, assign the first 2 units (e.g. 2 MB on a Xeon D 1540)
to apic-demo, the 3rd to tiny-demo. Also the non-root Linux config gets
the first 2 units (it cannot run in parallel to the other demos). All
this is for testing the management logic and will later be used to
benchmark the partitioning.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Introduce Cache Allocation Technology support for Intel CPUs
Jan Kiszka [Tue, 11 Aug 2015 07:05:24 +0000 (09:05 +0200)]
x86: Introduce Cache Allocation Technology support for Intel CPUs

CAT is a CPU feature first added to Xeon D and certain Xeon E5 v3
processors. It so far allows to specify access restrictions to the L3
cache, including complete isolation between different entities.

This adds CAT control to Jailhouse on a per-cell level. The user is free
to specify a contiguous access mask for each cell, use that mask
exclusively (typical case), share any overlaps with the root cell
(JAILHOUSE_CACHE_ROOTSHARED), or simply use the root cell mask. If
nothing else is specified, the root cell uses the full cache (until
non-root cells shrink it).

Due to the hardware-induced requirement to have a contiguous bitmask,
shrinking the root mask on cell creation and extending it again on
destruction is not trivial. Not at all.

When creating a new cell, we may punch a hole into the root mask. In
that case, we also remove the lower half from the roor mask and
accumulate those bits in a "freed mask" for reuse once the hole closes
again. And if we are unlucky, adding a cell empties the current root
mask. Then we have to look into the freed mask and switch to it if it's
non-empty.

When restoring the root mask on cell destruction, we choose a simple
algorithm that first collects all released bits in the freed mask, then
try to merge that mask bit-wise with the current root cell mask. On
success we restart the freed mask walk to ensure that all contiguous
bits are merged.

One may wonder why not reallocating masks completely dynamically and
automatically on each reconfiguration, instead of requiring that
explicit allocation via the config? The reason is that we do not want to
invalidate cache allocations of those cells that are not involved in a
reconfiguration.

A lot of complication with this mechanism which looked so simple on
first sight. Let's just hope that there is a noteworthy benefit in
restricting CAT bitmasks in hardware this way.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agocore, tools: Introduce cache regions to the cell configuration
Jan Kiszka [Tue, 11 Aug 2015 06:58:38 +0000 (08:58 +0200)]
core, tools: Introduce cache regions to the cell configuration

Allow to specify regions of caches so that the hypervisor can partition
their usage accordingly whenever the hardware supports this.

The specification of their start location and sizes depend on the
architecture specific partitioning support. So far, only L3 cache types
are definable, either as unified cached or further partitioned into code
and data (to cater Intel's CAT and CDP). As with memory regions, caches
are usually taken from the root cell on non-root cell creation, but they
can also be declared as shared with the root cell.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: vmx: Block write access to CAT MSRs
Jan Kiszka [Tue, 11 Aug 2015 04:40:53 +0000 (06:40 +0200)]
x86: vmx: Block write access to CAT MSRs

Make sure the cells cannot mess around with them, modifying the
configuration the hypervisor chose.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agox86: Add sub-leaf selection parameter to cpuid_*
Jan Kiszka [Tue, 11 Aug 2015 04:32:15 +0000 (06:32 +0200)]
x86: Add sub-leaf selection parameter to cpuid_*

This allows to call cpuid also on specific sub-leaves. Will be used
first for CAT.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: arm: Make LED blinking in gic-demo optional
Jan Kiszka [Sun, 10 Jan 2016 08:42:43 +0000 (09:42 +0100)]
inmates: arm: Make LED blinking in gic-demo optional

This is both a test/demo case for command line parsing on ARM and a
feature to control the LED signal in the gic-demo on Banana Pi. The
green LED will now only blink if "blinking_led" is specified as inmate
command line option.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: x86: Add optional cache pollution to apic-demo
Jan Kiszka [Mon, 4 Jan 2016 10:31:49 +0000 (11:31 +0100)]
inmates: x86: Add optional cache pollution to apic-demo

When "pollute_cache" is specified as command line parameter of the
apic-demo, the demo will fill each cache line with a pattern in each
measurement loop. Up to 512 KB of cache can be polluted this way.

This allows to test L3 cache partitioning features of recent Intel CPUs:
The cache pollution will dirty the L1 and L2 data caches so that the
next loop iteration will access L3. If that cache is shared, latencies
will rise as other cells use the cache as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: x86: Allow to bypass TSC and APIC timer calibration
Jan Kiszka [Mon, 4 Jan 2016 10:28:08 +0000 (11:28 +0100)]
inmates: x86: Allow to bypass TSC and APIC timer calibration

Make use of the command line feature and introduce the "tsc_freq" and
"apic_freq" parameters. When provided, these values are used directly
instead of running calibrations against the PM timer.

This is particularly useful when running micro-benchmarks that are
sensitive to the inherent small variations of the calibrations.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agotools: jailhouse: Add support for string loading
Jan Kiszka [Mon, 4 Jan 2016 10:25:09 +0000 (11:25 +0100)]
tools: jailhouse: Add support for string loading

Extend the "cell load" command by a variant where a string provided
along with the command is loaded into the cell memory. This can be used
together with the new command line feature to pass parameters to inmates
that support this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agotools: Rewrap jailhouse help output
Jan Kiszka [Fri, 1 Jan 2016 12:53:06 +0000 (13:53 +0100)]
tools: Rewrap jailhouse help output

Avoid that we exceed 80 characters.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: Add support for command line parameters
Jan Kiszka [Mon, 4 Jan 2016 10:17:11 +0000 (11:17 +0100)]
inmates: Add support for command line parameters

This provides support for parsing string, integer (long long type) and
boolean command line parameters. The former two need to be in the form
of "name=value" so that cmdline_parse_str/int will return the extracted
value. Boolean parameters are just of the form "name", and
cmdline_parse_bool will return true if this pattern is found. Parameters
need to be separated by blanks.

The parameters can be passed to the inmate by loading the string at an
architecture-specific location. That is 0xf0000 on x86 and 0x100 on ARM
so far. Note that the inmate has to reserve an appropriately sized
buffer via the CMDLINE_BUFFER macro.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: Add strlen and strncmp to library
Jan Kiszka [Mon, 4 Jan 2016 10:14:45 +0000 (11:14 +0100)]
inmates: Add strlen and strncmp to library

Add simplistic but generic implementations of strlen and strncmp to the
inmate library. Both will be used for the command line parser.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: Avoid jailhouse/types.h
Jan Kiszka [Sat, 2 Jan 2016 18:39:02 +0000 (19:39 +0100)]
inmates: Avoid jailhouse/types.h

Add missing bool to inmate_common.h and use inmate.h instead of pulling
the hypervisor types header.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: arm: Reduce dependencies on hypervisor gic headers
Jan Kiszka [Mon, 4 Jan 2016 09:50:55 +0000 (10:50 +0100)]
inmates: arm: Reduce dependencies on hypervisor gic headers

We still reuse asm/sysregs.h, but that header comes without further
dependencies, specifically the conflicting jailhouse/types.h.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: Factor out common library header
Jan Kiszka [Sun, 3 Jan 2016 10:25:10 +0000 (11:25 +0100)]
inmates: Factor out common library header

Collect arch-independent parts of inmate.h in a common header, included
by the architecture-specific ones.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: x86: Remove redundant hypercall include
Jan Kiszka [Sat, 2 Jan 2016 20:38:13 +0000 (21:38 +0100)]
inmates: x86: Remove redundant hypercall include

inmate.h takes care of this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: Provide memset implementation for non-built-in cases
Jan Kiszka [Sat, 2 Jan 2016 18:32:37 +0000 (19:32 +0100)]
inmates: Provide memset implementation for non-built-in cases

This avoids the inline variant of ARM. The new link optimization will
remove what is unused.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: Drop unused library functions during linking
Jan Kiszka [Sat, 2 Jan 2016 18:11:02 +0000 (19:11 +0100)]
inmates: Drop unused library functions during linking

Tiny size optimization: push library functions into separate sections
and drop unused ones during linking.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agoinmates: arm: Provide mmio_read/write32 via library header
Jan Kiszka [Sat, 2 Jan 2016 16:38:40 +0000 (17:38 +0100)]
inmates: arm: Provide mmio_read/write32 via library header

Avoids the ugly and indirect inclusion of the hypervisor definitions in
gic-demo. We still pull it from there in gic-v2/3, though - to be fixed
later.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8 years agohypervisor, inmates: Remove write-only fields from uart_chip
Jan Kiszka [Sat, 2 Jan 2016 16:16:34 +0000 (17:16 +0100)]
hypervisor, inmates: Remove write-only fields from uart_chip

baudrate and fifo_enabled are never read back.

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