]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/mini-os.git/log
people/liuw/libxenctrl-split/mini-os.git
10 years agomini-os: added arch_init_gnttab
Karim Raslan [Thu, 26 Jun 2014 11:28:25 +0000 (12:28 +0100)]
mini-os: added arch_init_gnttab

Moves some x86-specific code into arch/x86.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: split into multiple patches]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: whitespace
Thomas Leonard [Thu, 26 Jun 2014 11:28:24 +0000 (12:28 +0100)]
mini-os: whitespace

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: switched initial C entry point to arch_init
Karim Raslan [Thu, 26 Jun 2014 11:28:23 +0000 (12:28 +0100)]
mini-os: switched initial C entry point to arch_init

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: separated from big ARM commit]
[talex5@gmail.com: restored comment, moved prototypes to headers]
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[talex5@gmail.com: restored stack address printk on x86]
[talex5@gmail.com: moved first printk's after start_info setup on x86]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
10 years agomini-os: made off_t type signed
Thomas Leonard [Thu, 26 Jun 2014 11:28:22 +0000 (12:28 +0100)]
mini-os: made off_t type signed

POSIX requires this.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: use unbind_evtchn in unbind_all_ports
Thomas Leonard [Thu, 26 Jun 2014 11:28:21 +0000 (12:28 +0100)]
mini-os: use unbind_evtchn in unbind_all_ports

This marks the channel as closed, in case someone tries to use it again.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: fixed format string error in unbind_evtchn
Thomas Leonard [Thu, 26 Jun 2014 11:28:20 +0000 (12:28 +0100)]
mini-os: fixed format string error in unbind_evtchn

Would crash if HYPERVISOR_event_channel_op returned an error code.
The other changes in this commit are just fixing indentation.

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Ian Campbell <ian.cammpbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: fixed shutdown thread
Thomas Leonard [Thu, 26 Jun 2014 11:28:19 +0000 (12:28 +0100)]
mini-os: fixed shutdown thread

Before, it read "" and started a shutdown immediately. Now, it waits for
a non-empty value and then actually shuts down.

Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[talex5@gmail.com: avoid declaration-after-statement in kernel.c]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
10 years agomini-os: build fixes
Thomas Leonard [Thu, 26 Jun 2014 11:28:18 +0000 (12:28 +0100)]
mini-os: build fixes

Make .o rules depend on the includes. Before, only the final link step
depended on setting up the includes directory, making parallel builds
unreliable.

Make symlinks use explicit make rules instead of using a phony target.
Avoids unnecessary rebuilds.

[talex5@gmail.com: bring back "make links", for stubdom]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: don't include queue.h if there's no libc
Thomas Leonard [Wed, 11 Jun 2014 10:30:17 +0000 (11:30 +0100)]
mini-os: don't include queue.h if there's no libc

Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: moved events code under arch
Karim Raslan [Wed, 11 Jun 2014 10:30:15 +0000 (11:30 +0100)]
mini-os: moved events code under arch

This is all code motion, except that we now initialise
the ev_actions array before calling the arch-specific code
to make it more robust against future changes.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: separated from big ARM commit]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
10 years agomini-os: tidied up code
Karim Raslan [Wed, 11 Jun 2014 10:30:14 +0000 (11:30 +0100)]
mini-os: tidied up code

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: separated from big ARM commit]
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[talex5@gmail.com: use __func__ in DEBUG macro]
[talex5@gmail.com: drop text about "xm create"]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
11 years agominios (blkfront): Add more information on block error
Samuel Thibault [Thu, 20 Mar 2014 12:10:22 +0000 (13:10 +0100)]
minios (blkfront): Add more information on block error

This notably prints the offset and size of the block operation in error.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agominios: Correct HYPERVISOR_physdev_op()
Andrew Cooper [Fri, 24 Jan 2014 18:28:11 +0000 (18:28 +0000)]
minios: Correct HYPERVISOR_physdev_op()

A physdev_op is a two argument hypercall, taking a command parameter and an
optional pointer to a structure.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agomini-os: Fix stubdom build failures on gcc 4.8
Mike Neilsen [Wed, 22 Jan 2014 17:41:11 +0000 (11:41 -0600)]
mini-os: Fix stubdom build failures on gcc 4.8

This is a fix for bug 35:
http://bugs.xenproject.org/xen/bug/35

This bug report describes several format string mismatches which prevent
building the stubdom target in Xen 4.3 and Xen 4.4-rc2 on gcc 4.8.  This is a
copy of Alex Sharp's original patch with the following modifications:

* Andrew Cooper's recommendation applied to extras/mini-os/xenbus/xenbus.c to
  avoid stack corruption
* Samuel Thibault's recommendation to make "fun" an unsigned int rather than an
  unsigned long in pcifront_physical_to_virtual and related functions
  (extras/mini-os/include/pcifront.h and extras/mini-os/pcifront.c)

Tested on x86_64 gcc Ubuntu/Linaro 4.8.1-10ubuntu9.

Coverity-IDs: 1055807 1055808 1055809 1055810
Signed-off-by: Mike Neilsen <mneilsen@acm.org>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agomini-os: remove repeated statement in netfront_input
Matthew Daley [Fri, 8 Nov 2013 10:10:08 +0000 (11:10 +0100)]
mini-os: remove repeated statement in netfront_input

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agotools: remove unnecessary null pointer checks before frees
Matthew Daley [Tue, 15 Oct 2013 05:18:02 +0000 (18:18 +1300)]
tools: remove unnecessary null pointer checks before frees

