Commit graph

23 commits

Author SHA1 Message Date
Panagiotis Vasilopoulos e45e0eeb47 Everywhere: Replace SERENITY_ROOT with SERENITY_SOURCE_DIR 2021-04-20 15:27:52 +02:00
Idan Horowitz e4d9fa914e Kernel: Add base support for VirtRNG (VirtIO based Hardware RNG)
This is a very basic implementation that only requests 4096 bytes
of entropy from the host once, but its still high quality entropy
so it should be a good fix for #4490 (boot-time entropy starvation)
for virtualized environments.

Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17 10:21:23 +02:00
Idan Horowitz d1f7a2f9a5 Kernel: Finish base implementation of VirtQueues
This commit includes a lot of small changes and additions needed to
finalize the base implementation of VirtIOQueues and VirtDevices:
* The device specific driver implementation now has to handle setting
up the queues it needs before letting the base device class know it
finised initialization
* Supplying buffers to VirtQueues is now done via ScatterGatherLists
instead of arbitary buffer pointers - this ensures the pointers are
physical and allows us to follow the specification in regards to the
requirement that individual descriptors must point to physically
contiguous buffers. This can be further improved in the future by
implementating support for the Indirect-Descriptors feature (as
defined by the specification) to reduce descriptor usage for very
fragmented buffers.
* When supplying buffers to a VirtQueue the driver must supply a
(temporarily-)unique token (usually the supplied buffer's virtual
address) to ensure the driver can discern which buffer has finished
processing by the device in the case in which the device does not
offer the F_IN_ORDER feature.
* Device drivers now handle queue updates (supplied buffers being
returned from the device) by implementing a single pure virtual
method instead of setting a seperate callback for each queue
* Two new VirtQueue methods were added to allow the device driver
to either discard or get used/returned buffers from the device by
cleanly removing them off the descriptor chain (This also allows
the VirtQueue implementation to reuse those freed descriptors)

This also includes the necessary changes to the VirtIOConsole
implementation to match these interface changes.

Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17 10:21:23 +02:00
Idan Horowitz ecfa7cb824 Kernel: Implement a naive version of virtconsole by memcpying to physical page
This patch allocates a physical page for each of the virtqueues and
memcpys to it when receiving a buffer to get a physical, aligned
contiguous buffer as required by the virtio specification.

Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
2021-04-17 10:21:23 +02:00
Emanuele Torre 1f81bc6879 Everywhere: Remove unnecessary whitespace at the end of some lines. 2021-03-08 09:20:53 +01:00
Linus Groh a013a38e24 Meta: Make 'run.sh qgrub' work via SERENITY_RUN
It is possible to set the run.sh mode via the SERENITY_RUN environment
variable, but the SERENITY_DISK_IMAGE="grub_disk_image" override for
qgrub mode was only checking $1. This makes qgrub mode work via 'ninja
run' without explicitly setting SERENITY_DISK_IMAGE:

    SERENITY_RUN=qgrub ninja run
2021-03-06 19:55:53 +01:00
Liav A e65fd83e23 Meta: Boot Q35 machine with SATA drive instead of using IDE drive 2021-03-05 11:29:34 +01:00
Andrew Kaster ca8319f800 Meta: Add run target for CI
This invocation of qemu has no VGA, no sound, no graphics, debug output
going to a file, and defaults to printing /dev/ttyS0 to stdout.
2021-02-28 18:19:37 +01:00
Jakub Berkop 9aa91e6c6f Meta: Enable qemu virtualization acceleration on mac 2021-02-27 06:20:52 +01:00
Tom 54c66b8f7b Meta: Bump default RAM size to 512MB
Now that we commit memory, we need a lot more physical memory. Physical
memory requirements can be reduced again once we have memory swapping,
which allows the swap area/file to be counted against memory that can
be committed.
2021-01-01 23:43:44 +01:00
Tom e317ee7541 Meta: Add env variable SERENITY_RUN to be able to choose qemu, bochs, etc
This allows picking for example bochs: SERENITY_RUN=b ninja run
2020-09-19 00:33:02 +02:00
Ben Wiederhake 8498a5678d Meta: Avoid deprecated qemu option
Apparently "-soundhw pcspk" is deprecated too. However, I don't know which "name"
to insert, and I can't test it, hence I didn't touch it.
2020-09-12 13:46:15 +02:00
Andreas Kling e834c24eea Kernel/USB: Start fleshing out a basic UHCI controller driver :^)
Let's see if we can talk to some USB devices. We will now detect
a UHCI controller if present on the PCI bus.
2020-09-04 21:21:41 +02:00
Peter Nelson a8ad0d120d Meta: allow override of QEMU -cpu argument via environment variable
Introduces a SERENITY_QEMU_CPU environment variable that allows
overriding of the qemu -cpu command line parameter. If not specified,
the argument defaults to "max".

