Commit Graph
378 Commits
Author SHA1 Message Date
Ian Campbell 0d819a81ab 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>
2011-12-09 12:01:17 +00:00
Jeremy Fitzhardinge b57bd6d273 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>
2011-08-19 09:57:42 +01:00
Samuel Thibault 3ea1c17457 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>
2011-05-01 10:11:58 +01:00
Samuel Thibault 6f9d5eaa91 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>
2011-05-01 10:10:12 +01:00
Samuel Thibault a6ca982881 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>
2011-05-01 10:09:47 +01:00
Keir Fraser 547cb1849c 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>
2011-03-17 10:36:25 +00:00
Ian Campbell 26f91ef506 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>
2011-02-07 12:13:24 +00:00
John Weekes b920b2c761 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>
2011-01-27 09:37:19 +00:00
Stefano Stabellini 648429dc40 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>
2011-01-21 18:06:23 +00:00
Tim Deegan afadd6ac31 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>
2011-01-11 18:13:44 +00:00
Gianni Tedesco b3c8bef7a7 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>
2011-01-11 16:31:47 +00:00
Samuel Thibault 53424cba44 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>
2011-01-11 16:30:15 +00:00
Gianni Tedesco c761b54d7c 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>
2011-01-07 18:01:18 +00:00
Keir Fraser d5c277ab26 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>
2010-12-03 06:37:48 +00:00
Ian Campbell 26d4c59a0b 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>
2010-10-26 12:08:10 +01:00
Samuel Thibault 0ad4600ac7 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>
2010-10-12 10:27:56 +01:00
Keir Fraser 5cc436c1d2 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>
2010-05-28 09:30:19 +01:00
Keir Fraser 7203b89c15 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>
2010-05-04 12:15:28 +01:00
Keir Fraser cdabe14bff 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>
2010-04-07 08:17:21 +01:00
Keir Fraser 15d5739ea9 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>
2010-04-07 08:16:15 +01:00
Keir Fraser 42e3a21b11 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>
2010-04-07 08:15:55 +01:00
Keir Fraser 453c7b6442 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>
2010-04-06 07:13:19 +01:00
Keir Fraser d98d3c5208 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>
2010-04-06 07:12:39 +01:00
Keir Fraser a816129ee9 minios: Trivial spelling typo fixed.
Sigend-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-03-30 08:36:41 +01:00
Keir Fraser 6127bd73bd minios: implement xc_map_foreign_bulk
In order to do so it modifies map_frames_ex and do_map_frames to take
an int *err as parameter and return any error that way.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2010-01-18 14:48:18 +00:00
Keir Fraser 963bce5e3c mini-os: Fix build error when !HAVE_LIBC
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2009-12-18 07:31:02 +00:00
Keir Fraser bda0da7f26 mini-os: Fix a compilation error in xencons_ring when !HAVE_LIBC
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2009-12-14 11:38:15 +00:00
Keir Fraser 453414b284 mini-os: Fix memory leaks in blkfront, netfront, pcifront, etc.
The return value of Xenbus routines xenbus_transaction_start(),
xenbus_printf(), xenbus_transaction_end(), etc.  is a pointer of error
message.  This pointer should be passed to free() to release the
allocated memory when it is no longer needed.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
2009-12-14 09:51:07 +00:00
Keir Fraser feb567f210 mini-os: Fix memory leaks in xs_read() and xs_write()
xenbus_read() and xenbus_write() will allocate memory for error
message if any error occurs, this memory should be freed.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-12-11 09:01:15 +00:00
Keir Fraser 8ed87184f7 minios: Fix fb/kbd initialization
When allocating kbdfront and fbfront structures, we should zero them
since we do not initialize all fields.

Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
2009-11-23 07:22:28 +00:00
Keir Fraser 375f53964b minios: Fix xenbus_unwatch_path calls
In a lot of places in MiniOS frontends, xenbus_watch_path_token is
used instead of xenbus_watch_path to get more precise wake ups.  To
free those, xenbus_unwatch_path_token has to be used instead of
xenbus_unwatch_path, else the unwatch operation will fail.  This fixes
spurious watch events left by pv-grub.

Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
2009-11-23 07:21:58 +00:00
Keir Fraser 5c3c739758 pcifront: fix multiple initialization bug
Now that we have pcifront_watches to dynamically initialize pcifront
we don't need a call to init_pcifront in pcilib and pcifront_scan
anymore; we should just wait for the frontend to connect to the
backend instead.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-23 07:14:33 +00:00
Keir Fraser f8b6fcaf8f pcifront: implement dynamic connections and disconnections
this patch implements dynamic connections and disconnections in
pcifront.
This feature is required to properly support pci hotplug, because when
no pci devices are assigned to a guest, xend will remove the pci
backend altogether.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-11-13 21:58:30 +00:00
Keir Fraser 4e69eb152e minios: xmalloc and realloc fixes
- xmalloc currently faults if xmalloc_new_page fails due to OOM
 - realloc treats xmalloc_hdr.size as the size of just the data region
   rather than the total size of data region + headers + padding.