Patch generated by the following semantic patch
(http://coccinelle.lip6.fr/):

@@
expression *P;
@@

- if(P) free(P);
+ free(P);

...and then by filtering through the following command:

filterdiff -p1 -x 'stubdom/*' -x 'tools/firmware/*' -x 'tools/qemu-*' -x 'tools/blktap*'

Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
11 years agomini-os: fix various memory leaks in various locations
Matthew Daley [Wed, 18 Sep 2013 03:38:03 +0000 (15:38 +1200)]
mini-os: fix various memory leaks in various locations

Coverity-ID: 1055827
Coverity-ID: 1055828
Coverity-ID: 1055829
Coverity-ID: 1055830
Coverity-ID: 1055831
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: fix various memory leaks in consfront
Matthew Daley [Wed, 18 Sep 2013 03:38:02 +0000 (15:38 +1200)]
mini-os: fix various memory leaks in consfront

Coverity-ID: 1055816
Coverity-ID: 1055817
Coverity-ID: 1055818
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: fix various memory leaks in pcifront
Matthew Daley [Wed, 18 Sep 2013 03:38:01 +0000 (15:38 +1200)]
mini-os: fix various memory leaks in pcifront

Coverity-ID: 1055834-1055840
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: fix various memory leaks in netfront
Matthew Daley [Wed, 18 Sep 2013 03:38:00 +0000 (15:38 +1200)]
mini-os: fix various memory leaks in netfront

Coverity-ID: 1055832
Coverity-ID: 1055833
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: fix various memory leaks in {fb, kbd}front
Matthew Daley [Wed, 18 Sep 2013 03:37:59 +0000 (15:37 +1200)]
mini-os: fix various memory leaks in {fb, kbd}front

Coverity-ID: 1055819-1055826
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: fix various memory leaks in blkfront
Matthew Daley [Wed, 18 Sep 2013 03:37:58 +0000 (15:37 +1200)]
mini-os: fix various memory leaks in blkfront

Coverity-ID: 1055814
Coverity-ID: 1055815
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: fix nodename generation in init_netfront
Matthew Daley [Wed, 18 Sep 2013 03:37:57 +0000 (15:37 +1200)]
mini-os: fix nodename generation in init_netfront

Using strlen here makes no sense.

Coverity-ID: 1056053
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: handle possibly overlong _nodename in init_consfront
Matthew Daley [Tue, 10 Sep 2013 14:34:20 +0000 (02:34 +1200)]
mini-os: handle possibly overlong _nodename in init_consfront

The only current user that passes a non-NULL _nodename limits it to 64
bytes anyway.

Coverity-ID: 1054993
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agomini-os: fix use-after-free in xs_daemon_close event iteration
Matthew Daley [Tue, 10 Sep 2013 14:34:19 +0000 (02:34 +1200)]
mini-os: fix use-after-free in xs_daemon_close event iteration

We need to get the next pointer before the freeing of the event.

Coverity-ID: 1056173
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agominios: fix xenbus_rm() calls in frontend drivers
Ben Cressey [Fri, 6 Sep 2013 19:52:07 +0000 (12:52 -0700)]
minios: fix xenbus_rm() calls in frontend drivers

The commit "minios: refactor xenbus state machine" caused "/state" to
be appended to the local value of nodename. Previously the nodename
variable pointed to dev->nodename.

The xenbus_rm() calls were not updated to reflect this change, and
refer to paths that do not exist.

For example, shutdown_blkfront() for vbd 2049 would issue these calls:
    xenbus_rm(XBT_NIL, "device/vbd/2049/state/ring-ref");
    xenbus_rm(XBT_NIL, "device/vbd/2049/state/event-channel");

This patch restores the previous behavior, issuing these calls
instead:
    xenbus_rm(XBT_NIL, "device/vbd/2049/ring-ref");
    xenbus_rm(XBT_NIL, "device/vbd/2049/event-channel");

This causes frontend drivers to not be properly reset when PV-GRUB
exists. Some PV Linux drivers fail to re-initialize frontend devices
if PV-GRUB leaves them in this state.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
Reviewed-by: Matt Wilson <msw@amazon.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[msw: adjusted commit message to include consequences, split out
 changes into separate patches]
Signed-off-by: Matt Wilson <msw@amazon.com>
11 years agominios: clean up unneeded "err = NULL" in frontend drivers
Ben Cressey [Fri, 6 Sep 2013 19:52:06 +0000 (12:52 -0700)]
minios: clean up unneeded "err = NULL" in frontend drivers

This patch removes cases where the error message pointer is already
NULL and is then set to NULL. These are harmless, but suggest
incorrect practice: the pointer should be passed to free() to
deallocate memory prior to reassignment. There are no functional
changes in this patch.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
Reviewed-by: Matt Wilson <msw@amazon.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
[msw: split a larger patch from Ben into this cleanup patch]
Signed-off-by: Matt Wilson <msw@amazon.com>
11 years agominios: clean up allocation of char arrays used for xenbus paths
Matt Wilson [Fri, 6 Sep 2013 19:52:05 +0000 (12:52 -0700)]
minios: clean up allocation of char arrays used for xenbus paths

This patch cleans up instances of char array allocation where string
lengths were manually counted to use strlen() instead. There are no
functional changes in this patch.

Signed-off-by: Matt Wilson <msw@amazon.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agominios: correct char array allocation for xenbus paths
Matt Wilson [Fri, 6 Sep 2013 19:52:04 +0000 (12:52 -0700)]
minios: correct char array allocation for xenbus paths

The char arrays used to hold xenbus paths have historically been
allocated by manually counting the length longest string constants
included in constructing the path. This has led to improperly sized
buffers, both too large (with little consequence) and too small (which
obviously causes problems). This patch corrects the instances where
the length was incorrectly calculated by using strlen() on the longest
string constant used in building a xenbus path.

A follow-on clean-up patch will change all instances to use strlen().

Signed-off-by: Ben Cressey <bcressey@amazon.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
[msw: split this patch from a larger patch from Ben, reworked to use
 strlen()]
Signed-off-by: Matt Wilson <msw@amazon.com>
11 years agomini-os: eliminate duplicated definition of spin_unlock_wait
Chen Baozi [Thu, 9 May 2013 08:31:01 +0000 (16:31 +0800)]
mini-os: eliminate duplicated definition of spin_unlock_wait

Signed-off-by: Chen Baozi <baozich@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
11 years agolibxl: Restrict permissions on PV console device xenstore nodes
Ian Jackson [Tue, 25 Jun 2013 10:24:22 +0000 (11:24 +0100)]
libxl: Restrict permissions on PV console device xenstore nodes

Matthew Daley has observed that the PV console protocol places sensitive host
state into a guest writeable xenstore locations, this includes:

 - The pty used to communicate between the console backend daemon and its
   client, allowing the guest administrator to read and write arbitrary host
   files.
 - The output file, allowing the guest administrator to write arbitrary host
   files or to target arbitrary qemu chardevs which include sockets, udp, ptr,
   pipes etc (see -chardev in qemu(1) for a more complete list).
 - The maximum buffer size, allowing the guest administrator to consume more
   resources than the host administrator has configured.
 - The backend to use (qemu vs xenconsoled), potentially allowing the guest
   administrator to confuse host software.

So we arrange to make the sensitive keys in the xenstore frontend directory
read only for the guest. This is safe since the xenstore permissions model,
unlike POSIX directory permissions, does not allow the guest to remove and
recreate a node if it has write access to the containing directory.

There are a few associated wrinkles:

 - The primary PV console is "special". It's xenstore node is not under the
   usual /devices/ subtree and it does not use the customary xenstore state
   machine protocol. Unfortunately its directory is used for other things,
   including the vnc-port node, which we do not want the guest to be able to
   write to. Rather than trying to track down all the possible secondary uses
   of this directory just make it r/o to the guest. All newly created
   subdirectories inherit these permissions and so are now safe by default.

 - The other serial consoles do use the customary xenstore state machine and
   therefore need write access to at least the "protocol" and "state" nodes,
   however they may also want to use arbitrary "feature-foo" nodes (although
   I'm not aware of any) and therefore we cannot simply lock down the entire
   frontend directory. Instead we add support to libxl__device_generic_add for
   frontend keys which are explicitly read only and use that to lock down the
   sensitive keys.

 - Minios' console frontend wants to write the "type" node, which it has no
   business doing since this is a host/toolstack level decision. This fails
   now that the node has become read only to the PV guest. Since the toolstack
   already writes this node just remove the attempt to set it.

This is a security issue, XSA-57.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
11 years agotpmif: fix identifier prefixes
Jan Beulich [Fri, 21 Jun 2013 06:39:43 +0000 (08:39 +0200)]
tpmif: fix identifier prefixes

The definitions here shouldn't use vtpm_ or VPTM_ as their prefixes,
the interface should instead make use of tpmif_ and TPMIF_. This
fixes a build failure after syncing the public headers to
linux-2.6.18-xen.hg (where a struct vtpm_state already exists).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
12 years agomini-os/x86-64 entry: check against nested events and try to fix up
Xu Zhang [Thu, 11 Apr 2013 04:47:00 +0000 (23:47 -0500)]
mini-os/x86-64 entry: check against nested events and try to fix up

In hypervisor_callback, check against event re-entrant.
If we came from the critical region in interrupt context,
try to fix up by coalescing the two stack frames.
The execution is resumed as if the second event never happened.

Signed-off-by: Xu Zhang <xzhang@cs.uic.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os/x86-64 entry: defer RESTORE_REST until return
Xu Zhang [Thu, 11 Apr 2013 04:46:59 +0000 (23:46 -0500)]
mini-os/x86-64 entry: defer RESTORE_REST until return

No need to do a RESTORE_REST at this point because if we saw pending
events after we enabled event delivery, we have to do a SAVE_REST again.
Instead, we do a "lazy" RESTORE_REST, deferring it until actual return.
The offset of saved-on-stack rflags register is changed as well.

Signed-off-by: Xu Zhang <xzhang@cs.uic.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os/x86-64 entry: remove unnecessary event blocking
Xu Zhang [Thu, 11 Apr 2013 04:46:58 +0000 (23:46 -0500)]
mini-os/x86-64 entry: remove unnecessary event blocking

We don't need to block events here because:
 - if we came from "hypervisor_callback", events are disabled at this point,
   no need to block again;
 - if we came from "error_entry", we shouldn't touch event mask, for
   exception hanlding are meant to be interrupted by Xen events (virtual
   irq).

Signed-off-by: Xu Zhang <xzhang@cs.uic.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os/x86-64 entry: code refactoring; no functional changes
Xu Zhang [Thu, 11 Apr 2013 04:46:57 +0000 (23:46 -0500)]
mini-os/x86-64 entry: code refactoring; no functional changes

Re-arrange assembly code blocks so that they are in called
order instead of jumping around, enhancing readability.
Macros are grouped together as well.

Signed-off-by: Xu Zhang <xzhang@cs.uic.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os/x86-64 entry: define macros for registers partial save and restore
Xu Zhang [Thu, 11 Apr 2013 04:46:56 +0000 (23:46 -0500)]
mini-os/x86-64 entry: define macros for registers partial save and restore

No functional changes.

For saving and restoring registers rbx, rbp, and r12-r15,
define and use macros SAVE_REST and RESTORE_REST respectively.

Signed-off-by: Xu Zhang <xzhang@cs.uic.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os/x86-64 entry: code clean-ups; no functional changes
Xu Zhang [Thu, 11 Apr 2013 04:46:55 +0000 (23:46 -0500)]
mini-os/x86-64 entry: code clean-ups; no functional changes

Make use of tabs and spaces consistent in arch/x86/x86_64.S

Signed-off-by: Xu Zhang <xzhang@cs.uic.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os/tpmback: add tpmback_get_peercontext
Daniel De Graaf [Thu, 21 Mar 2013 20:11:22 +0000 (16:11 -0400)]
mini-os/tpmback: add tpmback_get_peercontext

This allows the XSM label of the TPM's client domain to be retrieved.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agomini-os/tpmback: Replace UUID field with opaque pointer
Daniel De Graaf [Thu, 21 Mar 2013 20:11:21 +0000 (16:11 -0400)]
mini-os/tpmback: Replace UUID field with opaque pointer

Instead of only recording the UUID field, which may not be of interest
to all tpmback implementations, provide a user-settable opaque pointer
associated with the tpmback instance.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
12 years agomini-os/tpmback: set up callbacks before enumeration
Daniel De Graaf [Thu, 21 Mar 2013 20:11:20 +0000 (16:11 -0400)]
mini-os/tpmback: set up callbacks before enumeration

The open/close callbacks in tpmback cannot be properly initalized in
order to catch the initial enumeration events because init_tpmback
clears the callbacks and then asynchronously starts the enumeration of
existing tpmback devices. Fix this by passing the callbacks to
init_tpmback so they can be installed before enumeration.

This also removes the unused callbacks for suspend and resume.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
12 years agomini-os/tpm{back, front}: Allow device repoens
Daniel De Graaf [Thu, 21 Mar 2013 20:11:19 +0000 (16:11 -0400)]
mini-os/tpm{back, front}: Allow device repoens

Allow the vtpm device to be disconnected and reconnected so that a
bootloader (like pv-grub) can submit measurements and return the vtpm
device to its initial state before booting the target kernel.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
12 years agomini-os/tpm{back, front}: Change shared page ABI
Daniel De Graaf [Thu, 11 Apr 2013 16:20:25 +0000 (12:20 -0400)]
mini-os/tpm{back, front}: Change shared page ABI

This changes the vTPM shared page ABI from a copy of the Xen network
interface to a single-page interface that better reflects the expected
behavior of a TPM: only a single request packet can be sent at any given
time, and every packet sent generates a single response packet. This
protocol change should also increase efficiency as it avoids mapping and
unmapping grants when possible. The vtpm xenbus device now requires a
feature-protocol-v2 node in xenstore to avoid conflicts with existing
(xen-patched) kernels supporting the old interface.

While the contents of the shared page have been defined to allow packets
larger than a single page (actually 4088 bytes) by allowing the client
to add extra grant references, the mapping of these extra references has
not been implemented; a feature node in xenstore may be used in the
future to indicate full support for the multi-page protocol. Most uses
of the TPM should not require this feature.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Jan Beulich <JBeulich@suse.com>
12 years agomini-os: implement poll(2)
Wei Liu [Mon, 25 Mar 2013 11:17:30 +0000 (11:17 +0000)]
mini-os: implement poll(2)

It is just a wrapper around select(2). This implementation mimics Linux's
do_poll.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
12 years agoFix emacs local variable block to use correct C style variable.
David Vrabel [Thu, 21 Feb 2013 16:12:46 +0000 (16:12 +0000)]
Fix emacs local variable block to use correct C style variable.

The emacs variable to set the C style from a local variable block is
c-file-style, not c-set-style.

Signed-off-by: David Vrabel <david.vrabel@citrix.com
12 years agomini-os: build fixes for lwip 1.3.2
David Vrabel [Wed, 30 Jan 2013 10:38:37 +0000 (02:38 -0800)]
mini-os: build fixes for lwip 1.3.2

Various fixes to mini-os needed to build lwip 1.3.2:

- Don't build the tests.
- Add BSD-style endianness macros to endian.h.
- free() is called via a function pointer so it needs to be a real
  function.  Do the same for malloc() and realloc().

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Keir Fraser <keir@xen.org>
12 years agomini-os: Fix test application link when various fronts are not enabled.
Samuel Thibault [Wed, 9 Jan 2013 08:44:17 +0000 (08:44 +0000)]
mini-os: Fix test application link when various fronts are not enabled.

When fronts are not enabled, the test application needs to disable the
corresponding tests.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Keir Fraser <keir@xen.org>
12 years agomini-os: Notify shutdown through weak function call instead of wake queue
Samuel Thibault [Wed, 9 Jan 2013 08:43:53 +0000 (08:43 +0000)]
mini-os: Notify shutdown through weak function call instead of wake queue

To allow for more flexibility, this notifies domain shutdown through a
function rather than a wake queue, to let the application use a wake
queue only if it wishes.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Keir Fraser <keir@xen.org>
12 years agomini-os: drop shutdown variables when CONFIG_XENBUS=n
Samuel Thibault [Thu, 6 Dec 2012 09:22:31 +0000 (09:22 +0000)]
mini-os: drop shutdown variables when CONFIG_XENBUS=n

Shutdown variables are meaningless when CONFIG_XENBUS=n since no
shutdown event will ever happen.  Better make sure that no code tries
to use it and never get the hoped shutdown event.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Keir Fraser <keir@xen.org>
12 years agomini-os: shutdown_thread depends on xenbus
Daniel De Graaf [Fri, 30 Nov 2012 21:51:17 +0000 (21:51 +0000)]
mini-os: shutdown_thread depends on xenbus

This fixes the build of the xenstore stub domain, which should never
be shut down and so does not need this feature.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
12 years agominios/console: console_input() weak reference
Andrew Cooper [Fri, 30 Nov 2012 09:37:13 +0000 (09:37 +0000)]
minios/console: console_input() weak reference

In exactly the same style as app_main() in kernel.c, create a weak
reference console_input() function for applications to override to
quickly gain access to the console.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Keir Fraser <keir@xen.org>
12 years ago[minios] Add xenbus shutdown control support
Samuel Thibault [Fri, 30 Nov 2012 09:32:27 +0000 (09:32 +0000)]
[minios] Add xenbus shutdown control support

Add a thread watching the xenbus shutdown control path and notifies a
wait queue.

Add HYPERVISOR_shutdown convenient inline for minios shutdown.

Add proper shutdown to the minios test application.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Keir Fraser <keir@xen.org>
12 years ago[minios] Fix test application link when pcifront is not enabled
Samuel Thibault [Fri, 30 Nov 2012 09:31:58 +0000 (09:31 +0000)]
[minios] Fix test application link when pcifront is not enabled

When pcifront is not enabled, the test application needs to disable
the PCI test.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Keir Fraser <keir@xen.org>
12 years agominios: Update mini-os license to support GPL features
Matthew Fioravante [Mon, 19 Nov 2012 12:59:48 +0000 (12:59 +0000)]
minios: Update mini-os license to support GPL features

This patch updates extras/mini-os/COPYING to explain
which optional features are GPL and what the implications
of enabling them are.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: fix bug in lseek for mini-os
Matthew Fioravante [Mon, 19 Nov 2012 12:59:47 +0000 (12:59 +0000)]
minios: fix bug in lseek for mini-os

lseek always used files[fd].file.offset. It should
use the offset of whatever union member is actually
being used.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: add tpmfront, tpm_tis, and tpmback drivers
Matthew Fioravante [Tue, 13 Nov 2012 10:46:58 +0000 (10:46 +0000)]
minios: add tpmfront, tpm_tis, and tpmback drivers

This patch adds 3 new drivers to mini-os.

tpmfront - paravirtualized tpm frontend driver
tpmback - paravirtualized tpm backend driver
tpm_tis - hardware tpm driver

Unfortunately these drivers were derived from GPL
licensed linux kernel drivers so they must carry
the GPL license. However, since mini-os now
supports conditional compilation, hopefully these
drivers can be included into the xen tree and
conditionally removed from non-gpl projects.
By default they are disabled in the makefile.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: add xenbus_read_uuid
Matthew Fioravante [Tue, 13 Nov 2012 10:46:57 +0000 (10:46 +0000)]
minios: add xenbus_read_uuid

Similar to xenbus_read_integer, this function reads a xenstore path
and parses it as a uuid. See include/xenbus.h for details.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: Disable -DGNT_DEBUG and -DGNTMAP_DEBUG
Matthew Fioravante [Tue, 13 Nov 2012 10:46:56 +0000 (10:46 +0000)]
minios: Disable -DGNT_DEBUG and -DGNTMAP_DEBUG

Disabling the above flags in default mini-os build. They generate a
lot of spam.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: add select definition to sys/time.h when HAVE_LIBC is defined
Matthew Fioravante [Tue, 9 Oct 2012 09:39:09 +0000 (10:39 +0100)]
minios: add select definition to sys/time.h when HAVE_LIBC is defined

This patch adds the select function to sys/time.h when HAVE_LIBC is
defined, which is according to standard (see the select() manpage).
It also removes a redudant lwip include from posix/sys/select.h.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: add posix io for blkfront
Matthew Fioravante [Tue, 9 Oct 2012 09:39:08 +0000 (10:39 +0100)]
minios: add posix io for blkfront

This patch adds posix io support (read,write,lseek) to block devices
using blkfront.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyons.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: setup fpu and sse in mini-os
Matthew Fioravante [Mon, 8 Oct 2012 13:36:31 +0000 (14:36 +0100)]
minios: setup fpu and sse in mini-os

This patch adds floating point and sse support to mini-os by
initializing the floating point unit and the see unit during
domain boot up.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyons.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: add CONFIG_XC conditional
Matthew Fioravante [Mon, 8 Oct 2012 13:36:31 +0000 (14:36 +0100)]
minios: add CONFIG_XC conditional

This patch adds a CONFIG_XC option to mini-os, to allow conditional
support for libxc for mini-os domains.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyons.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: Disable the mfn_is_ram() check, it doesn't work correctly on all systems
Matthew Fioravante [Mon, 8 Oct 2012 13:36:30 +0000 (14:36 +0100)]
minios: Disable the mfn_is_ram() check, it doesn't work correctly on all systems

This patch disables the mfn_is_ram check in mini-os. The current check
is insufficient and fails on some systems with larger than 4gb memory.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyons.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: Add endian, byteswap, and wordsize macros to mini-os
Matthew Fioravante [Mon, 8 Oct 2012 13:36:29 +0000 (14:36 +0100)]
minios: Add endian, byteswap, and wordsize macros to mini-os

This patch addes byte swapping macros and endian support to mini-os.

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyons.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agominios: Add ioread/iowrite functions to mini-os
Matthew Fioravante [Mon, 8 Oct 2012 13:36:28 +0000 (14:36 +0100)]
minios: Add ioread/iowrite functions to mini-os

This patch adds iowritexx() and ioreadxx() functions for interacting
with hardware memory to mini-os. The functions are available in a header
iorw.h

Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyons.org>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agotools: drop ia64 support
Ian Campbell [Wed, 12 Sep 2012 16:55:27 +0000 (17:55 +0100)]
tools: drop ia64 support

Removed support from libxc and mini-os.

This also took me under xen/include/public via various symlinks.

Dropped tools/debugger/xenitp entirely, it was described upon commit
as:
"Xenitp is a low-level debugger for ia64" and doesn't appear to be
linked into the build anywhere.

 99 files changed, 14 insertions(+), 32361 deletions(-)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
12 years agonstore: rename public xenstore headers
Ian Campbell [Mon, 14 May 2012 16:15:36 +0000 (17:15 +0100)]
nstore: rename public xenstore headers

The xenstore header xs.h is producing conflicts with other software[1].

xs is a too short identifier and does not matche the library. Renaming
the headers to xenstore.h and xenstore_lib.h is the easiest way to make
them easy recognizable and prevent furthe problems.

[1]: http://bugs.debian.org/668550

[ Also update QEMU_TAG, to bring in corresponding change to
qemu-xen-traditional. -iwj ]

Signed-off-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
--HG--
rename : tools/xenstore/xs.h => tools/xenstore/xenstore.h
rename : tools/xenstore/xs_lib.h => tools/xenstore/xenstore_lib.h

13 years agominios: Remove unused variables warnings
Ian Campbell [Mon, 20 Feb 2012 18:48:32 +0000 (18:48 +0000)]
minios: Remove unused variables warnings

s/DEBUG/printk/ in test_xenbus and all associated do_*_test+xenbus_dbg_message
and always print the IRQ and MFN used by the xenbus on init.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: John McDermott <john.mcdermott@nrl.navy.mil>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agostubdom: enable xenstored build
Daniel De Graaf [Thu, 9 Feb 2012 18:33:35 +0000 (18:33 +0000)]
stubdom: enable xenstored build

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agomini-os: make frontends and xenbus optional
Daniel De Graaf [Thu, 9 Feb 2012 18:33:32 +0000 (18:33 +0000)]
mini-os: make frontends and xenbus optional

This adds compile-time logic to disable certain frontends in mini-os:
 - pcifront is disabled by default, enabled for ioemu
 - blkfront, netfront, fbfront, kbdfront, consfront are enabled by default
 - xenbus is required for any frontend, and is enabled by default

If all frontends and xenbus are disabled, mini-os will run without
needing to communicate with xenstore, making it suitable to run the
xenstore daemon. The console frontend is not required for the initial
console, only consoles opened via openpt or ptmx.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agomini-os: Move test functions into test.c
Daniel De Graaf [Thu, 9 Feb 2012 18:33:31 +0000 (18:33 +0000)]
mini-os: Move test functions into test.c

While useful, these test functions should not be compiled into every
mini-os instance that we compile.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agomini-os: create app-specific configuration
Daniel De Graaf [Thu, 9 Feb 2012 18:33:31 +0000 (18:33 +0000)]
mini-os: create app-specific configuration

Instead of using CONFIG_QEMU and CONFIG_GRUB to enable or disable minios
code, create CONFIG_ items for features and use application-specific
configuration files to enable or disable the features.

The configuration flags are currently added to the compiler command
line; as the number of flags grows this may need to move to a header.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agomini-os: remove per-fd evtchn limit
Alex Zeffertt [Thu, 9 Feb 2012 18:33:30 +0000 (18:33 +0000)]
mini-os: remove per-fd evtchn limit

This changes the minios evtchn implementation to use a list instead of
an array which ahis allows it to grow as necessary to support any number
of ports, only limited by Xen (NR_EVS is 1024, should be enough for now).

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agomini-os: avoid crash if no console is provided
Daniel De Graaf [Thu, 9 Feb 2012 18:33:30 +0000 (18:33 +0000)]
mini-os: avoid crash if no console is provided

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agomini-os: stop compiler complaint about unused variables
John McDermott [Thu, 9 Feb 2012 16:03:05 +0000 (16:03 +0000)]
mini-os: stop compiler complaint about unused variables

gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) complains about unused variables
in mini-os drivers

Signed-off-by: John McDermott <john.mcdermott@nrl.navy.mil>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agomini-os: use BSD sys/queue.h instead of Linux list.h
Ian Campbell [Tue, 31 Jan 2012 16:06:14 +0000 (16:06 +0000)]
mini-os: use BSD sys/queue.h instead of Linux list.h

The latter is GPL which makes the whole of mini-os GPL rather than BSD
as intended. In tree users are all GPL or GPL-compatible but we should
fix this so that mini-os is BSD. Do so by using the same BSD
sys/queue.h as we use in libxl.

Tested with the builtin mini-os test app and qemu stubdomain, both of which
appear to still function as expected.

Move tools/libxl/external and the associated sed script to
tools/include/xen-external to allow more sensible access from mini-os.

Also add s/NULL/0/ in the sed script due to NULL not always being
defined in stubdom code when mini-os/wait.h is included.

As well as the obvious ABI changes there are a few API updates
associated with the change:

  - struct rw_semaphore.wait_list is unused
  - remove_waiter needs to take the wait_queue_head

The latter requires a qemu update, so there is also a QEMU_TAG
update in this changeset.

I sprinkled some extra-emacs local variables around the files I edited
which didn't have them.

I think this should be backported to the stable branches since
external users of mini-os may have been mislead into thinking they
could safely link mini-os against GPL-incompatible code.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
13 years agomini-os: convert mlock macros to C functions
Olaf Hering [Tue, 31 Jan 2012 11:33:35 +0000 (11:33 +0000)]
mini-os: convert mlock macros to C functions

mlock and munlock are implemented as macros in mini-os. Their usage
requires casting in common code.  Convert them to C syntax and provide
an empty dummy function.  Remove the now unneeded (void) cast from two
munlock calls.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
13 years agomini-os: do not wait for pci backend in pcifront_scan
Ian Campbell [Fri, 9 Dec 2011 12:01:17 +0000 (12:01 +0000)]
mini-os: do not wait for pci backend in pcifront_scan

This blocks the main thread indefinitely if there is no PCI backend present in
xenstore.

Even in the case where there are passthrough devices configured libxl creates
the stubdom and waits for it to startup _before_ adding the backend. Since the
stub domains main thread is blocked before it can write the "running" state to
xenstore the toolstack eventually times out and kills everything.

There is already a separate pcifront thread which waits for the backend to
appear and calls init_pcifront at the appropriate time should a backend ever
appear.

Unfortunately I don't have any free test boxes with VT-d so I haven't been able
to test the cases where PCI deivces are passed through but I obviously have
tested that I can now start an HVM domain with stub qemu without PCI devices
passed through which I couldn't do before so this is an improvement. This stuff
is a bit like pushing the lump around the carpet :-/

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
13 years agomini-os: work around ld bug causing stupid CTOR count
Jeremy Fitzhardinge [Fri, 19 Aug 2011 08:57:42 +0000 (09:57 +0100)]
mini-os: work around ld bug causing stupid CTOR count

I'm seeing pvgrub crashing when running CTORs.  It appears its because
the magic in the linker script is generating junk.  If I get ld to
output a map, I see:

.ctors          0x0000000000097000       0x18
                0x0000000000097000                __CTOR_LIST__ = .
                0x0000000000097000        0x4 LONG 0x25c04
                (((__CTOR_END__ - __CTOR_LIST__) / 0x4) - 0x2)
 *(.ctors)
 .ctors         0x0000000000097004       0x10
                /home/jeremy/hg/xen/unstable/stubdom/mini-os-x86_32-grub/mini-os.o
                0x0000000000097014        0x4 LONG 0x0
                0x0000000000097018                __CTOR_END__ = .

In other words, somehow ((0x97018-0x97000) / 4) - 2 = 0x25c04

The specific crash is that the ctor loop tries to call the NULL
sentinel.  I'm seeing the same with the DTOR list.

Avoid this by terminating the loop with the NULL sentinel, and get rid
of the CTOR count entirely.

From: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Keir Fraser <keir@xen.org>
14 years agomini-os: fix lib.h licence
Samuel Thibault [Sun, 1 May 2011 09:11:58 +0000 (10:11 +0100)]
mini-os: fix lib.h licence

Update the Linux stdio functions prototypes, and move them to a
separate header, licenced under GPL2+.  Import FreeBSD8 string
functions prototypes, update licence.  Drop kvec, of unsure source and
useless anyway.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
14 years agomini-os: lib/math.c: import FreeBSD 8 functions
Samuel Thibault [Sun, 1 May 2011 09:10:12 +0000 (10:10 +0100)]
mini-os: lib/math.c: import FreeBSD 8 functions

Import lib/math.c functions (and thus licence) from FreeBSD 8,
and re-apply a few of our changes. Whitespaces left aside, this
leads to almost no source change except s/int64_t/quad_t/ and
s/uint64_t/u_quad_t/.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
14 years agomini-os: Fix printf.c licence
Samuel Thibault [Sun, 1 May 2011 09:09:47 +0000 (10:09 +0100)]
mini-os: Fix printf.c licence

Changeset df1348e72390 actually completely replaced the freebsd printf
implementation with the Linux printf implementation. Further changes
are extremely minor and thus don't pose IP issue. Fix the licence
accordingly.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
14 years agobuild: Make XEN_ROOT an absolute path.
Keir Fraser [Thu, 17 Mar 2011 10:36:25 +0000 (10:36 +0000)]
build: Make XEN_ROOT an absolute path.

Otherwise make can search the path relative to certain standard paths
such as /usr/include (e.g., the line '-include $(XEN_ROOT)/.config' in
Config.mk suffers from this).

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agominios: do not export {test,set,clear}_bit etc to applications
Ian Campbell [Mon, 7 Feb 2011 12:13:24 +0000 (12:13 +0000)]
minios: do not export {test,set,clear}_bit etc to applications

Fixes ioemu stubdom build:
CC    i386-stubdom/piix4acpi.o
[...]/stubdom/ioemu/hw/piix4acpi.c:272: error: expected ')' before '?' token
[...]/stubdom/ioemu/hw/piix4acpi.c:277: error: conflicting types for 'set_bit'
[...]/stubdom/../extras/mini-os/include/x86/mini-os/os.h:396: error: previous definition of 'set_bit' was here
[...]/stubdom/ioemu/hw/piix4acpi.c:282: error: conflicting types for 'clear_bit'
[...]/stubdom/../extras/mini-os/include/x86/mini-os/os.h:414: error: previous definition of 'clear_bit' was here
[...]/stubdom/ioemu/hw/piix4acpi.c: In function 'gpe_sts_write':

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agominios: Fix bug/build problem introduced in c/s 22799
John Weekes [Thu, 27 Jan 2011 09:37:19 +0000 (09:37 +0000)]
minios: Fix bug/build problem introduced in c/s 22799

With "debug=n", "make stubdom" currently fails in xen-unstable. This
patch addresses this through minor fixups.

Signed-off-by: John Weekes <lists.xen@nuclearfallout.net>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agolibxl, minios: stubdom console based save/restore
Stefano Stabellini [Fri, 21 Jan 2011 18:06:23 +0000 (18:06 +0000)]
libxl, minios: stubdom console based save/restore

Add two "special" PV consoles to stubdoms that are going to be used
to send and receive the qemu-xen save files on save/restore.

Use the second PV console to send the qemu-xen save file and the third
PV console to receive the qemu-xen save file on restore.

Fix the console shutdown function free_consfront that is called when the
qemu save file is closed.

Stubdom save/restore is still broken with xend.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agotools: remove fs-front/fs-back
Tim Deegan [Tue, 11 Jan 2011 18:13:44 +0000 (18:13 +0000)]
tools: remove fs-front/fs-back

Its access controls are really not OK.  In particular, it's not good for
libxl, which stores per-VM config blobs in a directory that is exported
to all VMs.

This will break stub-qemu save/restore, which is the only user of
fs-front that I'm aware of, but:
 - It's currently broken anyway (fs-back isn't run by default and crashes
   if it is run manually); and
 - Stefano has a plan to plumb qemu save records through a dedicated
   console channel instead.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agostubdom/minios: don't retrieve the address of void variable
Gianni Tedesco [Tue, 11 Jan 2011 16:31:47 +0000 (16:31 +0000)]
stubdom/minios: don't retrieve the address of void variable

Objects must not be declared to have type void.  Declare shared_info
to have the appropriate type instead.

Author: Ganni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agostubdom/minios: use correct sized types for software floating point
Samuel Thibault [Tue, 11 Jan 2011 16:30:15 +0000 (16:30 +0000)]
stubdom/minios: use correct sized types for software floating point

Replace long/int/short sizes with proper exact-size types for 64bit
architectures.  As well as making the code correct, this eliminates a
compiler warning about an uninitialised variable.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agominios: use constant expression to size arrays
Gianni Tedesco [Fri, 7 Jan 2011 18:01:18 +0000 (18:01 +0000)]
minios: use constant expression to size arrays

Fixes a compile error in gcc-4.5 which is the reason __CONST_RING_SIZE()
was introduced. Let's just use it in minios netfront.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agominios: reverse layering of xc vs minios fd close
Keir Fraser [Fri, 3 Dec 2010 06:37:48 +0000 (06:37 +0000)]
minios: reverse layering of xc vs minios fd close

Having minios close() call back into the libxc core close routines is
backwards and unexpected. On every other OS the libxc core close
routine calls close().

