Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ACPI shutdown for NetBSD/xen



Le 22/04/2015 00:55, Pierre Pronchery a écrit :
Hi port-xen@,

after a short review of NetBSD/xen's and xen's own 4.5.0's source code,
I did not find anything preventing a regular ACPI shutdown (sleep statee
5) from working with NetBSD as DOM0, just like when running natively
(like GENERIC).

I just tested this successfully on an amd64 DOM0 (running NetBSD 7 with
a Lenovo ThinkPad T440s laptop), and also have a patch for i386
(untested, though the patch is almost identical).

Thoughts, comments, objections to commit?

Heya, sorry for this late answer, I am slowly returning back to day to day work :)

First, thanks for touching that dirty part. I do have thoughts, comments, and one objection but nothing unsurmountable.

Both patches are here:
http://git.edgebsd.org/gitweb/?p=edgebsd-src.git;a=commit;h=f6d98f09
http://git.edgebsd.org/gitweb/?p=edgebsd-src.git;a=commit;h=10b1d40d
(EdgeBSD's khorben/xen-acpi-shutdown branch)

I am also attaching them here.

It may work given dom0 privileges, however we have no warranty that the interface evolves and that dom0 someday loses its access rights on ACPI methods. IIRC acpi_enter_state() calls directly in ACPICA which does not support hypervisor calls. Alas, even with dom0 you are supposed to proxy your ACPI requests through hypercalls. You have those for ACPI sleep states:

http://xenbits.xen.org/docs/unstable/hypercall/x86_32/include,public,platform.h.html#Struct_xenpf_enter_acpi_sleep

For a basic start have a look at how Linux does this [1]; it's just a game of function pointers obviously where the proper method gets used depending on cb registration:

[1] http://lxr.free-electrons.com/source/include/xen/acpi.h?v=3.5

IMHO the best path for this is to move away from NACPICA/XEN cpp macros and do it like [1]. Register a noop function by default to handle the case where neither ACPICA nor Xen are present.

Feel free to contact me off-list in case you want to give this a go.

Cheers,

--
Jean-Yves Migeon


Home | Main Index | Thread Index | Old Index