Page MenuHomeFreeBSD

xen/acpi: implement hook to notify Xen about entering sleep
ClosedPublic

Authored by royger on Wed, Feb 25, 9:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Feb 25, 8:44 PM
Unknown Object (File)
Wed, Feb 25, 8:41 PM
Unknown Object (File)
Wed, Feb 25, 3:25 PM
Unknown Object (File)
Wed, Feb 25, 3:04 PM
Unknown Object (File)
Wed, Feb 25, 2:39 PM

Details

Summary

This is required so that ACPI power-off (entering S5) works as expected, as
the ACPI PM1a and PM1b blocks might not be accessible by dom0 directly.
Additionally, Xen also needs to do cleanup before entering a sleep state,
so it needs to be notified about it.

With this patch FreeBSD dom0 now powers off the host correctly:

acpi0: Powering system off...
(XEN) [ 85.686598] arch/x86/hvm/emulate.c:415:d0v0 fixup p2m mapping for page fedc6 added
(XEN) [ 85.687606] arch/x86/hvm/emulate.c:415:d0v0 fixup p2m mapping for page fbc10 added
(XEN) [ 85.692357] Preparing system for ACPI S5 state.
(XEN) [ 85.692702] Disabling non-boot CPUs ...
(XEN) [ 85.694471] Broke affinity for IRQ9, new: {0-7}
[...]
(XEN) [ 85.903118] Entering ACPI S5 state.

Should be a non-functional change when not running as a Xen dom0.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I do not have any opinion on the change, perhaps the only feedback you need is from jkim@ who does the acpica imports.
I only have style/cosmetics notes.

sys/dev/acpica/Osd/OsdHardware.c
54

This makes the braces unbalanced in editors like emacs. I suggest to put the ); outside ifdefs.

sys/dev/xen/acpi/xen-acpi.c
64

Elvis operator is gnu-ism, could we please avoid that?

71
74
sys/dev/acpica/Osd/OsdHardware.c
54

I think it's going to be clearer if I just store this in a local variable, let me give that a try.

sys/dev/xen/acpi/xen-acpi.c
64

Sure, didn't know it was a GNU extension.

Adjust usage of ACPI_REDUCED_HARDWARE and remove elvis operator.

royger added inline comments.
sys/dev/acpica/Osd/OsdHardware.c
54

This now depends on ACPI_REDUCED_HARDWARE always being defined, but AFAICT that's the case because the ACPICA headers will define it to 0 if unset.

sys/dev/acpica/Osd/OsdHardware.c
54

We could get away without the ext variable also, and just use the ternary operator directly in the parameter list. I had it as a separate variable because I was using #ifdef before. Let me know what you think and I can adjust.

kib added inline comments.
sys/dev/acpica/Osd/OsdHardware.c
54

I think that the ext varc an be eliminated without any loss in readability.

sys/dev/acpica/acpivar.h
616

No need to split the line.

623

We no longer require the blank line by style(9).

This revision is now accepted and ready to land.Thu, Feb 26, 4:51 PM