Export minios specific functions from the minios libxc code to
implement fd closing for each type of xc file handle and simply call
close() in the core close routine.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
14 years agominios: add parentheses to mlock/mulock arguments.
Ian Campbell [Tue, 26 Oct 2010 11:08:10 +0000 (12:08 +0100)]
minios: add parentheses to mlock/mulock arguments.

Fixes warning/build error with non-trivial arguments.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agoMiniOS: Fix continue; in netfront receive loop
Samuel Thibault [Tue, 12 Oct 2010 09:27:56 +0000 (10:27 +0100)]
MiniOS: Fix continue; in netfront receive loop

To properly ignore some requests through the use of continue;, indexes need to
be updated.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

14 years agolibxc: eliminate static variables, use xentoollog; API change
Keir Fraser [Fri, 28 May 2010 08:30:19 +0000 (09:30 +0100)]
libxc: eliminate static variables, use xentoollog; API change

This patch eliminate the global variables in libxenctrl (used for
logging and error reporting).

Instead the information which was in the global variables is now in a
new xc_interface* opaque structure, which xc_interface open returns
instead of the raw file descriptor; furthermore, logging is done via
xentoollog.

There are three new parameters to xc_interface_open to control the
logging, but existing callers can just pass "0" for all three to get
the old behaviour.