The primary motivation behind this is to be able to enable or disable
specific features for the vCPU in order to workaround QEMU issues with
certain hardware accelerators. For example, QEMU on Windows with WPHX
sometimes fails to start unless Virtual Machine eXtensions are
disabled. This can now be done with:

  export SERENITY_QEMU_CPU="max,vmx=off"
2020-08-14 15:09:59 +02:00
Nico Weber e91dd14fab run.sh: Remove cpu_reset debug output
It's fairly wordy and early OS startup seems to work well,
so this doesn't have to be on by default.
2020-07-06 17:03:26 +02:00
Emanuele Torre 6f8042d8e5 Meta: make Meta/run.sh qgrub work. 2020-07-01 12:53:39 +02:00
Emanuele Torre e62475d6e7 Meta: run.sh: fix usage comments 2020-07-01 12:53:39 +02:00
Emanuele Torre 1d9791bcdf Meta: Allow running run.sh from any where by setting SERENITY_BUILD
If SERENITY_BUILD is not set or empty, SERENITY_BUILD is treated as if
it was set to '.'.

`run.sh` will cd to SERENITY_BUILD before running the emulator.

Also, export SERENITY_BUILD in `Meta/CLion/run.sh` since we are using it
in `Meta/run.sh`.

Also, allow using a different bochs configuration file by setting the
SERENITY_BOCHSRC variable.
2020-07-01 12:53:39 +02:00
Emanuele Torre aabb482d5c Meta: move Kernel/.bochsrc => Meta/bochsrc
The run script is not in Kernel/ anymore, let's move `.bochsrc` in Meta/
so that it can be used with the new build system.

Also make bochs use `grub_disk_image` instead of `_disk_image`
2020-07-01 12:53:39 +02:00
Emanuele Torre f7f1c3d748 Meta: use "better" syntax to set SERENITY_KERNEL_CMDLINE in run.sh :^)
This removes some FIXMEs.

In bash, we could avoid `shift`:
    SERENITY_KERNEL_CMDLINE="${@:2}"

But let's stick to POSIX sh for now.
2020-07-01 12:53:39 +02:00
Emanuele Torre 0cee39355c Meta: quote variables in run.sh where it makes sense 2020-07-01 12:53:39 +02:00
Nico Weber 1539a976c8 run.sh: Pass -drive instead of -hda to qemu.
run.sh currently makes qemu print this as the very first output:

WARNING: Image format was not specified for '_disk_image' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.

This is scary for people who don't know that this is normal, and
write operations to block 0 being restricted could be confusing
for some operations happening from within serenity too at some point.

So specify the 'raw' format explicitly, like the warning suggests.
Requires using -drive instead of -hda.

From `man qemu-system`:

    Instead of -hda, -hdb, -hdc, -hdd, you can use:
        qemu-system-x86_64 -drive file=file,index=0,media=disk

So use that, and also pass format=raw.
2020-06-05 09:29:02 +02:00
Sergey Bugaev 450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
Renamed from Kernel/run (Browse further)