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

[WIP] virtio: detect PIIX4 and attempt to power off via PIIX4 (broken) #500

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mbacarella
Copy link

@mbacarella mbacarella commented Nov 17, 2021

This is attempt 1 of 2 to solve #499 (attempt 2 is at #501)

Summary:

This is my failed attempt to resolve #499 . It will detect the PIIX4 on GCE and attempt to power off if you exit the mirage unikernel (e.g. raise an uncaught exception right after you start), but it hangs instead of powering off because it's not a correct implementation.

Discussion:

Detecting the PIIX4 on the PCI bus works; it requires a simple change to the pci_enumerate function to list "functions" of PCI devices. The part where it tries to actually instruct the PIIX4 to power off is completely broken though.

I'm at the limits of my understanding of low-level x86 architecture, but will post this anyway in the event that someone with more expertise can determine if this is 90% of the way there and make use of it.

The specific problem is the base address that PCI enumeration probes for the PIIX4 device is 0, which obviously can't be used to inw/outw the device. I tried to learn the from this Linux kernel code but it became too challlenging for me to reason about.

@mbacarella mbacarella changed the title [WIP] virtio: detect PIIX4 and attempt to power off (broken) [WIP] virtio: detect PIIX4 and attempt to power off via PIIX4 (broken) Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

virtio: implement ACPI power-off
1 participant