akaros.git
3 years agoFix bug in pthread_sigmask() semantics.
Kevin Klues [Tue, 27 Oct 2015 17:12:37 +0000 (10:12 -0700)]
Fix bug in pthread_sigmask() semantics.

Previously, the 'how' parameter was not being ignored correctly if 'set'
was NULL. Moreover, we were not setting the value of 'oset' properly in
cases where 'set' was NULL and 'how' should be ignored. This patch
attempts to fix these semantics to match the specification in:

http://linux.die.net/man/2/sigprocmask

Signed-off-by: Kevin Klues <klueska@cs.berkeley.edu>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoTabified file carrying spaces
Davide Libenzi [Sun, 1 Nov 2015 01:31:15 +0000 (18:31 -0700)]
Tabified file carrying spaces

Tabified file carrying spaces.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMigrated user memory copy APIs to use the new exception table guards
Davide Libenzi [Sat, 31 Oct 2015 01:31:15 +0000 (18:31 -0700)]
Migrated user memory copy APIs to use the new exception table guards

Migrated user memory copy APIs to use the new exception table guards.
Added string copy APIs as well.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd RISCV uaccess.h
Barret Rhoden [Mon, 16 Nov 2015 21:02:25 +0000 (13:02 -0800)]
Add RISCV uaccess.h

This was written by Davide, but got lost in a rebase involving
6cc759554b02 ("Plugged the exception handling code") on his branch,
which was already c7c7f1ceb352 ("Plugged the exception handling code")
on master.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMake userspace think it has at least one vcore
Barret Rhoden [Fri, 13 Nov 2015 20:29:56 +0000 (15:29 -0500)]
Make userspace think it has at least one vcore

This popped up if you ran Akaros on a single core machine.  In that case, you'd
have 0 CG cores, which means the kernel gives you 0 vcores.  However, SCPs
think they have one vcore.  If a process runs at all, it needs to think it has
at least one vcore.

Rebuild busybox.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUpdate the user Makefrag to be more generic
Kevin Klues [Fri, 13 Nov 2015 02:51:53 +0000 (18:51 -0800)]
Update the user Makefrag to be more generic

This commit updates the makefrag for user libs so that it can handle
libraries that organize their header files using different patterns. As
part of this, we are now able to remove our custom pthread Makefile, as
one of the patterns we now support is the one used by the pthread
library.

Signed-off-by: Kevin Klues <klueska@cs.berkeley.edu>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd space between text and url in ak-code-review
Kevin Klues [Thu, 12 Nov 2015 17:32:56 +0000 (09:32 -0800)]
Add space between text and url in ak-code-review

Signed-off-by: Kevin Klues <klueska@cs.berkeley.edu>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoWhen starting a VM, just copy all registers in.
Ronald G. Minnich [Wed, 11 Nov 2015 01:29:28 +0000 (17:29 -0800)]
When starting a VM, just copy all registers in.

This allows the VMM to initialize registers, which we ought to do.

We need this anyway to pass in a bootparams pointer.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoLet the toolchain Makefile respect MAKE_JOBS environment variable
Edward Hyunkoo Jee [Tue, 10 Nov 2015 19:26:05 +0000 (11:26 -0800)]
Let the toolchain Makefile respect MAKE_JOBS environment variable

Users may want to use environment variables or command-line arguments,
instead of using Makelocal file.

Signed-off-by: Edward Hyunkoo Jee <edjee@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoModified vmx_launch in vmx.c to track the phy core of the vm every exit
GanShun [Wed, 4 Nov 2015 15:24:08 +0000 (07:24 -0800)]
Modified vmx_launch in vmx.c to track the phy core of the vm every exit

This change updates the vmctl every time we exit from the vm to ensure
that we keep track of the correct core to send the IPIs to.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdded Timer thread. Started by consin thread.
GanShun [Tue, 3 Nov 2015 21:18:09 +0000 (13:18 -0800)]
Added Timer thread. Started by consin thread.

Timer thread is started by the consin thread and injects interrupts into the
guest every so often.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMigrated Akaros code to use pragma once (XCC)
Davide Libenzi [Thu, 29 Oct 2015 13:22:45 +0000 (06:22 -0700)]
Migrated Akaros code to use pragma once (XCC)

