]> xenbits.xensource.com Git - mini-os.git/log
mini-os.git
17 months agoMini-OS: add EXPORT_SYMBOL() instances to gntmap.c
Juergen Gross [Mon, 27 Nov 2023 10:25:08 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to gntmap.c

Add the needed instances of EXPORT_SYMBOL() to gntmap.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to events.c
Juergen Gross [Mon, 27 Nov 2023 10:25:07 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to events.c

Add the needed instances of EXPORT_SYMBOL() to events.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to console.c
Juergen Gross [Mon, 27 Nov 2023 10:25:06 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to console.c

Add the needed instances of EXPORT_SYMBOL() to console.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to main.c
Juergen Gross [Mon, 27 Nov 2023 10:25:05 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to main.c

Add the needed instances of EXPORT_SYMBOL() to main.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to lib/xs.c
Juergen Gross [Mon, 27 Nov 2023 10:25:04 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to lib/xs.c

Add the needed instances of EXPORT_SYMBOL() to lib/xs.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to lib/xmalloc.c
Juergen Gross [Mon, 27 Nov 2023 10:25:03 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to lib/xmalloc.c

Add the needed instances of EXPORT_SYMBOL() to lib/xmalloc.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to lib/ctype.c
Juergen Gross [Mon, 27 Nov 2023 10:25:02 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to lib/ctype.c

Add the needed instances of EXPORT_SYMBOL() to lib/ctype.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to lib/printf.c
Juergen Gross [Mon, 27 Nov 2023 10:25:01 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to lib/printf.c

Add the needed instances of EXPORT_SYMBOL() to lib/printf.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to lib/math.c
Juergen Gross [Mon, 27 Nov 2023 10:25:00 +0000 (11:25 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to lib/math.c

Add the needed instances of EXPORT_SYMBOL() to lib/math.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to lib/string.c
Juergen Gross [Mon, 27 Nov 2023 10:24:59 +0000 (11:24 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to lib/string.c

Add the needed instances of EXPORT_SYMBOL() to lib/string.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to lib/sys.c
Juergen Gross [Mon, 27 Nov 2023 10:24:58 +0000 (11:24 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to lib/sys.c

Add the needed instances of EXPORT_SYMBOL() to lib/sys.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to mm.c
Juergen Gross [Mon, 27 Nov 2023 10:24:57 +0000 (11:24 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to mm.c

Add the needed instances of EXPORT_SYMBOL() to mm.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to sched.c
Juergen Gross [Mon, 27 Nov 2023 10:24:56 +0000 (11:24 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to sched.c

Add the needed instances of EXPORT_SYMBOL() to sched.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to hypervisor.c
Juergen Gross [Mon, 27 Nov 2023 10:24:55 +0000 (11:24 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to hypervisor.c

Add the needed instances of EXPORT_SYMBOL() to hypervisor.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: add EXPORT_SYMBOL() instances to kernel.c
Juergen Gross [Mon, 27 Nov 2023 10:24:54 +0000 (11:24 +0100)]
Mini-OS: add EXPORT_SYMBOL() instances to kernel.c

Add the needed instances of EXPORT_SYMBOL() to kernel.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: explicitly mark symbols to be visible for apps
Juergen Gross [Mon, 27 Nov 2023 10:24:53 +0000 (11:24 +0100)]
Mini-OS: explicitly mark symbols to be visible for apps

Add an EXPORT_SYMBOL() macro to explicitly mark a symbol to be visible
for an app or library linked with Mini-OS. This prepares hiding all
other symbols from external components, avoiding any problems with
duplicate symbol names.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: link kernel separately
Juergen Gross [Mon, 27 Nov 2023 10:24:52 +0000 (11:24 +0100)]
Mini-OS: link kernel separately

Add an additional link step with linking all Mini-OS kernel binaries
into a single object file.

This is done in preparation of hiding Mini-OS internal symbols before
linking the kernel with libraries and an application.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: fix 9pfs response receiving
Juergen Gross [Tue, 21 Nov 2023 09:49:53 +0000 (10:49 +0100)]
Mini-OS: fix 9pfs response receiving

When copying a 9pfs response chunk from the ring buffer across the
ring end, the local ring pointer and length field are not updated
correctly. Fix that.

Fixes: 0924fec1de58 ("Mini-OS: add 9pfs transport layer")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: fix 9pfs stat receive format
Juergen Gross [Tue, 21 Nov 2023 09:49:52 +0000 (10:49 +0100)]
Mini-OS: fix 9pfs stat receive format

The format string of the received data for the 9pfs stat command is
missing the initial 2 byte total length specifier. Add it.

Fixes: 2d1dfccd3aa3 ("Mini-OS: add read and write support to 9pfsfront")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
17 months agoMini-OS: don't crash if no shutdown node is available
Juergen Gross [Tue, 21 Nov 2023 09:49:51 +0000 (10:49 +0100)]
Mini-OS: don't crash if no shutdown node is available

It might be perfectly fine not to have a control/shutdown Xenstore
node. If this is the case, don't crash, but just terminate the
shutdown thread after issuing a message that shutdown isn't available.

In fini_shutdown() clearing the watch can result in an error now, in
case the early exit above was taken. Just ignore this error now.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
17 months agoMini-OS: get own domid
Juergen Gross [Tue, 21 Nov 2023 09:49:50 +0000 (10:49 +0100)]
Mini-OS: get own domid

Get the own domid via creation of a temporary event channel. There is
no "official" way to read the own domid in PV guests, so use the event
channel interface to get it:

- allocate an unbound event channel specifying DOMID_SELF for the
  other end

- read the event channel status which will contain the own domid in
  unbound.dom

- close the event channel

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
17 months agoMini-OS: make xenstore_buf externally visible
Juergen Gross [Tue, 21 Nov 2023 09:49:49 +0000 (10:49 +0100)]
Mini-OS: make xenstore_buf externally visible

For support of the 9pfs frontend in Xenstore-stubdom xenstore_buf
needs to be externally visible.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
18 months agobuild: silence GNU ld 2.39 warning about executable stacks
Jan Beulich [Thu, 2 Nov 2023 07:25:59 +0000 (08:25 +0100)]
build: silence GNU ld 2.39 warning about executable stacks

While for C files the compiler is supposed to arrange for emitting
respective information, for assembly sources we're responsible ourselves.

For the new use of cc-option to work we cannot pass -S to the compiler
anymore. We need the compiler to actually invoke the assembler, so switch
to using -c.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: add read and write support to 9pfsfront
Juergen Gross [Mon, 13 Feb 2023 08:44:12 +0000 (09:44 +0100)]
Mini-OS: add read and write support to 9pfsfront

Add support to read from and write to a file handled by 9pfsfront.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: add open and close handling to the 9pfs frontend
Juergen Gross [Mon, 13 Feb 2023 08:44:11 +0000 (09:44 +0100)]
Mini-OS: add open and close handling to the 9pfs frontend

Add the open() and close() support to the 9pfs frontend. This requires
to split the path name and to walk to the desired directory level.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: add 9pfs transport layer
Juergen Gross [Mon, 13 Feb 2023 08:44:10 +0000 (09:44 +0100)]
Mini-OS: add 9pfs transport layer

Add the transport layer of 9pfs. This is basically the infrastructure
to send requests to the backend and to receive the related answers via
the rings.

As a first example add the version and attach requests of the 9pfs
protocol when mounting a new 9pfs device. For the version use the
"9P2000.u" variant, as it is the smallest subset supported by the qemu
based backend.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: add 9pfs frontend
Juergen Gross [Mon, 13 Feb 2023 08:44:09 +0000 (09:44 +0100)]
Mini-OS: add 9pfs frontend

Add a frontend for the 9pfs PV device. For now add only the code needed
to connect to the backend and the related disconnect functionality. The
9pfs protocol support will be added later.

Due to its nature (ability to access files) the whole code is guarded
by "#ifdef HAVE_LIBC".

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: add support for runtime mounts
Juergen Gross [Mon, 13 Feb 2023 08:44:08 +0000 (09:44 +0100)]
Mini-OS: add support for runtime mounts

Add the support to mount a device at runtime. The number of dynamic
mounts is limited by a #define.

For devices supporting multiple files struct file is modified to hold
a pointer to file specific data in contrast to device specific data.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: add concept of mount points
Juergen Gross [Mon, 13 Feb 2023 08:44:07 +0000 (09:44 +0100)]
Mini-OS: add concept of mount points

Add the concept of mount points to Mini-OS. A mount point is a path
associated with a device pointer and an open() callback. A mount point
can be either a file (e.g. "/dev/mem") or a directory ("/var/log").

This allows to replace the special casing in the generic open()
handling with a generic mount point handling.

Prepare the open() callbacks to support creating new files by adding a
mode parameter.

Additionally add a close() prototype to include/lib.h, as it is missing
today.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: xenbus: add support for reading node from directory
Juergen Gross [Mon, 13 Feb 2023 08:44:06 +0000 (09:44 +0100)]
Mini-OS: xenbus: add support for reading node from directory

Especially PV device drivers often need to read multiple Xenstore
nodes from a common directory. Add support for reading a string or an
unsigned value by specifying the directory and the node.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: move xenbus test code into test.c
Juergen Gross [Fri, 27 Jan 2023 07:33:46 +0000 (08:33 +0100)]
Mini-OS: move xenbus test code into test.c

The test code in xenbus.c can easily be moved into test.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMini-OS: remove stale subdirs from Makefile
Juergen Gross [Fri, 27 Jan 2023 07:32:44 +0000 (08:32 +0100)]
Mini-OS: remove stale subdirs from Makefile

The SUBDIRS make variable has some stale entries, remove them.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: fix bug in ballooning on PVH xen-4.17.0-rc4 xen-4.18.0-rc4 xen-4.18.0-rc5 xen-RELEASE-4.17.0 xen-RELEASE-4.17.1 xen-RELEASE-4.17.3 xen-RELEASE-4.18.0 xen-RELEASE-4.18.1
Juergen Gross [Tue, 21 Jun 2022 07:23:14 +0000 (09:23 +0200)]
mini-os: fix bug in ballooning on PVH

There is a subtle bug in ballooning code for PVH: in case ballooning
extends above a non-RAM area of the memory map, wrong pages will be
used.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: fix number of pages for PVH
Juergen Gross [Tue, 21 Jun 2022 07:23:13 +0000 (09:23 +0200)]
mini-os: fix number of pages for PVH

When getting the current allocation from Xen, this value includes the
pages allocated in the MMIO area. Fix the highest available RAM page
by subtracting the size of that area.

This requires to read the E820 map before needing this value. Add two
functions returning the current and the maximum number of RAM pages
taking this correction into account.

At the same time add the LAPIC page to the memory map in order to
avoid reusing that PFN for internal purposes.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: prefer memory map via start_info for PVH
Juergen Gross [Tue, 21 Jun 2022 07:23:12 +0000 (09:23 +0200)]
mini-os: prefer memory map via start_info for PVH

Since some time now a guest started in PVH mode will get the memory
map from Xen via the start_info structure.

Modify the PVH initialization to prefer this memory map over the one
obtained via hypercall, as this will allow to add information to the
memory map for a new kernel when supporting kexec.

In case the start_info structure doesn't contain memory map information
fall back to the hypercall.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: take newest version of arch-x86/hvm/start_info.h
Juergen Gross [Tue, 21 Jun 2022 07:23:11 +0000 (09:23 +0200)]
mini-os: take newest version of arch-x86/hvm/start_info.h

Update include/xen/arch-x86/hvm/start_info.h to the newest version
from the Xen tree.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: add mini-os-debug[.gz] to .gitignore
Juergen Gross [Mon, 20 Jun 2022 07:38:20 +0000 (09:38 +0200)]
mini-os: add mini-os-debug[.gz] to .gitignore

mini-os-debug and mini-os-debug.gz are created when building Mini-OS,
add them to .gitignore.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: apply coding style to console.c
Juergen Gross [Mon, 20 Jun 2022 07:38:19 +0000 (09:38 +0200)]
mini-os: apply coding style to console.c

Make console.c coding style compliant.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: eliminate console directory
Juergen Gross [Mon, 20 Jun 2022 07:38:18 +0000 (09:38 +0200)]
mini-os: eliminate console directory

Merge the two remaining source files in the console directory into
a single one and move it to the main directory.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: apply coding style to consfront.c
Juergen Gross [Mon, 20 Jun 2022 07:38:17 +0000 (09:38 +0200)]
mini-os: apply coding style to consfront.c

Make consfront.c coding style compliant.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: rename console/xenbus.c to consfront.c
Juergen Gross [Mon, 20 Jun 2022 07:38:16 +0000 (09:38 +0200)]
mini-os: rename console/xenbus.c to consfront.c

Move console/xenbus.c into the main directory and rename it to
consfront.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: eliminate console/console.h
Juergen Gross [Mon, 20 Jun 2022 07:38:15 +0000 (09:38 +0200)]
mini-os: eliminate console/console.h

console/console.h contains only a single prototype. Move that to
include/console.h and remove console/console.h.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: apply coding style to xenbus.c
Juergen Gross [Mon, 20 Jun 2022 07:38:14 +0000 (09:38 +0200)]
mini-os: apply coding style to xenbus.c

Make xenbus.c coding style compliant.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agomini-os: drop xenbus directory
Juergen Gross [Mon, 20 Jun 2022 07:38:13 +0000 (09:38 +0200)]
mini-os: drop xenbus directory

The xenbus directory contains only a single source. Move this source
up and remove the xenbus directory.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agofix wrong function declaration
Juergen Gross [Wed, 19 Jan 2022 13:06:00 +0000 (14:06 +0100)]
fix wrong function declaration

Coverity spotted a wrong function declaration, fix it.

Coverity-Id: 1497423
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
3 years agomake files array private to sys.c
Juergen Gross [Sun, 16 Jan 2022 08:33:28 +0000 (09:33 +0100)]
make files array private to sys.c

There is no user of the files[] array outside of lib/sys.c left, so
it can be made static.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoadd struct file_ops for FTYPE_FILE
Juergen Gross [Sun, 16 Jan 2022 08:33:27 +0000 (09:33 +0100)]
add struct file_ops for FTYPE_FILE

FTYPE_FILE is the last relevant file type without a struct file_ops.
Add it.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoadd struct file_ops for file type socket
Juergen Gross [Sun, 16 Jan 2022 08:33:26 +0000 (09:33 +0100)]
add struct file_ops for file type socket

Even with some special handling needed in select_poll(), add a struct
file_ops for FTYPE_SOCKET. Due to the need of the special handling it
isn't possible to use a dynamically allocated file type.

Most functions calling the file_ops methods can be simplified a lot now
that no file type specific handling is left. Same applies to the file
type name printing in debug/verbose mode.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agouse file_ops and get_file_from_fd() for console
Juergen Gross [Sun, 16 Jan 2022 08:33:25 +0000 (09:33 +0100)]
use file_ops and get_file_from_fd() for console

Add struct file_ops for the console related file types (FTYPE_CONSOLE
and savefile). FTYPE_CONSOLE remains statically defined, as it is used
to statically init stdin, stdout and stderr.

Instead of directly accessing the files[] array use get_file_from_fd().

With CONSOLE now handled via file_ops the bogus file descriptor case in
select_poll() now needs to be handled more explicit instead of dropping
into console handling, assuming that this case was basically meant to
cover SAVEFILE.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agouse alloc_file_type() and get_file_from_fd() in fbfront
Juergen Gross [Sun, 16 Jan 2022 08:33:24 +0000 (09:33 +0100)]
use alloc_file_type() and get_file_from_fd() in fbfront

Allocate file types dynamically via alloc_file_type().

Instead of directly accessing the files[] array use get_file_from_fd().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agouse alloc_file_type() and get_file_from_fd() in netfront
Juergen Gross [Sun, 16 Jan 2022 08:33:23 +0000 (09:33 +0100)]
use alloc_file_type() and get_file_from_fd() in netfront

Allocate the file type dynamically via alloc_file_type().

Instead of directly accessing the files[] array use get_file_from_fd().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agouse alloc_file_type() and get_file_from_fd() in blkfront
Juergen Gross [Sun, 16 Jan 2022 08:33:22 +0000 (09:33 +0100)]
use alloc_file_type() and get_file_from_fd() in blkfront

Allocate the file type dynamically via alloc_file_type().

Instead of directly accessing the files[] array use get_file_from_fd().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agouse alloc_file_type() and get_file_from_fd() in tpmfront
Juergen Gross [Sun, 16 Jan 2022 08:33:21 +0000 (09:33 +0100)]
use alloc_file_type() and get_file_from_fd() in tpmfront

Allocate a file type dynamically via alloc_file_type().

Instead of directly accessing the files[] array use get_file_from_fd().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agouse alloc_file_type() and get_file_from_fd() in tpm_tis
Juergen Gross [Sun, 16 Jan 2022 08:33:20 +0000 (09:33 +0100)]
use alloc_file_type() and get_file_from_fd() in tpm_tis

Allocate a file type dynamically via alloc_file_type().

Instead of directly accessing the files[] array use get_file_from_fd().

Make some now local functions static and modify their prototypes to
match the file_ops requirements.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agouse alloc_file_type() and get_file_from_fd() in xs
Juergen Gross [Sun, 16 Jan 2022 08:33:19 +0000 (09:33 +0100)]
use alloc_file_type() and get_file_from_fd() in xs

Allocate the needed file type via alloc_file_type().

Instead of directly accessing the files[] array use get_file_from_fd().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoremove gnttab specific member from struct file
Juergen Gross [Sun, 16 Jan 2022 08:33:18 +0000 (09:33 +0100)]
remove gnttab specific member from struct file

The gnttab specific union member in struct file is no longer
needed, so remove it.

The gnttab file type and its associated handling can be removed, too,
as libxengnttab is now supplying a struct file_ops via a call of
alloc_file_type().

This removes all contents of CONFIG_LIBXENGNTTAB guarded sections, so
this config option can be removed.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoremove event channel specific struct file definitions
Juergen Gross [Sun, 16 Jan 2022 08:33:17 +0000 (09:33 +0100)]
remove event channel specific struct file definitions

The event channel specific union member in struct file is no longer
needed, so remove it together with the associated structure
definitions.

The event channel file type and its associated handling can be removed,
too, as libxenevtchn is now supplying a struct file_ops via a call of
alloc_file_type().

This removes all contents of CONFIG_LIBXENEVTCHN guarded sections, so
this config option can be removed.

Add an extern declaration for event_queue as it is used by
libxenevtchn.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoadd CONFIG_LIBXS item
Juergen Gross [Sun, 16 Jan 2022 06:45:27 +0000 (07:45 +0100)]
add CONFIG_LIBXS item

Mini-OS contains a stripped down version of libxenstore in lib/xs.c.
Today it is being built always if CONFIG_XENBUS is set and libc
support is enabled.

In order to allow a Mini-OS specific build of libxenstore to be used
instead add a new CONFIG_LIBXS item which per default will have the
same setting as CONFIG_XENBUS. A user wanting to replace lib/xs.c
with libxenstore would just need to set CONFIG_XENBUS=y and
CONFIG_LIBXS=n.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agouse function vectors instead of switch for file operations
Juergen Gross [Sun, 16 Jan 2022 06:45:26 +0000 (07:45 +0100)]
use function vectors instead of switch for file operations

Introduce file type specific function vectors for all the needed file
operations which are file type specific in order to prepare replacing
the large switch statements in each generic file function.

Add a function to allocate a new file type dynamically in order to
prepare removing direct dependencies to external components in the
future. For this reason switch the file type from an enum to an
unsigned int. Prepare removal of some statically defines file types
by putting them at the end of the defined list.

Change the debug output for the file type from a single character to
a string in order to support a future removal of the file_types[]
array.

Provide some functions useful for file_ops in future patches.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoremove file type FTYPE_XC
Juergen Gross [Sun, 16 Jan 2022 06:45:25 +0000 (07:45 +0100)]
remove file type FTYPE_XC

The only reason for the file type FTYPE_XC has been gone long time
ago: it was needed for xc_map_foreign_bulk(), which has been switched
to use libxenforeignmemory and doesn't need this special file any
more.

So remove everything related to FTYPE_XC.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoreset file type in close() in one place only
Juergen Gross [Sun, 16 Jan 2022 06:45:24 +0000 (07:45 +0100)]
reset file type in close() in one place only

Today the file type in struct file is set to FTYPE_NONE for each
file type individually. Do that at the end of close() handling for
all types.

While at it wipe the complete struct file, too, in order to avoid
old data creeping into a new allocated struct file.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agointroduce get_file_from_fd()
Juergen Gross [Sun, 16 Jan 2022 06:45:23 +0000 (07:45 +0100)]
introduce get_file_from_fd()

Exporting the files[] array especially for components outside the
mini-os source tree is limiting the ability to change any file handling
in mini-os.

Introduce a new function get_file_from_fd() to return the struct file
pointer (or NULL) for a given file descriptor.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoEliminate xenbus union member in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:13 +0000 (15:58 +0100)]
Eliminate xenbus union member in struct file

Replace the xenbus specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoEliminate tpmtis union member in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:12 +0000 (15:58 +0100)]
Eliminate tpmtis union member in struct file

Replace the tpmtis specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoEliminate tpmfront union member in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:11 +0000 (15:58 +0100)]
Eliminate tpmfront union member in struct file

Replace the tpmfront specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoMove tpm respgot member of struct file to device specific data
Juergen Gross [Tue, 11 Jan 2022 14:58:10 +0000 (15:58 +0100)]
Move tpm respgot member of struct file to device specific data

Tpmfront has a "respgot" flag in struct file, which can be moved to the
device specific data. While at it make it a bool.

The respgot flag of the tpm_tis member of struct file can be removed,
as it is never read.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoEliminate netfront union member in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:09 +0000 (15:58 +0100)]
Eliminate netfront union member in struct file

Replace the netfront specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoEliminate kbdfront union member in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:08 +0000 (15:58 +0100)]
Eliminate kbdfront union member in struct file

Replace the kbdfront specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoEliminate fbfront union member in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:07 +0000 (15:58 +0100)]
Eliminate fbfront union member in struct file

Replace the fbfront specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoEliminate consfront union member in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:06 +0000 (15:58 +0100)]
Eliminate consfront union member in struct file

Replace the consfront specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoEliminate blkfront union member in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:05 +0000 (15:58 +0100)]
Eliminate blkfront union member in struct file

Replace the blkfront specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoIntroduce a common dev pointer in struct file
Juergen Gross [Tue, 11 Jan 2022 14:58:04 +0000 (15:58 +0100)]
Introduce a common dev pointer in struct file

There are many dev pointers in a union in struct file. Prepare to
switch to a single one by introducing a new common one.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoReplace multiple fd elements in struct file by common one
Juergen Gross [Tue, 11 Jan 2022 14:58:03 +0000 (15:58 +0100)]
Replace multiple fd elements in struct file by common one

The type specific union in struct files contains two instances of
"int fd". Replace them by a common one.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoMake offset a common struct file member for all types
Juergen Gross [Tue, 11 Jan 2022 14:58:02 +0000 (15:58 +0100)]
Make offset a common struct file member for all types

Currently 4 file types have an offset member in their private struct
file part. Make offset a common struct member shared by all file types.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoMake file.read bool and move it ahead of device specific part
Juergen Gross [Tue, 11 Jan 2022 14:58:01 +0000 (15:58 +0100)]
Make file.read bool and move it ahead of device specific part

The read member of struct file should be bool.

In order to have the device specific part at the end of the structure
move "read" ahead of that.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoSplit struct file definition from its usage
Juergen Gross [Tue, 11 Jan 2022 14:58:00 +0000 (15:58 +0100)]
Split struct file definition from its usage

Make the struct file definition standalone and use it for the
declaration of the files array.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: modify grant mappings to work in PVH mode
Juergen Gross [Tue, 21 Dec 2021 08:46:36 +0000 (09:46 +0100)]
mini-os: modify grant mappings to work in PVH mode

For being able to use the grant mapping interface in PVH mode some
changes are required, as the guest needs to specify a physical address
in the hypercall interface.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: prepare grantmap entry interface for use by PVH mode
Juergen Gross [Tue, 21 Dec 2021 08:46:35 +0000 (09:46 +0100)]
mini-os: prepare grantmap entry interface for use by PVH mode

Instead of passing the pointer of a grantmap entry to the
_gntmap_[un]map_grant_ref() sub-functions use the map pointer and the
entry index instead. This will be needed for PVH mode usage.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: add proper pvh grant table handling
Juergen Gross [Tue, 21 Dec 2021 08:46:34 +0000 (09:46 +0100)]
mini-os: add proper pvh grant table handling

Grant table initialization for PVH requires some additional actions
compared to PV mode. Add those.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: move x86 specific gnttab coding into arch/x86/gnttab.c
Juergen Gross [Tue, 21 Dec 2021 08:46:33 +0000 (09:46 +0100)]
mini-os: move x86 specific gnttab coding into arch/x86/gnttab.c

Having grant table code in arch/x86/mm.c seems wrong. Move it to the
new file arch/x86/gnttab.c, especially as the amount of code is
expected to grow further.

While doing that replace  type casts to pte_t with the more appropriate
__pte() macro.

No functional change.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: add memory map service functions
Juergen Gross [Tue, 21 Dec 2021 08:46:32 +0000 (09:46 +0100)]
mini-os: add memory map service functions

Add two functions for adding reserved areas to the memory map and
for removing them again.

Those will be needed for proper grant table/mapping support in PVH
mode.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: don't repeat definition available via header file
Juergen Gross [Tue, 21 Dec 2021 08:46:31 +0000 (09:46 +0100)]
mini-os: don't repeat definition available via header file

arch/x86/setup.c is repeating the definition of __pte() instead using
the appropriate header. Fix that.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: respect memory map when ballooning up
Juergen Gross [Tue, 21 Dec 2021 08:46:30 +0000 (09:46 +0100)]
mini-os: respect memory map when ballooning up

Today Mini-OS won't look at the memory map when ballooning up. This can
result in problems for PVH domains with more than 4 GB of RAM, as
ballooning will happily run into the ACPI area.

Fix that by adding only pages being marked as RAM in the memory map and
by distinguishing between the current number of RAM pages and the first
unallocated page.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: don't assume contiguous RAM when initializing in PVH mode
Juergen Gross [Tue, 21 Dec 2021 08:46:29 +0000 (09:46 +0100)]
mini-os: don't assume contiguous RAM when initializing in PVH mode

Sizing the available memory should respect memory holes, so look at
the memory map when setting the boundary for the memory allocator.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: sort and sanitize e820 memory map
Juergen Gross [Tue, 21 Dec 2021 08:46:28 +0000 (09:46 +0100)]
mini-os: sort and sanitize e820 memory map

Do some processing of the E820 memory map obtained from the hypervisor:

- align the entries to page boundaries
- sort the entries by their start address
- merge adjacent entries of same type

This is relevant for PVH mode only.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: split e820 map handling into new source file
Juergen Gross [Tue, 21 Dec 2021 08:46:27 +0000 (09:46 +0100)]
mini-os: split e820 map handling into new source file

Introduce e820.c containing all the E820 memory map handling.

No functional change.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agoxenbus: support large messages
Juergen Gross [Mon, 4 Oct 2021 09:40:00 +0000 (11:40 +0200)]
xenbus: support large messages

Today the implementation of the xenbus protocol in Mini-OS will only
allow to transfer the complete message to or from the ring page buffer.
This is limiting the maximum message size to lower values as the xenbus
protocol normally would allow.

Change that by allowing to transfer the xenbus message in chunks as
soon as they are available.

Avoid crashing Mini-OS in case of illegal data read from the ring
buffer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: add config options for xen libraries
Juergen Gross [Mon, 4 Oct 2021 14:19:24 +0000 (16:19 +0200)]
mini-os: add config options for xen libraries

Today close hooks into libxenctrl, libxenevtchn and libxengnttab are
under the CONFIG_XC umbrella. In order to support Mini-OS builds using
stable Xen libraries only, add CONFIG_LIBXENCTRL, CONFIG_LIBXENEVTCHN
and CONFIG_LIBXENGNTTAB config options.

In case CONFIG_XC was specified in the Mini-OS config explicitly, set
the three new variables to the specified value.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: fix testbuilds regarding CONFIG_XC
Juergen Gross [Mon, 4 Oct 2021 14:19:23 +0000 (16:19 +0200)]
mini-os: fix testbuilds regarding CONFIG_XC

CONFIG_GC is requiring external support, so disable it in testbuilds.

The only reason this is working right now is its usage being inside
a HAVE_LIBC section.

Make that more obvious by making the default setting of CONFIG_XC
depending on libc being available.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agognttab: drop GNTMAP_can_fail xen-4.16.0-rc4 xen-RELEASE-4.16.0 xen-RELEASE-4.16.1 xen-RELEASE-4.16.2 xen-RELEASE-4.16.3 xen-RELEASE-4.16.4
Jan Beulich [Thu, 26 Aug 2021 10:20:26 +0000 (12:20 +0200)]
gnttab: drop GNTMAP_can_fail

There's neither documentation of what this flag is supposed to mean, nor
any implementation in the hypervisor.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
3 years agomini-os: netfront: fix initialization without ip address in xenstore
Juergen Gross [Thu, 19 Aug 2021 05:30:56 +0000 (07:30 +0200)]
mini-os: netfront: fix initialization without ip address in xenstore

Commit 4821876fcd2ff ("mini-os: netfront: fix suspend/resume handling")
introduced a NULL pointer dereference in the initialization of netfront
in the case of no IP address being set in Xenstore.

Fix that by testing this condition. At the same time fix a long
standing bug for the same condition if someone used init_netfront()
with a non-NULL ip parameter.

Fixes: 4821876fcd2ff ("mini-os: netfront: fix suspend/resume handling")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: move test functions under CONFIG_TEST
Juergen Gross [Tue, 17 Aug 2021 09:54:59 +0000 (11:54 +0200)]
mini-os: move test functions under CONFIG_TEST

There is no need to have the xenbus test support functions always
included in Mini-OS. Move them inside #ifdef CONFIG_TEST.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
3 years agomini-os: make config handling more generic
Juergen Gross [Tue, 17 Aug 2021 09:54:58 +0000 (11:54 +0200)]
mini-os: make config handling more generic

When adding a new CONFIG_ variable this needs to be done in multiple
places. Change the handling to be more generic.

This at once fixes a bug with CONFIG_XC which was not defined for the
C preprocessor (it seems that this never resulted in any real issues,
though).

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
4 years agomini-os: netfront: Handle init failure when no vifs are provided
Costin Lupu [Tue, 15 Dec 2020 16:50:12 +0000 (16:50 +0000)]
mini-os: netfront: Handle init failure when no vifs are provided

These changes deal with the case when no vifs are created. This can happen when
no vif is provided in the config file for mini-os images with netfront support.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Samuel Thibault <samuel.thibault@@ens-lyon.org>
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>