From: James Pendergrass <James.Pendergrass@jhuapl.edu>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-29 08:34:51 +00:00
Keir Fraser bee72b5893 minios: Optimize mmap(open("/dev/mem"))
Set map_frames_ex's stride parameter to 0 and increment to 1 to avoid
building an explicit list of mfns.

Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
2009-10-23 09:59:45 +01:00
Keir Fraser 05ec439680 stubdom: mmap on /dev/mem support
This patch adds support for mmap on /dev/mem in a stubdom; it is
secure because it only works for memory areas that have been
explicitly allowed by the toolstack (xc_domain_iomem_permission).
Incidentally this is all that is needed to make MSI-X passthrough work
with stubdoms.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-21 16:08:28 +01:00
Keir Fraser c637aa4f78 minios: fix console end of line: \n\r -> \r\n
Change the end of line produced by minios' console from \n\r to \r\n.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-14 08:58:47 +01:00
Keir Fraser 17af1d38f3 minios: fix minios console
MiniOS' console_print tries to expand '\n' into "\n\r" in place,
causing page faults if the string resides in text.
Use a duplicate of the string instead.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-14 08:55:43 +01:00
Keir Fraser 2757a76076 minios pcifront: translate physical into virtual addresses
Qemu understands physical pci addresses while pciback expects virtual
pci addresses: this patch adds a translation function in pcifront to
make the conversion.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-14 08:31:07 +01:00
Keir Fraser 643898034e stubdom/minios: re-structure headers
As part of making stubdom usable on NetBSD, it is necessary to
restructure the minios headers to avoid conflicts with NetBSD's
crossbuild toolchain.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2009-10-01 12:28:54 +01:00
Keir Fraser 70ad90095b fs-front: cope with a missing fs-backend
Obviously save\restore is not going to work if fs-backend is missing,
but at least the stubdom will be able to work correctly in all the
other cases.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-07-23 08:57:02 +01:00
Keir Fraser 0df54d9807 minios: switch to C99 integer types
This is a necessary step to make minios build on NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-07-15 09:09:48 +01:00
Keir Fraser 02e1301f01 minios: fix free_fbfront
When a stubdom is destroyed, fbfront tries to unbind the evtchn
twice.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-27 10:39:10 +01:00
Keir Fraser 1a965f0e72 minios: add few missing constants in limits.h
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-25 14:30:00 +01:00
Keir Fraser 8f771d00bf minios: Use posix_openpt() rather than non-standard openpty().
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-18 10:19:25 +01:00
Keir Fraser c12b25aa7d minios: support secondary guest consoles.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-17 07:22:18 +01:00
Keir Fraser 6f1d3ce238 Introduce mechanism to check standard conformance of headers
While pretty simplistic, it appears to serve the purpose at the moment
(i.e. it spotted two places where a GNU extension was used withou
proper preprocessor conditionals). The "simplistic" here includes that
the checking gets only done for native builds, and ia64 gets excluded
due to its arch-specific header intentionally (for whatever reason)
checking that anonymous struct/unions can be used.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2009-06-17 07:21:03 +01:00
Keir Fraser 83fd7b933e minios: Introduce BSD license COPYING file
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-04 10:35:03 +01:00
Keir Fraser eedc9ebb14 minios: Clean up and remove Linux remnants from x86_64.S
Sigend-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-06-03 18:27:05 +01:00
Keir Fraser 8323478d5b minios: refactor xenbus state machine
Implement xenbus_wait_for_state_change and xenbus_switch_state and
change the various frontends to use the two functions and do proper
error checking.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-06-03 11:09:14 +01:00