All libxc callers have been adjusted accordingly.

Also update QEMU_TAG for corresponding qemu change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agomini-os: Revert 21106:b20f897d6010 "Fix xenbus initialisation"
Keir Fraser [Tue, 4 May 2010 11:15:28 +0000 (12:15 +0100)]
mini-os: Revert 21106:b20f897d6010 "Fix xenbus initialisation"

Jeremy Fitzhardinge (jeremy@goop.org) reports that this fixes HVM+stubdom.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agomini-os: Fix xenbus_switch_state's transaction retry
Keir Fraser [Wed, 7 Apr 2010 07:17:21 +0000 (08:17 +0100)]
mini-os: Fix xenbus_switch_state's transaction retry

When xenbus_switch_state has to retry the transaction which it just
created, it needs to recreate another one.  Clearing xbt triggers it.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
15 years agomini-os: Fix crash on frontend shutdown failures
Keir Fraser [Wed, 7 Apr 2010 07:16:15 +0000 (08:16 +0100)]
mini-os: Fix crash on frontend shutdown failures

Do not free frontend resources if some error happened, since the
backend may not have finished properly restarting in such case.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
15 years agomini-os: Fix frontend shutdown wait loop
Keir Fraser [Wed, 7 Apr 2010 07:15:55 +0000 (08:15 +0100)]
mini-os: Fix frontend shutdown wait loop

minios frontends must wait for backends to be shut down and
reinitialized before freeing resources.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
15 years agomini-os: Fix xenbus initialisation
Keir Fraser [Tue, 6 Apr 2010 06:13:19 +0000 (07:13 +0100)]
mini-os: Fix xenbus initialisation

This fixes xenbus initialization of blkfront, netfront and pcifront
by uniformizing with fbfront: after writing parameters, set state to
initialised, then wait for backend to switch to connect state, and
then only read its parameter and switch to the connect state.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
15 years agomini-os: Do not use the same wait element twice
Keir Fraser [Tue, 6 Apr 2010 06:12:39 +0000 (07:12 +0100)]
mini-os: Do not use the same wait element twice

To enqueue the kbdfront thread on two separate wait queues, we need
two different wait elements.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>