Migrated Akaros code to use pragma once include file marker.

Rebuild glibc.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
[toolchain notice]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMigrated position dependent initialization, to label based
Davide Libenzi [Tue, 10 Nov 2015 02:31:47 +0000 (18:31 -0800)]
Migrated position dependent initialization, to label based

Migrated position dependent initialization, to label based.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdded kernel test case for command line parsing code
Davide Libenzi [Tue, 3 Nov 2015 12:48:49 +0000 (04:48 -0800)]
Added kernel test case for command line parsing code

Added kernel test case for command line parsing code.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdded support for multiboot protocol command line extraction
Davide Libenzi [Tue, 3 Nov 2015 03:14:32 +0000 (19:14 -0800)]
Added support for multiboot protocol command line extraction

Added support for multiboot protocol command line extraction.
Added API to fetch kernel boot command line parameters.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
[removed unnecessary null-termiate after strlcpy]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRename static_assert to avoid conflicting with C++'11 (and later) (XCC)
Dan Cross [Wed, 4 Nov 2015 19:22:26 +0000 (14:22 -0500)]
Rename static_assert to avoid conflicting with C++'11 (and later) (XCC)

The C++ standard laid claim to the name, 'static_assert' in the
C++'11 standard; our macro caused conflict trying to build C++
programs. Rename ours to avoid the conflict.

C11 also has support for _Static_assert and the 'static_assert'
macro in the 'assert.h' header. We should migrate to that.  This
is an incremental step in that direction.

