The applesmc device only answers APPLESMC_READ_CMD at its command
port. Modern macOS guests (x86 10.14+, all 15.x) also issue WRITE,
TYPE and GET_KEY_BY_INDEX, and enumerate the SMC key space at boot.
The unanswered commands and the near-empty key table drive the
AppleSMC kext into a kSMCSpuriousData retry storm (~1800 errors/sec,
kernel_task ~70% CPU, WindowServer ~509% CPU on macOS 15).
Patch 1 implements the missing commands. Patch 2 populates the key
table with a realistic iMac20,1 profile and the canonical #KEY count,
so the guest's boot-time enumeration terminates.
v4:
- Regenerated against current master. Drop a stray hunk in patch 2/2
that reverted the qdev-properties.h include move (commit 78d45220b4);
the include is now left untouched. Reported-by Philippe
Mathieu-Daudé. No functional change.
- No other changes from v3.
v3: https://lore.kernel.org/qemu-devel/20260719152343.69536-1-matthew@pq.io/
v2: addressed Peter Maydell's style review (loop braces, stl_be_p()).
v1: https://lore.kernel.org/qemu-devel/20260507040153.14565-1-matthew@pq.io/
Matthew Jackson (2):
hw/misc/applesmc: implement GET_KEY_BY_INDEX, WRITE and TYPE commands
hw/misc/applesmc: populate Apple SMC key table
hw/misc/applesmc.c | 344 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 337 insertions(+), 7 deletions(-)
--
2.50.1 (Apple Git-155)