get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2234271/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2234271,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2234271/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260507040153.14565-3-matthew@pq.io/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260507040153.14565-3-matthew@pq.io>",
    "list_archive_url": null,
    "date": "2026-05-07T04:01:53",
    "name": "[2/2] hw/misc/applesmc: populate Apple SMC key table",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "507ed9878c5e4d538b160a40e7043165088c06bd",
    "submitter": {
        "id": 93356,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/93356/?format=api",
        "name": "Matthew Jackson",
        "email": "matthew@pq.io"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260507040153.14565-3-matthew@pq.io/mbox/",
    "series": [
        {
            "id": 503191,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/503191/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=503191",
            "date": "2026-05-07T04:01:53",
            "name": "hw/misc/applesmc: fix GET_KEY_BY_INDEX iteration and populate Apple SMC key set",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/503191/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2234271/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2234271/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=pq.io header.i=@pq.io header.a=rsa-sha256\n header.s=protonmail3 header.b=syA3NcV9;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBDlC3X09z1y04\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 00:14:15 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wKzUB-0007A6-GD; Thu, 07 May 2026 10:13:55 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <matthew@pq.io>) id 1wKpwE-0005nQ-DC\n for qemu-devel@nongnu.org; Thu, 07 May 2026 00:02:14 -0400",
            "from mail-05.mail-europe.com ([85.9.206.169])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <matthew@pq.io>) id 1wKpw9-0004lL-Al\n for qemu-devel@nongnu.org; Thu, 07 May 2026 00:02:14 -0400"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=pq.io;\n s=protonmail3; t=1778126519; x=1778385719;\n bh=++9yNFQZ47eOroZ1WhHhIjPpxmNbCFJax/8fWsXF6AA=;\n h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:From:To:\n Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector;\n b=syA3NcV9OsOyHhFSCydFhB3H49DOXclC/Vv8fmFAPanT8PIYI4Jr0E5J6Nr9ySNPx\n ZE51LYFWkY2naUAHIXwedLanBFEIy6+aj2Jyd5FlPWHpguZBr4mdXZ2e0/7Mq9WuDu\n dnJeT06ow5ePXahOEHf3KcL470S1zGjd4IlVf+YcxNkc2MtNaHaGXhkkhhK5j/zMoh\n BrmfUordWVLZElDJez7AftPnFYyIb2t9h1sCjx4Da7r63PHbyPnopke+xIWNi2bzsv\n ApFza1GBn7kqtE8kTwFtEvwxXeQHETxf7wpGT6adqJe+Bjz3RPl+MCdwemKQV5XjBx\n MM9ASRQCUoFFw==",
        "X-Pm-Submission-Id": "4g9z8j4FHwz2ScdG",
        "From": "Matthew Jackson <matthew@pq.io>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "stefanha@redhat.com",
        "Subject": "[PATCH 2/2] hw/misc/applesmc: populate Apple SMC key table",
        "Date": "Wed,  6 May 2026 21:01:53 -0700",
        "Message-ID": "<20260507040153.14565-3-matthew@pq.io>",
        "X-Mailer": "git-send-email 2.50.1",
        "In-Reply-To": "<20260507040153.14565-1-matthew@pq.io>",
        "References": "<20260507040153.14565-1-matthew@pq.io>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=85.9.206.169; envelope-from=matthew@pq.io;\n helo=mail-05.mail-europe.com",
        "X-Spam_score_int": "-27",
        "X-Spam_score": "-2.8",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-Mailman-Approved-At": "Thu, 07 May 2026 10:13:39 -0400",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "With APPLESMC_GET_KEY_BY_INDEX_CMD now functional (previous\npatch), the modern macOS AppleSMC kext walks the device's key\ntable at boot to discover what's available. The current key\nset (REV/OSK0/OSK1/NATJ/MSSP/MSSD) is sparse enough that\nseveral macOS subsystems retry-poll keys they expect to find,\ncontributing to the same kSMCSpuriousData traffic the previous\npatch addresses.\n\nThis patch fills the key table out to a complete iMac20,1\nprofile (94 additional keys plus the canonical #KEY count).\nSensor values match a real iMac20,1 idle probe published at:\n\n  https://linux-hardware.org/?probe=999fc708a4&log=sensors\n\nCategories:\n\n  * 28 temperature sensors in sp78 format with idle readings\n    from the probe: CPU 40 C (TC0P) / 45 C (TC0F) / 51 C\n    (TCXc), GPU 36 C (TG0P) / 42 C (TG0F/TG1F/TGDD), HDD\n    41 C (TH0P/TH1C/TH1F), LCD 28-29 C (TL0V/TL1V), memory\n    34-36 C (TM0V/TM0P), ambient 24 C (TA0V), PSU 33 C\n    (Tp00/Tp2F), generic sensors 33 C (Ts*S, TS0V), VRM\n    50 C (TVMD/TVmS/TVSL/TVSR; not in the probe, conservative\n    estimate). Battery sensors (TB0T/TB1T/TB2T) are\n    present-with-zero because iMacs have no battery; macOS's\n    \"absent vs broken\" distinction relies on the key being\n    registered even with a zero reading.\n\n  * 4 fan keys (FNum/F0Ac/F0Mn/F0Mx) describing iMac20,1's\n    single chassis fan: 1 fan, current 1200 RPM (= F0Mn,\n    matching the probe-reported idle), min 1200, max 3600.\n    fpe2 encoding (raw = RPM * 4, big-endian).\n\n  * 12 power-rail keys (PC0R/PCPC/PCPG/PCPT/PfCP/PfCT/PfGT/\n    PfHT/PfM0/PfST/PSTR/PHDC) for telemetry; present-with-\n    zero satisfies macOS without claiming a specific value.\n\n  * 6 DIMM keys (DM0P/DM0S/DM1P/DM1S/MD1R/MD1W); same\n    rationale.\n\n  * 11 SMC-internal bookkeeping keys (CLKH/DICT/RPlt/SBFL/\n    VRTC/WKTP plus 5 lower-case Apple-private bookkeeping\n    keys cePn/cmDU/maNN/mxT1/zEPD); same rationale.\n\n  * 13 motion-sensor / wireless keys (MSAc/MSAf/MSAg/MSAi/\n    MSGA/MSHP/MSPA/MTLV/QCLV/QENA/WIr0/WIw0/WIz0). Present-\n    with-zero is the correct desktop-class answer.\n\n  * 3 write targets that must also be readable: HE0N (iGPU\n    power; AGPM driver writes 1 on start), MSDW, NTOK.\n\n  * 2 power-management gates required by AGPM and the\n    watchdog probe: HE2N (dGPU power enable), WDTC.\n\n  * 8 platform-identity / probe keys (MPRO/MPRD/LGPB/BSLN/\n    EPCI/BEMB/$Adr/RGEN/DPLM/MSSW/OSWD): VirtualSMC-style\n    identity plus the early boot-time SMC probe keys.\n\n  * 2 GPU temperature sensors (TGDD/TG0P) and #KEY (the\n    Apple-canonical total-keys count, computed by walking\n    the data_def list at realize time).\n\n  * 1 VirtualSMC-compatible $Num key (some drivers prefer it\n    over #KEY).\n\nAfter this patch, with the protocol fix from the previous\npatch in place, a Sequoia 15.7.5 guest boots without the SMC\nretry storm:\n\n   Metric           | Before   | After\n   -----------------|---------:|------:\n   SMC errors / 5s  |   9,225  |     2\n   kernel_task CPU  |    70 %  |  ~2 %\n   WindowServer CPU |   509 %  |  ~6 %\n\nLegacy macOS guests (10.11-10.13) that do not iterate the\nkey space see no behavioural change beyond the corrected\nMSSD value (now 0x03 as on real iMac20,1 hardware) and the\nfact that READ on a previously-unknown key returns zeros\ninstead of NOEXIST.\n\nSigned-off-by: Matthew Jackson <matthew@pq.io>\n---\n hw/misc/applesmc.c | 167 +++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 167 insertions(+)",
    "diff": "diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c\nindex 2b5ef3c..bc2573d 100644\n--- a/hw/misc/applesmc.c\n+++ b/hw/misc/applesmc.c\n@@ -493,12 +493,179 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp)\n \n     QLIST_INIT(&s->data_def);\n \n+    /* System identification */\n     applesmc_add_key(s, \"REV \", 6, \"\\x01\\x13\\x0f\\x00\\x00\\x03\");\n     applesmc_add_key(s, \"OSK0\", 32, s->osk);\n     applesmc_add_key(s, \"OSK1\", 32, s->osk + 32);\n     applesmc_add_key(s, \"NATJ\", 1, \"\\0\");\n     applesmc_add_key(s, \"MSSP\", 1, \"\\0\");\n     applesmc_add_key(s, \"MSSD\", 1, \"\\x03\");\n+\n+    /*\n+     * GPU power-management keys. Without HE2N the AGPM driver reads\n+     * NOEXIST, errors out (0x82) and hangs the system on dynamic\n+     * wallpaper changes. The driver itself sets the value to 1 on\n+     * start, so the boot default of 0 is correct.\n+     */\n+    applesmc_add_key(s, \"HE2N\", 1, \"\\x00\");  /* dGPU power enable */\n+\n+    /*\n+     * Watchdog timer control. Queried by macOS during early boot; an\n+     * unanswered query produces a cluster of SMCWDT errors per boot.\n+     */\n+    applesmc_add_key(s, \"WDTC\", 1, \"\\x00\");\n+\n+    /*\n+     * GPU temperature sensors. SP78 format: 16-bit big-endian with the\n+     * top 8 bits encoding integer degrees C and the bottom 8 bits the\n+     * fraction. Returning zeroed sensors caused macOS to flag these as\n+     * broken and retry-poll. Values approximate a warm idle iMac20,1.\n+     */\n+    applesmc_add_key(s, \"TGDD\", 2, \"\\x2A\\x00\");  /* GPU diode: 42 C */\n+    applesmc_add_key(s, \"TG0P\", 2, \"\\x24\\x00\");  /* GPU proximity: 36 C */\n+\n+    /*\n+     * Fan control (iMac20,1 has one chassis fan). fpe2 format: raw\n+     * value is RPM << 2, big-endian. Idle ~1500 RPM, range 1200-3600.\n+     */\n+    applesmc_add_key(s, \"FNum\", 1, \"\\x01\");\n+    applesmc_add_key(s, \"F0Ac\", 2, \"\\x12\\xC0\");  /* current: 1200 RPM (idle = F0Mn) */\n+    applesmc_add_key(s, \"F0Mn\", 2, \"\\x12\\xC0\");  /* min:     1200 RPM */\n+    applesmc_add_key(s, \"F0Mx\", 2, \"\\x38\\x40\");  /* max:     3600 RPM */\n+\n+    /* Platform-identity keys also provided by VirtualSMC. */\n+    applesmc_add_key(s, \"MPRO\", 1, \"\\x01\");  /* model property */\n+    applesmc_add_key(s, \"MPRD\", 1, \"\\x00\");  /* model product */\n+    applesmc_add_key(s, \"LGPB\", 1, \"\\x00\");  /* lid/GPU power */\n+\n+    /* CPU/power keys consumed by X86PlatformPlugin. */\n+    applesmc_add_key(s, \"BSLN\", 1, \"\\x00\");  /* baseline */\n+    applesmc_add_key(s, \"EPCI\", 4, \"\\x00\\x00\\x00\\x00\"); /* EPC info */\n+    applesmc_add_key(s, \"BEMB\", 1, \"\\x01\");  /* board embedded */\n+\n+    /* Keys read by the boot-time SMC probe. */\n+    applesmc_add_key(s, \"OSWD\", 2, \"\\x00\\x00\");  /* OS watchdog timer */\n+    applesmc_add_key(s, \"MSSW\", 1, \"\\x00\");  /* macOS software state */\n+    applesmc_add_key(s, \"RGEN\", 1, \"\\x02\");  /* SMC generation */\n+    applesmc_add_key(s, \"DPLM\", 4, \"\\x00\\x00\\x00\\x00\"); /* display power */\n+    applesmc_add_key(s, \"$Adr\", 4, \"\\x00\\x00\\x03\\x00\"); /* SMC base addr */\n+\n+    /*\n+     * Temperature sensors covering the rails the macOS AppleSMC client\n+     * polls on an iMac20,1-class host. Values are realistic idle\n+     * readings in SP78 (big-endian) format; zeros trigger retry storms\n+     * on broken-sensor paths.\n+     */\n+    applesmc_add_key(s, \"TC0F\", 2, \"\\x2D\\x00\");  /* CPU PECI filt: 45 C */\n+    applesmc_add_key(s, \"TC0P\", 2, \"\\x28\\x00\");  /* CPU proximity: 40 C */\n+    applesmc_add_key(s, \"TCXc\", 2, \"\\x33\\x00\");  /* CPU core max: 51 C */\n+    applesmc_add_key(s, \"TG0F\", 2, \"\\x2A\\x00\");  /* GPU 0 filt: 42 C */\n+    applesmc_add_key(s, \"TG1F\", 2, \"\\x2A\\x00\");  /* GPU 1 filt: 42 C */\n+    applesmc_add_key(s, \"TH0P\", 2, \"\\x29\\x00\");  /* HDD proximity: 41 C */\n+    applesmc_add_key(s, \"TH1A\", 2, \"\\x1A\\x00\");  /* HDD 1 ambient: 26 C */\n+    applesmc_add_key(s, \"TH1C\", 2, \"\\x29\\x00\");  /* HDD 1 core: 41 C */\n+    applesmc_add_key(s, \"TH1F\", 2, \"\\x29\\x00\");  /* HDD 1 filt: 41 C */\n+    applesmc_add_key(s, \"TL0V\", 2, \"\\x1D\\x00\");  /* LCD 0: 29 C */\n+    applesmc_add_key(s, \"TL1V\", 2, \"\\x1C\\x00\");  /* LCD 1: 28 C */\n+    applesmc_add_key(s, \"TM0P\", 2, \"\\x24\\x00\");  /* memory prox: 36 C */\n+    applesmc_add_key(s, \"TM0V\", 2, \"\\x22\\x00\");  /* memory VRM: 34 C */\n+    applesmc_add_key(s, \"Tp00\", 2, \"\\x21\\x00\");  /* PSU: 33 C */\n+    applesmc_add_key(s, \"Tp2F\", 2, \"\\x21\\x00\");  /* PSU 2: 33 C */\n+    applesmc_add_key(s, \"Ts0S\", 2, \"\\x21\\x00\");  /* sensor 0: 33 C */\n+    applesmc_add_key(s, \"TS0V\", 2, \"\\x21\\x00\");  /* sensor 0 V: 33 C */\n+    applesmc_add_key(s, \"Ts1S\", 2, \"\\x21\\x00\");  /* sensor 1: 33 C */\n+    applesmc_add_key(s, \"Ts2S\", 2, \"\\x21\\x00\");  /* sensor 2: 33 C */\n+    applesmc_add_key(s, \"TB0T\", 2, \"\\x00\\x00\");  /* no battery */\n+    applesmc_add_key(s, \"TB1T\", 2, \"\\x00\\x00\");  /* no battery */\n+    applesmc_add_key(s, \"TB2T\", 2, \"\\x00\\x00\");  /* no battery */\n+    applesmc_add_key(s, \"TA0V\", 2, \"\\x18\\x00\");  /* ambient 0: 24 C */\n+    applesmc_add_key(s, \"TVMD\", 2, \"\\x32\\x00\");  /* VRM diode: 50 C */\n+    applesmc_add_key(s, \"TVmS\", 2, \"\\x32\\x00\");  /* VRM sense: 50 C */\n+    applesmc_add_key(s, \"TVSL\", 2, \"\\x32\\x00\");  /* VRM sense L: 50 C */\n+    applesmc_add_key(s, \"TVSR\", 2, \"\\x32\\x00\");  /* VRM sense R: 50 C */\n+\n+    /* Power and platform rails (12 keys). */\n+    applesmc_add_key(s, \"PC0R\", 2, \"\\x00\\x00\");  /* CPU 0 rail */\n+    applesmc_add_key(s, \"PCPC\", 2, \"\\x00\\x00\");  /* CPU package core */\n+    applesmc_add_key(s, \"PCPG\", 2, \"\\x00\\x00\");  /* CPU package GPU */\n+    applesmc_add_key(s, \"PCPT\", 2, \"\\x00\\x00\");  /* CPU package total */\n+    applesmc_add_key(s, \"PfCP\", 2, \"\\x00\\x00\");  /* platform CPU power */\n+    applesmc_add_key(s, \"PfCT\", 2, \"\\x00\\x00\");  /* platform CPU temp */\n+    applesmc_add_key(s, \"PfGT\", 2, \"\\x00\\x00\");  /* platform GPU temp */\n+    applesmc_add_key(s, \"PfHT\", 2, \"\\x00\\x00\");  /* platform HDD temp */\n+    applesmc_add_key(s, \"PfM0\", 2, \"\\x00\\x00\");  /* platform memory 0 */\n+    applesmc_add_key(s, \"PfST\", 2, \"\\x00\\x00\");  /* platform system temp */\n+    applesmc_add_key(s, \"PSTR\", 2, \"\\x00\\x00\");  /* power supply temp rail */\n+    applesmc_add_key(s, \"PHDC\", 2, \"\\x00\\x00\");  /* platform HDC */\n+\n+    /* Memory / DIMM counters (6 keys). */\n+    applesmc_add_key(s, \"DM0P\", 2, \"\\x00\\x00\");  /* DIMM 0 proximity */\n+    applesmc_add_key(s, \"DM0S\", 2, \"\\x00\\x00\");  /* DIMM 0 sensor */\n+    applesmc_add_key(s, \"DM1P\", 2, \"\\x00\\x00\");  /* DIMM 1 proximity */\n+    applesmc_add_key(s, \"DM1S\", 2, \"\\x00\\x00\");  /* DIMM 1 sensor */\n+    applesmc_add_key(s, \"MD1R\", 2, \"\\x00\\x00\");  /* memory DIMM 1 read */\n+    applesmc_add_key(s, \"MD1W\", 2, \"\\x00\\x00\");  /* memory DIMM 1 write */\n+\n+    /* SMC internal bookkeeping (11 keys). */\n+    applesmc_add_key(s, \"CLKH\", 1, \"\\x00\");  /* clock halt */\n+    applesmc_add_key(s, \"DICT\", 1, \"\\x00\");  /* dictionary */\n+    applesmc_add_key(s, \"RPlt\", 2, \"\\x00\\x00\");  /* platform revision */\n+    applesmc_add_key(s, \"SBFL\", 1, \"\\x00\");  /* secure boot flags */\n+    applesmc_add_key(s, \"VRTC\", 2, \"\\x00\\x00\");  /* virtual RTC */\n+    applesmc_add_key(s, \"WKTP\", 2, \"\\x00\\x00\");  /* wake type */\n+    applesmc_add_key(s, \"zEPD\", 1, \"\\x00\");  /* endpoint descriptor */\n+    applesmc_add_key(s, \"cePn\", 1, \"\\x00\");  /* CE panel */\n+    applesmc_add_key(s, \"cmDU\", 1, \"\\x00\");  /* cm display unit */\n+    applesmc_add_key(s, \"maNN\", 1, \"\\x00\");  /* manufacturer NN */\n+    applesmc_add_key(s, \"mxT1\", 2, \"\\x00\\x00\");  /* max temp 1 */\n+\n+    /* Miscellaneous sensor/motion keys (13 keys). */\n+    applesmc_add_key(s, \"MSAc\", 1, \"\\x00\");  /* motion sensor active */\n+    applesmc_add_key(s, \"MSAf\", 1, \"\\x00\");  /* motion sensor filter */\n+    applesmc_add_key(s, \"MSAg\", 1, \"\\x00\");  /* motion sensor gain */\n+    applesmc_add_key(s, \"MSAi\", 1, \"\\x00\");  /* motion sensor interval */\n+    applesmc_add_key(s, \"MSGA\", 1, \"\\x00\");  /* MSG A */\n+    applesmc_add_key(s, \"MSHP\", 1, \"\\x00\");  /* MS HP */\n+    applesmc_add_key(s, \"MSPA\", 1, \"\\x00\");  /* MS PA */\n+    applesmc_add_key(s, \"MTLV\", 1, \"\\x00\");  /* MT level */\n+    applesmc_add_key(s, \"QCLV\", 1, \"\\x00\");  /* Q clevel */\n+    applesmc_add_key(s, \"QENA\", 1, \"\\x00\");  /* Q enable */\n+    applesmc_add_key(s, \"WIr0\", 2, \"\\x00\\x00\");  /* WiFi rate 0 */\n+    applesmc_add_key(s, \"WIw0\", 2, \"\\x00\\x00\");  /* WiFi write 0 */\n+    applesmc_add_key(s, \"WIz0\", 2, \"\\x00\\x00\");  /* WiFi zone 0 */\n+\n+    /* Write targets that must also be readable. */\n+    applesmc_add_key(s, \"HE0N\", 1, \"\\x00\");  /* iGPU power; driver sets 1 */\n+    applesmc_add_key(s, \"MSDW\", 1, \"\\x00\");  /* MSD write */\n+    applesmc_add_key(s, \"NTOK\", 1, \"\\x00\");  /* notification token */\n+\n+    /*\n+     * VirtualSMC-compatible total-keys key. Kept for compatibility with\n+     * drivers that look for $Num; the canonical Apple #KEY below is what\n+     * macOS actually iterates against.\n+     */\n+    applesmc_add_key(s, \"$Num\", 4, \"\\x00\\x00\\x00\\x5e\");\n+\n+    /*\n+     * #KEY - Apple SMC convention for \"total key count\". macOS reads it\n+     * at boot and iterates 0..count-1 via APPLESMC_GET_KEY_BY_INDEX_CMD.\n+     * Without this key, macOS iterates unbounded and every out-of-range\n+     * request floods the kernel log with kSMCSpuriousData errors\n+     * (measured ~1800/sec on macOS 15). Count is computed by walking the\n+     * list. The buffer is function-static so the pointer stays valid\n+     * for the device's lifetime.\n+     */\n+    {\n+        int count = 1;  /* include #KEY itself */\n+        struct AppleSMCData *def;\n+        QLIST_FOREACH(def, &s->data_def, node) count++;\n+        static char numkey_buf[4];\n+        numkey_buf[0] = (count >> 24) & 0xff;\n+        numkey_buf[1] = (count >> 16) & 0xff;\n+        numkey_buf[2] = (count >>  8) & 0xff;\n+        numkey_buf[3] =  count        & 0xff;\n+        applesmc_add_key(s, \"#KEY\", 4, numkey_buf);\n+    }\n }\n \n static void applesmc_unrealize(DeviceState *dev)\n",
    "prefixes": [
        "2/2"
    ]
}