All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia.org>
To: "Matthew Jackson" <matthew@pq.io>,
	"Alexander Graf" <agraf@csgraf.de>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	Kane-Chen-AS <kane_chen@aspeedtech.com>,
	"jack wang" <163wangjack@gmail.com>,
	qemu-devel@nongnu.org
Subject: [PATCH 0/2] hw/misc/applesmc: SMC shutdown watchdog and trace events
Date: Wed, 19 Aug 2026 18:36:38 +0100	[thread overview]
Message-ID: <cover.1787150842.git.daniel@makrotopia.org> (raw)
In-Reply-To: <20260720164930.68383-1-matthew@pq.io>

These two patches are the part of my earlier AppleSMC series [1] that is not
already covered by Matthew Jackson's Apple SMC v4 series [2], rebased on top
of it.

Matthew's series is the more complete of the two -- besides the write and
get-key-type commands (which we implemented independently) it also handles
get-key-by-index and populates a full key table -- so I have dropped the
overlapping patches from mine and kept only the two bits it does not cover:

  1/2  trace events for the command dispatch and each handler, so the
       SMC command/key conversation can be watched with -trace 'applesmc*'.
       This is how the exact set of commands and keys a macOS guest relies
       on was found in the first place.

  2/2  the SMC shutdown watchdog: the "NATi"/"NATJ"/"OSWD" keys that patch
       1/2 of Matthew's series accepts and discards are the watchdog macOS
       arms to force the machine down. Model them as a QEMUTimer that a
       write arms, refreshes or disarms.

Both apply on top of Matthew's v4 [2]; they touch only hw/misc/applesmc.c
and hw/misc/trace-events and do not conflict with it.

Tested by booting a macOS 26 (Tahoe) guest on Matthew's v4 plus these two
patches. It boots and shuts down cleanly; every SMC command the guest issues
is accepted (0 rejected out of 77 in one boot+shutdown), the boot-time key
writes (NTOK, MSDW, QENA, HE0N) succeed, get-key-type is answered for the 60+
keys the guest probes, and on shutdown the guest's "OSWD" write is handled as
a watchdog disarm (trace_applesmc_wdt_disarm). The guest arms the watchdog
only to disarm it on the way down; the arm-and-expiry path is the documented
behaviour for a guest that does arm it.

[1] https://patchew.org/QEMU/cover.1787114994.git.daniel@makrotopia.org/
[2] https://patchew.org/QEMU/20260720164930.68383-1-matthew@pq.io/

Daniel Golle (2):
  hw/misc/applesmc: Add trace events
  hw/misc/applesmc: Emulate the SMC shutdown watchdog

 hw/misc/applesmc.c   | 80 ++++++++++++++++++++++++++++++++++++++++++++
 hw/misc/trace-events | 13 +++++++
 2 files changed, 93 insertions(+)

-- 
2.55.0


  parent reply	other threads:[~2026-08-19 17:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  4:01 [PATCH 0/2] hw/misc/applesmc: fix GET_KEY_BY_INDEX iteration and populate Apple SMC key set Matthew Jackson
2026-05-07  4:01 ` [PATCH 1/2] hw/misc/applesmc: fix GET_KEY_BY_INDEX to return real keys, accept WRITE/TYPE commands Matthew Jackson
2026-05-07  4:01 ` [PATCH 2/2] hw/misc/applesmc: populate Apple SMC key table Matthew Jackson
2026-05-07 14:27   ` Peter Maydell
2026-05-07 15:20 ` [PATCH v2 0/2] hw/misc/applesmc: fix GET_KEY_BY_INDEX iteration and populate Apple SMC key set Matthew Jackson
2026-06-01 15:28   ` [PATCH v3 0/3] " Matthew Jackson
2026-06-01 15:28     ` [PATCH v3 1/3] hw/misc/applesmc: fix GET_KEY_BY_INDEX to return real keys, accept WRITE/TYPE commands Matthew Jackson
2026-06-01 15:28     ` [PATCH v3 2/3] hw/misc/applesmc: populate Apple SMC key table Matthew Jackson
2026-07-20  8:02       ` Philippe Mathieu-Daudé
2026-06-01 15:28     ` [PATCH v3 3/3] MAINTAINERS: adopt hw/misc/applesmc.c Matthew Jackson
2026-05-07 15:20 ` [PATCH v2 1/2] hw/misc/applesmc: fix GET_KEY_BY_INDEX to return real keys, accept WRITE/TYPE commands Matthew Jackson
2026-05-07 15:20 ` [PATCH v2 2/2] hw/misc/applesmc: populate Apple SMC key table Matthew Jackson
2026-07-19 15:23 ` [PATCH v3 0/2] hw/misc/applesmc: fix GET_KEY_BY_INDEX iteration and populate Apple SMC key set Matthew Jackson
2026-07-20 16:49   ` [PATCH v4 " Matthew Jackson
2026-07-20 16:49     ` [PATCH v4 1/2] hw/misc/applesmc: implement GET_KEY_BY_INDEX, WRITE and TYPE commands Matthew Jackson
2026-08-19 17:35       ` Daniel Golle
2026-07-20 16:49     ` [PATCH v4 2/2] hw/misc/applesmc: populate Apple SMC key table Matthew Jackson
2026-08-19 17:36       ` Daniel Golle
2026-08-19 17:36     ` Daniel Golle [this message]
2026-08-19 17:36       ` [PATCH 1/2] hw/misc/applesmc: Add trace events Daniel Golle
2026-08-19 17:36       ` [PATCH 2/2] hw/misc/applesmc: Emulate the SMC shutdown watchdog Daniel Golle
2026-07-19 15:23 ` [PATCH v3 1/2] hw/misc/applesmc: fix GET_KEY_BY_INDEX to return real keys, accept WRITE/TYPE commands Matthew Jackson
2026-07-19 15:23 ` [PATCH v3 2/2] hw/misc/applesmc: populate Apple SMC key table Matthew Jackson
2026-07-20  8:04   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1787150842.git.daniel@makrotopia.org \
    --to=daniel@makrotopia.org \
    --cc=163wangjack@gmail.com \
    --cc=agraf@csgraf.de \
    --cc=clg@redhat.com \
    --cc=kane_chen@aspeedtech.com \
    --cc=matthew@pq.io \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@oss.qualcomm.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.