Signed-off-by: Dan Cross <crossd@gmail.com>
[removed undef of parlib_static_assert; we aren't overriding stuff]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd empty akaros-specific sysmacros.h (XCC)
Dan Cross [Tue, 3 Nov 2015 17:11:03 +0000 (12:11 -0500)]
Add empty akaros-specific sysmacros.h (XCC)

Traditionally, this header file contains macros for
accessing the major and minor portions of a device
number, as well as a macro for combing a (major,minor)
pair into a single dev num. Unfortunately, these macros
can cause conflicts with other code (the identifiers
are too generic). Since Akaros doesn't use device
numbers, we can just have an empty file.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoPatch Busybox to use it's own version of major/minor/makedev macros
Dan Cross [Tue, 3 Nov 2015 21:19:13 +0000 (16:19 -0500)]
Patch Busybox to use it's own version of major/minor/makedev macros

These are needed for compatibility with legacy file formats (e.g.,
tar, cpio), but are absent from Akaros proper.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd a set of ak-scripts for use by docopt-scripts
Kevin Klues [Tue, 3 Nov 2015 15:45:57 +0000 (07:45 -0800)]
Add a set of ak-scripts for use by docopt-scripts

The docopt-scripts tool provides a framework for invoking a collection
of bash scripts through a single command line interface. Its purpose is
to ease the development of these scripts with well-formed usage
semantics from docopt and collect them into a single place for easy
access.

The docopt-scripts tool can be downloaded from here:
https://github.com/google/docopt-scripts

Signed-off-by: Kevin Klues <klueska@cs.berkeley.edu>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemove unnecessary #if.
Dan Cross [Mon, 2 Nov 2015 15:28:35 +0000 (10:28 -0500)]
Remove unnecessary #if.

Remove a #if that sets a prerequisite for GCC 4.4.  No one
uses gcc 4.4 anymore, and our toolbase is based around gcc
4.9.2 so this is unnecessary.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMade the timer interrupt setup callback consistent in behavior
Davide Libenzi [Sat, 31 Oct 2015 23:02:18 +0000 (16:02 -0700)]
Made the timer interrupt setup callback consistent in behavior

Made the timer interrupt setup callback consistent in behavior among
local and remote CPU invocation.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
[touched up checkpatch warnings]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd networking unit tests
Xiao Jia [Wed, 28 Oct 2015 00:36:41 +0000 (17:36 -0700)]
Add networking unit tests

Currently it includes a unit test for ptclbsum, and unit tests for
checksum benchmark.

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix manager to run tests if KERNEL_TESTING is set
Xiao Jia [Wed, 28 Oct 2015 00:36:40 +0000 (17:36 -0700)]
Fix manager to run tests if KERNEL_TESTING is set

KERNEL_POSTBOOT_TESTING is not defined, and if USERSPACE_TESTING is
disabled, we won't run any unit tests, which is not right.

Fix it by letting the tests run whenever KERNEL_TESTING is present.

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoExplain why ptclcsum_finalize is correct
Xiao Jia [Wed, 28 Oct 2015 00:36:39 +0000 (17:36 -0700)]
Explain why ptclcsum_finalize is correct

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix ptclbsum to handle odd offsets
Xiao Jia [Wed, 28 Oct 2015 00:36:38 +0000 (17:36 -0700)]
Fix ptclbsum to handle odd offsets

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix ptclcsum_one to adjust odd
Xiao Jia [Wed, 28 Oct 2015 00:36:37 +0000 (17:36 -0700)]
Fix ptclcsum_one to adjust odd

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix typo for TCP checksum offload feature
Xiao Jia [Wed, 28 Oct 2015 00:36:36 +0000 (17:36 -0700)]
Fix typo for TCP checksum offload feature

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agomlx4: Temporarily disable offload features
Xiao Jia [Wed, 28 Oct 2015 00:36:35 +0000 (17:36 -0700)]
mlx4: Temporarily disable offload features

Temporarily disable offload features before they are implemented.
This also allows us to test TCP before actually implementing them.

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agomlx4: Allow override MLX4_DEFAULT_MGM_LOG_ENTRY_SIZE
Xiao Jia [Wed, 28 Oct 2015 00:36:34 +0000 (17:36 -0700)]
mlx4: Allow override MLX4_DEFAULT_MGM_LOG_ENTRY_SIZE

Original mlx4 driver in Linux uses module parameters to override such
configuration values.  We don't have module_param's (yet), so for now
let's use Kconfig for that purpose.

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agomlx4: Fix lock initializations
Xiao Jia [Wed, 28 Oct 2015 00:36:33 +0000 (17:36 -0700)]
mlx4: Fix lock initializations

I was getting "Lock XXX tried to spin when it shouldn't" errors when
the kernel was compiled with spinlock debugging.

Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix binutils/gold breakage (XCC)
Dan Cross [Mon, 2 Nov 2015 20:19:59 +0000 (15:19 -0500)]
Fix binutils/gold breakage (XCC)

Binutils's safe-ctype.h plays some games with cpp macros that
are of dubious legalities as far as C++ is concerned: it is
not clear that the standard permits one to create macros with
the names of the various functions from <ctype.h>. In
particular, these are defined as functions in C++, as opposed
to macros.

"safe-ctype.h" #undef's these and #define's them to symbols that
are guaranteed to fail; this caused some problems under another
compilation environment that included C++ headers that defined
classes with member functions with the same names as the symbols
from <ctype.h>; these were being expanded to these failing
symbols.

The workaround is to move inclusion of safe-ctype.h to the end
of the list of includes. We should probably upstream this.

Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBe more careful when re#defining printf (XCC)
Barret Rhoden [Tue, 3 Nov 2015 15:36:26 +0000 (10:36 -0500)]
Be more careful when re#defining printf (XCC)

The problem here was that #defining printf catches all usages of the
word printf.  We only want to #define printf when it is used as a
function.

This popped up when libgomp failed to build, complaining that
"akaros_printf" is not a format function.  What's going on is that
somewhere in libgomp they are doing an __atttribute__ ((format (printf,
1, 2))), which marks a function as a printf-style function.  The word
'printf' in there is getting expanded to akaros_printf, and gcc rejects
that.  (For more info on that, check out
https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html).

Removing parlib/stdio.h from parlib/common.h wouldn't really fix this.
It would, in the short term, but eventually libgomp would need to
 #include parlib/stdio.h, since it probably will use some 2LS / vcore
feature and want to do a printf.

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoLimit the headers pulled in by parlib/arch.h (XCC)
Barret Rhoden [Tue, 3 Nov 2015 15:32:57 +0000 (10:32 -0500)]
Limit the headers pulled in by parlib/arch.h (XCC)

The problem here is that arch.h is used by parts of glibc.  By including
common.h, we're pulling in parlib/stdio.h, which pulls in stdio.h.
That's more than parts of glibc can handle.  string.h was unneeded as
well.

The problem manifested itself as glibc build errors, complaining about
stdio.  An alternative solution would be to remove parlib/assert.h and
parlib/stdio.h from parlib/common.h, though that would make it harder
for us to broadly include those headers.

For now, we can keep the lower-level headers (e.g. arch.h) from
including other major parts of parlib.

Rebuild glibc.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMove ros/vmx.h to an arch-specific location (XCC)
Barret Rhoden [Tue, 3 Nov 2015 16:15:57 +0000 (11:15 -0500)]
Move ros/vmx.h to an arch-specific location (XCC)

VMX is an x86 thing, so we shouldn't have it as a top-level kernel header.
It's also an intel-specific thing, but at least that's all in the x86
directory.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdding vmexits to proc.
GanShun [Tue, 29 Sep 2015 22:20:20 +0000 (15:20 -0700)]
Adding vmexits to proc.

Counts the number of times we do a vmexit and stores that in proc under Qvmstatus

Signed-off-by: GanShun <ganshun@gmail.com>
[moved vmexits into struct vmm]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoModified vmrunkernel consin to use read instead of fgets.
GanShun [Tue, 29 Sep 2015 22:20:20 +0000 (15:20 -0700)]
Modified vmrunkernel consin to use read instead of fgets.

Fixed a bug where only one character would be sent into the guest at a time by swapping fgets for read

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoRemoved debug prints. Fixed virtio decode function to handle full set of 16 registers.
GanShun [Sat, 26 Sep 2015 22:20:20 +0000 (15:20 -0700)]
Removed debug prints. Fixed virtio decode function to handle full set of 16 registers.

Removed all debug prints after vm has fully started.

Fixed decode function to find the correct register from the instruction and handle full set of 16 registers.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoChanged magic number from 0xE5 to I_VMMPC_POSTED
GanShun [Sat, 26 Sep 2015 22:20:20 +0000 (15:20 -0700)]
Changed magic number from 0xE5 to I_VMMPC_POSTED

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoSend IPI using function in vmx.c through pwrite to #cons/vmtcl at offset 4096 is...
GanShun [Sat, 26 Sep 2015 22:20:20 +0000 (15:20 -0700)]
Send IPI using function in vmx.c through pwrite to #cons/vmtcl at offset 4096 is successful.

We now get an IPI sent by the consin thread automatically when we press enter

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoEOI virtualization and virtual APIC success.
GanShun [Tue, 22 Sep 2015 22:20:20 +0000 (15:20 -0700)]
EOI virtualization and virtual APIC success.

Reenabled APIC emulation for APIC reads that are not automatically virtualized by the hardware.
We are now able to inject multiple interrupts into the guest.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVAPIC page is now actually enabled and active.
GanShun [Mon, 21 Sep 2015 22:20:20 +0000 (15:20 -0700)]
VAPIC page is now actually enabled and active.

Changed APIC_ACCESS_ADDR to be the physical address that's translated from guest physical address 0xfee00000 instead of being 0xfee00000

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdded emsr_fake_1b function
GanShun [Mon, 21 Sep 2015 22:20:20 +0000 (15:20 -0700)]
Added emsr_fake_1b function

Modified to return 0xfee00900 instead of reading from the msr.

Signed-off-by: GanShun <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMMCP: Virtualized APIC is now working(sort of)
Gan Shun Lim [Tue, 8 Sep 2015 22:20:20 +0000 (15:20 -0700)]
VMMCP: Virtualized APIC is now working(sort of)

Cleared SVI to acknowledge the delivery of the virtual interrupt. Enabled debug prints and added APIC memory dump.

Signed-off-by: Gan Shun Lim <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: ignore IF flags
Ronald G. Minnich [Sun, 6 Sep 2015 22:20:20 +0000 (15:20 -0700)]
vmmcp: ignore IF flags

we're using the VAPIC and don't need to worry about the processor
state any more.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMMCP: upgrade for newer cpu.
Ronald G. Minnich [Tue, 1 Sep 2015 22:20:20 +0000 (15:20 -0700)]
VMMCP: upgrade for newer cpu.

We will allow monitor/mwait.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: implement optional bits setting in the 5 control registers
Ronald G. Minnich [Tue, 1 Sep 2015 22:20:20 +0000 (15:20 -0700)]
vmmcp: implement optional bits setting in the 5 control registers

There's enough weird variance in even the newer systems that we have to have it.

Tested with lots of error cases.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMMCP: start move to systems I can't use on my mac
Ronald G. Minnich [Wed, 30 Sep 2015 22:20:20 +0000 (15:20 -0700)]
VMMCP: start move to systems I can't use on my mac

Oh well, I just wasted a day because we decided to ignore an error a few months back.

Bad Giraffe!

Anyway, I'm going to start enabling this stuff, and say goodbye to vmware fusion,
since it can no longer play the game. Damn. Gotta fine a real computer now.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: cut over to virtual apic; fix include mess after upgrade
Ronald G. Minnich [Wed, 30 Sep 2015 22:20:20 +0000 (15:20 -0700)]
vmmcp: cut over to virtual apic; fix include mess after upgrade

we really need to start building outside tree. This is just painful.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMMCP:update constants for vapic
Ronald G. Minnich [Tue, 29 Sep 2015 22:20:20 +0000 (15:20 -0700)]
VMMCP:update constants for vapic

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMMCP: misc stuff
Ronald G. Minnich [Tue, 22 Sep 2015 22:20:20 +0000 (15:20 -0700)]
VMMCP: misc stuff

i.e., use a reserved interrupt vector for virtio_mmio

virtio_mmio, it turns out, doesn't really work on x86. I will refrain
from further comment. Grrrrrrr...

So for now the guest linux will set a trap gate for 17, and we'll be smart and use it.

Awful.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMMCP: better support incoming interrupts. Fix idiot bug where Dune stripped rflags...
Ronald G. Minnich [Tue, 22 Sep 2015 22:20:20 +0000 (15:20 -0700)]
VMMCP: better support incoming interrupts. Fix idiot bug where Dune stripped rflags and we injected interrupts when we should not

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp/APIC: the empire strikes back.
Ronald G. Minnich [Wed, 16 Sep 2015 19:31:13 +0000 (12:31 -0700)]
vmmcp/APIC: the empire strikes back.

Some folks think we should be able to get along without these, but I've given up

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoPull ACPI into the user mode vmm
Ronald G. Minnich [Fri, 18 Sep 2015 21:02:28 +0000 (14:02 -0700)]
Pull ACPI into the user mode vmm

I hate it; we have to do it.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoVMMCP: EPT failures: don't exit, return all f's
Ronald G. Minnich [Mon, 14 Sep 2015 17:00:24 +0000 (10:00 -0700)]
VMMCP: EPT failures: don't exit, return all f's

On real hardware, a read outside memory returns all 1s. In some cases
kernels count on this. We can't rewrite every single place, so just
return all 1's for now.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agolapic and ioapic support that's Not Good Enough.
Ronald G. Minnich [Fri, 16 Oct 2015 17:04:11 +0000 (10:04 -0700)]
lapic and ioapic support that's Not Good Enough.

I really hate to do this, but I think I'm going to have to bring in the
whole enchilada from linux :-(

The linux kernel is just not happy with the level of support I'm providing.
We've tried counseling and adjustment, but this relationship is not working.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agouser level msr support for register not requiring read/write msr
Ronald G. Minnich [Fri, 4 Sep 2015 01:38:00 +0000 (18:38 -0700)]
user level msr support for register not requiring read/write msr

We can handle non-real MSRs in user mode.

Still need to split "fake" msrs out of kernel but this is a "checkpoint"
commit.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFailed effort at moving MSR functions to user mode
Ronald G. Minnich [Tue, 1 Sep 2015 19:36:51 +0000 (12:36 -0700)]
Failed effort at moving MSR functions to user mode

Forgot, rdmsr/wrmsr require CPL0. I thought we'd be ok with
something else.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agouser/vmm: change a longstanding bug in showstatus
Ronald G. Minnich [Tue, 1 Sep 2015 17:41:28 +0000 (10:41 -0700)]
user/vmm: change a longstanding bug in showstatus

showstatus was using the wrong struct member to print the
exit type.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmrunkernel: Handle the INTERRUPT_WINDOW exit; print more info on unhandled exits
Ronald G. Minnich [Tue, 1 Sep 2015 17:40:09 +0000 (10:40 -0700)]
vmrunkernel: Handle the INTERRUPT_WINDOW exit; print more info on unhandled exits

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoChange PENDING_INTERRUPT to INTERRUPT_WINDOW to have a more meaningful name.
Ronald G. Minnich [Tue, 1 Sep 2015 17:36:34 +0000 (10:36 -0700)]
Change PENDING_INTERRUPT to INTERRUPT_WINDOW to have a more meaningful name.

Allow the old one to persist for now

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFirst, second, and third pass at apic code. Crude
Ronald G. Minnich [Mon, 31 Aug 2015 04:09:04 +0000 (21:09 -0700)]
First, second, and third pass at apic code. Crude

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoStart putting together ACPI for guests.
Ronald G. Minnich [Sat, 29 Aug 2015 01:13:38 +0000 (18:13 -0700)]
Start putting together ACPI for guests.

This sucks, but has to happen if we want to let guests use
x2apic without lots of mods to the kernel.

But I still hate acpi.

This needs to get all library-ized once I learn how to make it work.

Worst case is we end up writing ACPI code and compiling it with iasl.

I'd really rather avoid that.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoabortive try at setting up tables. Failed miserably.
Ronald G. Minnich [Fri, 28 Aug 2015 01:55:40 +0000 (18:55 -0700)]
abortive try at setting up tables. Failed miserably.

We're going to have to create our own acpi tables. Dammit.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMake MMAP_LOWEST_VA PAGE_SIZE; set ld.so mmap address
Ronald G. Minnich [Thu, 27 Aug 2015 18:03:53 +0000 (11:03 -0700)]
Make MMAP_LOWEST_VA PAGE_SIZE; set ld.so mmap address

The ld.so constant is probably in the wrong place but we can
fix that.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMove the kernel to start at 16M+2M.
Ronald G. Minnich [Wed, 26 Aug 2015 00:13:17 +0000 (17:13 -0700)]
Move the kernel to start at 16M+2M.

This leaves room for ACPI shit.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoInject NMI on vmexits when it is an interrupt and, low and behold, it interrupts...
Ronald G. Minnich [Tue, 25 Aug 2015 00:13:17 +0000 (17:13 -0700)]
Inject NMI on vmexits when it is an interrupt and, low and behold, it interrupts the guest.

Mirabile dictu. Emphasis on the 'bile' part.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMajor cleanups.
Ronald G. Minnich [Mon, 24 Aug 2015 23:56:52 +0000 (16:56 -0700)]
Major cleanups.

Put IO into user mode. PCI will be moving too.

Break out decoding.

Add -d (debug) and -m (max iterations before turning debug on) into vmrunkernel

Drop out of vmx if we an IO exit.

The goal here is to get more stuff into user mode and maybe someday even get interrupts.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix VMPXE script
Ronald G. Minnich [Fri, 21 Aug 2015 20:23:18 +0000 (13:23 -0700)]
Fix VMPXE script

The network mangler is crap, so I removed it from ubuntu and I start needed daemeons by hand.

My vm is working much better, and I no longer need to kick broken daemons into action.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix printing acpi base
Ronald G. Minnich [Fri, 21 Aug 2015 20:22:48 +0000 (13:22 -0700)]
Fix printing acpi base

it was coming out in decimal before.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoUse correct vmcs field to inject an interrupt
Ronald G. Minnich [Fri, 21 Aug 2015 20:18:08 +0000 (13:18 -0700)]
Use correct vmcs field to inject an interrupt

Now if only stupid Linux had a way to receive it.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoHandle guest halting. Print nice message.
Ronald G. Minnich [Fri, 21 Aug 2015 20:17:36 +0000 (13:17 -0700)]
Handle guest halting. Print nice message.

I wanted to print a dead penguin but I'm not good enough.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoInterrupt framework
Ronald G. Minnich [Tue, 18 Aug 2015 20:41:33 +0000 (13:41 -0700)]
Interrupt framework

Beginnings of interrupt framework. We're not doing x2apic or anything fancy.
We're going to let the timer fire and then kick off a given interrupt
in the guest.

Note that our attempts to do a gpf fail. It just fails to enter the guest
at all.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoExtend vmexit handler in vmrunkernel to handle vmcall printks
Ronald G. Minnich [Mon, 17 Aug 2015 20:41:33 +0000 (13:41 -0700)]
Extend vmexit handler in vmrunkernel to handle vmcall printks

This way we can get vm guest output to a file via stdout.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoMove msr-index.h to arch/86/ros so user programs can use it
Ronald G. Minnich [Mon, 17 Aug 2015 20:40:56 +0000 (13:40 -0700)]
Move msr-index.h to arch/86/ros so user programs can use it

We need this for vmrunkernel at least.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoCreate ros/vmm/vmx.h, prepare to move lots of code to user mode from kernel driver.
Ronald G. Minnich [Mon, 17 Aug 2015 18:51:28 +0000 (11:51 -0700)]
Create ros/vmm/vmx.h, prepare to move lots of code to user mode from kernel driver.

We need these constants and maybe these structs in user mode, so we can
handle more vmexits. Now that this is done, we can start to move
code out of the kernel driver.

Longer term, we probably even want the vmcs registers set up in user mode
so we can deal with the inevitable undocumented/incorrect hardware without
having to respin the kernel.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd the consin handler.
Ronald G. Minnich [Thu, 13 Aug 2015 20:08:27 +0000 (13:08 -0700)]
Add the consin handler.

It doesn't explode. Does it work? Not sure.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoWe're finding more undocumented bits. So the bit set test is failing.
Ronald G. Minnich [Thu, 13 Aug 2015 20:08:27 +0000 (13:08 -0700)]
We're finding more undocumented bits. So the bit set test is failing.

FIX ME.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoActual working output now from virtio ring. Time for lots and lots of cleanup.
Ronald G. Minnich [Thu, 13 Aug 2015 17:53:28 +0000 (10:53 -0700)]
Actual working output now from virtio ring. Time for lots and lots of cleanup.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoThe host needs to set up the virtqueue. This is an interim commit so suleiman can...
Ronald G. Minnich [Thu, 13 Aug 2015 16:49:17 +0000 (09:49 -0700)]
The host needs to set up the virtqueue. This is an interim commit so suleiman can see what I am doing.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovirtio console can't support V2, have to use V1.
Ronald G. Minnich [Wed, 12 Aug 2015 16:59:24 +0000 (09:59 -0700)]
virtio console can't support V2, have to use V1.

But also fixed the features crap.

The features stuff is damned confusing but it boils down to
"if you support v2, you have to say you support v1. And if you support
v1 you have to accept v1."

I don't know, I still don't get it all.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAllow read/write of msr 0x345/MSR_IA32_PERF_CAPABILITIES
Ronald G. Minnich [Wed, 12 Aug 2015 16:59:24 +0000 (09:59 -0700)]
Allow read/write of msr 0x345/MSR_IA32_PERF_CAPABILITIES

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFix up DEVICE_FEATURES usage
Ronald G. Minnich [Wed, 12 Aug 2015 16:59:24 +0000 (09:59 -0700)]
Fix up DEVICE_FEATURES usage

I misunderstood some of it.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBegin work on true virtio mmio Kill tests/vmrunkernel.c Our makefiles, plus emacs...
Ronald G. Minnich [Mon, 3 Aug 2015 16:59:24 +0000 (09:59 -0700)]
Begin work on true virtio mmio Kill tests/vmrunkernel.c Our makefiles, plus emacs, == disaster.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoFirst checking of virtio-mmio.c from qemu.
Ronald G. Minnich [Fri, 31 Jul 2015 21:35:30 +0000 (14:35 -0700)]
First checking of virtio-mmio.c from qemu.

needed to support virtio-mmio.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoStart shuffling functionality from kernel to user.
Ronald G. Minnich [Fri, 31 Jul 2015 18:18:28 +0000 (11:18 -0700)]
Start shuffling functionality from kernel to user.

First step is IO, then vmcall, then whatever else we can do.

Required to make virtio channels work, and, really, this stuff should be
in user mode anyway.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoModify device to take a binary struct.
Ronald G. Minnich [Thu, 30 Jul 2015 16:36:34 +0000 (09:36 -0700)]
Modify device to take a binary struct.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmrunkernel: dump virtio mmio area in a human-readable fashion.
Ronald G. Minnich [Thu, 30 Jul 2015 16:08:39 +0000 (09:08 -0700)]
vmrunkernel: dump virtio mmio area in a human-readable fashion.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoStart supporting virtio stuff in vmrunkernel.c
Ronald G. Minnich [Wed, 29 Jul 2015 19:49:54 +0000 (12:49 -0700)]
Start supporting virtio stuff in vmrunkernel.c

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoBasic init of the virtio_mmio region
Ronald G. Minnich [Mon, 20 Jul 2015 22:36:08 +0000 (15:36 -0700)]
Basic init of the virtio_mmio region

not quite there but better. This is tightly tied to the linux kernel I have, sorry.

e820 layou for this:
0-efffff reserved
f00000-fffff reserved (for virtio mmio)
1000000-+128M (ram)

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAdd virtio_mmio.h
Ronald G. Minnich [Mon, 20 Jul 2015 19:09:48 +0000 (12:09 -0700)]
Add virtio_mmio.h

This is pretty unchanging, so we figure it's ok to include.

Copied from Linux.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: final set of changes for PCI emulation
Ronald G. Minnich [Fri, 17 Jul 2015 00:32:49 +0000 (17:32 -0700)]
vmmcp: final set of changes for PCI emulation

In the end, this is not going to work. PCI in Linux brings in all sorts of stuff you don't want to bring in, such as ACPI. If
you don't bring in ACPI, it brings in dmi decode. Either way, it brings in code that wants to grovel through the f segment and
we've declared the low 16m off limits.

So, I'm going to take a different tack. We've got the coreboot tables and vmcall, might as well use them for something.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoManage writes to cfc: ignore them for now.
Ronald G. Minnich [Thu, 16 Jul 2015 17:54:58 +0000 (10:54 -0700)]
Manage writes to cfc: ignore them for now.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: piss-poor pci emulation
Ronald G. Minnich [Thu, 16 Jul 2015 17:23:53 +0000 (10:23 -0700)]
vmmcp: piss-poor pci emulation

It only needs to work well enough for virtio, so we're hoping it's enough.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcpconfig: version right after adding PCI=y and VIRTIO
Ronald G. Minnich [Wed, 15 Jul 2015 15:21:49 +0000 (08:21 -0700)]
vmmcpconfig: version right after adding PCI=y and VIRTIO

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: further restrictions on IO; a few more hacks; lindent damage
Ronald G. Minnich [Mon, 13 Jul 2015 21:56:21 +0000 (14:56 -0700)]
vmmcp: further restrictions on IO; a few more hacks; lindent damage

This gets us to not being able to open a console.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: allow basic IO and more MSRs
Ronald G. Minnich [Mon, 13 Jul 2015 16:54:32 +0000 (09:54 -0700)]
vmmcp: allow basic IO and more MSRs

Note that we're not disabling any IO at this point, since we can't get
the bitmap to work yet. Later.

This gets us to killing init.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: final set of msr operations
Ronald G. Minnich [Wed, 8 Jul 2015 17:04:18 +0000 (10:04 -0700)]
vmmcp: final set of msr operations

This now lets our guest linux get to the next blocker: DR registers.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: allow a fake write to CSTAR
Ronald G. Minnich [Wed, 8 Jul 2015 15:15:41 +0000 (08:15 -0700)]
vmmcp: allow a fake write to CSTAR

We don't expect that a guest will ever really use this.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agovmmcp: begin cleanup of vmrunkernel; grow memory size.
Ronald G. Minnich [Tue, 7 Jul 2015 23:39:03 +0000 (16:39 -0700)]
vmmcp: begin cleanup of vmrunkernel; grow memory size.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
3 years agoAllow guests to do INVLPG.
Ronald G. Minnich [Tue, 7 Jul 2015 23:38:29 +0000 (16:38 -0700)]
Allow guests to do INVLPG.

We require EPTs so that should be ok.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>