Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reboot functionality #306

Merged
merged 7 commits into from
Sep 8, 2023
Merged

Conversation

wipawel
Copy link
Contributor

@wipawel wipawel commented Sep 7, 2023

Support reboot via three means:

  • ACPI reset (FADT reset register) - requires APICA
  • i8042 keyboard controller CPU reset
  • Triple Fault

Support reboot triggering via three ways:

  • CTRL+ALT+DEL key combination (requires i8042 controller presence)
  • UART input +++ character sequence
  • Cmdline option reboot_timeout= which automatically reboots after a specified number of seconds (requires a timer)

@wipawel wipawel added the improvement A small enhancement, that makes already implemented features better label Sep 7, 2023
@wipawel wipawel requested a review from a team as a code owner September 7, 2023 08:56
@wipawel wipawel enabled auto-merge (rebase) September 7, 2023 08:56
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
This function triggers Triple Fault by loading NULL IDT pointer and
issuing an int3 instruction.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
sktt
sktt previously approved these changes Sep 8, 2023
Copy link
Contributor

@sktt sktt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! Looks good from here :)

lib/lib.c Show resolved Hide resolved
common/kernel.c Show resolved Hide resolved
common/kernel.c Outdated Show resolved Hide resolved
common/kernel.c Outdated Show resolved Hide resolved
drivers/serial.c Outdated Show resolved Hide resolved
The reboot() uses either acpi_reboot() (when ACPICA support is compiled
in) or keyboard_reboot (when i8042 controller is present). It fallbacks
to the hard_reboot() as a last resort.

The reboot() is called only upon i8042's handled CTRL+ALT+DEL key
combination.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
The UART reboot functionality looks for '+++' character string input
received via UART and calls reboot() when detected.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
In case communication with KTF is not possible (no PS/2 keyboard nor
UART port) add an option to automatically reboot after specified amount
of time.
The reboot_timeout by default is off. Value 0 means reboot immediately.
Values unit is seconds.

Please note a timer needs to be enabled for this functionality to work.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
@wipawel wipawel merged commit a40e3db into KernelTestFramework:mainline Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A small enhancement, that makes already implemented features better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants