]> xenbits.xensource.com Git - mini-os.git/log
mini-os.git
4 years agomini-os: netfront: fix suspend/resume handling
Juergen Gross [Tue, 22 Sep 2020 10:58:26 +0000 (12:58 +0200)]
mini-os: netfront: fix suspend/resume handling

Suspend/resume handling of netfront is completely broken from the
beginning. Commit d225f4012d69a1 ("Save/Restore Support: Add
suspend/restore support for netfront") introduced a new structure
netfront_dev_list referencing the real struct netfront_dev elements.
This list is used to setup the devices when resuming again.

Unfortunately the netfront_dev elements are released during suspend,
so at resume time those references will be stale.

Fix this whole mess by dropping struct netfront_dev_list again and
link the netfront_dev elements directly into a list. When suspending
don't free those elements.

The ip-address, netmask and gateway strings can just be released when
suspending and reread from xenstore at resume time.

Fixes: d225f4012d69a1 ("Save/Restore Support: Add suspend/restore support for netfront")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: netfront: retrieve netmask and gateway via extra function
Juergen Gross [Tue, 22 Sep 2020 10:58:25 +0000 (12:58 +0200)]
mini-os: netfront: retrieve netmask and gateway via extra function

Commit 1b8ed31f4ce40 ("mini-os: netfront: Read netmask and gateway from
Xenstore") modified init_netfront() to take two additional parameters.
This broke the Xen build as init_netfront() is used in grub stubdom,
too.

So instead of tightly coupling Mini-OS and Xen build via this interface
modification undo this change of init_netfront() and add two other
functions for retrieving the netmask and gateway for a network device.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: Fix outdated init_netfront() calls
Costin Lupu [Thu, 27 Aug 2020 16:45:36 +0000 (19:45 +0300)]
mini-os: Fix outdated init_netfront() calls

Commit 1b8ed31f changed the init_netfront() declaration. This patch fixes a
couple of calls that were overlooked for that initial commit.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: Add suspend stubs for ARM
Costin Lupu [Wed, 19 Aug 2020 16:41:08 +0000 (19:41 +0300)]
mini-os: Add suspend stubs for ARM

This patch introduces the missing suspend-related stubs for ARM. It also
introduces the new arch_suspend() function in order to keep the logic in
kernel_suspend() arch independent.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: Use a single start_info_ptr variable
Costin Lupu [Wed, 19 Aug 2020 15:45:36 +0000 (18:45 +0300)]
mini-os: Use a single start_info_ptr variable

The second definition of the `start_info_ptr` variable was introduced by commit
e05eb0 which was part of a series trying to add suspend/resume support to
mini-os. This patch removes the second definition by reverting some changes of
the mentioned commit and of commit 892b66.

However the logic in shutdown.c is still left in an inconsistent state because
it still doesn't work for ARM. The solution should be part of a future patch.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: netfront: Read netmask and gateway from Xenstore
Costin Lupu [Wed, 19 Aug 2020 12:49:00 +0000 (15:49 +0300)]
mini-os: netfront: Read netmask and gateway from Xenstore

When providing the IP address via the config file, one can also add the
netmask and gateway address, e.g. "ip=192.168.0.2 255.255.255.0
192.168.0.1", which will be further published to Xenstore. This patch adds
support for reading the netmask and gateway values.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: console.c: Rename static variable from buf to __print_buf
Costin Lupu [Tue, 18 Aug 2020 13:44:06 +0000 (16:44 +0300)]
mini-os: console.c: Rename static variable from buf to __print_buf

lwip soure code also has a static variable called 'buf' in ip_frag.c. This can
get confusing when inspecting the binary (e.g. with objdump or something
similar). Therefore this patch renames the 'buf' variable used by print()
function to '__print_buf'.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: correct memory access rights for pvh mode RELEASE-4.15.3 xen-RELEASE-4.15.0 xen-RELEASE-4.15.1 xen-RELEASE-4.15.2 xen-RELEASE-4.15.3 xen-RELEASE-4.15.4
Juergen Gross [Sat, 15 Aug 2020 11:15:57 +0000 (13:15 +0200)]
mini-os: correct memory access rights for pvh mode

When running as a PVH guest the memory access rights are not set
correctly: _PAGE_USER should not be set and CR0.WP should be set.
Especially CR0.WP is important in order to let the allocate on
demand feature work, as it requires a page fault when writing to a
read-only page.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: fix do_map_frames() for pvh
Juergen Gross [Sat, 15 Aug 2020 11:12:57 +0000 (13:12 +0200)]
mini-os: fix do_map_frames() for pvh

In case ov PVH dom_map_frames() is missing to increment the virtual
address. This leads to writing only the first page table entry multiple
times.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: don't hard-wire xen internal paths
Juergen Gross [Mon, 13 Jul 2020 08:42:30 +0000 (10:42 +0200)]
mini-os: don't hard-wire xen internal paths

Mini-OS shouldn't use Xen internal paths for building. Import the
needed paths from Xen and fall back to the current values only if
the import was not possible.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agoconsole: add newline at EOF xen-RELEASE-4.14.0 xen-RELEASE-4.14.1 xen-RELEASE-4.14.2 xen-RELEASE-4.14.3 xen-RELEASE-4.14.4 xen-RELEASE-4.14.5
Jan Beulich [Mon, 18 May 2020 07:09:14 +0000 (09:09 +0200)]
console: add newline at EOF

Some gcc versions get pretty unhappy without.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agomini-os: Avoid segfaults in tc{g,s}etattr
Jason Andryuk [Mon, 27 Apr 2020 03:40:19 +0000 (23:40 -0400)]
mini-os: Avoid segfaults in tc{g,s}etattr

Commit c96c22f1d94 "mini-os: minimal implementations of some termios
functions" introduced implementations of tcgetattr and tcsetattr.
However, they do not check if files[fildes].cons.dev is non-NULL before
dereferencing.  This is not a problem for FDs allocated through
alloc_fd, but the files array pre-allocates FDs 0-2 for stdio.  Those
entries have a NULL .dev, so tc{g,s}etattr on them segfault.

ioemu-stubdom segfaults when term_init() calls tcgetattr on FD 0.

Restore tcgetattr and tcsetattr behavior when .dev is NULL equivalent to
unsupported_function as it was before c96c22f1d94.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agomini-os: allow 4096 event channels for 64-bit mini-os
Juergen Gross [Thu, 16 Apr 2020 12:27:00 +0000 (14:27 +0200)]
mini-os: allow 4096 event channels for 64-bit mini-os

Limiting the number of event channels to 1024 is fine for 32-bit
builds, but not for 64-bit ones. This might be a problem when using
Xenstore-stubdom as the number of domains which can be supported is
then limited to a little bit more than 1000.

So raise the number of event channels to 4096 in 64-bit builds.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agomini-os: provide binary without debug information
Juergen Gross [Thu, 16 Apr 2020 12:27:48 +0000 (14:27 +0200)]
mini-os: provide binary without debug information

Provide a mini-os binary stripped from debug information in order to
have a smaller resulting kernel file. The binary with debug
information is kept with the suffix "-debug".

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agomini-os: use -m elf_i386 for final linking
Juergen Gross [Thu, 16 Apr 2020 13:17:15 +0000 (15:17 +0200)]
mini-os: use -m elf_i386 for final linking

Using the standard -m elf_x86_64 for 64-bit mini-os results in the
first section (.text) to start only at offset 2MB in the binary file.

Quoting Andrew Cooper on that topic:

  Specifically, 64bit emulation appears to include "align primary
  sections to 2M so your OS can make better use of superpages even when
  mmap()ing", with no way I can spot to override this in the linker
  file.

Using -m elf_i386 avoids that problem without any visible disadvantage.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agomini-os: fix several memory leaks related to xenbus
Juergen Gross [Thu, 9 Apr 2020 14:12:40 +0000 (16:12 +0200)]
mini-os: fix several memory leaks related to xenbus

There are several instances of calls to xenbus functions which don't
test for an error and in consequence are not freeing the returned
error strings, or which are just not freeing the string after e.g.
printing it.

Fix that by either adding the needed calls of free().

Coverity-ID: 1433632
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wl@xen.org>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agomini-os: fix double free() in xenbus
Juergen Gross [Thu, 9 Apr 2020 14:12:39 +0000 (16:12 +0200)]
mini-os: fix double free() in xenbus

Commit 973ad0c4de1b48 ("Save/Restore Support: Add suspend/restore
support for xenbus") introduced a double free of some memory and leaked
another memory allocation.

Fix those.

Coverity-ID: 1433640
Fixes: 973ad0c4de1b48 ("Save/Restore Support: Add suspend/restore support for xenbus")
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wl@xen.org>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agomini-os: fix double free() in netfront
Juergen Gross [Thu, 9 Apr 2020 14:12:38 +0000 (16:12 +0200)]
mini-os: fix double free() in netfront

Commit d225f4012d69a19 ("Save/Restore Support: Add suspend/restore
support for netfront") introduced a regression in form of freeing a
netfront device structure twice.

Fix that.

Coverity-ID: 1433637
Fixes: d225f4012d69a19 ("Save/Restore Support: Add suspend/restore support for netfront")
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wl@xen.org>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add fini_shutdown call to app exit flow.
Bruno Alvisio [Tue, 27 Mar 2018 15:54:20 +0000 (08:54 -0700)]
Save/Restore Support: Add fini_shutdown call to app exit flow.

Instead of calling kernel_shutdown() in the exit flow, a call to fini_shutdown()
is added to the existing exit flow.

kernel_shutdown() is removed since it is not used in any part of mini-OS.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
7 years agoSave/Restore Support: Move location of CONFIG_XENBUS macro to include appropiate...
Bruno Alvisio [Fri, 23 Mar 2018 17:47:52 +0000 (10:47 -0700)]
Save/Restore Support: Move location of CONFIG_XENBUS macro to include appropiate variables and functions.

init_shutdown and fini_shutdown functions should only be implemented if
CONFIG_XENBUS is defined.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
7 years agoSave/Restore Support: Implement code for arch suspend/resume
Bruno Alvisio [Mon, 11 Dec 2017 16:05:18 +0000 (08:05 -0800)]
Save/Restore Support: Implement code for arch suspend/resume

Before suspending the domain the shared_info_page is unmapped and for PVs the
pagetables should be canonicalized. After resume the shared_info_page should be
mapped again.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add suspend/restore support for netfront
Bruno Alvisio [Mon, 11 Dec 2017 16:23:15 +0000 (08:23 -0800)]
Save/Restore Support: Add suspend/restore support for netfront

Performed an additional cleanup to make the file more syntactically consistent.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add suspend/restore support for xenbus
Bruno Alvisio [Mon, 11 Dec 2017 16:21:48 +0000 (08:21 -0800)]
Save/Restore Support: Add suspend/restore support for xenbus

Currently the watch path is not saved in the watch struct when it is registered.
During xenbus resume the path is needed so that the watches can be registered again.
Thus, 'path' field is added to struct watch so that watches can be re-registered
during xenbus resume.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add suspend/restore support for Grant Tables.
Bruno Alvisio [Mon, 11 Dec 2017 16:12:47 +0000 (08:12 -0800)]
Save/Restore Support: Add suspend/restore support for Grant Tables.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
7 years agoSave/Restore Support: Add support for suspend/restore events.
Bruno Alvisio [Mon, 11 Dec 2017 16:11:09 +0000 (08:11 -0800)]
Save/Restore Support: Add support for suspend/restore events.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add suspend/restore support for console
Bruno Alvisio [Mon, 11 Dec 2017 16:09:21 +0000 (08:09 -0800)]
Save/Restore Support: Add suspend/restore support for console

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add suspend/resume support for timers
Bruno Alvisio [Mon, 11 Dec 2017 16:07:29 +0000 (08:07 -0800)]
Save/Restore Support: Add suspend/resume support for timers

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
7 years agoSave/Restore Support: Disable/enable IRQs during suspend/restore
Bruno Alvisio [Mon, 18 Dec 2017 19:29:59 +0000 (11:29 -0800)]
Save/Restore Support: Disable/enable IRQs during suspend/restore

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add arch_mm_pre|post_suspend
Bruno Alvisio [Tue, 19 Dec 2017 01:17:53 +0000 (17:17 -0800)]
Save/Restore Support: Add arch_mm_pre|post_suspend

For PV guests the pagetables reference the real MFNs rather than PFNs, so when
the guest is resumed into a different area of a hosts memory, these will need to
be rewritten.

PVH guests are auto-translated so no memory operation is needed.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add unmap_shared_info
Bruno Alvisio [Mon, 11 Dec 2017 15:25:36 +0000 (07:25 -0800)]
Save/Restore Support: Add unmap_shared_info

This function is necessary as part of the pre-suspend operation.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Moved shutdown thread to shutdown.c
Bruno Alvisio [Mon, 11 Dec 2017 15:22:31 +0000 (07:22 -0800)]
Save/Restore Support: Moved shutdown thread to shutdown.c

The shutdown thread present in kernel.c was removed and now the thread in
shutdown.c is created instead.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Add kernel shutdown logic to shutdown.c
Bruno Alvisio [Mon, 11 Dec 2017 15:17:16 +0000 (07:17 -0800)]
Save/Restore Support: Add kernel shutdown logic to shutdown.c

Created shutdown.c for the shutdown thread and all the shutdown related
functions.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
7 years agoSave/Restore Support: Add xenbus_release_wait_for_watch
Bruno Alvisio [Tue, 12 Dec 2017 23:55:34 +0000 (15:55 -0800)]
Save/Restore Support: Add xenbus_release_wait_for_watch

xenbus_release_wait_for_watch generates a fake event to trigger make
xenbus_wait_for_watch return. This is necessary to wake up waiting threads.

release_xenbus_id additionally checks if the number of requests == 0 to wake
up the 'waiting' suspend xenbus thread.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Declare kernel and arch pre/post suspend functions
Bruno Alvisio [Mon, 11 Dec 2017 15:07:08 +0000 (07:07 -0800)]
Save/Restore Support: Declare kernel and arch pre/post suspend functions

For mini-OS to support suspend and restore, the kernel will have to suspend
different modules such as xenbus, console, irq, etc. During save/restore the
kernel and arch pre_suspend and post_suspend functions will be invoked to
suspend/resume each of the modules.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Refactor trap_init() and setup vector callbacks
Bruno Alvisio [Thu, 14 Dec 2017 00:30:10 +0000 (16:30 -0800)]
Save/Restore Support: Refactor trap_init() and setup vector callbacks

Currently the setup of the IDT and the request to set the HVM vector callbacks
are performed both in the trap_init function.

As part of the post-suspend operation, the HVM vector callback needs to be setup
again while the IDT does not. Thus, the trap_init function is split into two
separate functions: trap_init (sets up IDT) and xen_callback_vector (sets the
HVM vector callback). During the post-suspend operations the xen_callback_vector
function will be invoked.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoSave/Restore Support: Refactor HYPERVISOR_suspend hypercall
Bruno Alvisio [Mon, 11 Dec 2017 06:51:07 +0000 (22:51 -0800)]
Save/Restore Support: Refactor HYPERVISOR_suspend hypercall

Directly using the SHUTDOWN_suspend macro as a parameter for the schedop
hypercall causes an error in the Xen hypercall handler. Also for consistency,
the SHUTDOWN_suspend param is wrapped in the sched_shutdown struct.

Signed-off-by: Bruno Alvisio <bruno.alvisio@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agomini-os: add config item for printing via hypervisor
Juergen Gross [Wed, 22 Nov 2017 07:59:32 +0000 (08:59 +0100)]
mini-os: add config item for printing via hypervisor

Today Mini-OS will print all console output via the hypervisor, too.

Make this behavior configurable instead and default it to "off".

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agomini-os: add a coding style file
Juergen Gross [Thu, 9 Nov 2017 12:10:12 +0000 (13:10 +0100)]
mini-os: add a coding style file

Since carving out Mini-OS from the Xen repository there hasn't been a
description of the preferred coding style. Copy the Xen CODING_STYLE
file.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
7 years agoUpdate Xen header files again xen-4.11.0-rc1.1 xen-4.12.0-rc1 xen-4.13.0-rc1 xen-RELEASE-4.10.0 xen-RELEASE-4.10.1 xen-RELEASE-4.10.2 xen-RELEASE-4.10.3 xen-RELEASE-4.10.4 xen-RELEASE-4.11.0 xen-RELEASE-4.11.1 xen-RELEASE-4.11.2 xen-RELEASE-4.11.3 xen-RELEASE-4.11.4 xen-RELEASE-4.12.0 xen-RELEASE-4.12.1 xen-RELEASE-4.12.2 xen-RELEASE-4.12.3 xen-RELEASE-4.12.4 xen-RELEASE-4.13.0 xen-RELEASE-4.13.1 xen-RELEASE-4.13.2 xen-RELEASE-4.13.3 xen-RELEASE-4.13.4 xen-RELEASE-4.13.5
Wei Liu [Mon, 16 Oct 2017 15:36:41 +0000 (16:36 +0100)]
Update Xen header files again

The most important thing is the update to console.h, which fixes a bug
that requires the consumers to include string.h.

Update all headers nonetheless for other fixes and new content.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoLink against libxentoolcore xen-4.10.0-rc1
Ian Jackson [Tue, 3 Oct 2017 18:45:19 +0000 (19:45 +0100)]
Link against libxentoolcore

Bringing this commit into xen.git needs coordination with the
corresponding change to introduce the new library: this commit needs to
be introduced to xen.git immediately after
   xentoolcore, _restrict_all: Introduce new library and implementation

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
7 years agoUpdate public headers from Xen
Wei Liu [Wed, 4 Oct 2017 13:43:30 +0000 (14:43 +0100)]
Update public headers from Xen

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agoInclude string.h before console.h
Wei Liu [Wed, 4 Oct 2017 13:51:26 +0000 (14:51 +0100)]
Include string.h before console.h

Starting from Xen commit af8d93564, it is required to include string.h
before console.h.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agolib/math.c: implement __udivmoddi4
Wei Liu [Wed, 9 Aug 2017 12:15:48 +0000 (13:15 +0100)]
lib/math.c: implement __udivmoddi4

Some code compiled by gcc 7 requires this.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
7 years agomini-os: add declaration of cfmakeraw
Simon Waterman [Sun, 25 Jun 2017 22:02:09 +0000 (23:02 +0100)]
mini-os: add declaration of cfmakeraw

Add declaration of cfmakeraw as this is the simplest way of an
application setting a tty into raw mode.

Signed-off-by: Simon Waterman <watermansrdev@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
7 years agomini-os: minimal implementations of some termios functions
Simon Waterman [Sun, 25 Jun 2017 22:02:08 +0000 (23:02 +0100)]
mini-os: minimal implementations of some termios functions

Add minimal implementation of termios functions so that a console
can be configured in raw mode if an application requires it.

Signed-off-by: Simon Waterman <watermansrdev@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
7 years agomini-os: skip crnl conversion if console is in raw mode
Simon Waterman [Sun, 25 Jun 2017 22:02:07 +0000 (23:02 +0100)]
mini-os: skip crnl conversion if console is in raw mode

Signed-off-by: Simon Waterman <watermansrdev@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
7 years agomini-os: add a flag that records when a console is configured in raw mode
Simon Waterman [Sun, 25 Jun 2017 22:02:06 +0000 (23:02 +0100)]
mini-os: add a flag that records when a console is configured in raw mode

Signed-off-by: Simon Waterman <watermansrdev@gmail.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
7 years agomini-os: use gzip -n
Bernhard M. Wiedemann [Thu, 22 Jun 2017 13:40:26 +0000 (15:40 +0200)]
mini-os: use gzip -n

to not add current timestamp to
ioemu-stubdom.gz
pv-grub-x86_32.gz
pv-grub-x86_64.gz
xenstore-stubdom.gz

to allow for reproducible builds

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Acked-by: Wei Liu <wei.liu2@citrix.com>
7 years agoRevert "mini-os: Remove \r\n conversion when writing to PV serial port"
Wei Liu [Mon, 15 May 2017 15:35:51 +0000 (16:35 +0100)]
Revert "mini-os: Remove \r\n conversion when writing to PV serial port"

This reverts commit 88c9b4357e5e7a2f3d7b7821a64a4454061631ed.

7 years agomini-os: Remove \r\n conversion when writing to PV serial port
Simon Waterman [Wed, 10 May 2017 22:33:23 +0000 (23:33 +0100)]
mini-os: Remove \r\n conversion when writing to PV serial port

This change removes \n to \r\n conversion when writing to a PV serial
port so that binary protocols carried over the port are not corrupted.

The change enables new use-cases for example connectivity from the Windows
Kernel Debugger to a guest via it's IOEMU stubdom.

Signed-off-by: Simon Waterman <watermansrdev@gmail.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Keir Fraser <keir@xen.org>
8 years agoInclude libxendevicemodel with libxc xen-4.9.0-rc1.2 xen-RELEASE-4.9.0 xen-RELEASE-4.9.1 xen-RELEASE-4.9.2 xen-RELEASE-4.9.3 xen-RELEASE-4.9.4
Paul Durrant [Wed, 22 Feb 2017 11:03:37 +0000 (11:03 +0000)]
Include libxendevicemodel with libxc

libxendevicemodel has just been split out from libxc. From mini-os's
point of view we don't care about the distinction, so keep things
simple by just including libxendevicemodel if libxc is enabled.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agobuild: prepend OBJ_DIR to linker script xen-RELEASE-4.8.2 xen-RELEASE-4.8.3 xen-RELEASE-4.8.4 xen-RELEASE-4.8.5
Wei Liu [Tue, 13 Dec 2016 15:02:02 +0000 (15:02 +0000)]
build: prepend OBJ_DIR to linker script

After 5623e2d2 ("x86: use unified linker script") the linker script for
x86 build is generated. But the special rule to generate linker script
doesn't have OBJ_DIR prepended so in parallel build the same file is
written multiple times. This is racy and would cause parallel build to
fail.

Fix this by prepending OBJ_DIR to the path of linker script. Change
other variables where necessary.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agominios: remove reference to xensource.com xen-4.9.0-rc1
Juergen Gross [Fri, 25 Nov 2016 13:20:29 +0000 (14:20 +0100)]
minios: remove reference to xensource.com

include/xen/hvm/pvdrivers.h contains a reference to
xen-devel@lists.xensource.com. Replace it by the correct address
xen-devel@lists.xenproject.org

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
8 years agominios: fix build issue with xen_*mb defines xen-4.8.0-rc1 xen-RELEASE-4.8.0 xen-RELEASE-4.8.1
Juergen Gross [Wed, 28 Sep 2016 09:50:04 +0000 (11:50 +0200)]
minios: fix build issue with xen_*mb defines

Commit e35295d724d64e6e025ec31c2e510e448b8641d1 ("mini-os: fix builds
with uncommon config settings") introduced a bug which will break
the build, as xc_minios.c will have defined those macros via
xc_private.h.

Fix this by defining the macros only if compiling a minios source.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agominios: make mini-os_app.o depend on included xen libraries
Juergen Gross [Tue, 27 Sep 2016 12:06:24 +0000 (14:06 +0200)]
minios: make mini-os_app.o depend on included xen libraries

When building Mini-OS with an app which is using xen libraries like
libxenguest.a let mini-os_app.o depend on the library binaries as it
is statically linked with them.

While at it add "-T" before app.lds for linking mini-os_app.o to avoid
a linker warning.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agoAdd travis.yml and travis-build script
Wei Liu [Mon, 5 Sep 2016 14:43:21 +0000 (15:43 +0100)]
Add travis.yml and travis-build script

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: add comments in Config.mk regarding new config options
Juergen Gross [Mon, 5 Sep 2016 11:43:30 +0000 (13:43 +0200)]
mini-os: add comments in Config.mk regarding new config options

Add some comment in Config.mk what to do in case of adding new config
options.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: update README to reflect recent changes
Juergen Gross [Fri, 2 Sep 2016 08:56:47 +0000 (10:56 +0200)]
mini-os: update README to reflect recent changes

Add some notes to README regarding configuration of Mini-OS via config
files.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: add testbuild target to Makefile
Juergen Gross [Fri, 2 Sep 2016 08:56:46 +0000 (10:56 +0200)]
mini-os: add testbuild target to Makefile

Add a "testbuild" target to the Makefile to test building a set of
pre-defined configurations.

Configurations tested are stored under arch/<arch>/testbuild in form
of configuration files. All configurations found there are built in
a local directory.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: fix builds with uncommon config settings
Juergen Gross [Fri, 2 Sep 2016 08:56:45 +0000 (10:56 +0200)]
mini-os: fix builds with uncommon config settings

Some config settings won't build standalone. Fix the following cases:

- all CONFIG_* set to "n"
- standard config with latest Xen interface version

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: support "make config" for out-of-tree users
Juergen Gross [Tue, 30 Aug 2016 11:51:23 +0000 (13:51 +0200)]
mini-os: support "make config" for out-of-tree users

Mini-OS applications being compiled using Mini-OS headers without
being integrated in the make environment of Mini-OS need a way to set
CONFIG_* defines according to their Mini-OS configuration.

Add a new make target "config" for that purpose creating a Makefile
snipplet $(CONFIG_FILE) (defaults to ./minios-config.mk) containing
the needed information.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: provide irq on/off/save/restore functions for Mini-OS apps
Juergen Gross [Tue, 30 Aug 2016 11:51:22 +0000 (13:51 +0200)]
mini-os: provide irq on/off/save/restore functions for Mini-OS apps

Provide non-inline variants of the local_irq_*() functions for Mini-OS
apps which should not depend on Mini-OS configuration.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: support newer xen interface
Juergen Gross [Tue, 30 Aug 2016 11:51:21 +0000 (13:51 +0200)]
mini-os: support newer xen interface

Mini-OS is currently setting __XEN_INTERFACE_VERSION__ to a rather
ancient version.

To be able to use a more recent variant garnt_entry_t must be changed
to grant_entry_v1_t. In balloon.c we omit initializing elements of
struct xen_memory_reservation with 0 to avoid problems with different
named structure elements in different Xen interface versions.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: don't get xenbus parameters if xenbus is disabled
Juergen Gross [Mon, 29 Aug 2016 14:18:27 +0000 (16:18 +0200)]
mini-os: don't get xenbus parameters if xenbus is disabled

get_xenbus() should be called only if CONFIG_XENBUS is set.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: partially revert "remove using start_info ..."
Juergen Gross [Mon, 29 Aug 2016 14:18:26 +0000 (16:18 +0200)]
mini-os: partially revert "remove using start_info ..."

Commit e33452c4f5547ed14defe6382b3b53664ac5bd8a ("remove using
start_info in architecture independent code") removed the start_info
variable completely. grub stubdom needs the start_info structure.

Readd the start_info structure, but make it dependent on
CONFIG_PARAVIRT.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agogitignore: ignore files generated by various indexing software
Wei Liu [Mon, 29 Aug 2016 13:01:42 +0000 (14:01 +0100)]
gitignore: ignore files generated by various indexing software

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agoMakefile: add gtags target
Wei Liu [Mon, 29 Aug 2016 13:01:41 +0000 (14:01 +0100)]
Makefile: add gtags target

Use GNU Global to generate source code index.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agoMakefile: simplify all_sources macro
Wei Liu [Mon, 29 Aug 2016 13:01:40 +0000 (14:01 +0100)]
Makefile: simplify all_sources macro

There is no SCCS file.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: remove unused functions from sched.c
Juergen Gross [Mon, 29 Aug 2016 06:17:22 +0000 (08:17 +0200)]
mini-os: remove unused functions from sched.c

sched.c contains some functions nobody is using. Remove them.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: cleanup x86_64.S
Juergen Gross [Mon, 29 Aug 2016 06:17:21 +0000 (08:17 +0200)]
mini-os: cleanup x86_64.S

arch/x86/x86_64.S contains some unnecessary macros. Remove them.

Add a SAVE_PARAVIRT macro for saving %rcx and %r11 on the stack in
case of CONFIG_PARAVIRT defined.

Remove the parameter from HYPERVISOR_IRET macro as it is used with
0 only.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: cleanup x86_32.S
Juergen Gross [Mon, 29 Aug 2016 06:17:20 +0000 (08:17 +0200)]
mini-os: cleanup x86_32.S

arch/x86/x86_32.S has some superfluous instructions. Remove them.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agox86_64: don't unnecessarily export some entries
Wei Liu [Thu, 25 Aug 2016 14:56:48 +0000 (15:56 +0100)]
x86_64: don't unnecessarily export some entries

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agox86_64: introduce and use SAVE_ALL
Wei Liu [Thu, 25 Aug 2016 14:52:38 +0000 (15:52 +0100)]
x86_64: introduce and use SAVE_ALL

Introduce this macro to match RESTORE_ALL. Also delete the unused
SAVE_REST.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agox86_64: merge RESTORE_REST into RESTORE_ALL
Wei Liu [Thu, 25 Aug 2016 12:55:57 +0000 (13:55 +0100)]
x86_64: merge RESTORE_REST into RESTORE_ALL

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agox86_64: remove unused labels
Wei Liu [Thu, 25 Aug 2016 13:11:31 +0000 (14:11 +0100)]
x86_64: remove unused labels

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agox86_32: remove inclusion of x86-32.h
Wei Liu [Thu, 25 Aug 2016 12:42:39 +0000 (13:42 +0100)]
x86_32: remove inclusion of x86-32.h

There is no need to do that explicitly.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: support idle for HVMlite
Juergen Gross [Tue, 23 Aug 2016 14:45:08 +0000 (16:45 +0200)]
mini-os: support idle for HVMlite

Instead of calling HYPERVISOR_sched_op(SCHEDOP_block, 0) we need to use
the "hlt" instruction with interrupts enabled to switch to idle when
running as HVMlite domain.

This requires to setup a new timer in the timer handler as there is no
guarantee the original timer event we are waiting for won't fire
between enabling interrupts and calling "hlt".

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: get physical memory map
Juergen Gross [Mon, 22 Aug 2016 14:56:51 +0000 (16:56 +0200)]
mini-os: get physical memory map

On HVMlite we have to look at the physical memory map to know which
memory frames are usable.

In order to make life easier we define a dummy memory map for other
domain types (pv and arm) which has just one entry with a maximum
memory size.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: print start of day messages depending on domain type
Juergen Gross [Mon, 22 Aug 2016 07:58:11 +0000 (09:58 +0200)]
mini-os: print start of day messages depending on domain type

Select what to print in arch_init() depending on the domain type.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: remove using start_info in architecture independent code
Juergen Gross [Mon, 22 Aug 2016 07:01:09 +0000 (09:01 +0200)]
mini-os: remove using start_info in architecture independent code

The start_info structure should be used only in case of CONFIG_PARAVIRT
defined. Remove it from being used in other places. Especially the
usage as parameter for applications linked to the kernel is no good
idea.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: map shared info page for HVMlite
Juergen Gross [Mon, 22 Aug 2016 08:45:03 +0000 (10:45 +0200)]
mini-os: map shared info page for HVMlite

Add a service function to map the shared info page on a
non-paravirtualized system. The code is already existing on ARM side,
just move it to hypervisor.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: add get_cmdline() function
Juergen Gross [Mon, 22 Aug 2016 06:22:15 +0000 (08:22 +0200)]
mini-os: add get_cmdline() function

The command line parameters are passed in start_info structure for pv,
but via hvm_start_info for HVMlite. Add a generic function to fill a
local cmdline variable with the command line string.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: setup xenbus interface parameters
Juergen Gross [Sun, 21 Aug 2016 09:29:44 +0000 (11:29 +0200)]
mini-os: setup xenbus interface parameters

In order to support HVMlite we need to get the ring page and event
channel from the hypervisor via hypercalls. Move the already existing
get_xenbus() function from arm specific coding to xenbus/xenbus.c and
provide a similar paravirtualized function.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: setup console interface parameters
Juergen Gross [Tue, 16 Aug 2016 14:10:58 +0000 (16:10 +0200)]
mini-os: setup console interface parameters

In order to support HVMlite we need to get the ring page and event
channel from the hypervisor via hypercalls. Move the already existing
get_console() function from arm specific coding to
console/xencons_ring.c and provide a similar paravirtualized function.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: add map_frame_virt() function
Juergen Gross [Thu, 18 Aug 2016 11:36:36 +0000 (13:36 +0200)]
mini-os: add map_frame_virt() function

Add a function map_frame_virt() to map a given frame and return its
virtual address.

On arm we just use the frame physical address, while on x86 we take a
page from the virtual kernel area. For this purpose make this area
available even in case of undefined CONFIG_BALLOON.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: correct wrong calculation of alloc bitmap size
Juergen Gross [Thu, 18 Aug 2016 11:58:42 +0000 (13:58 +0200)]
mini-os: correct wrong calculation of alloc bitmap size

When remapping the page allocator's bitmap for the ballooning support
the calculation of the needed size is wrong. This doesn't really
matter today as nothing is allocated after that bitmap, but it should
be corrected nevertheless.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: add x86 native page table handling
Juergen Gross [Thu, 18 Aug 2016 14:59:27 +0000 (16:59 +0200)]
mini-os: add x86 native page table handling

For support of HVMlite don't use mmu_update hypercalls, but write the
page table entries directly.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: add static page tables for virtual kernel area for HVMlite
Juergen Gross [Thu, 18 Aug 2016 11:00:27 +0000 (13:00 +0200)]
mini-os: add static page tables for virtual kernel area for HVMlite

In HVMlite mode we need the virtual kernel area for mapping of the
console and xenbus ring pages as especially on 32 bit architecture
their pfns might be above the supported maximum memory size.

Add the page tables needed for doing the mapping.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: make p2m related code depend on CONFIG_PARAVIRT
Juergen Gross [Thu, 18 Aug 2016 11:00:27 +0000 (13:00 +0200)]
mini-os: make p2m related code depend on CONFIG_PARAVIRT

All handling related to p2m is needed for paravirtualized environment
only. So put all functions operating on p2m list in #ifdef
CONFIG_PARAVIRT sections. Add a paravirt.h header defining dummy
functions for non-paravirtualized environments. Instead of using
references to start_info use dedicated variables initialized from
start_info on boot.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: support HVMlite traps
Juergen Gross [Mon, 22 Aug 2016 12:08:28 +0000 (14:08 +0200)]
mini-os: support HVMlite traps

Trap handling in HVMlite domain is different from pv one.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: initialize trap handling for HVMlite
Juergen Gross [Thu, 18 Aug 2016 11:00:27 +0000 (13:00 +0200)]
mini-os: initialize trap handling for HVMlite

Trap handling for HVMlite domains requires an initialized IDT.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: support hvm_op hypercall
Juergen Gross [Thu, 18 Aug 2016 11:00:27 +0000 (13:00 +0200)]
mini-os: support hvm_op hypercall

Support the HYPERVISOR_hvm_op() hypercall which is needed for HVMlite.
Add convenience functions hvm_get_parameter() and hvm_set_parameter().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: setup hypercall page for HVMlite
Juergen Gross [Thu, 18 Aug 2016 11:00:27 +0000 (13:00 +0200)]
mini-os: setup hypercall page for HVMlite

When running in HVMlite mode we need to setup the hypercall page by
ourself.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: add boot code for HVMlite support
Juergen Gross [Thu, 18 Aug 2016 11:00:27 +0000 (13:00 +0200)]
mini-os: add boot code for HVMlite support

A HVMlite domain is always starting in 32 bit mode. Add the appropriate
boot code to arch/x86 for the non-paravirtualized case.

For this boot code to become active we need to suppress the pv related
elfnotes and add an appropriate elfnote for HVMlite.

As the HVMlite boot code is more or less the same for 32- and 64-bit
Mini-OS #include the new code from x86_[32|64].S in order to avoid
error prone code duplication. The specific parts of 32- or 64-bit code
are added to x86_[32|64].S

This enables Mini-OS to start the boot process in HVMlite mode until it
enters C code. This is working for 32- and for 64-bit mode.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: make some memory management related macros usable from assembler
Juergen Gross [Thu, 18 Aug 2016 11:00:27 +0000 (13:00 +0200)]
mini-os: make some memory management related macros usable from assembler

Especially page table entry definitions are currently not usable from
assembler sources on x86 as the constants are defined with ULL suffix.
Change this by adding the suffix only when the header is included from
a C source.

Hide some C prototypes when in assembler environment.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: add CONFIG_PARAVIRT
Juergen Gross [Thu, 18 Aug 2016 11:00:27 +0000 (13:00 +0200)]
mini-os: add CONFIG_PARAVIRT

Add a new config macro CONFIG_PARAVIRT which defaults to be defined on
x86. This is the first step for supporting a HVMlite Mini-OS.

Doing this via CONFIG_PARAVIRT instead of something like CONFIG_HVMLITE
was chosen as the arm port can then drop some dummy routines needed for
para-virtualization only.

Add include/paravirt.h for future support of paravirt specific
handling.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: make dump_regs() work in early boot
Juergen Gross [Mon, 22 Aug 2016 14:01:40 +0000 (16:01 +0200)]
mini-os: make dump_regs() work in early boot

dump_regs() will result in page fault in early boot as there is no
current thread pointer. Handle this case.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agomini-os: resync xen headers
Juergen Gross [Mon, 22 Aug 2016 06:01:47 +0000 (08:01 +0200)]
mini-os: resync xen headers

Use the latest Xen headers.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agox86: use unified linker script
Wei Liu [Thu, 18 Aug 2016 10:15:26 +0000 (11:15 +0100)]
x86: use unified linker script

There are only a few differences between i386 and x86-64 linker scripts.
Unify them into one. Re-indent the file at the same time.

Construct a special rule in top-level directory to cope with the change.
Ideally the build system should also be made more elegant, but
overhauling the build system is out of scope of this patch.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agox86: switch to use elfnote
Wei Liu [Thu, 18 Aug 2016 10:15:25 +0000 (11:15 +0100)]
x86: switch to use elfnote

Use the newer ELF note interface. The generated ELF notes results in
equivalent configuration.

Also need to modify linker script to provide a note section.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>