From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077117; cv=none; d=zohomail.com; s=zohoarc; b=BgC7Mqb/nlxxEMPg038YRlbMl1l+LMgAan6k9Gx4p66w9KGM6XnF7Xe4szIxlHPqVztXAaU2cyJ5R+LITxrPPsgRCtfGBSO6whT/OKwHbEv9OmjafNQcCLxqfNXVh4SRr4AHVtIPj2MrM0xyyJw4wx5eWh5UzSRWo6gJxH9uyv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077117; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=74etoE1H4Vt/KU4xZOoXzZ54Zty9qqrQvEaIpDfvh7E=; b=epKyVuRscsX5GNb05IqdF4HTMaEu7TRTTp83Q1VEZQWcTZ1ZpCvYhrK87ZVU1zZfP6bkRnuT0YQkvswRc4EnQueaRHx9BaCRF2QNFhtG8WXF4hg5yQsA9LIAsT5a2sSMKewXmHJEL42J0Trj7/RODZOcI3iZK+0PaODNF13P1vw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077117139364.7150041826769; Thu, 15 Oct 2026 08:11:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN5z-0005ft-CO; Thu, 15 Oct 2026 11:10:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN5l-0005Um-Ho for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:03 -0400 Received: from mail-wm1-f46.google.com ([209.85.128.46]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN5i-0001PN-2g for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:00 -0400 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4a02667ccebso39763765e9.0 for ; Thu, 15 Oct 2026 08:09:57 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1c50689e6sm21829695e9.5.2026.10.15.08.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:09:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792076996; x=1792681796; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=74etoE1H4Vt/KU4xZOoXzZ54Zty9qqrQvEaIpDfvh7E=; b=N3BmnQr0NhSX6brgfoPtxEC2RnsrGId9pXzZBAdAeGC3WZVXGXVXYV3+6tJp1xNx/U 1vfjgJ5uSYDmyfUyL7Aqb4O7F9WtCUHyJ+iadh6rC70C3U7aXVNIbi5bS2HXMW3gVfh4 4mx70xEVrQIc0Hxi5Um17c5bS6YT5E+55iZOBTRlOt1Es0RDnMQp6JqjGVsrJiEBANfH xX3uAF6bxqL6QtdtmANaFVdKnlMvaSK2fdWUkTEGxXva59PZxdShaIifkzUav6STA0gv 9+I3xRX06A2AMqN+UIrG3IsF/lOo9WjIybqCr3LMvUaG4u3jqD/OcGWCJNE6lZrYrl+D 9Gqw== X-Gm-Message-State: AFq9FYI8grAzWhyyqby9giSzAEgy+GfBCeZLCTXGzEvUur76O+E9ti3c wGdxd/PnzI1YMzq7+3fgBnmcMbCWBGknM9Xyik7O/FGUPJtB2GdMTztA/oLteg== X-Gm-Gg: AYBFou1KBb2+YJN/QlD+yMKfpe0gBJkjjBdGl22hoAP2flJGDrATAVzJMGiQNNYBt1Y rc6pS4+6PK/FXBLhNfBpBXjgWEEF3pZ1JwVhgXcboRx6juZIyN6W4plzFzp1V0k9TaVmxNJRwK6 d4uqV4m1KPpas7w29HuHsi8Dm/SuAAh7XDkP8icqw59Saj7n2QFMORjrEbjIZ26B7RmIEGDyFOy vSkHlhCuHz9xvPYmARX/qn0c8dCz+sQ2C/6+fJQWhO/YxDo1oNiz0OwQ8ebLTX7Bi4cWH819zJ2 LuB8dnIWUYUlrXK4GqKoKx4a1o9BHc5cqd1T8RgsEVucw4Pubj7DZLxMcUbL4oHpQzotUjHj9RQ Zl8qT89JCSwsYh0FYCMHzLRdXvM0G+CxY4tU+DrBMIWFKc4tV6d9xvuusA995qjLoIc0O7kup5i PG3Bf1A8jjMMCNpvznP4Xr0a6+tjJrKsFPIYE52vbZrZSJsFLtYgKbEH81yzOYqNP1MgGzBpowy 4QR8M8WpwL9Igmm7vvYWx8G8TQOCxa7Gp07iRm8+fj7sw== X-Received: by 2002:a05:600d:82e4:b0:4a1:a45a:88f with SMTP id 5b1f17b1804b1-4a1a45a08f7mr248945935e9.20.1792076995953; Thu, 15 Oct 2026 08:09:55 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:39 +0200 Subject: [PATCH 01/22] hw/sensor: tmp421: do not report a stale errno on a parse failure MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-1-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065464; l=1336; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=XVWhDGukLr6PXwfmY7rmr+tRBguotXtnONw9Q1wdDtg=; b=WmgsaWFpkmIFw+F3nWjd/O7l2l0iYLNlbzlXG4rsJ9GkxrZ0G9HrP2bFGhYNFKh9dkwshkYry 1NBe7mpQ9NqDSbPJ82IP+/UD+Ts0qtl+iRTfBZYTh9VYxKTnHqa0Fny X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.46; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f46.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077119376158500 The temperature property accessors decode the channel index out of the property name and report a failure with error_setg_errno(). sscanf() does not set errno when it matches fewer items than expected, so the message is suffixed with whatever unrelated error was left behind by an earlier call. The bounds check right below already uses plain error_setg() for the same condition. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index 127edd0ba5..fde41b2323 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -117,7 +117,7 @@ static void tmp421_get_temperature(Object *obj, Visitor= *v, const char *name, int tempid; =20 if (sscanf(name, "temperature%d", &tempid) !=3D 1) { - error_setg_errno(errp, errno, "error reading %s", name); + error_setg(errp, "error reading %s", name); return; } =20 @@ -154,7 +154,7 @@ static void tmp421_set_temperature(Object *obj, Visitor= *v, const char *name, } =20 if (sscanf(name, "temperature%d", &tempid) !=3D 1) { - error_setg_errno(errp, errno, "error reading %s", name); + error_setg(errp, "error reading %s", name); return; } =20 --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077287; cv=none; d=zohomail.com; s=zohoarc; b=ihbjMVLOBGcJfQzs91knt1BIdMg9Ulz+vCtCaWayLRXp16ndHkYFIiX13Bb9JeXyGSXK2jWPzE8JiZwTWsJT6aXLdzJbwC3cw25pvbyUHZkktrJtyfYMW3INJ/RV49MdceEOsUH9TBnch0cdczB6rn+EDclnOQyqEgbVUJmiVus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077287; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=ICRLGSZ/DEoudJkKLVJVk8LBp8oLkoBLzgOCyFtFqxo=; b=SRKVrWGRfLeyjs4NMaFMQq02bNXfzDzCRZTZ0FknR6S1Q62cWI3P6ec4P/feD8Y2BRPL0r9HezejKN4mSaqmRzWIO56gBtgsrLQEdeNK0EfTPV1unyGHgnXMGZU9ZnQK/POn/tEkJJjtSuc6IDKRVDdZfLyyht2sJfJ4roQcPU4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179207728709160.09878727875423; Thu, 15 Oct 2026 08:14:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN60-0005gG-K7; Thu, 15 Oct 2026 11:10:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN5q-0005Wx-8d for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:07 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN5o-0001XO-7y for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:05 -0400 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-48b0584ad71so3248700f8f.0 for ; Thu, 15 Oct 2026 08:10:03 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48de09693c7sm24117519f8f.4.2026.10.15.08.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:10:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077003; x=1792681803; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ICRLGSZ/DEoudJkKLVJVk8LBp8oLkoBLzgOCyFtFqxo=; b=e7ZtHTp2L24XIULu3Ri3Am/FiwXup8M11NPcT1a6be7XUTFjCJ4vw68Hlc5LPv18GC kE5WPtoMMmhlILafkl9X3BUUd9I1NhauzD7kpXzreBdBPW593JT/SPtJAVsD6asRcon5 RlEnWkPGbHsD09R4UB0WFO+ZLDHnc6wqftJjRsKRibmEfRtLOm5IEyPg3atBM53lK0tB LSW/VvvTzAFgzZ0w7fOtiwEdrXMbFpJw81uwSfYDvARwyoMzguGlHWyJCUuFa3+E27uV 7q8o2Sa/ExrB61nIdlK9/9viDx1jl1jslYi+3EyDyJ9HRb3TkvVGUmOBiBgl8NJcwjWl cWJw== X-Gm-Message-State: AFq9FYKzd5RgIHvlosjgFyD1p+6yeZN5rmgGb9ApF9TwZKcuQqvWFPVC eY2SkVLKTQZY1FPA5AP1+QMNDYubyRN7LD3mOoDvwyEpLJZwI8LptL/1rgM9+g== X-Gm-Gg: AYBFou3M3LOK0UNv9CJaRj3/edhG0tCSpBboEl+11Z1kTp/ejIx9NT9pGH53eV9soSH 013TXedEq2gj+9L3w0ANj7mgqZOZzAewwcs3Ak7Z6+NV9SaPdn2O8/43gw5WN/HotUGEKfdVcZA 7pChUtUn1CA5de46NeD3QW0+YPFqdbxg+rwFRCe2wchTHkbXtalIzaCVgulQG6f1cWB9GXJJ5fn AQ6cfA9BunyP+TYLk99jfP6cyLx1+UF7UbeekvaCDmfAvRAiwgHxR61PVZmnPmUT+ny5lqyrGbN AXY6MdEPMbXzFvGsWyTpnPNcwnvD0rgbUXOuTIyc2K2hIJG2cEfJHSuTf7R66Iy9dqhD7qbgjwc eSFzfT9sOHJlFhV6BUohaPUYSRl0eOVI6VVf0NO5SrCrcdUe3G8AGKCkokPCFvHizML4/Z1ldGD fFzaRbFvnUKU0mSC2AGlw62suZMRzox1SyBIGbSuFPx1gNicRWBZ1IVZlgS5MSALCFtANYrlyRS pRXyKoaIQ+AIlBj9zuQJSsjC02sI+Bb8DnFMw1QlQIEmA== X-Received: by 2002:a5d:64cb:0:b0:48d:f34e:7561 with SMTP id ffacd0b85a97d-48df34e7658mr5958821f8f.14.1792077002424; Thu, 15 Oct 2026 08:10:02 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:40 +0200 Subject: [PATCH 02/22] hw/sensor: tmp421: name the parent object field parent_obj MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-2-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=1266; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=X/kN3xjDzBiaRkUauZ8mdXFMaJnkPfrAonUxOqKT35c=; b=WjB09hui7HQXWFAbEC8wG6Br3jLUb4uI/kqiCrexynUPB01RTw+KxlLcc/cnDMJpAtlBfB1qa lLLAd96LyHRDF2VdMjjv0UuN12QZQ0G9jLnDyPXruz6egHsUT8/nipp X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.49; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f49.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077288203158500 Follow the QOM convention for the embedded I2CSlave, matching the other hw/sensor I2C devices. No functional change. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index fde41b2323..e7927699ce 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -51,7 +51,7 @@ static const DeviceInfo devices[] =3D { =20 struct TMP421State { /*< private >*/ - I2CSlave i2c; + I2CSlave parent_obj; /*< public >*/ =20 int16_t temperature[4]; @@ -298,7 +298,7 @@ static const VMStateDescription vmstate_tmp421 =3D { VMSTATE_UINT8(status, TMP421State), VMSTATE_UINT8(rate, TMP421State), VMSTATE_INT16_ARRAY(temperature, TMP421State, 4), - VMSTATE_I2C_SLAVE(i2c, TMP421State), + VMSTATE_I2C_SLAVE(parent_obj, TMP421State), VMSTATE_END_OF_LIST() } }; @@ -334,7 +334,7 @@ static void tmp421_realize(DeviceState *dev, Error **er= rp) { TMP421State *s =3D TMP421(dev); =20 - tmp421_reset(&s->i2c); + tmp421_reset(&s->parent_obj); } =20 static void tmp421_class_init(ObjectClass *klass, const void *data) --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077100; cv=none; d=zohomail.com; s=zohoarc; b=lXbpyOrV4X3ieVztJjq9nJySdzzO/Svk6hjQ1nX/3QwqJir36aW9+dwG30gDmBO775bbnB/5JCf0t2Jl9u0CSdyVRk8eomsoyDr6TroGAsq/SFEUqq7USVGQ726lvJ9RcTiwMKFzS6jT5pidDEtCYieIY98gJSlzbJYhH3FjW/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077100; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=tMgSw4UUJMwBSnxsh5UNM4ZZEUwyYmjlfix+bmhPnj0=; b=YheWgmBDWBfn+FeWvGC0hoavrdxvv5578lLKzxfp975RtAyMwhHL5qCzBZm0HiR3FFuk/QlCkPFi8vvYVSkKhUqhXq5VHzPZlZaN/Nqj2vG/u/cweTo9gaS2DolUniHWIvWd1D9nj77reeusFtDMABF+lqua1s6OTtpzoMnR5Dg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077100426135.20216758076776; Thu, 15 Oct 2026 08:11:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN61-0005gW-2m; Thu, 15 Oct 2026 11:10:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN5w-0005en-6X for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:12 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN5u-0001dN-Fe for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:11 -0400 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-48de6a62a4cso2494612f8f.2 for ; Thu, 15 Oct 2026 08:10:10 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd97349esm77230245e9.3.2026.10.15.08.10.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:10:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077009; x=1792681809; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tMgSw4UUJMwBSnxsh5UNM4ZZEUwyYmjlfix+bmhPnj0=; b=iFZxOPgemAzK15yfB/Sb//Wbmk1g0cQeV5Q8UVEDuGo8XdMkZEyPkdmQRPESsJ0oqs FMzaHfp6nrsY+JmIhVoRn3OaT7bhFJVMVy+ag14VJgqJM1J3Nr5D2TbYpNb48a14qKkX KJgbOjYH2QYGQ/e7b/SU5TH45vnJS6U44DYD+FrLDbjoI+SX9Wc7SYnXKgk0gyX3UO1C gkR8hvy1FAFRdQkXOeI6EjCFisxNcAfz4I4qaxOvot9+HUh1IyuDYGWu3oSn7/gyF1hI 6k3UuPSFEK60XofjSIC54d9LQJJ2uD81Nc4wEw0cujae5FVSrVYcN+rcYB4EaGXeKBUv x46w== X-Gm-Message-State: AFq9FYIkdTY7Glbb2vE4AASGAIE6ge/Q5TZS/bUIi+2ejnu7qw97Q6B6 Bbw6h/PPISTrShD1aJFR0fqbLYLnvvrrUWjS2+YlJGFtXeK5zSGS3oPzua4FDQ== X-Gm-Gg: AYBFou2Dk8EobWqijviAcdi2/Xb9nEQPKH+GhmIOaj80W4H5lFrAaYcqa6RYllyh6Ju yXJFWx1u6Iozn5Sns+X74f0fdb/IVMPqmqAzRaPXkXEeL419lckIacxJocM9ioWxmV5PUuJ4Mih xZbrucWxpaV9wKglJxffKBL0p5VTv5tFjDrNk/6gWah3knyciXH+cetNkrpoop4RWxZWDUr14/z TvSwEQRZyUcmSI5KWbMuumogXTJa9HBaH4d89sEIY9WHOutT1/EU2d28bbossLOaoWg3CglPIiO X5EDDoTNuoAskNvEMfpynNtdpCFeD4WhlAJhRp2rY494uY6lJbcvX8Jlpq5mOxshIwDcNDLweZG MoyzqfYIgu5O8lHReohbvPiZ5qEkH6IQ57MspkWTsCQH0pKNJ8Pn6I2eiUaWXOuXejnx6TWR9ED 7SwQmaDXIPuCm2LuNCcIF8ETETaCL+PW4UZe22tv0To3bAwylm43Z+mladC/ueVtSQLI5/YC4Oh f/7CyyD19YOGjlIIc1sbUEEullbUAyZnQkdaOKJWsa0pA== X-Received: by 2002:a05:600c:4e91:b0:4a1:7ec7:a479 with SMTP id 5b1f17b1804b1-4a18e4f56bcmr398107885e9.33.1792077008886; Thu, 15 Oct 2026 08:10:08 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:41 +0200 Subject: [PATCH 03/22] hw/sensor: tmp421: implement Resettable reset MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-3-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=2741; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=tvoqjrv2J/EoPO9TG+O1KcuhmkCkE0+CZRSFQBVZEPU=; b=bfuAI4tj6xSx6us8DxH28R9e4wNaTF5rDzWe5qWPiOQmlr3R0AAkHJiAe8eEx8IuQ2u9yxBex ct1l++VAwwxBWrVT58OcbaAj9U70VV/yorE5z644+jKHHPLPspaIcZC X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.49; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f49.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077104108158500 Wire the reset through the Resettable hold phase instead of only calling it from realize, so bus and system resets re-initialise the device. The measured temperatures are no longer cleared on reset: they represent the physical input the ADC re-samples, and boards may preset them before the machine-wide power-on reset. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index e7927699ce..a9d15601cb 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -224,7 +224,7 @@ static void tmp421_read(TMP421State *s) } } =20 -static void tmp421_reset(I2CSlave *i2c); +static void tmp421_reset(TMP421State *s); =20 static void tmp421_write(TMP421State *s) { @@ -239,7 +239,7 @@ static void tmp421_write(TMP421State *s) s->config[1] =3D s->buf[0]; break; case TMP421_RESET: - tmp421_reset(I2C_SLAVE(s)); + tmp421_reset(s); break; } } @@ -303,17 +303,18 @@ static const VMStateDescription vmstate_tmp421 =3D { } }; =20 -static void tmp421_reset(I2CSlave *i2c) +static void tmp421_reset(TMP421State *s) { - TMP421State *s =3D TMP421(i2c); TMP421Class *sc =3D TMP421_GET_CLASS(s); =20 - memset(s->temperature, 0, sizeof(s->temperature)); + /* + * The measured temperatures are not cleared: they model the physical + * input the ADC re-samples after reset, and boards may preset them. + */ s->pointer =3D 0; + s->config[0] =3D 0; =20 - s->config[0] =3D 0; /* TMP421_CONFIG_RANGE */ - - /* resistance correction and channel enablement */ + /* resistance correction and channel enablement */ switch (sc->dev->model) { case TMP421_DEVICE_ID: s->config[1] =3D 0x1c; @@ -330,23 +331,22 @@ static void tmp421_reset(I2CSlave *i2c) s->status =3D 0; } =20 -static void tmp421_realize(DeviceState *dev, Error **errp) +static void tmp421_reset_hold(Object *obj, ResetType type) { - TMP421State *s =3D TMP421(dev); - - tmp421_reset(&s->parent_obj); + tmp421_reset(TMP421(obj)); } =20 static void tmp421_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); I2CSlaveClass *k =3D I2C_SLAVE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); TMP421Class *sc =3D TMP421_CLASS(klass); =20 - dc->realize =3D tmp421_realize; k->event =3D tmp421_event; k->recv =3D tmp421_rx; k->send =3D tmp421_tx; + rc->phases.hold =3D tmp421_reset_hold; dc->vmsd =3D &vmstate_tmp421; sc->dev =3D (DeviceInfo *) data; =20 --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077112; cv=none; d=zohomail.com; s=zohoarc; b=JUmx1ZQr5BP/FBOzHfPpCF6MLSsbhRSuRJOZcPdvwen+Kg2wR1Gjf99xQFwvp99FFV7YYbLus61p0XsC6Mnxc9Vx2hLxvazoEk3IqeBZVmF6ghFAyF0GeCHLrEY2IVbQq5uTDajQqCXYCwZz/ubycfUVP+T04HuKdmLtFlAik9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077112; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=DrWxbSnsvaHk4FolD7xYhC/5nO5JDheWb9wR5efBY2k=; b=FeIVQWvbzlJrI+FLOF0QMDpacabBkczY/wU0vI9BFR3yHqSg26e2I0lV7dKHCSxYLgQ9Ue2+6EqFFQQD1HN5mtj9Xzp6+0s9bwZyWrkbbXTDBuIxR7j5lGFAd5l8p65qWctGzlvyCenNm3qZJjeP9k/O74kV+LsUfKTjJ4EtQmo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077112413819.487735429735; Thu, 15 Oct 2026 08:11:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN65-0005hY-SP; Thu, 15 Oct 2026 11:10:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN63-0005hH-VC for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:19 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN62-0001e5-3s for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:19 -0400 Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-48b060ec084so3549299f8f.0 for ; Thu, 15 Oct 2026 08:10:17 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48defca4013sm9546455f8f.9.2026.10.15.08.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:10:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077017; x=1792681817; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=DrWxbSnsvaHk4FolD7xYhC/5nO5JDheWb9wR5efBY2k=; b=eFDPVh79beho3J0rQ1j28wsvv1Dv64F7CHpxLedxEnNLDm5XqGeNtim5G/Zo8JN5Tj cV3G1JWp9XbQjDYKQw/nFH3dQWL+L917bf9JoQhUTzRugSRZqIirfy8NIHeTdzvUq9gv ie4ivXjoe8ECnR5STJYh/OLedd1KaP/TOQ1NmvCjmGIIGX3gnqyG8u6OmFL11h+WVhrC ASZKnJhZg0E6pz1uVoU7LG4P4+iQ/mdBRVq6KsACOTZ13TUTqpeVfP9rxNLLdTBsKjUZ 1MnTN7NI1Mi9XCQnSZDzQV6FJ6aXIeCLg3C0jCVeZBpzxdVs+SIgWv1pTp9TpMMHlXp8 KrPQ== X-Gm-Message-State: AFq9FYIAf/5GDJQsSPvajThpid8n+IIECg4bo4ZpUQejTsma3SqH0T3/ TmcsAxGX30UEHn5pQZOjiUuq10h4oHh4LlNeJ9b1gee+ZTua8k2BwlZyKVNSug== X-Gm-Gg: AYBFou1ACaKzhg5/AfWtRy1+fm9WX2RDdT/OkWi4HH2F2v+IJN/hRTEd0qVhuLL+jwP EfrzEeKzkoUDwCtk1/IvHGSeoOy/6KYfuxXSXXtn2zLkoyvu3ofu5O20uRiVTMs/yf5LdxcDxJp rpN8eZK9Kk+yo6qLvMZYkIj4WIx6SIbwHAWNlTNZYLXF12G0u838+g5bZkrcxkUqkVVT1mnTWQV g2OrBKv+Q07ZxkXSCGy9Tssj9IY92e5f7CquqeTJrp0cp8kz9y7xDaNfahsgGcZAzYd0RHMY+Hv 7QEuyy3FJxTsOcUhn3/t2GjJW3bwuY9AA1+paNttoJ68qhvWRF7lwLBT+590q8Xcx6byotz4Vgb /LutDs9RCQXTUm8VYzpujXiMLVm289b3oBcbfdSA36G0JMDYtsofU4P58ahMzFsL1txwjLetAeP x2rHL8Zo0NGDC80YwL/ZScdpa+9g8MJo8RlTkIRfB6ydgyZhyn53LaeFVg5ModgfnhMNqE77c9m 4K/Lt7hSsCPVomBMjzjpvR5EynR6RcKAkypSQhBZo0xLjS/H+eqKVSt X-Received: by 2002:a05:6000:290f:b0:48d:f485:5f34 with SMTP id ffacd0b85a97d-48df4855fbfmr5188731f8f.45.1792077016245; Thu, 15 Oct 2026 08:10:16 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:42 +0200 Subject: [PATCH 04/22] hw/sensor: tmp421: model device variants with a class descriptor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-4-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=4905; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=nYz/UVk+7v4ORl7v0nKTPKyz2xEqXKmkO03V/LuED0w=; b=lHK58tIcIUrhEryl11iCJpmtCXq0KyJvgFDG2jm21GX8BmIYvGomljYK4GFTqHVTXU7FxtNlH 2KabCzGnjO/ASoBs8smE7id2Fbx3LYtbE2GBMlPY8ESAAUpu6Ciyj04 X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.41; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f41.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077113339158500 Replace the ad-hoc DeviceInfo table and its manual type-registration loop with per-variant fields on the device class, set by a dedicated class_init for each part and registered through DEFINE_TYPES. This drops the abstract base type in favour of the TMP421 acting as the base for its TMP422/TMP423 supersets. The three instantiable type names are unchanged, but TYPE_TMP421 now spells "tmp421" rather than the abstract "tmp421-generic", which no longer exists, and a TMP421 cast now succeeds for the two supersets. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 98 +++++++++++++++++++++++++-------------------------= ---- 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index a9d15601cb..7f0e3b3214 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -38,17 +38,6 @@ #define TMP422_DEVICE_ID 0x22 #define TMP423_DEVICE_ID 0x23 =20 -typedef struct DeviceInfo { - int model; - const char *name; -} DeviceInfo; - -static const DeviceInfo devices[] =3D { - { TMP421_DEVICE_ID, "tmp421" }, - { TMP422_DEVICE_ID, "tmp422" }, - { TMP423_DEVICE_ID, "tmp423" }, -}; - struct TMP421State { /*< private >*/ I2CSlave parent_obj; @@ -68,10 +57,14 @@ struct TMP421State { =20 struct TMP421Class { I2CSlaveClass parent_class; - const DeviceInfo *dev; + + uint8_t device_id; + uint8_t config2_reset; }; =20 -#define TYPE_TMP421 "tmp421-generic" +#define TYPE_TMP421 "tmp421" +#define TYPE_TMP422 "tmp422" +#define TYPE_TMP423 "tmp423" OBJECT_DECLARE_TYPE(TMP421State, TMP421Class, TMP421) =20 =20 @@ -177,7 +170,7 @@ static void tmp421_read(TMP421State *s) s->buf[s->len++] =3D TMP421_MANUFACTURER_ID; break; case TMP421_DEVICE_ID_REG: - s->buf[s->len++] =3D sc->dev->model; + s->buf[s->len++] =3D sc->device_id; break; case TMP421_CONFIG_REG_1: s->buf[s->len++] =3D s->config[0]; @@ -313,20 +306,7 @@ static void tmp421_reset(TMP421State *s) */ s->pointer =3D 0; s->config[0] =3D 0; - - /* resistance correction and channel enablement */ - switch (sc->dev->model) { - case TMP421_DEVICE_ID: - s->config[1] =3D 0x1c; - break; - case TMP422_DEVICE_ID: - s->config[1] =3D 0x3c; - break; - case TMP423_DEVICE_ID: - s->config[1] =3D 0x7c; - break; - } - + s->config[1] =3D sc->config2_reset; s->rate =3D 0x7; /* 8Hz */ s->status =3D 0; } @@ -348,7 +328,9 @@ static void tmp421_class_init(ObjectClass *klass, const= void *data) k->send =3D tmp421_tx; rc->phases.hold =3D tmp421_reset_hold; dc->vmsd =3D &vmstate_tmp421; - sc->dev =3D (DeviceInfo *) data; + + sc->device_id =3D TMP421_DEVICE_ID; + sc->config2_reset =3D 0x1c; =20 object_class_property_add(klass, "temperature0", "int", tmp421_get_temperature, @@ -364,28 +346,40 @@ static void tmp421_class_init(ObjectClass *klass, con= st void *data) tmp421_set_temperature, NULL, NULL); } =20 -static const TypeInfo tmp421_info =3D { - .name =3D TYPE_TMP421, - .parent =3D TYPE_I2C_SLAVE, - .instance_size =3D sizeof(TMP421State), - .class_size =3D sizeof(TMP421Class), - .abstract =3D true, +static void tmp422_class_init(ObjectClass *klass, const void *data) +{ + TMP421Class *sc =3D TMP421_CLASS(klass); + + sc->device_id =3D TMP422_DEVICE_ID; + sc->config2_reset =3D 0x3c; +} + +static void tmp423_class_init(ObjectClass *klass, const void *data) +{ + TMP421Class *sc =3D TMP421_CLASS(klass); + + sc->device_id =3D TMP423_DEVICE_ID; + sc->config2_reset =3D 0x7c; +} + +static const TypeInfo tmp421_types[] =3D { + { + .name =3D TYPE_TMP421, + .parent =3D TYPE_I2C_SLAVE, + .instance_size =3D sizeof(TMP421State), + .class_size =3D sizeof(TMP421Class), + .class_init =3D tmp421_class_init, + }, + { + .name =3D TYPE_TMP422, + .parent =3D TYPE_TMP421, + .class_init =3D tmp422_class_init, + }, + { + .name =3D TYPE_TMP423, + .parent =3D TYPE_TMP421, + .class_init =3D tmp423_class_init, + }, }; =20 -static void tmp421_register_types(void) -{ - int i; - - type_register_static(&tmp421_info); - for (i =3D 0; i < ARRAY_SIZE(devices); ++i) { - TypeInfo ti =3D { - .name =3D devices[i].name, - .parent =3D TYPE_TMP421, - .class_init =3D tmp421_class_init, - .class_data =3D &devices[i], - }; - type_register_static(&ti); - } -} - -type_init(tmp421_register_types) +DEFINE_TYPES(tmp421_types) --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077100; cv=none; d=zohomail.com; s=zohoarc; b=WIIRRV8lDc9dz4Ckah4oAHrL1wXgzwsBtzbb4+Ht9X2ARp9fji70kX4TRxX1AarP28egmbgq5kHi34aDjhV0G7rw931thnz/OOANCmkg2x1sWAqb4e1leqwm8tPop42ozSfu1g3a08F++Pz/7rTiCaV2IXuDFbCoMDb11qdKA8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077100; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=OlcJaO13/HWgHXhBu0C0Yz3eZ87xrrYAWtMGnHtQsnk=; b=Ia2WQniRqrPJ6ixSaCI1hwlG8XKnzb6wCNTxJsZnL5oKUwS+tAzvGSXLtAX5gLqLR3CUbEKZJ/kdAYsEyOdMLGjsUwF8DwCCyyApc3/8tfIgiIGU2ai3vQRtgz19VsaQZscGPqU94Tb6TqivibUjIAwADSjy+hgS56sXZs3T58k= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077100150957.9325006704116; Thu, 15 Oct 2026 08:11:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN6G-0005lc-JX; Thu, 15 Oct 2026 11:10:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN6C-0005k4-N3 for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:28 -0400 Received: from mail-wm1-f53.google.com ([209.85.128.53]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN6A-0001fD-Kb for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:28 -0400 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4a020e65269so35810825e9.2 for ; Thu, 15 Oct 2026 08:10:26 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd96f9a0sm75740515e9.1.2026.10.15.08.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:10:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077025; x=1792681825; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OlcJaO13/HWgHXhBu0C0Yz3eZ87xrrYAWtMGnHtQsnk=; b=pJulP+TGNKIATfQN4o83nHA3OATP6NmB7Kl0cVf2nl6TMjNw6j5ImbrRn3x7/9TFOg 2aSBUV/OTSGcYqHBu0lndVzY5K2he5l56dTcaNi/sUJivw9cSdzS9f7AN0scBnv0u39A d7LZZO03B05lR6qdWAfVy0NINSZNi/vnwxBLRPWX/44O7W2T6qDQMiniGn4pwg5DfGWi swmuZ8JAh8T5WENZJxAm+Z/PWCP8HFINzqaxOIntMl72IBSHNVg37n7APISXlLGUr6/g LBMlxcRR6ld+3lFV9kvA7EeDD+LCnDz9MgOYVwXm03cMZrt3s15LRM2tBW1EPPbz4dyQ 6U0w== X-Gm-Message-State: AFq9FYLJX/jobclF3ZG2qzrVTzTklXNzrrHnGh/Ty1XW/9HvAAJo5THF KsIlNX95IP6riozY4f8sHRVNuE32kYeu0KciyvH4Bp4+KlKze7giFKs4BXzUaw== X-Gm-Gg: AYBFou3SmAEQiBDS9x9tLkCzpEiBxdBzmRx0YlKhjih0f3XYi8dWAPXJ1+arC03bEFI 5+Nhu6in8/jZkuRhBOu4D9XjoPZoQrMXPFA/jkhhAONxxS3TsoaVOQ2DrQ7PgB/qOWaqctrIZEN XWYuWP3omer71L1nGdlRSzBJzsVaUG9i1Ttia+1GeTEytOspmIMB720XqjyORXkdpk1szzDBqto n6J2dlKG7s2A5gxBuGaPMfO31mlPhWz+dJ4Eig0hF74dD22isgkW0T4mFA7B276Zdvk93IyejBl wgzO8j0pQr/a3Enzyigclj20tNXAy3REvdxUPDMJXqzYc36LPrARBHjfaiLj+DgdjvVdZg6pGZy JL0QRer1r9y0Ii1O5CsAKokVAEv503ohqEkBPeZvOtOwcKwmYyH69wshBeDg0cEcwUjGrMmZLwo 7D/r6QBuDk8bJi8bk97tp9xE0JAHOHcl2jBgEmVDbdPOgj6JMf8gMcLRYSp44rUcvu6ap38lYOn LnYc1rB77BDxIMauGopeMIalyoL6amdQ+5XZ0DjJqIROQ== X-Received: by 2002:a05:600c:3e8f:b0:4a0:1c0e:b057 with SMTP id 5b1f17b1804b1-4a18e44653cmr399949475e9.4.1792077025117; Thu, 15 Oct 2026 08:10:25 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:43 +0200 Subject: [PATCH 05/22] hw/sensor: tmp421: honor per-variant channels and channel enablement MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-5-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=6605; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=YX60yitZnrhatj4jjBlP51Qv1RKMFJvzEHfnfBzeo04=; b=kUaFbYlvh4B8rmDjh265ZPMM7QwzqZqcCCi0ck8Vu0/3/WJ0IMfOBLSbZjYBoFQZUwG7dEK4S ZbUnuBfKYecBFqqCKi9HYy0Kxx20dpgFgnUjcaTYF+Fe7sAzGXaUNV4 X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.53; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f53.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077104135158500 Each part exposes a different number of temperature channels; register only the temperature properties that exist and gate the temperature register reads on both channel presence and the configuration enable bits. A disabled or absent channel now reads back zero instead of stale data, resolving the long-standing FIXME. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 100 +++++++++++++++++++++++++++++++------------------= ---- 1 file changed, 58 insertions(+), 42 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index 7f0e3b3214..8bacd7d05e 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -59,6 +59,7 @@ struct TMP421Class { I2CSlaveClass parent_class; =20 uint8_t device_id; + uint8_t nchannels; /* local + remote */ uint8_t config2_reset; }; =20 @@ -159,12 +160,50 @@ static void tmp421_set_temperature(Object *obj, Visit= or *v, const char *name, s->temperature[tempid] =3D (int16_t) ((temp * 256 - 128) / 1000) + off= set; } =20 +static bool tmp421_channel_enabled(TMP421State *s, unsigned channel) +{ + TMP421Class *sc =3D TMP421_GET_CLASS(s); + + return channel < sc->nchannels && + (s->config[1] & (1 << (3 + channel))); +} + +/* + * A disabled or absent channel reads back zero. The low byte carries the + * temperature fraction in its upper nibble. + */ +static uint8_t tmp421_temp_high(TMP421State *s, unsigned channel) +{ + uint16_t reg =3D s->temperature[channel]; + + return tmp421_channel_enabled(s, channel) ? reg >> 8 : 0; +} + +static uint8_t tmp421_temp_low(TMP421State *s, unsigned channel) +{ + uint16_t reg =3D s->temperature[channel]; + + return tmp421_channel_enabled(s, channel) ? reg & 0xf0 : 0; +} + static void tmp421_read(TMP421State *s) { TMP421Class *sc =3D TMP421_GET_CLASS(s); =20 s->len =3D 0; =20 + if (s->pointer <=3D TMP421_TEMP_MSB3) { + /* high byte read latches the paired low byte from one conversion = */ + unsigned channel =3D s->pointer - TMP421_TEMP_MSB0; + s->buf[s->len++] =3D tmp421_temp_high(s, channel); + s->buf[s->len++] =3D tmp421_temp_low(s, channel); + return; + } + if (s->pointer >=3D TMP421_TEMP_LSB0 && s->pointer <=3D TMP421_TEMP_LS= B3) { + s->buf[s->len++] =3D tmp421_temp_low(s, s->pointer - TMP421_TEMP_L= SB0); + return; + } + switch (s->pointer) { case TMP421_MANUFACTURER_ID_REG: s->buf[s->len++] =3D TMP421_MANUFACTURER_ID; @@ -184,35 +223,8 @@ static void tmp421_read(TMP421State *s) case TMP421_STATUS_REG: s->buf[s->len++] =3D s->status; break; - - /* FIXME: check for channel enablement in config registers */ - case TMP421_TEMP_MSB0: - s->buf[s->len++] =3D (((uint16_t) s->temperature[0]) >> 8); - s->buf[s->len++] =3D (((uint16_t) s->temperature[0]) >> 0) & 0xf0; - break; - case TMP421_TEMP_MSB1: - s->buf[s->len++] =3D (((uint16_t) s->temperature[1]) >> 8); - s->buf[s->len++] =3D (((uint16_t) s->temperature[1]) >> 0) & 0xf0; - break; - case TMP421_TEMP_MSB2: - s->buf[s->len++] =3D (((uint16_t) s->temperature[2]) >> 8); - s->buf[s->len++] =3D (((uint16_t) s->temperature[2]) >> 0) & 0xf0; - break; - case TMP421_TEMP_MSB3: - s->buf[s->len++] =3D (((uint16_t) s->temperature[3]) >> 8); - s->buf[s->len++] =3D (((uint16_t) s->temperature[3]) >> 0) & 0xf0; - break; - case TMP421_TEMP_LSB0: - s->buf[s->len++] =3D (((uint16_t) s->temperature[0]) >> 0) & 0xf0; - break; - case TMP421_TEMP_LSB1: - s->buf[s->len++] =3D (((uint16_t) s->temperature[1]) >> 0) & 0xf0; - break; - case TMP421_TEMP_LSB2: - s->buf[s->len++] =3D (((uint16_t) s->temperature[2]) >> 0) & 0xf0; - break; - case TMP421_TEMP_LSB3: - s->buf[s->len++] =3D (((uint16_t) s->temperature[3]) >> 0) & 0xf0; + default: + s->buf[s->len++] =3D 0; break; } } @@ -316,6 +328,19 @@ static void tmp421_reset_hold(Object *obj, ResetType t= ype) tmp421_reset(TMP421(obj)); } =20 +static void tmp421_initfn(Object *obj) +{ + TMP421Class *sc =3D TMP421_GET_CLASS(obj); + + for (unsigned channel =3D 0; channel < sc->nchannels; channel++) { + g_autofree char *name =3D g_strdup_printf("temperature%u", channel= ); + + object_property_add(obj, name, "int", + tmp421_get_temperature, + tmp421_set_temperature, NULL, NULL); + } +} + static void tmp421_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -331,19 +356,7 @@ static void tmp421_class_init(ObjectClass *klass, cons= t void *data) =20 sc->device_id =3D TMP421_DEVICE_ID; sc->config2_reset =3D 0x1c; - - object_class_property_add(klass, "temperature0", "int", - tmp421_get_temperature, - tmp421_set_temperature, NULL, NULL); - object_class_property_add(klass, "temperature1", "int", - tmp421_get_temperature, - tmp421_set_temperature, NULL, NULL); - object_class_property_add(klass, "temperature2", "int", - tmp421_get_temperature, - tmp421_set_temperature, NULL, NULL); - object_class_property_add(klass, "temperature3", "int", - tmp421_get_temperature, - tmp421_set_temperature, NULL, NULL); + sc->nchannels =3D 2; } =20 static void tmp422_class_init(ObjectClass *klass, const void *data) @@ -352,6 +365,7 @@ static void tmp422_class_init(ObjectClass *klass, const= void *data) =20 sc->device_id =3D TMP422_DEVICE_ID; sc->config2_reset =3D 0x3c; + sc->nchannels =3D 3; } =20 static void tmp423_class_init(ObjectClass *klass, const void *data) @@ -360,6 +374,7 @@ static void tmp423_class_init(ObjectClass *klass, const= void *data) =20 sc->device_id =3D TMP423_DEVICE_ID; sc->config2_reset =3D 0x7c; + sc->nchannels =3D 4; } =20 static const TypeInfo tmp421_types[] =3D { @@ -367,6 +382,7 @@ static const TypeInfo tmp421_types[] =3D { .name =3D TYPE_TMP421, .parent =3D TYPE_I2C_SLAVE, .instance_size =3D sizeof(TMP421State), + .instance_init =3D tmp421_initfn, .class_size =3D sizeof(TMP421Class), .class_init =3D tmp421_class_init, }, --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077155; cv=none; d=zohomail.com; s=zohoarc; b=kgFaQ9/9/nZq7DAJeSOon1V6Lt07KlWzeQMfDy8EXjhP/H3+Fur/GMaoh3dqDP3EPoM/S9NIendSU8Eajb92DVPwdimyq2LfNKZOFIziFCYeV6x/l7ta2mYKIqgGDTL5W8mil/eOPlwoGH3hxgUZvKl0tsYC/HbNWjfS8NT2ktE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077155; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=AXWD4+zwD5+znWTjB90+sqSvptsRhK2GKfreGaEa0pg=; b=Uhdak3P3AdQj3qMrlEfOCh3Iu9OLYTH8Kq5zRYl+gQvvEZxZXKED3d+Afsw/H4rS9WLrL450gnahsV3VE2BAzj5DCKIq8ZO+3VixCuAUBcU0YUwClyB0HoQxn/GrwPku4583DZx7AyzSWFahUgWFFS8+cnKgB5lRCpAWjTh2eJo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077155551127.30064025411389; Thu, 15 Oct 2026 08:12:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN6V-0005n8-BZ; Thu, 15 Oct 2026 11:10:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN6T-0005mb-K8 for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:45 -0400 Received: from mail-wm1-f51.google.com ([209.85.128.51]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN6R-0001gP-HJ for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:45 -0400 Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4a1880e1bf1so20493715e9.1 for ; Thu, 15 Oct 2026 08:10:43 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bdbb4a30sm74559955e9.15.2026.10.15.08.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:10:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077042; x=1792681842; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AXWD4+zwD5+znWTjB90+sqSvptsRhK2GKfreGaEa0pg=; b=OxKv4uba7FeSvu/dgDX3NHZxICDRB+/G8KNg6Chm2xkrt1Wz6llqNnGu8EQ4aMVeeO Wv0rThyI6mpFdthepKY4K4zDwZjAj5UDbfMoMdNle94PZ2XrTGghM9JSr4M25rR2fkEI /pjAc1Iyh5wQt0g7ZQ/+hHHz+sLs/w1OkjSKXaTktIPCUeD4MLb1Ow97YATOV/SOwboK 4vuujMEMr7WLeIllayxxYyG1yyVg9hcisjsOrS/eCAr3D2AP8cElvmnVnWccz55Cpopz nTM8inxVk0EQdRZxYjmjkqI3DMFMEt8cvi3SdZn2vjLpg1sh/yAGvoPX5KuiX5ay14tp pKtw== X-Gm-Message-State: AFq9FYK76VWnOfj6FQUqtohydkHniIffpJ3HuEqCeE8gKTJ7AW4I7NXw e32lziQ0moIHiiiv7B9KROOcksT4wU5j0fooJoN1lepELsBhPtexvg9lG0Q9AQ== X-Gm-Gg: AYBFou2vx7rrMLVClHz6Mi39XW/H/YDz4VZNo1STPBe2ZP5oO83VAtPc4HKTdSJ2Pxs aCDmYesLyQ4jfOMnnR6mXo0Q7XexzP6e2HZb1PJDcoFkNz2IuPzT5slMT1DJpgWsIedYE49F+7O qEoNtzJoT+RKT+5b+8wZvLPYEaQkJe/7AEGMgnb7dp/4Wh9C/Q57XCKReOdC5zPZxRDcMKcFCax yxA6/81gtA78CrpZn8p3mXhvdNhj5E83OHHRoNJcuYqA1oD7p0Up8VyI8FX+Fqg1+NrUZecOFiN CiAjgyi2OCHJsp+YL7Tm8i9GiGdm/wRKav5jKPsWYAPXilHmBVu67VNU1jhjgYiPISYJ7u69PwP VO2TYGLzbonrxWWD0IyQX6WzY5VFzM40e2OvwwsbgeMnrH9vZLYOcZ3QIedxDVATZ0lXVMXizw6 vp+fRClOVq9WEHZ+GV4bBdxsb3fo/elXHDEjS1QIueGUeGWiX5fPwZIfbOdhrFBLdxnlA5qpdDD Ka2Jrw2dnFS48V48riqzLYi7Rllr5MtADihsu7ft9BDvw== X-Received: by 2002:a05:600c:e549:20b0:4a1:9438:719e with SMTP id 5b1f17b1804b1-4a1943872ecmr225766815e9.9.1792077041969; Thu, 15 Oct 2026 08:10:41 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:44 +0200 Subject: [PATCH 06/22] hw/sensor: tmp421: implement register write masks, one-shot and N-factor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-6-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=5041; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=cin5ptKk8HcvGgeoKuQLp36sHnFJYgrk5/pmB0x+vAw=; b=QVwfojw1gxHqFWDhmpboOeQ8XeQotUnSJWdU1soj9tRyGgP8yR88CckaOWS9vd63aY3K2anfT 9/LII9Zitq+AP137nHCV0UN+LUGkrRX7vG1Q5rFOUkVUw5CGOO6+l46 X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.51; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f51.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077156128158500 Mask out reserved and absent-channel bits on writes to the two configuration registers and the conversion rate, accept the one-shot trigger, and back the per-remote-channel N-factor correction registers with real storage. The N-factor state migrates through an optional subsection. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++-= ---- 1 file changed, 60 insertions(+), 5 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index 8bacd7d05e..9e1249afb8 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -22,6 +22,16 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, see . + * + * Limitations: + * - Conversions are instantaneous. The conversion-rate register and the + * shutdown bit are stored but do not decide when a measurement appears, + * and a one-shot write is accepted without scheduling anything: a read + * always returns a fresh value. + * - The N-factor correction registers are stored and never applied. The m= odel + * has no ideality factor to correct for. + * - The sensor-fault OPEN bit and the PVLD bit of the temperature low byt= e are + * never set, so neither an open circuit nor a low supply is reported. */ =20 #include "qemu/osdep.h" @@ -44,6 +54,7 @@ struct TMP421State { /*< public >*/ =20 int16_t temperature[4]; + uint8_t n_correct[3]; /* remote channels only */ =20 uint8_t status; uint8_t config[2]; @@ -85,6 +96,8 @@ OBJECT_DECLARE_TYPE(TMP421State, TMP421Class, TMP421) #define TMP421_CONVERSION_RATE_REG 0x0B #define TMP421_ONE_SHOT 0x0F =20 +#define TMP421_N_CORRECT 0x21 + #define TMP421_RESET 0xFC #define TMP421_MANUFACTURER_ID_REG 0xFE #define TMP421_DEVICE_ID_REG 0xFF @@ -203,6 +216,11 @@ static void tmp421_read(TMP421State *s) s->buf[s->len++] =3D tmp421_temp_low(s, s->pointer - TMP421_TEMP_L= SB0); return; } + if (s->pointer >=3D TMP421_N_CORRECT && s->pointer < TMP421_N_CORRECT = + 3) { + unsigned idx =3D s->pointer - TMP421_N_CORRECT; + s->buf[s->len++] =3D idx + 1 < sc->nchannels ? s->n_correct[idx] := 0; + return; + } =20 switch (s->pointer) { case TMP421_MANUFACTURER_ID_REG: @@ -233,15 +251,29 @@ static void tmp421_reset(TMP421State *s); =20 static void tmp421_write(TMP421State *s) { + TMP421Class *sc =3D TMP421_GET_CLASS(s); + + if (s->pointer >=3D TMP421_N_CORRECT && s->pointer < TMP421_N_CORRECT = + 3) { + unsigned idx =3D s->pointer - TMP421_N_CORRECT; + if (idx + 1 < sc->nchannels) { + s->n_correct[idx] =3D s->buf[0]; + } + return; + } + switch (s->pointer) { - case TMP421_CONVERSION_RATE_REG: - s->rate =3D s->buf[0]; - break; case TMP421_CONFIG_REG_1: - s->config[0] =3D s->buf[0]; + s->config[0] =3D s->buf[0] & + (TMP421_CONFIG_RANGE | TMP421_CONFIG_SHUTDOWN); break; case TMP421_CONFIG_REG_2: - s->config[1] =3D s->buf[0]; + s->config[1] =3D s->buf[0] & sc->config2_reset; + break; + case TMP421_CONVERSION_RATE_REG: + s->rate =3D s->buf[0] & 0x07; + break; + case TMP421_ONE_SHOT: + /* starts a conversion in shutdown; conversions are immediate here= */ break; case TMP421_RESET: tmp421_reset(s); @@ -291,6 +323,24 @@ static int tmp421_event(I2CSlave *i2c, enum i2c_event = event) return 0; } =20 +static bool tmp421_n_correct_needed(void *opaque) +{ + TMP421State *s =3D opaque; + + return s->n_correct[0] || s->n_correct[1] || s->n_correct[2]; +} + +static const VMStateDescription vmstate_tmp421_n_correct =3D { + .name =3D "TMP421/n-correct", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D tmp421_n_correct_needed, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT8_ARRAY(n_correct, TMP421State, 3), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_tmp421 =3D { .name =3D "TMP421", .version_id =3D 0, @@ -305,6 +355,10 @@ static const VMStateDescription vmstate_tmp421 =3D { VMSTATE_INT16_ARRAY(temperature, TMP421State, 4), VMSTATE_I2C_SLAVE(parent_obj, TMP421State), VMSTATE_END_OF_LIST() + }, + .subsections =3D (const VMStateDescription * const []) { + &vmstate_tmp421_n_correct, + NULL } }; =20 @@ -316,6 +370,7 @@ static void tmp421_reset(TMP421State *s) * The measured temperatures are not cleared: they model the physical * input the ADC re-samples after reset, and boards may preset them. */ + memset(s->n_correct, 0, sizeof(s->n_correct)); s->pointer =3D 0; s->config[0] =3D 0; s->config[1] =3D sc->config2_reset; --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077109; cv=none; d=zohomail.com; s=zohoarc; b=Fevz2okK9hsbLRSdqo/8DL05xinbVAB83DHRimUa4K0sSPhw/4FjghJS6l2liGMWfUeXN144G0NrcbN3x8mh/S4U+oJEAj9rhRLsUuf0vFkLLMZ67XJx0FzTlCggBF5H3WDP+9LqQazL3XDypsQb9hgp6Sa62L3MMaQIiaXOmSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077109; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=Hmi3ycbafsBZqQdN90IKJvQBv3NLUgGj3AYEGDMYcqU=; b=a+XfWav7rPRCbwz4gAFyo1/clQyheF049RV4WQC0jHwsY+gJDprhC8Zz43VES97eoEqdT6favVqi4rfZVw60NlJUEvTOoZ9UQuIwWI9oxfs2IqQM6nB5gvgfDYXTZR3usZmoz8ndGOeZVJLQKVUT7w5l5PkAGH7xGY+qmBsqSxU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179207710972731.41052033274002; Thu, 15 Oct 2026 08:11:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN6b-0005oM-JH; Thu, 15 Oct 2026 11:10:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN6Z-0005o6-WA for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:52 -0400 Received: from mail-wm1-f44.google.com ([209.85.128.44]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN6Y-0001h7-Ee for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:51 -0400 Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4a061a13884so45448625e9.3 for ; Thu, 15 Oct 2026 08:10:49 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bf63567esm111132515e9.10.2026.10.15.08.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:10:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077049; x=1792681849; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Hmi3ycbafsBZqQdN90IKJvQBv3NLUgGj3AYEGDMYcqU=; b=EO2ljUFZ2POOqy8iD6k/mnE+dCSwOxHaroj2wOeY/WJKDqPBA3CvMigvaYgKGgPQw/ 5+Xk8wT9yTJOSrn3GZWzKsNis14zMQkAmXQclHfCv+zBnKreGw82FCA/cCVApy6OsZwg nJDWbdxZWyWgjuUrHO/n3ZUASA6UCFoIVif1Xh1ar3SZxU0379arNlcmF8jo9nHmaPCR YEloOsD9ETtEIcNv8P7lwAEzXV0IRfXVKh8ExG8xhq5CToRyFGYE1UZ5RnjZKIsJuG8Q YpSmMAeK+w2Bvlet9JV8iL7AY+Tk5XDOQhPs0mkpXOVQlPv0iWye3O5CV6QCt3YCMf03 gSYg== X-Gm-Message-State: AFq9FYJTCMAEtejR4dXsMJyB/fPfekHNYZlk1NIkDk7k1U2dSejmxFBq +W2hiKabIT7GAvpAf8DwZycolPBOkKF/2jFytF7KFrwsoKdC3R2H0xzq2AOB6Q== X-Gm-Gg: AYBFou3veYA8CR2smu5jMI0PRono4uUaWAda8wRts0krx6jzajk85TxXRywBJY/QJcO d0iaAHx3sLdyB3E3+A6HduMnM9eO63mAzI1vCwnbbPZEkMWhALJ6/uKSxXwzDuLqxWBIwNtFs2y Vb1tgZIYbKADDMPy3BcnBFlbSJTsclkCoxnw59WUglPs55Gx/JE9kBPMV4yS0hCKA/N1Oy+ubcm mfrIbAEHWnMjiyHO3UNKurdWNFWTkdOlqbC/sH8sw9D9JoZl23QlPGyC+3Weqnvc3QWRFoLhsey N9BxfwVefffJLQVs98IoixjyL4NVuzt8+zz28QrmhxZoCfNMa9Wo6B5XvHPtzO7G/ppu0cD/aFZ 4vBK0tZWkiWk5Rpu++rbzpdDTLUDU09Rxt5nxc4TMmE8TffSJwrfuJLXE8w0lzbEAn+4fKE4tzq 04B39OzLMTqRQugoN2KwseTNwIpnwfN4wyc7j3tiFLQ4L6JZgtZVqp1eviB9l+ujLyJ/Rn91cOC ATgDZ7VxsJHPWZ1IyEoq2IDmI+DnqMUfO3XFq4xQTJzMA== X-Received: by 2002:a05:600c:c113:b0:4a1:985b:83a9 with SMTP id 5b1f17b1804b1-4a1985b87f5mr232108635e9.4.1792077048648; Thu, 15 Oct 2026 08:10:48 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:45 +0200 Subject: [PATCH 07/22] hw/sensor: tmp421: describe the temperature properties MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-7-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=747; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=M1t+L7+uRqimR0C44vmJeOL7CEkGaHASB3lV1y0GENQ=; b=01ccWiDvVWr21jIf4Btm8NLVrKNY0zHN++JvPc+v0bFKRm5zQpB8LqkVvLQVolw6xbMJKHzUP bS75t4ZzwVCBPHqm/kA6be+hlCswf+uZfbBwRrDnTdZwkAbpD4qSxuz X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.44; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f44.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077113173158500 Attach a description to each temperature property so it shows up in qom-list-properties. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index 9e1249afb8..ec3a9a9760 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -393,6 +393,8 @@ static void tmp421_initfn(Object *obj) object_property_add(obj, name, "int", tmp421_get_temperature, tmp421_set_temperature, NULL, NULL); + object_property_set_description(obj, name, + "Temperature, in millidegrees Celsius"); } } =20 --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077125; cv=none; d=zohomail.com; s=zohoarc; b=R+hx8PKW/ilZpSyNLxidUfOdSufVYJO7ocyWZl1EJYIMknQEw+/0BNcNhIzG99jM+UfjbHfEFZjy/vYGf1dKE03fCuivM7Lnbrfqwg2bCyZg7BA6WAKwoGvDIldr4JYRWzaIy9YBR7WpenDUxRWM2JTMUBMjYcYzl8/5ol0PQuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077125; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=IDlbDLDHRWaNADiSqZo7W6elqsi2wuUJKHLctAcDsPc=; b=MSrBPV2d/4nWrErID95IgRl90MudAT5FWCV6IYK7RJdqriAXgy7VlNL9KDT6VyfkMbNIbUWQqIklR6+EtZzhcisrTJd+Y57DXYY3lHwg4DDFR0V/bDIDiWrsGKsvA22ig1ai1pWPuJnUgqvph8Yl3TXxQWyyzC8RzVugSfQ/daY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077125302942.8041716962954; Thu, 15 Oct 2026 08:12:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN6k-000642-1d; Thu, 15 Oct 2026 11:11:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN6h-0005zb-RH for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:59 -0400 Received: from mail-ej1-f46.google.com ([209.85.218.46]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN6f-0001hf-Lk for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:10:59 -0400 Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-c2e36c3478aso314084666b.0 for ; Thu, 15 Oct 2026 08:10:57 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48dface154csm637300f8f.53.2026.10.15.08.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:10:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077056; x=1792681856; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=IDlbDLDHRWaNADiSqZo7W6elqsi2wuUJKHLctAcDsPc=; b=VEJuZFh+56MX7H5PLSz79WQP/0UbpsHyR3+pbuUlaC5n/krQdMBjEoXD2NvgcpMg72 +jrU+zXIfUxbtYqJdEN2F30b1DMYw0P+dDtRKR3pocl1I8nm+k1MfoXGwOMa/CmJ4hPD lXtvYBVTMzWhfSLlTmvOiHIoN9BNaqsKG1hBSXsa5VXfslkWs7hVVsP4xrCg11qZVE6B kbes1uXHWLEu3q/UMaJzZMngaxSDx2YR8YdVVaR1Yq15D9T2CmQMPXer7rJQxGvntLMg /P6qUn1K+uvjy4h4MEr4ryUuGZMx2EDnxCoZtYqXx76ZZzgs2dGa7texi680WEE7Zckk RIMA== X-Gm-Message-State: AFq9FYKS8T6MyKMuAL9mFM3qJoLCXWWelhD9Kh/Rf2jsmaUF1uFWZDVh 0ZmWIOTkT0T4aRGslxxkniBvRmKbXDIq5NjIoE+IP+hSDWYs073zvnNJS5R4Ig== X-Gm-Gg: AYBFou1NBnn49gEZVjtyOiBK5fwAxC1PIeh/lJw0TwUa3cO5JCkcEWujBsmNUic+Eax zXBE21G8wU5/3b+hXbtI0PMmya2jiaaryUpBsS+u1dVB5i0K0nxNejNSt6x9aLpgEscj/g9IVf7 cj94gyerUO0ymTt4RNdwrPXkRRtlhcj3e4fG6yLhovAlzXE0ciYGne1RLfKx0utidcUhLZEbX/W MvepXC28PY1zuWuTFbbf3Wmbo8NfRR3neHoQxPXf2mcHsyfmPPc2M/DmvOMxkI4nzPnCeHTb6rc iqMfpeKhOOQtrCu4cpPpJn7rc+tv5QeN2w6Vah2c/K2S2bCWObS/ym8jbeEe40caP8miSy0IzKL HeRXj4bswO7M1MPj0K0lJbRQUovL0u5WcBR9gwyE47t9E+PVziNFSyV51SXvEOVgwvWKU7E96l3 4d1VPXvCY5VRp3hV0dPjhvVcujkNDHYMmSBUtQWDhsvQ4uitHhU9WrXhADhQDYB1b5+yneWTm5T iDu/Rm3IR+gC2Q/rG/gOOdDarSbxzSjtO0x26CXRRhWUA== X-Received: by 2002:a17:907:3d0d:b0:c2d:ca32:217a with SMTP id a640c23a62f3a-c31aa07c3a1mr1804343266b.33.1792077055675; Thu, 15 Oct 2026 08:10:55 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:46 +0200 Subject: [PATCH 08/22] hw/sensor: tmp421: keep the measurement across a range change MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-8-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=6919; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=375Ik3T0Cx9iLheWZazLL0l1G2uWK8cbucMQ8xoxZc0=; b=Yhlb/H65fOBddLJAzn4/HRCh9nHGFSg7/Hru8pMtpbIYEJGp09L0mgIDc/xpSMGL0PEchkD5O AJp7NdOYZRvAu4koy4b8vzp7lNBI69vDXjQsCwD6m2swxBkP4FYvnSb X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.218.46; envelope-from=eblot.ml@gmail.com; helo=mail-ej1-f46.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077127673158500 The model stored temperatures in their register form, which carries the extended-range offset. Leaving that range therefore reinterpreted the stored value and shifted the reported temperature by 64 degrees, whether the range bit was cleared by a configuration write or by a reset. The encoding was wrong at both ends too: the extended range is offset binary, so it does not fit a signed register above +64 C, and neither range saturated where the datasheet says it should. Hold the measurement in millidegrees and derive the register from it on each read, which is what the range bit selects: an encoding, not a new measurement. The stream keeps carrying the register form, which is what a released QEMU writes and expects, so it stays loadable both ways; the measurement is converted to and from it on save and load. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 96 +++++++++++++++++++++++++++++++++++++++++++++-----= ---- 1 file changed, 81 insertions(+), 15 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index ec3a9a9760..1e061045cb 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -53,9 +53,13 @@ struct TMP421State { I2CSlave parent_obj; /*< public >*/ =20 - int16_t temperature[4]; + /* Measured temperature, millidegrees Celsius */ + int32_t temp_mc[4]; uint8_t n_correct[3]; /* remote channels only */ =20 + /* migration only: the register form the stream carries */ + int16_t temperature[4]; + uint8_t status; uint8_t config[2]; uint8_t rate; @@ -114,12 +118,51 @@ OBJECT_DECLARE_TYPE(TMP421State, TMP421Class, TMP421) static const int32_t mins[2] =3D { -40000, -55000 }; static const int32_t maxs[2] =3D { 127000, 150000 }; =20 +/* + * Register form of a measurement (datasheet Table 1): whole degrees in the + * high byte, the fraction in the upper nibble of the low byte. The standa= rd + * range is two's complement and saturates at -64 C (C0h) and +127 C (7Fh); + * the extended range is unsigned with a -64 C offset, spanning -64 C (00h= ) to + * +191 C (FFh). The range only selects an encoding: the measurement itsel= f is + * held apart, so switching range re-reads the same temperature. + */ +#define TMP421_EXT_OFFSET (64 * 256) +#define TMP421_STD_REG_MIN (-64 * 256) /* C0h, -64 C */ +#define TMP421_STD_REG_MAX (127 * 256 + 0xf0) /* 7Fh, +127 C */ +#define TMP421_EXT_REG_MAX (255 * 256 + 0xf0) /* FFh, +191 C offset */ + +static uint16_t tmp421_encode(const TMP421State *s, unsigned channel) +{ + bool ext_range =3D s->config[0] & TMP421_CONFIG_RANGE; + int raw =3D s->temp_mc[channel] * 256 / 1000; + + if (ext_range) { + raw =3D MAX(0, MIN(TMP421_EXT_REG_MAX, raw + TMP421_EXT_OFFSET)); + } else { + raw =3D MAX(TMP421_STD_REG_MIN, MIN(TMP421_STD_REG_MAX, raw)); + } + + return raw; +} + +/* + * The inverse of tmp421_encode(). Only the standard range is signed: the + * extended one spans the whole byte, so its top bit is a temperature, not= a + * sign. Rounding follows the sign so that every register value the encoder + * can produce decodes back to the measurement it came from. + */ +static int32_t tmp421_decode(const TMP421State *s, int16_t reg) +{ + bool ext_range =3D s->config[0] & TMP421_CONFIG_RANGE; + int32_t raw =3D ext_range ? (uint16_t)reg - TMP421_EXT_OFFSET : reg; + + return (raw * 1000 + (raw < 0 ? -128 : 128)) / 256; +} + static void tmp421_get_temperature(Object *obj, Visitor *v, const char *na= me, void *opaque, Error **errp) { TMP421State *s =3D TMP421(obj); - bool ext_range =3D (s->config[0] & TMP421_CONFIG_RANGE); - int offset =3D ext_range * 64 * 256; int64_t value; int tempid; =20 @@ -133,21 +176,18 @@ static void tmp421_get_temperature(Object *obj, Visit= or *v, const char *name, return; } =20 - value =3D ((s->temperature[tempid] - offset) * 1000 + 128) / 256; + value =3D s->temp_mc[tempid]; =20 visit_type_int(v, name, &value, errp); } =20 -/* Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8 - * fixed point, so units are 1/256 centigrades. A simple ratio will do. - */ +/* Units are 0.001 centigrades relative to 0 C. */ static void tmp421_set_temperature(Object *obj, Visitor *v, const char *na= me, void *opaque, Error **errp) { TMP421State *s =3D TMP421(obj); int64_t temp; bool ext_range =3D (s->config[0] & TMP421_CONFIG_RANGE); - int offset =3D ext_range * 64 * 256; int tempid; =20 if (!visit_type_int(v, name, &temp, errp)) { @@ -170,7 +210,7 @@ static void tmp421_set_temperature(Object *obj, Visitor= *v, const char *name, return; } =20 - s->temperature[tempid] =3D (int16_t) ((temp * 256 - 128) / 1000) + off= set; + s->temp_mc[tempid] =3D temp; } =20 static bool tmp421_channel_enabled(TMP421State *s, unsigned channel) @@ -187,16 +227,14 @@ static bool tmp421_channel_enabled(TMP421State *s, un= signed channel) */ static uint8_t tmp421_temp_high(TMP421State *s, unsigned channel) { - uint16_t reg =3D s->temperature[channel]; - - return tmp421_channel_enabled(s, channel) ? reg >> 8 : 0; + return tmp421_channel_enabled(s, channel) ? + tmp421_encode(s, channel) >> 8 : 0; } =20 static uint8_t tmp421_temp_low(TMP421State *s, unsigned channel) { - uint16_t reg =3D s->temperature[channel]; - - return tmp421_channel_enabled(s, channel) ? reg & 0xf0 : 0; + return tmp421_channel_enabled(s, channel) ? + tmp421_encode(s, channel) & 0xf0 : 0; } =20 static void tmp421_read(TMP421State *s) @@ -341,10 +379,38 @@ static const VMStateDescription vmstate_tmp421_n_corr= ect =3D { } }; =20 +/* + * The stream carries the register form of the measurement: that is what a + * QEMU predating the millidegree state writes, and what it expects back. + */ +static int tmp421_pre_save(void *opaque) +{ + TMP421State *s =3D opaque; + + for (unsigned channel =3D 0; channel < ARRAY_SIZE(s->temp_mc); channel= ++) { + s->temperature[channel] =3D tmp421_encode(s, channel); + } + + return 0; +} + +static int tmp421_post_load(void *opaque, int version_id) +{ + TMP421State *s =3D opaque; + + for (unsigned channel =3D 0; channel < ARRAY_SIZE(s->temp_mc); channel= ++) { + s->temp_mc[channel] =3D tmp421_decode(s, s->temperature[channel]); + } + + return 0; +} + static const VMStateDescription vmstate_tmp421 =3D { .name =3D "TMP421", .version_id =3D 0, .minimum_version_id =3D 0, + .pre_save =3D tmp421_pre_save, + .post_load =3D tmp421_post_load, .fields =3D (const VMStateField[]) { VMSTATE_UINT8(len, TMP421State), VMSTATE_UINT8_ARRAY(buf, TMP421State, 2), --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077161; cv=none; d=zohomail.com; s=zohoarc; b=SUySKeyXKrYyBjFUrUzcNg9mt6+QdPXPtDFNaRwtwqcNLlRXgplcLlisApqppactwB/TXHT6Mma5hgzYCGUFSAS/XMiprk/LZBU90K72rJt90gOlCu+FWhBDkigEnEtnsSqazEMj8hV6FclI9h4L01UXj/9Va81LD5B/6ZoOihE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077161; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=QALtB1JjwJWKzUBaARxhOo0RyLWLhPW//31H+iGWjAk=; b=JdaaCQYqPziBWMfaxw4+ITceIPMQSk2yOikPl5D9Mg8pN2DO/4hW/S2c4Jn8rkWQn/nlr7MxwKnePlu9HEmudsuQM4cDcKodyhLAtHjyN8uZ4pbCa/aVUE0P+lNXJEzyoRG3dc2R6nY42WKlHy1sq2g9nea2mfM23UphWLPXs/I= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077161481616.7715098615499; Thu, 15 Oct 2026 08:12:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN6t-0006cR-AX; Thu, 15 Oct 2026 11:11:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN6s-0006aQ-73 for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:10 -0400 Received: from mail-wr1-f54.google.com ([209.85.221.54]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN6p-0001iG-1y for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:09 -0400 Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-48c4be28b82so562348f8f.2 for ; Thu, 15 Oct 2026 08:11:06 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48de0ac5265sm20302446f8f.41.2026.10.15.08.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:11:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077065; x=1792681865; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=QALtB1JjwJWKzUBaARxhOo0RyLWLhPW//31H+iGWjAk=; b=GHrguPEECqlOfmA+LDkx6OpRqYFAW+HhnamxWoe2RKa62dva7uzWSB5qKiYoO6qodp jmAz5UwyIe469aTLHmvrIloP+i+fQ616cabIrhGzd/wKPSKtyp//la5+cRij/hn7XXmh eF54PuBSCu3V89u5aBDlzAQ4VLUJOGYCBQMZ4lJmozc5uKqDlTL6x0HHh29qR9S6wxW4 O2PHE/ifKJnNgG+E/VA3Ln5dTlSTAOzGvEFhkQnLtBo+1ptTsLgNOoP5MruD3n6VpOsq 00Ajq4ugPOxup7AzjOBL3B8QUifQC7Ni3nXFFoY5bACT5ZhMffOoVj1c4RVS9B35VAeh o3ZQ== X-Gm-Message-State: AFq9FYKWQ1c9pSDbxzlFI2XVLMbG4s1j3QeDQAUD870B5MMQ+dBpw8CV oL0c9PWPhQahKMasf/B8ZddwLF2E55OaJgT+9t1Sazb3XEBwOiDizLDrd/7uMw== X-Gm-Gg: AYBFou13tIajg1w5o9tQLBz2Z6TKq2fStKfiCdLZ69c99C7EYXwH9bvY1qVVdAbn61c P8M7L/8pyHuRIo8B57t7VZrVPfsuAprRWhyzJFQLtGSoYwrYDvCrwSHvtei/P192j3Yr8blOje/ c7/Af+ByHIK5BfGqpWGOnEkUvooItmQYv5amZjVfCPc3HfpJLUIzWb/0BlWeJ2BmmhUp3FCbGIE yzHFGc+R01zfZ51tHeHcA8Uk6OVoeVLbRhOrhTN4Qq4EGFBhoKdECfgahVHJTTZQ+Zy2abn7lvp oyQvMO+4R7UA3ZvELkw/dPv/LoIiRg5Outb6pGfe6la3yG0Y8bApQZS4TK7zsOLmSPcDS6oWnpa Sz83jvxw9n/bbRXPtlgE1tWU5orH5kfFqyVHpr4NVjGPLmuuUdUwuPO3OJCKqMAI/dcP4wfLm3n Mo98HDfx7qP/zJ8214e9iOT536Lu6HGJLtlGK5DdN4+QHmHhwHRuqM01G1BpGpi4L/3kcEJoRmF pdxKrxKW57vD7BsxzXDRJuapOLr0P9LiEPXxU/lp4ARBg== X-Received: by 2002:a05:6000:2606:b0:48d:eb45:742d with SMTP id ffacd0b85a97d-48deb45757dmr10400041f8f.22.1792077065222; Thu, 15 Oct 2026 08:11:05 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:47 +0200 Subject: [PATCH 09/22] hw/sensor: tmp421: migrate the exact measurement MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-9-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=3784; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=WkdVkGiPzxeWatF4oFQP9cdVEfej5xbiLCyVJyd/Exg=; b=iTInpBgYCl9BA8spP92Lp0rju5OGi6Ykf9mvFhRxNkqTIW6K6EIizFAEUjgVD8Eh5sLol4dj2 iMHQ7e+ePNlApbO+C2RWgUwGVgNV5pw0daZjYdZBZfl7npDyKU4ULV2 X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.54; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f54.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077162297158500 The register form the stream carries only resolves a sixteenth of a degree, so a temperature set through the property does not survive a round trip unless it happens to fall on that grid. Add a subsection holding the measurement itself, sent only when the register form cannot reproduce it. A stream from a sensor holding an expressible value -- the usual case, boards preset whole degrees -- therefore stays loadable by a QEMU that knows nothing of it. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index 1e061045cb..e391bb20e1 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -59,6 +59,7 @@ struct TMP421State { =20 /* migration only: the register form the stream carries */ int16_t temperature[4]; + bool temp_mc_loaded; =20 uint8_t status; uint8_t config[2]; @@ -379,6 +380,56 @@ static const VMStateDescription vmstate_tmp421_n_corre= ct =3D { } }; =20 +/* + * That form only resolves a sixteenth of a degree, so the measurement its= elf + * travels in a subsection -- sent only when the register form cannot + * reproduce it, which leaves the usual stream loadable by a QEMU that does + * not know the subsection. + */ +static bool tmp421_temp_mc_needed(void *opaque) +{ + TMP421State *s =3D opaque; + bool ext_range =3D s->config[0] & TMP421_CONFIG_RANGE; + int32_t offset =3D ext_range ? TMP421_EXT_OFFSET : 0; + + /* + * The register form reproduces a measurement when the conversion divi= des + * exactly and the encoder had nothing to clamp. Asking the decoder + * instead would settle the question with the function whose result the + * subsection exists to protect, and hide any error it has. + */ + for (unsigned channel =3D 0; channel < ARRAY_SIZE(s->temp_mc); channel= ++) { + int32_t scaled =3D s->temp_mc[channel] * 256; + + if (scaled % 1000 || + (uint16_t)(scaled / 1000 + offset) !=3D tmp421_encode(s, chann= el)) { + return true; + } + } + + return false; +} + +static int tmp421_temp_mc_post_load(void *opaque, int version_id) +{ + TMP421State *s =3D opaque; + + s->temp_mc_loaded =3D true; + return 0; +} + +static const VMStateDescription vmstate_tmp421_temp_mc =3D { + .name =3D "TMP421/temperature-mc", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D tmp421_temp_mc_needed, + .post_load =3D tmp421_temp_mc_post_load, + .fields =3D (const VMStateField[]) { + VMSTATE_INT32_ARRAY(temp_mc, TMP421State, 4), + VMSTATE_END_OF_LIST() + } +}; + /* * The stream carries the register form of the measurement: that is what a * QEMU predating the millidegree state writes, and what it expects back. @@ -398,9 +449,13 @@ static int tmp421_post_load(void *opaque, int version_= id) { TMP421State *s =3D opaque; =20 - for (unsigned channel =3D 0; channel < ARRAY_SIZE(s->temp_mc); channel= ++) { - s->temp_mc[channel] =3D tmp421_decode(s, s->temperature[channel]); + if (!s->temp_mc_loaded) { + for (unsigned channel =3D 0; channel < ARRAY_SIZE(s->temp_mc); + channel++) { + s->temp_mc[channel] =3D tmp421_decode(s, s->temperature[channe= l]); + } } + s->temp_mc_loaded =3D false; =20 return 0; } @@ -423,6 +478,7 @@ static const VMStateDescription vmstate_tmp421 =3D { VMSTATE_END_OF_LIST() }, .subsections =3D (const VMStateDescription * const []) { + &vmstate_tmp421_temp_mc, &vmstate_tmp421_n_correct, NULL } --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077124; cv=none; d=zohomail.com; s=zohoarc; b=UZb1POSc3tvtjLROZ+FkzC4y4lsheRw4DSqbdDoQa9U+f4ByMyylGC5Cp5VGcfiRjFqLdFmNHuyBWQw4pTUeAn60Q9JLFis5fZg+wE/ixUtEP/Jk2whb4f6uKcAsbx5TinOtyNCJZTExMxT8U4tZOmoX4LwWfPxZcXtf1xYc2MA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077124; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=h/jBhx8TqfsnPUJuouPhKp95SfbgVptMIf/ysrEaIhQ=; b=BI+f/fwHJNl/Gy/jHv0JWzefV9P3RMaH7rQ1DrXmX4l9biZbG+/kvmZ9tYzipK2uYNkItyXhwd37Wq+TpZQKmPQMphbbgRv0ZOfrnhQmy/fwWD6LjP9WTtkOtPm/wRdbWmdsnO7635HdBc1+94bwAKstaBzsITEQA7qaAxqd79Y= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077124478971.3792152970166; Thu, 15 Oct 2026 08:12:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN70-0006to-Gw; Thu, 15 Oct 2026 11:11:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN6y-0006oP-Ib for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:16 -0400 Received: from mail-wm1-f41.google.com ([209.85.128.41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN6w-0001jH-PU for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:16 -0400 Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4a1635f7c89so22595895e9.2 for ; Thu, 15 Oct 2026 08:11:14 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1beb77054sm52640165e9.1.2026.10.15.08.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:11:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077073; x=1792681873; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=h/jBhx8TqfsnPUJuouPhKp95SfbgVptMIf/ysrEaIhQ=; b=qlPGz5hWZuSlT5LPPcNXneAwqAcoyIDwhVPPPtoHHRDO+iasZ2WsgrhnaG5NQkoTtJ w88+C0e30ejoWw5uJNMqyNkHNP/wrlF3UnBSLYfwgr+XKyMh38XRi6ikDftxBK1aD1nj 4mCL6WxdT+WxhrZT9dlkO8+lO/zb1Lnsh4wTyLnZY5DxOKhdasho1xI7bRylHCSJZzA1 L4rxoL/VW768SsovUtKMlEFFkuIeleN/1TED8Qn+qlD2U8N6/7GoajcmyZ2YJrwxto2u LC4f2TCM275bi1EpTGMIqU2CTTnyQOH3s+p538x3+wS75DJOJk7iYgk97mf2W9/IP+eM MOuQ== X-Gm-Message-State: AFq9FYJzt0xuZnjN2LFC7M1v0UG1RxBGR4JounB/lYloCLd9WNFUm5l6 8ZqeUEa5du2r3E3B23CwQncgQKd+jaztdBtCr3PkI7oWryIldo/PvOO0eV4DgA== X-Gm-Gg: AYBFou3jAFq8cdhsJ0uTWmx0PWsL9N6ucggCD/kaENo4yAkikRIrNZLAR7N+ctUBgD1 t1R2O3VjlS/PlDDKnUKG1/BiOIO8IL7DZdnHbf+BWHatMaPpnb2wPhArsKWqqlNRFO76sPZxhSP 9Rlosa+DUMEvUYcWdH2S7cQ7lYKLtqHM0qBd3OXUqRDd1qDRAJGhgwOldLCLLekkGocwjqFuqj+ oaJN2zQBsDvupRXsydoqvlSp3viieye6qcxwqO5mt6Se16+s2Q/Wn3fPuxrqdtlwndTOGPGC0fF L6UnwGBE8PdGQgLZW9xbFY9lPBuwW42AIm+f5CTP8q0Zul9PzH9lOOUUasyhMI0fqTpwO/E90Ck teVpsoqmt6VLM0EphmIRbmbm0VW3zdFwvOQCGYAqC02dHJvoaXHNKxGY1GOCfaF8PSJxe93QVg+ 4eyvax9j3enCPOcvY56AKlKsp/kYfwsNZ4VUSV7yB4UEZNh5gU7ya3RBGKAni1MpIHoErvjFd0B BfxM1xeqIti+HsE1kq7t/pbO1EMdqHJp9oVysqky1YdqGIOfINhEPWH6Q== X-Received: by 2002:a05:600c:4ecb:b0:4a1:76c9:5408 with SMTP id 5b1f17b1804b1-4a18e4a510emr394094355e9.11.1792077073123; Thu, 15 Oct 2026 08:11:13 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:48 +0200 Subject: [PATCH 10/22] hw/sensor: tmp421: publish the variant type names MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-10-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=1627; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=8uCJ56eVIcCR8z+k4HKJzPHWZ54KMlo/ENguxWLEwls=; b=PWfPkiOW1sGzox04JJcNLsWYGWYKGKZXs4ZX3ccT1Yf4RpTdJd+FzZ3P+utkCha+d8LUtcWpg sTqueunC8FwAFPtW2AGhntp85idvyY5QZ+lDaFjtwSX5I1lMlOw8SYB X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.41; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f41.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077125936158500 Move TYPE_TMP421/TYPE_TMP422/TYPE_TMP423 from tmp421.c into a new include/hw/sensor/tmp421.h, so boards instantiating the device share one definition instead of repeating the type strings locally. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp421.c | 4 +--- include/hw/sensor/tmp421.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c index e391bb20e1..5c04960b29 100644 --- a/hw/sensor/tmp421.c +++ b/hw/sensor/tmp421.c @@ -41,6 +41,7 @@ #include "qapi/visitor.h" #include "qemu/module.h" #include "qom/object.h" +#include "hw/sensor/tmp421.h" =20 /* Manufacturer / Device ID's */ #define TMP421_MANUFACTURER_ID 0x55 @@ -79,9 +80,6 @@ struct TMP421Class { uint8_t config2_reset; }; =20 -#define TYPE_TMP421 "tmp421" -#define TYPE_TMP422 "tmp422" -#define TYPE_TMP423 "tmp423" OBJECT_DECLARE_TYPE(TMP421State, TMP421Class, TMP421) =20 =20 diff --git a/include/hw/sensor/tmp421.h b/include/hw/sensor/tmp421.h new file mode 100644 index 0000000000..fbfdd87b7a --- /dev/null +++ b/include/hw/sensor/tmp421.h @@ -0,0 +1,19 @@ +/* + * Texas Instruments TMP421/TMP422/TMP423 temperature sensor + * + * Browse the data sheet: + * + * https://www.ti.com/lit/gpn/tmp421 + * + * Copyright (c) 2016 IBM Corporation. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef HW_SENSOR_TMP421_H +#define HW_SENSOR_TMP421_H + +#define TYPE_TMP421 "tmp421" +#define TYPE_TMP422 "tmp422" +#define TYPE_TMP423 "tmp423" + +#endif --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077163; cv=none; d=zohomail.com; s=zohoarc; b=A7itFik6LC7vlu/NnRNFo5I8havq7y7KZLqz9uM0s5I/6kLHwcaLuyXnMZ3khN7vueN8l2d72z+t1YydI2AYp3NYLzzcx+56GMP1AlnBA0lq6zPpvBA5E5817frYm7m0oDc7A3kKlV1Pt3jwavBVSxUeq9NVWvrCzSA7qAxH9Vg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077163; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=174P2+r/v6oMnNkGCAQKO8WuiRU63QW9ctJQj0TLd14=; b=eUOU7XqPP/JMN74UdQC7qHqbUVDS1l4h2KmTo7EeU7YrrAy/nxG3ak+qKWUXnOje+iD7A9cUyS4JGXzXSqZRdmhWYrwqo46YNDW9VJMc56XlQAKzzLuq+gkkx3/FO/PD0E/W4oDwPdI134if075x5XqmZi2kgTVTUJS9IdCwjZs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077163291946.368136485711; Thu, 15 Oct 2026 08:12:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN7D-0007Kc-G7; Thu, 15 Oct 2026 11:11:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN7B-0007He-N3 for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:29 -0400 Received: from mail-wm1-f51.google.com ([209.85.128.51]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN78-0001lB-Gf for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:29 -0400 Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4a018792ab3so43975585e9.0 for ; Thu, 15 Oct 2026 08:11:26 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd98637asm80447505e9.8.2026.10.15.08.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:11:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077085; x=1792681885; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=174P2+r/v6oMnNkGCAQKO8WuiRU63QW9ctJQj0TLd14=; b=XUfgtrDfpASfJTSNSYcXFQao97Ez3oyLjkKM1nDkdqNmGA9RXE/L3k7fTxjoVeNCrs YTqbYmR1xdMoQckJHOfB8pKKciM3ubk9xZEvcAVMFdstYUzl/CTSWHnPNKj/UdELS742 DoFbetwnkaB7wRUxt7G0kl+TLwr7OCIguhL7vGITdWU1dsfCQhskTi6X+FanzYx5YW/j OlIvkjPJ1YBB1moPy40ezS7zuCho38S8c5WfEc2is5vXpzUsEoBg9//xWsHPXeijs/mp 03Cm16lZQRrgygexwcTConZQJZHPfa0Irc67ZjGYCVB49Xm4I2visJVFgC6HXpTExSTQ 0uPg== X-Gm-Message-State: AFq9FYIHybZ2MmXZ0ZqBQ7fKLexAkFjezb3ZmwfZbWjFWw4jI6vKS/2I 18ikIVtEEY+Rifgt6ihVriwledov1KbmqMIa/SXE9wpw0qVsBt+aTK8ahEdQYg== X-Gm-Gg: AYBFou3Z5/YGdyuSLAqiVtKVBo6763h2EGm60CyVU9zvS/NKc6quV2NbICApWI/DgiD aFwVf9SEXIwnk5Wgs8DO1mB2yoWGhMcKbaRXG6bBkz5gGjS3Gr4hJgZ7rhtdBSbC00tl0M8V7pg C1vzDNOOk0cvSqRYu8Wswbrd7FiI/7bZAxWqmGVxsvmICdh7PGOOKUtR7m1AAadmG6ThiZsoxL8 siiXDWmqC/wzGSsVTRNAt366MI6JFmah1Vq/xHw4xcxEd4GvzGdaAe1L9R8gbMQYCRFKeu53INq 2/FuoWI3PA7Gt+zxXrTRm/0Owq6GAEHFq5D+sydvPde0eYsVxD5em8bDPACGQsBDaH5eX+IOtva kltX0kjA2fQll8OxvDwYvKeqItCOYr19l5FkUuY8RSxU4e/tgyLexVzQZ46/5NirsnYCQnPs93/ +ef74MpSAUqVk+p49YEPY+la2FSxO6gQC5d0ZVXFskL1v32Xe71tqMa1Xgbt/m5kA8DbwtiyTSq b58I+tQ52/bv92cj0Gjbm5d+iAJ5Rh1q93ZWtnV1Nyb5A== X-Received: by 2002:a05:600c:6749:b0:4a0:1a7f:2abf with SMTP id 5b1f17b1804b1-4a18e49d633mr384520705e9.7.1792077084933; Thu, 15 Oct 2026 08:11:24 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:49 +0200 Subject: [PATCH 11/22] hw/arm/aspeed: use the TMP421 type-name macros MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-11-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=11877; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=AEPhqDqJmrBwOAvfk44breSxS4/rhsDd7PB3uTZuSRk=; b=mCSqJjzbWCo+VzX9PF5BUp1xmJZRo884HH2X6yZl6j0DMMAbhP2vR86S67njze4Pz9oH1iHk0 T48qs4YDznBAk9ivYCP1/eDPSD/VyKyWFOCrZqJFRhEL0kYSwd4eqfq X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.51; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f51.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077164290158501 Include the new tmp421.h and refer to the sensor variants through TYPE_TMP421/TYPE_TMP422/TYPE_TMP423 instead of open-coded string literals and per-board local defines. Signed-off-by: Emmanuel Blot Reviewed-by: Jamin Lin --- hw/arm/aspeed_ast2400_palmetto.c | 3 ++- hw/arm/aspeed_ast2400_supermicrox11.c | 3 ++- hw/arm/aspeed_ast2500_supermicro-x11spi.c | 3 ++- hw/arm/aspeed_ast2500_tiogapass.c | 10 +++++++--- hw/arm/aspeed_ast2500_witherspoon.c | 7 +++++-- hw/arm/aspeed_ast2500_yosemitev2.c | 10 +++++++--- hw/arm/aspeed_ast2600_bletchley.c | 3 +-- hw/arm/aspeed_ast2600_catalina.c | 3 +-- hw/arm/aspeed_ast2600_fby35.c | 2 +- hw/arm/aspeed_ast2600_fuji.c | 3 +-- hw/arm/aspeed_ast2600_rainier.c | 13 +++++++++---- 11 files changed, 38 insertions(+), 22 deletions(-) diff --git a/hw/arm/aspeed_ast2400_palmetto.c b/hw/arm/aspeed_ast2400_palme= tto.c index 185185f0bb..7b165394c2 100644 --- a/hw/arm/aspeed_ast2400_palmetto.c +++ b/hw/arm/aspeed_ast2400_palmetto.c @@ -12,6 +12,7 @@ #include "hw/arm/aspeed_soc.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/rtc/ds1338.h" +#include "hw/sensor/tmp421.h" =20 /* Palmetto hardware value: 0x120CE416 */ #define PALMETTO_BMC_HW_STRAP1 ( \ @@ -45,7 +46,7 @@ static void palmetto_bmc_i2c_init(AspeedMachineState *bmc) =20 /* add a TMP423 temperature sensor */ dev =3D DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2= ), - "tmp423", 0x4c)); + TYPE_TMP423, 0x4c)); object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abo= rt); object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abo= rt); object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abo= rt); diff --git a/hw/arm/aspeed_ast2400_supermicrox11.c b/hw/arm/aspeed_ast2400_= supermicrox11.c index 051e072c5a..fd2fda9290 100644 --- a/hw/arm/aspeed_ast2400_supermicrox11.c +++ b/hw/arm/aspeed_ast2400_supermicrox11.c @@ -12,6 +12,7 @@ #include "hw/arm/aspeed_soc.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/rtc/ds1338.h" +#include "hw/sensor/tmp421.h" =20 /* TODO: Find the actual hardware value */ #define SUPERMICROX11_BMC_HW_STRAP1 ( \ @@ -45,7 +46,7 @@ static void supermicrox11_bmc_i2c_init(AspeedMachineState= *bmc) =20 /* add a TMP423 temperature sensor */ dev =3D DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2= ), - "tmp423", 0x4c)); + TYPE_TMP423, 0x4c)); object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abo= rt); object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abo= rt); object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abo= rt); diff --git a/hw/arm/aspeed_ast2500_supermicro-x11spi.c b/hw/arm/aspeed_ast2= 500_supermicro-x11spi.c index dc0248422d..1ea61348f6 100644 --- a/hw/arm/aspeed_ast2500_supermicro-x11spi.c +++ b/hw/arm/aspeed_ast2500_supermicro-x11spi.c @@ -12,6 +12,7 @@ #include "hw/arm/aspeed_soc.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/rtc/ds1338.h" +#include "hw/sensor/tmp421.h" =20 /* TODO: Find the actual hardware value */ #define SUPERMICRO_X11SPI_BMC_HW_STRAP1 ( \ @@ -41,7 +42,7 @@ static void supermicro_x11spi_bmc_i2c_init(AspeedMachineS= tate *bmc) =20 /* add a TMP423 temperature sensor */ dev =3D DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2= ), - "tmp423", 0x4c)); + TYPE_TMP423, 0x4c)); object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abo= rt); object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abo= rt); object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abo= rt); diff --git a/hw/arm/aspeed_ast2500_tiogapass.c b/hw/arm/aspeed_ast2500_tiog= apass.c index 6cb567526c..5433198abd 100644 --- a/hw/arm/aspeed_ast2500_tiogapass.c +++ b/hw/arm/aspeed_ast2500_tiogapass.c @@ -11,6 +11,7 @@ #include "hw/arm/aspeed.h" #include "hw/arm/aspeed_soc.h" #include "hw/nvram/eeprom_at24c.h" +#include "hw/sensor/tmp421.h" =20 /* value: 0xF100C2E6 */ #define TIOGAPASS_BMC_HW_STRAP1 (( \ @@ -54,9 +55,12 @@ static void tiogapass_bmc_i2c_init(AspeedMachineState *b= mc) at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 6), 0x54, 128 * Ki= B, tiogapass_bmc_fruid, tiogapass_bmc_fruid_len); /* TMP421 */ - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), "tmp421", 0x= 1f); - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x= 4f); - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x= 4e); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), + TYPE_TMP421, 0x1f); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), + TYPE_TMP421, 0x4f); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), + TYPE_TMP421, 0x4e); } =20 static void aspeed_machine_tiogapass_class_init(ObjectClass *oc, diff --git a/hw/arm/aspeed_ast2500_witherspoon.c b/hw/arm/aspeed_ast2500_wi= therspoon.c index c69065846c..385deb2154 100644 --- a/hw/arm/aspeed_ast2500_witherspoon.c +++ b/hw/arm/aspeed_ast2500_witherspoon.c @@ -12,6 +12,7 @@ #include "hw/arm/aspeed_soc.h" #include "hw/misc/led.h" #include "hw/sensor/tmp105.h" +#include "hw/sensor/tmp421.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/gpio/pca9552.h" #include "hw/rtc/ds1338.h" @@ -60,8 +61,10 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState = *bmc) } i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3), "dps310", 0x= 76); i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3), "max31785", = 0x52); - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 0x= 4c); - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x= 4c); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), + TYPE_TMP423, 0x4c); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), + TYPE_TMP423, 0x4c); =20 /* The Witherspoon expects a TMP275 but a TMP105 is compatible */ i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), TYPE_TMP105, diff --git a/hw/arm/aspeed_ast2500_yosemitev2.c b/hw/arm/aspeed_ast2500_yos= emitev2.c index 3ba1ed5f6f..3dd0d37175 100644 --- a/hw/arm/aspeed_ast2500_yosemitev2.c +++ b/hw/arm/aspeed_ast2500_yosemitev2.c @@ -11,6 +11,7 @@ #include "hw/arm/aspeed.h" #include "hw/arm/aspeed_soc.h" #include "hw/nvram/eeprom_at24c.h" +#include "hw/sensor/tmp421.h" =20 /* value: 0xF100C2E6 */ #define YOSEMITEV2_BMC_HW_STRAP1 (( = \ @@ -54,9 +55,12 @@ static void yosemitev2_bmc_i2c_init(AspeedMachineState *= bmc) at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 128 * Ki= B, yosemitev2_bmc_fruid, yosemitev2_bmc_fruid_len); /* TMP421 */ - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "tmp421", 0= x1f); - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x= 4e); - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x= 4f); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), + TYPE_TMP421, 0x1f); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), + TYPE_TMP421, 0x4e); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), + TYPE_TMP421, 0x4f); =20 } =20 diff --git a/hw/arm/aspeed_ast2600_bletchley.c b/hw/arm/aspeed_ast2600_blet= chley.c index 0e746055a2..536e910229 100644 --- a/hw/arm/aspeed_ast2600_bletchley.c +++ b/hw/arm/aspeed_ast2600_bletchley.c @@ -13,8 +13,7 @@ #include "hw/gpio/pca9552.h" #include "hw/nvram/eeprom_at24c.h" #include "hw/rtc/ds1338.h" - -#define TYPE_TMP421 "tmp421" +#include "hw/sensor/tmp421.h" /* Bletchley hardware value */ #define BLETCHLEY_BMC_HW_STRAP1 0x00002000 #define BLETCHLEY_BMC_HW_STRAP2 0x00000801 diff --git a/hw/arm/aspeed_ast2600_catalina.c b/hw/arm/aspeed_ast2600_catal= ina.c index b15d932086..13dca7a846 100644 --- a/hw/arm/aspeed_ast2600_catalina.c +++ b/hw/arm/aspeed_ast2600_catalina.c @@ -16,14 +16,13 @@ #include "hw/nvram/eeprom_at24c.h" #include "hw/rtc/ds1338.h" #include "hw/sensor/tmp105.h" +#include "hw/sensor/tmp421.h" =20 /* Catalina hardware value */ #define CATALINA_BMC_HW_STRAP1 0x00002002 #define CATALINA_BMC_HW_STRAP2 0x00000800 #define CATALINA_BMC_RAM_SIZE (2 * GiB) =20 -#define TYPE_TMP421 "tmp421" - /* * "BMC Storage Module" FRU data. Generated with frugen. * diff --git a/hw/arm/aspeed_ast2600_fby35.c b/hw/arm/aspeed_ast2600_fby35.c index 28c9c143d8..25f39d5135 100644 --- a/hw/arm/aspeed_ast2600_fby35.c +++ b/hw/arm/aspeed_ast2600_fby35.c @@ -12,10 +12,10 @@ #include "hw/arm/aspeed_soc.h" #include "hw/nvram/eeprom_at24c.h" #include "hw/sensor/tmp105.h" +#include "hw/sensor/tmp421.h" #include "system/reset.h" =20 #define TYPE_LM75 TYPE_TMP105 -#define TYPE_TMP421 "tmp421" #define FBY35_BMC_RAM_SIZE (2 * GiB) =20 static const uint8_t fby35_nic_fruid[] =3D { diff --git a/hw/arm/aspeed_ast2600_fuji.c b/hw/arm/aspeed_ast2600_fuji.c index 08d809b2fd..526494ecfe 100644 --- a/hw/arm/aspeed_ast2600_fuji.c +++ b/hw/arm/aspeed_ast2600_fuji.c @@ -12,10 +12,9 @@ #include "hw/arm/aspeed_soc.h" #include "hw/i2c/i2c_mux_pca954x.h" #include "hw/sensor/tmp105.h" +#include "hw/sensor/tmp421.h" #include "hw/nvram/eeprom_at24c.h" =20 -#define TYPE_TMP422 "tmp422" - /* Fuji hardware value */ #define FUJI_BMC_HW_STRAP1 0x00000000 #define FUJI_BMC_HW_STRAP2 0x00000000 diff --git a/hw/arm/aspeed_ast2600_rainier.c b/hw/arm/aspeed_ast2600_rainie= r.c index 43a8f01a9e..bdbc78aee7 100644 --- a/hw/arm/aspeed_ast2600_rainier.c +++ b/hw/arm/aspeed_ast2600_rainier.c @@ -13,6 +13,7 @@ #include "hw/nvram/eeprom_at24c.h" #include "hw/i2c/i2c_mux_pca954x.h" #include "hw/sensor/tmp105.h" +#include "hw/sensor/tmp421.h" =20 /* Rainier hardware value: (QEMU prototype) */ #define RAINIER_BMC_HW_STRAP1 (0x00422016 | SCU_AST2600_HW_STRAP_BOOT_SRC_= EMMC) @@ -137,12 +138,16 @@ static void rainier_bmc_i2c_init(AspeedMachineState *= bmc) /* Bus 8: ucd90320@b */ /* Bus 8: ucd90320@c */ =20 - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x= 4c); - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x= 4d); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), + TYPE_TMP423, 0x4c); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), + TYPE_TMP423, 0x4d); at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 9), 0x50, 128 * KiB); =20 - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), "tmp423", 0= x4c); - i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), "tmp423", 0= x4d); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), + TYPE_TMP423, 0x4c); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), + TYPE_TMP423, 0x4d); at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 10), 0x50, 128 * KiB); =20 i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), TYPE_TMP105, --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077385; cv=none; d=zohomail.com; s=zohoarc; b=T3d3bpVcHs2o+We4WHXj5ncXq4BzWxlXid2q84Cy2T43CS46bWaRYEX5+51C+22/1SjcG+B+kDE1z1IrJ0REghkGUIXU3ppNkVN9GPbfiXGsQAJhWKzNFkCEKaFPQbLBiNvPIjL+RoubDXCcmkgbA8rqQGez5mRxE+hwYfAPVyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077385; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=vymNcviCs9C76UCnlkWMOWZQKyzqiBj8ztjQDyyYQSA=; b=PQoZrxs48UarRQxO1W8dNK+2an0QaF5C/P3ZIfmvMeqdF31OdsGCqZDMMDOfM6utHNswDdFPHGteNHdtVjcM7LksaglhGjE7XqcAygGWSGKyc8mO6zykF7CEFbqgcHYoxLcnh7EodMn3P+nr83yjOYZaPuZbveZ/M+pMw8NkTgI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077385770440.260492926451; Thu, 15 Oct 2026 08:16:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN7R-0007bC-VP; Thu, 15 Oct 2026 11:11:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN7H-0007Uv-J6 for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:36 -0400 Received: from mail-wm1-f46.google.com ([209.85.128.46]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN7F-0001nz-8v for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:35 -0400 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4a061a13884so45457365e9.3 for ; Thu, 15 Oct 2026 08:11:32 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd98637asm80462195e9.8.2026.10.15.08.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:11:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077092; x=1792681892; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=vymNcviCs9C76UCnlkWMOWZQKyzqiBj8ztjQDyyYQSA=; b=s5HLzK5CqIwwb8NGUCFeKr/TTBB0GWeBpt53kaNylEvJlO7QX1yP7wHXKbxwVrSIAd LWDskZi2+FbKN/1wmgakvOIPt88qTbI49Vi0O8xcOf3ulWFKRp/9FXcdI0RMe6kludmI TcqkYUScy+DFKS3uBA7SsT+l39a03MlKRphAanpJOrmDV0pJIH+ext96VKrO4UcBR1D8 f32AERJPUJBxFFvY6GV4kxQS9knRaHcrtKFzLcRUsqs1X3fN77gzy3pdxOANcJVDt/VY XZQt6iOUoWiC9dH0RyOFhGm/662NadQf/bEYJCdgLLy/8jbdbfiedZOE3FuacBcsitoP znBw== X-Gm-Message-State: AFq9FYK+aGzuxiFQx6MBKQA9qlSHdDt67WXu212ilKZ6CgagHd9FRDL2 +sxu4HYIMs6ik6l2wVLC3UUo71R0rfv5lxEHys1sfSyWM2LZ/KICXLiytbOHuw== X-Gm-Gg: AYBFou1tbcO+7FHYk51PlkfIldtby0pneXIeH4ajpFaRurUZmI6VS8dWWhRDNtWFIs9 oqD/xw/0etaVjCfiwwRXX7OwnWaXm7hBLqpJIIxRdoxfSI5GoCPWPwUufdnTCN6wiT3DLAb9lVA ulJw8ZjncX7HqrURS8GorSwIFwTYvgTJARFLkNvTzalazCVl15+AiBsq+1ITecVdlYVUFoX+74S cYH8zoT9LGeAz3lgkh77YuGAIHamhk0sVCUaRSK1XkmAh8jRBFRM7nihQ+c07n52FrQQc5Qv8zF cYIetGdEuoUoKe6XGbYlyPV9G0L6qdgdq8eSrAjp1OFAHmQPG4pZCt5KPvZqt/aneRk+NUx1uSi bOw0J9rgA9Joqp0lu50XIHWf2gH4g/Ht6gxnq2NZxhEXHWHFXqizXgd8noY5hCnTHlRkTHt4Gm9 lS2qbzan2NDVepUUbscCS5qMtdEGITTP5hcDuhfZqDReljjdIeY2ktGZr7u4XR6qXTSrc2KsKNv eN0l1vgHwF0UjieGJW2rNnNtkLMbr6VhnV+gmR5XrU+hw== X-Received: by 2002:a05:600c:64c7:b0:49f:ff32:803c with SMTP id 5b1f17b1804b1-4a18e49c536mr369904345e9.16.1792077091745; Thu, 15 Oct 2026 08:11:31 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:50 +0200 Subject: [PATCH 12/22] tests/qtest: tmp421: cover device IDs and reset defaults MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-12-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=3934; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=IzbVRRFlc2F+EENA5Eeve7GOfuWQMxnkPz/QJ9eQ9pc=; b=+F3cC/u6H9MkOpw3an+HRKIVd1++pnltZx/Q0cdcBpfeIXFqteWWr2YZBBsyrrpcwYEE8NzVH IxL/ZwIcUgiADAwBYsYk+pie8xwU2cE4ZUxk/6MxIg1Q/Qo4bZJLyMP X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.46; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f46.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077388259158500 Add a qgraph test that instantiates each variant and checks the manufacturer and device identification bytes and the reset values of the configuration and conversion-rate registers. Signed-off-by: Emmanuel Blot --- tests/qtest/meson.build | 1 + tests/qtest/tmp421-test.c | 84 +++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 85 insertions(+) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 7005509d4d..5042ae52b2 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -349,6 +349,7 @@ qos_test_ss.add( 'sdhci-test.c', 'spapr-phb-test.c', 'tmp105-test.c', + 'tmp421-test.c', 'emc141x-test.c', 'usb-hcd-ohci-test.c', 'virtio-test.c', diff --git a/tests/qtest/tmp421-test.c b/tests/qtest/tmp421-test.c new file mode 100644 index 0000000000..2307e5f603 --- /dev/null +++ b/tests/qtest/tmp421-test.c @@ -0,0 +1,84 @@ +/* + * QTest testcase for the TMP421/TMP422/TMP423 temperature sensor + * + * Copyright (c) 2026 Meta Platforms, Inc. and affiliates. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" + +#include "libqtest-single.h" +#include "libqos/qgraph.h" +#include "libqos/i2c.h" +#include "qobject/qdict.h" + +/* + * TMP421 register map, per the datasheet. Kept here rather than + * shared with the model, so the test states the values it expects + * independently of the implementation it is checking. + */ +#define TMP421_CONFIG_REG_1 0x09 +#define TMP421_CONFIG_REG_2 0x0A +#define TMP421_CONVERSION_RATE_REG 0x0B +#define TMP421_MANUFACTURER_ID_REG 0xFE +#define TMP421_DEVICE_ID_REG 0xFF +#define TMP421_MANUFACTURER_ID 0x55 + +#define TMP421_TEST_ID "tmp421-test" +#define TMP422_TEST_ID "tmp422-test" +#define TMP423_TEST_ID "tmp423-test" + +/* + * Per-variant expectations, passed as the qos test payload so a single te= st + * body can cover all three parts. + */ +typedef struct TMP421Variant { + const char *id; + uint8_t device_id; + uint8_t config2_reset; + unsigned nchannels; +} TMP421Variant; + +static const TMP421Variant tmp421_variant =3D { TMP421_TEST_ID, 0x21, 0x1c= , 2 }; +static const TMP421Variant tmp422_variant =3D { TMP422_TEST_ID, 0x22, 0x3c= , 3 }; +static const TMP421Variant tmp423_variant =3D { TMP423_TEST_ID, 0x23, 0x7c= , 4 }; + +static void test_ids(void *obj, void *data, QGuestAllocator *alloc) +{ + const TMP421Variant *var =3D data; + QI2CDevice *i2cdev =3D obj; + + g_assert_cmphex(i2c_get8(i2cdev, TMP421_MANUFACTURER_ID_REG), =3D=3D, + TMP421_MANUFACTURER_ID); + g_assert_cmphex(i2c_get8(i2cdev, TMP421_DEVICE_ID_REG), =3D=3D, var->d= evice_id); + g_assert_cmphex(i2c_get8(i2cdev, TMP421_CONFIG_REG_1), =3D=3D, 0); + g_assert_cmphex(i2c_get8(i2cdev, TMP421_CONFIG_REG_2), =3D=3D, + var->config2_reset); + g_assert_cmphex(i2c_get8(i2cdev, TMP421_CONVERSION_RATE_REG), =3D=3D, = 0x07); +} + +static void tmp421_register_node(const TMP421Variant *var, const char *typ= e, + uint8_t addr) +{ + QOSGraphEdgeOptions opts =3D { + .extra_device_opts =3D g_strdup_printf("id=3D%s,address=3D0x%02x", + var->id, addr), + }; + + add_qi2c_address(&opts, &(QI2CAddress) { addr }); + qos_node_create_driver(type, i2c_device_create); + qos_node_consumes(type, "i2c-bus", &opts); + + qos_add_test("ids", type, test_ids, + &(QOSGraphTestOptions) { .arg =3D (void *)var }); +} + +static void tmp421_register_nodes(void) +{ + tmp421_register_node(&tmp421_variant, "tmp421", 0x4c); + tmp421_register_node(&tmp422_variant, "tmp422", 0x4d); + tmp421_register_node(&tmp423_variant, "tmp423", 0x4e); +} + +libqos_init(tmp421_register_nodes); --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077142; cv=none; d=zohomail.com; s=zohoarc; b=ZOcUZ56W0tgQL2wRYLWotWzI2K7BoPWuwEnmWVs5VU/BXBOlM+GXunVVGBubJID+ilkfw4mh4BQcR7KtYELpPhcQOkT09saO6lqyW35riwOoaIZM9c4yD3/X5aILesK7kWVNPVDE3VF/08EkXWutaspZ+So0IKpvr4zz5i7TfBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077142; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=ZT03pXOUyF1VnCcltW3we9XEJr4ijAWCTIBb53nAbTQ=; b=keJTkBpDm8DrY03J1ZqF6Le1ZkUOw6ofr8p9t9xj+uryGdKFhpQtWa4qPHAYsBZJosdLhwTBXBDh1QCC0u9cSgEduFLHiCnXm70j5W7VnZHlN/3UORD4wzVwUQ+p4SNsmaW7pvUj8CMKm6v9xypY7SlmGBOeoWmxPQDgTwJhtaM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179207714284678.31029630236367; Thu, 15 Oct 2026 08:12:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN7c-0007xA-1e; Thu, 15 Oct 2026 11:11:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN7Q-0007b5-AO for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:45 -0400 Received: from mail-wm1-f53.google.com ([209.85.128.53]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN7N-0001qT-4K for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:44 -0400 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4a0286c981dso20940165e9.2 for ; Thu, 15 Oct 2026 08:11:40 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd5ec195sm73095455e9.0.2026.10.15.08.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:11:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077100; x=1792681900; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ZT03pXOUyF1VnCcltW3we9XEJr4ijAWCTIBb53nAbTQ=; b=E7vADHbemzhmG4v0Me3exMqUr+/75CMw5mkV4NDcatsD+oRjb1vhGlds/+DTLkQJy2 lqRdvojjcbsrC56juBeZ0d+ciJmC6zLMLneE/yKPLOtj7M8Ru3+ZjTeAlpQ1Ix0pYpXD HsgMhsdFvmVnSmXbMlbGbL4kETpAx/CWXi0WBR7KuFsHHiIIWCeF+DFXO27XXcfiTsYc UduxHyvXbtJngnHpiCP0hEyUIgeP+z99a8GwkkwNyP+GSn1J9GCzdedI/0TVO/Gjb6Cm WJ6msvb8jD6mNQukqt2LAgu1Qi3NE8RXhpCeH8fu8L4EyzDljXT/4HO3v35L8UI9wUGw JSyg== X-Gm-Message-State: AFq9FYIRc58t0uyZK7KX5uqxnNkmK+ebtmixGT52GvhcyGzQZWv1VFKD rd+P6sTUFbVbnKLyhgNRiaURcki8nv1So9kUbTWB5P9tlAyGs00vFsFAuwxh5Q== X-Gm-Gg: AYBFou1+UQuYRNrsjvc+zyk7gjT8oeXQe9Agtw5eqS+rHaCL5U7fmHm8Lck+sr1N+CC xm/eq8UCw2pcyIR9YCY/Lt31hrsvlitJLkSOA/t3t6S4qKgGqlhr/qk/OD3aBfJC1JyqnU0yUfT 2JAmhr2uydfWjAUzn/fEqSI2U0QhtocXZnF/K514hppss6nEaQ69OjQjbXJnLWC2Z8vDfFCMpvv muo0NZa55oim/j0CxvBg0ZBU9DSfH6ZtNHa4gUf7qK68vtRv+dKjSU363irC11QFOUl2y1wmQwP kvR58mu8H4zEfnC8aklJFSr79RvxVCK0/crRoB9EzIp7FyBRRDJKPrRE/B78166cIp85UX0Xiva 24W8sCCcFYRsnKGUw5e6iSjP7mI1WWkYvojENBgt1xWLuKfMjAMlCyRPMVxXFFarr9jlOskCanS pRmo8w3UYi4uZrzHSoXj9b/ub0UzZSiXvdnKJZ2FKp/pPKwEqnvRrzVxiBzwMbcNET+9+q+jbGu h7M0up0tZnNttPm+6J1AOGWU6p9j7xxxnELqwEn2JxMHyvadAwQy/PntA== X-Received: by 2002:a05:600c:8b06:b0:4a1:7ce1:2eaf with SMTP id 5b1f17b1804b1-4a18e4e0963mr401128545e9.34.1792077099451; Thu, 15 Oct 2026 08:11:39 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:51 +0200 Subject: [PATCH 13/22] tests/qtest: tmp421: cover temperature encoding and range MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-13-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=6462; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=AEzQURKuJZlDUat8fg72pNeAc6ypqWG6k7Vbs2+CVL0=; b=FxUvpuxrGsxanAAo9GuczGCFhcMe3pGZNR2l4tjgPP5c6ZXWCSuttDzbEKWfJ4v5nJxhHx+IS enJzZ+GywB2AWOfWmddbTCRt0l9SCssxwu4uuN/5+YxfRhufZ9Myp0Q X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.53; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f53.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077144341158500 Set a temperature over QMP and read it back through the two-byte and single-byte register paths, checking the fixed-point encoding and the extended-range offset. A second case pins the saturation: a temperature the standard range cannot express reads back clamped, without harming the measurement itself. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp421-test.c | 102 ++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 102 insertions(+) diff --git a/tests/qtest/tmp421-test.c b/tests/qtest/tmp421-test.c index 2307e5f603..390f17b6b2 100644 --- a/tests/qtest/tmp421-test.c +++ b/tests/qtest/tmp421-test.c @@ -18,9 +18,13 @@ * shared with the model, so the test states the values it expects * independently of the implementation it is checking. */ +#define TMP421_TEMP_MSB0 0x00 #define TMP421_CONFIG_REG_1 0x09 +#define TMP421_CONFIG_RANGE (1 << 2) #define TMP421_CONFIG_REG_2 0x0A #define TMP421_CONVERSION_RATE_REG 0x0B +#define TMP421_TEMP_LSB0 0x10 +#define TMP421_RESET 0xFC #define TMP421_MANUFACTURER_ID_REG 0xFE #define TMP421_DEVICE_ID_REG 0xFF #define TMP421_MANUFACTURER_ID 0x55 @@ -44,6 +48,36 @@ static const TMP421Variant tmp421_variant =3D { TMP421_T= EST_ID, 0x21, 0x1c, 2 }; static const TMP421Variant tmp422_variant =3D { TMP422_TEST_ID, 0x22, 0x3c= , 3 }; static const TMP421Variant tmp423_variant =3D { TMP423_TEST_ID, 0x23, 0x7c= , 4 }; =20 +static QDict *qmp_get_temperature(const char *id, unsigned channel) +{ + g_autofree char *prop =3D g_strdup_printf("temperature%u", channel); + + return qmp("{ 'execute': 'qom-get', 'arguments': { 'path': %s, " + "'property': %s } }", id, prop); +} + +static int get_temperature(const char *id, unsigned channel) +{ + QDict *response =3D qmp_get_temperature(id, channel); + int ret; + + g_assert(qdict_haskey(response, "return")); + ret =3D qdict_get_int(response, "return"); + qobject_unref(response); + return ret; +} + +static void set_temperature(const char *id, unsigned channel, int value) +{ + g_autofree char *prop =3D g_strdup_printf("temperature%u", channel); + QDict *response; + + response =3D qmp("{ 'execute': 'qom-set', 'arguments': { 'path': %s, " + "'property': %s, 'value': %d } }", id, prop, value); + g_assert(qdict_haskey(response, "return")); + qobject_unref(response); +} + static void test_ids(void *obj, void *data, QGuestAllocator *alloc) { const TMP421Variant *var =3D data; @@ -58,6 +92,70 @@ static void test_ids(void *obj, void *data, QGuestAlloca= tor *alloc) g_assert_cmphex(i2c_get8(i2cdev, TMP421_CONVERSION_RATE_REG), =3D=3D, = 0x07); } =20 +static void test_temperature(void *obj, void *data, QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D obj; + + /* A whole degree lands on a whole register value, fraction cleared. */ + set_temperature(TMP421_TEST_ID, 0, 25000); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0x1900); + + /* The standard range is two's complement below 0 C. */ + set_temperature(TMP421_TEST_ID, 0, -25000); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0xE700); + + /* A temperature the register form represents exactly. */ + set_temperature(TMP421_TEST_ID, 0, 25063); + g_assert_cmpint(get_temperature(TMP421_TEST_ID, 0), =3D=3D, 25063); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0x1910); + + /* A lone low-byte read returns the same conversion as the pair. */ + g_assert_cmphex(i2c_get8(i2cdev, TMP421_TEMP_LSB0), =3D=3D, 0x10); + + /* Extended range encodes the same measurement with a +64 C offset. */ + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, TMP421_CONFIG_RANGE); + set_temperature(TMP421_TEST_ID, 0, 25063); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0x5910); + + /* Leaving it, whether by a write or a reset, reports the same value */ + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, 0); + g_assert_cmpint(get_temperature(TMP421_TEST_ID, 0), =3D=3D, 25063); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0x1910); + + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, TMP421_CONFIG_RANGE); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0x5910); + i2c_set8(i2cdev, TMP421_RESET, 0); + g_assert_cmpint(get_temperature(TMP421_TEST_ID, 0), =3D=3D, 25063); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0x1910); + + /* The extended range is unsigned: it reaches past +64 C (Table 1). */ + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, TMP421_CONFIG_RANGE); + set_temperature(TMP421_TEST_ID, 0, 100063); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0xA410); +} + +/* + * A temperature the standard range cannot express saturates at +127 C (7F= h) + * instead of wrapping, and the extended range still reports it in full: t= he + * range picks an encoding, it does not alter the measurement. + */ +static void test_range_saturation(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D obj; + + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, TMP421_CONFIG_RANGE); + set_temperature(TMP421_TEST_ID, 0, 149938); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0xD5F0); + + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, 0); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0x7FF0); + g_assert_cmpint(get_temperature(TMP421_TEST_ID, 0), =3D=3D, 149938); + + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, TMP421_CONFIG_RANGE); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0xD5F0); +} + static void tmp421_register_node(const TMP421Variant *var, const char *typ= e, uint8_t addr) { @@ -79,6 +177,10 @@ static void tmp421_register_nodes(void) tmp421_register_node(&tmp421_variant, "tmp421", 0x4c); tmp421_register_node(&tmp422_variant, "tmp422", 0x4d); tmp421_register_node(&tmp423_variant, "tmp423", 0x4e); + + /* Temperature encoding is variant-independent; exercise it once. */ + qos_add_test("temperature", "tmp421", test_temperature, NULL); + qos_add_test("range-saturation", "tmp421", test_range_saturation, NULL= ); } =20 libqos_init(tmp421_register_nodes); --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077322; cv=none; d=zohomail.com; s=zohoarc; b=nr0B08qZr19N/eJ0dXcGRT8Gh1o4AVChUHvdXDQL9nOVfMZqLSVVVjqm4y5IlI4ZTBETp0AVyBb35mbiBo/h6eMcjU17OO6OvY0nF+kTeLvYbjLtLrbunm6hUTpuqvBNYO5iXY4rFSb2J2/zs0DFU9Vqzp0yt5zuhtRmcaH+59w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077322; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=tMqRetAxiQAIvpDJW998EtamxiidvOknZM6HJPGhQpw=; b=V2e1Ifx9M1qhCld6aGwiMpj6hjU1pE+VBiyxsvW5pAFEOGFwT+6Jlx0nhWsmq5OxpTvdpZiWrpPBy/Pn94kHthskhy/LOtDGZY8MZiz+8TN8rNXUgYO6062GPhsJ7SZXyeFmyeODw4NIMxmV7bFg+F+hydabIN5WzC41b8q2iYY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077322361982.3776819843039; Thu, 15 Oct 2026 08:15:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN7e-000868-JZ; Thu, 15 Oct 2026 11:11:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN7X-0007uC-RZ for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:55 -0400 Received: from mail-wm1-f46.google.com ([209.85.128.46]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN7U-0001tn-8N for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:11:50 -0400 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4a16c399641so52430625e9.2 for ; Thu, 15 Oct 2026 08:11:47 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd67a080sm76025545e9.3.2026.10.15.08.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:11:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077106; x=1792681906; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tMqRetAxiQAIvpDJW998EtamxiidvOknZM6HJPGhQpw=; b=btbYyOG123HeOcEINyi2O4NC13XCC8USI0El5Du6l97TdjyJe5ILlqGaKqIJqA46cN dr4xaZsx1ZLTdtpeg/m2dH8/HOztgbLxa8JL0hL6iYSGQ4EI/8rH7aRhsFJxJJGJbLgn HMsO5uFZrgWRRAUY4+JbOBMMpIAYEAVH8wMqQWjiDWtAIWPQiMgkkla7RvKgjJVUCyxB I8rHKyOaRSXRI5/P/XPJhDSf6LtMbevGIci7xBssumQBVrACmEDLtumAxKeIBgFATSJR Ex93n8aZL1qJtlwEnDM4S/xXZRzP4gxk/VPltRU9V8xcT1XhyfRiHkXSZjcpgCvbNd+A nApg== X-Gm-Message-State: AFq9FYJlDivAKYplFS4wevLaQMe77UFCYChCu3oUxjmUDqs/7rADp7DO 0Unmx2LfjR2V2rhzK9AYCjn1QL0kLnxi+HJhvtDhU3lYQiJXqXYAa51YFQl5bQ== X-Gm-Gg: AYBFou2szSQl3STCSwB7jPQPu+Oqy2lQKVQP1mUg/j+YK0hRZuFTxRFGeCYCLT/goXk /MN6eDaZvxsNPKJN5ipTBmdXJaq/Xhqai3p/kNnppYdzDWM91vxTS8s08miUIX8Yj1ZIfmf86R8 O//KpcVbArNCBs7oSX3JvUlinzYG4z9hj/EEILO+KzqWwBwseNDhWi/yHYlhGooVvzhlmff76+D +L92x/RyagtQ1xpu8eWrLGuB6EbQnXieBkr97e0bbTXZFT36ZbS/xmmgNy2NB2Q1qQWgLjjo7+U a3gCGVWoqWwWL4YysT+4l7+Tt02H7Ou7PK+zuc3Rl6pWreQOzCzWwC9hIKSNR+kD1bDsQzeThEB KfxyovOY/0v2vnjCFNbbHjmiyq8o+tThAWWBUY4skqBBLqf6bQ/pergY30l04BqkGdfL97BKmXu s5BEir37sjUhAi6s7ksHUcytpjwNTFDLJRI7gGvRcAS601bW4DmSbABjZ2bpVKS7+s/EkeQixjJ Eou3BvjZeyTAIaDLKR/icItzPcT3EHvJPrZRu/qgFjNLw== X-Received: by 2002:a05:600c:608d:b0:49c:cee0:e7c1 with SMTP id 5b1f17b1804b1-4a18e48d45cmr423407005e9.16.1792077106332; Thu, 15 Oct 2026 08:11:46 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:52 +0200 Subject: [PATCH 14/22] tests/qtest: tmp421: cover per-variant channels and enablement MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-14-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=3174; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=6nvwu9Ryau4lnUGBjjuEHQaAZ8bpboeH30ZpsRWrAg8=; b=HhA8RHg1vxLyr/RENBtHEhSzLZGngzeRTfx5zbWgykNa6LMEYbLF2r/UAYqLyKP0TS7KRyP6S ROVZx8tVuY9AMA3PQUv2DJSFhIhdN0FH4OXdx/Pr5HBaTV2yHZH//Kj X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.46; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f46.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077324887158500 Check that each variant exposes only its own temperature properties, that writing an absent channel's enable bit is ignored, and that disabling a present channel makes it read back as zero. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp421-test.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/qtest/tmp421-test.c b/tests/qtest/tmp421-test.c index 390f17b6b2..04f9252188 100644 --- a/tests/qtest/tmp421-test.c +++ b/tests/qtest/tmp421-test.c @@ -22,6 +22,7 @@ #define TMP421_CONFIG_REG_1 0x09 #define TMP421_CONFIG_RANGE (1 << 2) #define TMP421_CONFIG_REG_2 0x0A +#define TMP421_CONFIG_REN (1 << 4) #define TMP421_CONVERSION_RATE_REG 0x0B #define TMP421_TEMP_LSB0 0x10 #define TMP421_RESET 0xFC @@ -78,6 +79,15 @@ static void set_temperature(const char *id, unsigned cha= nnel, int value) qobject_unref(response); } =20 +static bool has_temperature(const char *id, unsigned channel) +{ + QDict *response =3D qmp_get_temperature(id, channel); + bool present =3D qdict_haskey(response, "return"); + + qobject_unref(response); + return present; +} + static void test_ids(void *obj, void *data, QGuestAllocator *alloc) { const TMP421Variant *var =3D data; @@ -156,6 +166,31 @@ static void test_range_saturation(void *obj, void *dat= a, g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0xD5F0); } =20 +static void test_channels(void *obj, void *data, QGuestAllocator *alloc) +{ + const TMP421Variant *var =3D data; + QI2CDevice *i2cdev =3D obj; + + /* Only the variant's own channels expose a temperature property. */ + for (unsigned ch =3D 0; ch < 4; ch++) { + g_assert_true(has_temperature(var->id, ch) =3D=3D (ch < var->nchan= nels)); + } + + /* Absent channel enables and reserved bits are dropped on write. */ + i2c_set8(i2cdev, TMP421_CONFIG_REG_2, 0xff); + g_assert_cmphex(i2c_get8(i2cdev, TMP421_CONFIG_REG_2), =3D=3D, + var->config2_reset); + + /* Disabling remote channel 1 makes it read back as zero. */ + set_temperature(var->id, 1, 25001); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0 + 1), =3D=3D, 0x190= 0); + i2c_set8(i2cdev, TMP421_CONFIG_REG_2, + var->config2_reset & ~TMP421_CONFIG_REN); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0 + 1), =3D=3D, 0); + i2c_set8(i2cdev, TMP421_CONFIG_REG_2, var->config2_reset); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0 + 1), =3D=3D, 0x190= 0); +} + static void tmp421_register_node(const TMP421Variant *var, const char *typ= e, uint8_t addr) { @@ -170,6 +205,8 @@ static void tmp421_register_node(const TMP421Variant *v= ar, const char *type, =20 qos_add_test("ids", type, test_ids, &(QOSGraphTestOptions) { .arg =3D (void *)var }); + qos_add_test("channels", type, test_channels, + &(QOSGraphTestOptions) { .arg =3D (void *)var }); } =20 static void tmp421_register_nodes(void) --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077425; cv=none; d=zohomail.com; s=zohoarc; b=RmIsruWBYFCpGQsFgo6aMkwRHbMpikq+EGww1W8zwZUCfLT7mAOPD+m9VCy6S5j++bjCmDkuLTbOBDDlAda7OsJcxLppzyYzUIg3+2Nc+gtThhnytQWMV0w1+9P3pT2lDrIWuuu2CNSBsZPaIsFzAaWvcTyyBeykQgL2yzZlHR4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077425; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=ElO83exPm/Nk9fwRFrC4lA4TMItjH/WcdCQDoITT8Is=; b=ZpbjRqrvMfvd2abWaqnOjucP9Gmaopt2tmb2IzlJIPiA1fMaSuRwgBbRQw2Dsr3RX7AKVa7/p55lKZG3AETP0Tu6NR4TqY1wx2OlLoEBU2zAhJ7Ueoh4ZTg9dV7ra9iDRFF8vh3m0cCn4LUqTyAbPaVzMDgBbCYLrPmsWQUGt2o= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077425778724.6281588903062; Thu, 15 Oct 2026 08:17:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN7s-0000QL-IT; Thu, 15 Oct 2026 11:12:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN7p-0000Jf-HT for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:09 -0400 Received: from mail-wm1-f42.google.com ([209.85.128.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN7m-0001wC-Je for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:09 -0400 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4a1682bff3cso10304165e9.1 for ; Thu, 15 Oct 2026 08:12:06 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd69b2a3sm7488065e9.4.2026.10.15.08.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:12:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077125; x=1792681925; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ElO83exPm/Nk9fwRFrC4lA4TMItjH/WcdCQDoITT8Is=; b=zsse/OJnC2mzEtLDaOwTQG4Zvbsa44frfRCXpZoEUCGxXdW55EQC8cN1qazzKHuIPW p1PERHX00gsDh6ZnPfKnOORVUnYJv1CMR+TJjxfLpb99ydQ1JCGloNm9hp+fqCALvmAv cfkK1vX+QGgVsXgdNvj0705NdqwVNdGbiVuI/ScJ8DSb7GMda0BpQzvjZn7dpdbT+kNJ cpvBHe0+lpsCyLesbV3iGDeBZIFdERPRIClW+Q+hZ4QKrlvUM/Z5e9IqKJcupXTBNV4A UzaALaUwfS0ac11YW0C2wwratPROdSPf9YqVbqXTVTucfXjBy4+B1ZAAyZ5T3tWDI14V NlGw== X-Gm-Message-State: AFq9FYIbeCOGmEQot3BZYfR1xXmcQHk3s7zaXLSSp+1asu5NwULyE65A ZwfOcdtp2dBb8YNnOSqkGIONEjoMHL94A/OqkKPTe8rQJo/Cmka6zhpkt9xPBg== X-Gm-Gg: AYBFou3zccyaVYWCypqOlcti1y7SoYHf2s+CuAcHCKJPrEPSQx4C/6zR/Db87lY2UxB JH2PwkzLyjOfUFNKUxP70bvTaaPbSdC/UXWd7iIRhG1985BdgJQbHp38j0T+41DXrpF5+pCeZ4f Xq2+x2YQmAoLqnCIXTiA4qLBl0uXfv6n5fakRK/3nxwR9dXIG1L0oEg2MtzGZsjfoKrANUmH0ZL 0mzsxk8pzYFHyWo/G2SCsxT6KQ2946t28JgsTBfD2yEhSQJqMMhu/o4CRag5NcB2czqtlZmVTB8 s4IrJwGWqg4A3FGsFYYkFY3VTBPhRUxnx2uub012VNnfqahH/QoLfLgK7+C0/Ybzx0s/6dLqjtU 35VybLoKsG3zIjXf2GBGRUmnv3xQ8ksIc1t5qzn6fc3tvV7FILmthnWRFJGY8eSTcrOUISATXcM 0FlSj7lYoZHV8ZRY2t09knj9jIO5uXVu9/7tnvXiWS+A2Ug/D/mCFxHycxcAPXzY7fpBjP5eYEb xtsTd8tixLmqT2b73KocU83v37MJTszE9XTbX9ZG0i9og== X-Received: by 2002:a05:600c:e547:20b0:4a1:946c:953d with SMTP id 5b1f17b1804b1-4a1946c968cmr237610795e9.27.1792077124678; Thu, 15 Oct 2026 08:12:04 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:53 +0200 Subject: [PATCH 15/22] tests/qtest: tmp421: cover software reset and N-factor registers MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-15-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=2952; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=sHWJWSoGggCvrRbUN63qwoGmhhEQg3PCcE0NhyHKFWg=; b=DLjlvfZDbHQTytD6VL0ThDCgH/2DbYIwU81mWZhmGNuGZM1/JxPZ8kVvU0KYiGBZp5X+xfY0V I+9Nu0aOQ87Aj6FvQACjVlqqjroxrI7OIvnyW1NWZiDc0dszEZiz1wY X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.42; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f42.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077429098158500 Check that the software-reset register restores the configuration and conversion-rate defaults, and that the N-factor correction registers are writable only on the remote channels each variant provides. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp421-test.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/qtest/tmp421-test.c b/tests/qtest/tmp421-test.c index 04f9252188..6c5332211b 100644 --- a/tests/qtest/tmp421-test.c +++ b/tests/qtest/tmp421-test.c @@ -25,6 +25,7 @@ #define TMP421_CONFIG_REN (1 << 4) #define TMP421_CONVERSION_RATE_REG 0x0B #define TMP421_TEMP_LSB0 0x10 +#define TMP421_N_CORRECT 0x21 #define TMP421_RESET 0xFC #define TMP421_MANUFACTURER_ID_REG 0xFE #define TMP421_DEVICE_ID_REG 0xFF @@ -191,6 +192,38 @@ static void test_channels(void *obj, void *data, QGues= tAllocator *alloc) g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0 + 1), =3D=3D, 0x190= 0); } =20 +static void test_soft_reset(void *obj, void *data, QGuestAllocator *alloc) +{ + const TMP421Variant *var =3D data; + QI2CDevice *i2cdev =3D obj; + + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, TMP421_CONFIG_RANGE); + i2c_set8(i2cdev, TMP421_CONFIG_REG_2, 0); + i2c_set8(i2cdev, TMP421_CONVERSION_RATE_REG, 0); + + i2c_set8(i2cdev, TMP421_RESET, 0); + + g_assert_cmphex(i2c_get8(i2cdev, TMP421_CONFIG_REG_1), =3D=3D, 0); + g_assert_cmphex(i2c_get8(i2cdev, TMP421_CONFIG_REG_2), =3D=3D, + var->config2_reset); + g_assert_cmphex(i2c_get8(i2cdev, TMP421_CONVERSION_RATE_REG), =3D=3D, = 0x07); +} + +static void test_n_correct(void *obj, void *data, QGuestAllocator *alloc) +{ + const TMP421Variant *var =3D data; + QI2CDevice *i2cdev =3D obj; + + for (unsigned remote =3D 0; remote < 3; remote++) { + uint8_t reg =3D TMP421_N_CORRECT + remote; + + i2c_set8(i2cdev, reg, 0x7f); + /* Registers exist only for the variant's remote channels. */ + g_assert_cmphex(i2c_get8(i2cdev, reg), =3D=3D, + remote + 1 < var->nchannels ? 0x7f : 0); + } +} + static void tmp421_register_node(const TMP421Variant *var, const char *typ= e, uint8_t addr) { @@ -207,6 +240,10 @@ static void tmp421_register_node(const TMP421Variant *= var, const char *type, &(QOSGraphTestOptions) { .arg =3D (void *)var }); qos_add_test("channels", type, test_channels, &(QOSGraphTestOptions) { .arg =3D (void *)var }); + qos_add_test("soft-reset", type, test_soft_reset, + &(QOSGraphTestOptions) { .arg =3D (void *)var }); + qos_add_test("n-correct", type, test_n_correct, + &(QOSGraphTestOptions) { .arg =3D (void *)var }); } =20 static void tmp421_register_nodes(void) --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077414; cv=none; d=zohomail.com; s=zohoarc; b=jC2bYgkUHon5If/1LjhDQTKZeASyu9pqlfrcwMciZ4cv1nfIgKFlVlFGz86wzD74n4Z8UaMaiGv8BAi0GdmYcrNmJlio31qWhPBFRiMxcgbk0dd5vXVPxXXoLesEaKggeTC2E3i/TqWFpD1hDS2cBhlFQ3S8+zF0aLY09f7mhKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077414; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=hRQau7jFOLMcW9cDld4PZy7QHA0r3DkmWSHU69Dv0ic=; b=Z1DvSQEtfsHynHWrLBI2Sr6Z1Q/Udg7TVJz3u1RKiAlq+Wj70b1NhlfS7OYqXbydQz9UF/c2PiXQJBO7PfsSMQOOqLx6WtXWvbOB0wCdZbUZkfJEJiNSVTuefbHFMz/2URNquYPhWMTHNIA3CVDk5cur648X6oenWnHl5p3x53I= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077414510320.3907221255596; Thu, 15 Oct 2026 08:16:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN7y-0000mz-E5; Thu, 15 Oct 2026 11:12:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN7v-0000eQ-NR for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:15 -0400 Received: from mail-wm1-f49.google.com ([209.85.128.49]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN7t-0001y6-Rx for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:15 -0400 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-49ff680331aso25056245e9.3 for ; Thu, 15 Oct 2026 08:12:13 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd64b5e7sm77275735e9.2.2026.10.15.08.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:12:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077132; x=1792681932; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hRQau7jFOLMcW9cDld4PZy7QHA0r3DkmWSHU69Dv0ic=; b=sEAeF8fmNFaPzYJqN25wifIt0/4xXbWkAEk7IAUosQjw8eoB9NyGAf4cuPLNtAzXLd XBk6BCYeAtRqQbP4Jw0wpKB0RCVjJseIdA1BYA+CLD49bCmhnkpsqXLztPof4p17FGDg ZJiVgk0R0qptfj3dKRhYmls9UauZr4L4AOeo3ltIuhOXmtInrCotawhgfwD7+IJ7F9wT V8fEgcrSA61toYl9vobu3nAWdfcXL555xJptIDPGaFbVrNsjvWmj2ULfJwcwsBCvwvE2 JsJph8+DhUKkjwRa8BuAN9/92ruKcZ7ZYZz9/m478SuCcqzUkqE7UOkzSIk3b5IRigqp adzw== X-Gm-Message-State: AFq9FYI6NM8HD3eYDPoXkcx2UYGH3Ozo4D/8o+AlGKvcX8lUFQMI4wfi WMdJxoJcNfB9LwveHmeAVQSDM9suE2sdZF6WNh5+HVkO49DNEnDL5vCkQ/68lA== X-Gm-Gg: AYBFou0FSTrsqhCwu5Ydsh+m3lV4qGOyzpR+1zxWqquIrfHqERzwi8TGqcB5ncdohW0 eWupKpucAj9ap1zMwM55k+yazbRJuOh7V0i4/KC81FxuzkZM499Q3IZV9zzgQfXVjkTlZEVFNgs ImO9q5q1+MnYYIWw45adjtWC8+toFBxIkdbIWhNhT4SOEJooOdpoz74upx4lY63UC3PJj4oRAnr 5UbKwwAD9u42HpYibmYP/T5GaDMGilZlJNwbXpUwFddUjd23hlmIYRzzfbH7bJREIpQl97WSo9y k8qKjIEPWCoMAWBRAkpOI+vD+C0QR5HqHTE5mzpXQjWVDeGS6+dPVZ1vLWoDsC+CW4uM3vxNyjH fbevMndrqTddOEK579W8Bhu99gt6xmgN8iF716kWKHuRgTbwXAz7Kwdzx68jZK9m8cTevcKhDih AHStUt0ySZGj4r/rWvNpA2yvj7pEO0gdLNUeM/fPCS68Whod6FfIVrQyWpaf5qY5g2XWQpH0Qlh Dfuu1U9CAU5EiZbw1ynLICUIwS0gpJaq6dzJuNQz4jlGBw= X-Received: by 2002:a05:600c:4e89:b0:4a0:12d7:4c88 with SMTP id 5b1f17b1804b1-4a18e4ac77amr434246385e9.30.1792077132261; Thu, 15 Oct 2026 08:12:12 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:54 +0200 Subject: [PATCH 16/22] tests/qtest: tmp421: cover the register form of the migration stream MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-16-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=3815; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=KCKssRn/w/mRE8Rh274RLtAfGbpNnr2ePuT78VSY79A=; b=Px6Rno0FU9aNGFRQDDqZEW7yiUg/GPF11gsY4AdAEFz9J6+BMnEu32N755/95aExgtsl5nHL2 7iX3si4AryyBgt6jBkA5QExdH963O4CoSMQ/cDBusoVseVD6i+dk7fG X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.49; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f49.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077416909158500 A stream with no measurement subsection has the shape of every stream written before that subsection existed; loading one exercises the conversion back from the register form. The temperature is picked so that form reproduces it exactly, and picked in the extended range, where the top register bit is part of the value rather than a sign. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp421-test.c | 66 +++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 66 insertions(+) diff --git a/tests/qtest/tmp421-test.c b/tests/qtest/tmp421-test.c index 6c5332211b..5be2abc822 100644 --- a/tests/qtest/tmp421-test.c +++ b/tests/qtest/tmp421-test.c @@ -8,6 +8,8 @@ =20 #include "qemu/osdep.h" =20 +#include +#include "libqtest.h" #include "libqtest-single.h" #include "libqos/qgraph.h" #include "libqos/i2c.h" @@ -224,6 +226,69 @@ static void test_n_correct(void *obj, void *data, QGue= stAllocator *alloc) } } =20 +static int qtest_get_temperature(QTestState *qts, const char *id, + unsigned channel) +{ + g_autofree char *prop =3D g_strdup_printf("temperature%u", channel); + QDict *response; + int ret; + + response =3D qtest_qmp(qts, "{ 'execute': 'qom-get', 'arguments': " + "{ 'path': %s, 'property': %s } }", id, prop); + g_assert(qdict_haskey(response, "return")); + ret =3D qdict_get_int(response, "return"); + qobject_unref(response); + return ret; +} + +/* + * A stream written before the measurement was held in millidegrees carries + * only the register form. The subsection holding the measurement is left = out + * whenever that form can reproduce it, so an exactly representable extend= ed + * range temperature -- whose register value has its top bit set, and is n= ot + * a negative number -- travels the same path such a stream takes. + */ +static void test_migration(void *obj, void *data, QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D obj; + g_autofree char *tmpfs =3D NULL; + g_autofree char *mig_path =3D NULL; + g_autofree char *uri =3D NULL; + GString *dest_cmdline; + GError *err =3D NULL; + QTestState *to; + QDict *rsp; + + tmpfs =3D g_dir_make_tmp("tmp421-test-XXXXXX", &err); + g_assert_no_error(err); + g_assert(tmpfs); + + mig_path =3D g_strdup_printf("%s/socket.mig", tmpfs); + uri =3D g_strdup_printf("unix:%s", mig_path); + + i2c_set8(i2cdev, TMP421_CONFIG_REG_1, TMP421_CONFIG_RANGE); + set_temperature(TMP421_TEST_ID, 0, 100000); + g_assert_cmphex(i2c_get16(i2cdev, TMP421_TEMP_MSB0), =3D=3D, 0xA400); + + dest_cmdline =3D g_string_new(qos_get_current_command_line()); + g_string_append_printf(dest_cmdline, " -incoming %s", uri); + to =3D qtest_init(dest_cmdline->str); + + rsp =3D qmp("{ 'execute': 'migrate', 'arguments': { 'uri': %s } }", ur= i); + g_assert(qdict_haskey(rsp, "return")); + qobject_unref(rsp); + + qmp_eventwait("STOP"); + qtest_qmp_eventwait(to, "RESUME"); + + g_assert_cmpint(qtest_get_temperature(to, TMP421_TEST_ID, 0), =3D=3D, = 100000); + + qtest_quit(to); + g_unlink(mig_path); + g_rmdir(tmpfs); + g_string_free(dest_cmdline, true); +} + static void tmp421_register_node(const TMP421Variant *var, const char *typ= e, uint8_t addr) { @@ -255,6 +320,7 @@ static void tmp421_register_nodes(void) /* Temperature encoding is variant-independent; exercise it once. */ qos_add_test("temperature", "tmp421", test_temperature, NULL); qos_add_test("range-saturation", "tmp421", test_range_saturation, NULL= ); + qos_add_test("migration", "tmp421", test_migration, NULL); } =20 libqos_init(tmp421_register_nodes); --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077166; cv=none; d=zohomail.com; s=zohoarc; b=IOGSqCruJ/yFifewLb2Xb1YRecvt5eiGmTo+JVsaiLCAcHYlHeImR+8e+1udumCOsGrK2E+OgB/uTXePgRybGp+Q3TBJ3AzrGcSRBoFMeWXYKOiHInpBIIO066tVVdeDN7T0ydz+Dc1IMA0g0g4LsLSe8SYFu6u4vSZ/64s6SwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077166; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=Wz917+uBupSyWRH1dqvy7enyaP5Nw7m4IxLZ4sXKP08=; b=SgoOwhQhrCq39wgXWW3eIBhwyDfC81NqWhb16Jf6RT78ac00yoQ4uoIEf4/0hu2z51md+iDcNMQcTxcE7SGzjhkArKpKYkWy9Hsdj6ABMId0sL5dkyiW9e8dcKPGBNROlwHgY97EDFPdIMlTtDzqqKzbceWnmp3J1PtHPh3adYE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077166457547.0454569713519; Thu, 15 Oct 2026 08:12:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN88-0001JH-TU; Thu, 15 Oct 2026 11:12:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN85-0001DE-RS for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:26 -0400 Received: from mail-wm1-f43.google.com ([209.85.128.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN83-0001zN-6u for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:25 -0400 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4a02718da81so43636195e9.1 for ; Thu, 15 Oct 2026 08:12:22 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bdc036a4sm89459775e9.11.2026.10.15.08.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:12:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077142; x=1792681942; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Wz917+uBupSyWRH1dqvy7enyaP5Nw7m4IxLZ4sXKP08=; b=QQSfttJvyVJVDPMmM1/Fti7GEa5ACYw8r0fFY9GUC9TeNkCleybLV2zhk6jCdA2o6G ujPTUZo8nva97T7laK67bHPh/edmpA3mOuZaX9Kni0vnbePBWiA+Yp6shmZ4iOXgHo2R ONIfXFuZfJk02BVwrpFUF7UsLSvujjlYRdwm4krSJR2XNRZqLkjuE+y0hBFjMCzjLrgm OpW3H2ikZwqS4CLwMfzX4UfHLbVHK445Rt0tQldyBKu/ZoqC6Gi5gC+BN+5aQ+9g9jh3 ycJd8AdxjmTOEqPS/pHoT6LeukOniV1B9UHuWd3y0G5HXt/wNJxiXX1mPxR984ivuexB PNGg== X-Gm-Message-State: AFq9FYIcxa/yJPB54lo+MPnP0pN3TOC+NTwEpcCb6FpSFOo/oBbsowyl e+/8DoLbiUX+Mm5LYvHvnvESKsZLCybAqvdOeYPaJ0kJtZ0/75UMV91rxWeYDg== X-Gm-Gg: AYBFou1F/0fBgXyHpVl5jbHvgEs+vScV/7FVtQC/c5dGzc4YMsA3NdkdjNoOyGPcS5R 7TpSTF9kXOPwkEPmxl+kCzvKAIQfChBNSRNKMu14pyhG7vHwGJg+cE05X5oe4rkHaKHuS6Sz0Nh 4wS4Wrrmw4xyIp4kk9tmU9qhfkI8FaU3sQufMVhJogF7qf6TJukLRKCvdtsn0w0F4voJb+As4kF ZB3BTIeEO2vZugpPFFtaRHJqbTrVfNM9PKw4cI6o/wws65gF6+k5vhn1YIaMcfzNBa53VWvy2K5 +YLbb7pR3Qh9XQ6xT2sNAz9Mq9AORdIfKwF7mXj4M/93M++3FOLxQfORDRQvKry9v6S9w157Ixm j1teEd5ut0O+8SlQ3LoGWO5EoUHEv9HOzrYaPcdNyYt9ROKnu1gAVaSj+0gR5aRjfDtcNVj7jIQ 7I2fGk6/POysgw8QEnAoQ/O+snbXftmO5rjZ0iZ7atrd3b569tbhvAqEkfWLkV/P5rt3S5eKGRJ jJf8Pi2Uchdsc4J1j4NzfmQo33zHq0QtwRK2o0kieh46Q== X-Received: by 2002:a05:600c:3e8c:b0:49e:6861:50f7 with SMTP id 5b1f17b1804b1-4a18e49d251mr364033375e9.5.1792077141562; Thu, 15 Oct 2026 08:12:21 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:55 +0200 Subject: [PATCH 17/22] hw/sensor: tmp105: add the TMP1075 variant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-17-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=8350; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=yuPMFyntZoIKyBRcJ/PEi8kqrviD7nEvWLABiSDbjNo=; b=/DA700DdktBm2jgRRZSTsxbDMloG3YmYfPNerMT57DG19YJKNpl9DW+QpjizHHP69k5VTXGJ1 KglcVC35cvCAUOe4+pG4+d+/VPjKCThuaLhgsteQZdmlyJwqku8Df3G X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.43; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f43.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077168457158500 The TMP1075 is register-compatible with the xx75 family but widens the Config register to 16 bits and adds a read-only Device ID register. Model it as a new variant of the shared TMP105 device: the control bits keep the legacy layout in the upper byte, the lower byte has no function of its own but is writable, and single-byte access stays compatible with the 8-bit parts. The converter is fixed at 12 bits and the fault queue matches the TMP75. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp105.c | 85 +++++++++++++++++++++++++++++++++++++= +++- include/hw/sensor/tmp105.h | 2 + include/hw/sensor/tmp105_regs.h | 5 +++ 3 files changed, 91 insertions(+), 1 deletion(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index ece0650d70..c5aa553d9a 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -1,5 +1,5 @@ /* - * Texas Instruments TMP105/TMP75/TMP175/LM75B temperature sensor. + * Texas Instruments TMP105/TMP75/TMP175/TMP1075/LM75B temperature sensor. * * Copyright (C) 2008 Nokia Corporation * Written by Andrzej Zaborowski @@ -51,6 +51,7 @@ struct TMP105State { =20 uint8_t pointer; uint8_t config; + uint8_t config_lsb; int16_t temperature; int16_t limit[2]; uint8_t faults; @@ -76,6 +77,12 @@ struct TMP105State { * @fixed_res: converter resolution field pinned by the device, or -1 when= it is * software-selectable. * @limit_lsb_mask: low-byte mask applied to the T_LOW/T_HIGH limit regist= ers. + * @config16: the Config register is 16 bits wide over I2C. Its control bi= ts + * occupy the upper byte (mirroring the 8-bit layout); the lower byte has = no + * function of its own but is writable, and comes up as 0xff. Single-byte + * access stays compatible with the 8-bit parts. + * @die_id: value of the read-only Device ID register, or 0 when the devic= e has + * none. */ struct TMP105Class { I2CSlaveClass parent_class; @@ -84,6 +91,8 @@ struct TMP105Class { int8_t fixed_res; uint8_t limit_lsb_mask; bool tm_change_clears_alert; + bool config16; + uint16_t die_id; }; =20 FIELD(CONFIG, SHUTDOWN_MODE, 0, 1) @@ -185,6 +194,13 @@ static void tmp105_read(TMP105State *s) tmp105_interrupt_update(s); } =20 + if (tc->die_id && (s->pointer & 0x0f) =3D=3D TMP105_REG_DIE_ID) { + s->buf[s->len++] =3D tc->die_id >> 8; + s->buf[s->len++] =3D tc->die_id & 0xff; + trace_tmp105_read(s->parent_obj.address, s->pointer); + return; + } + switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: res =3D tc->fixed_res >=3D 0 ? tc->fixed_res : @@ -196,6 +212,9 @@ static void tmp105_read(TMP105State *s) =20 case TMP105_REG_CONFIG: s->buf[s->len++] =3D s->config; + if (tc->config16) { + s->buf[s->len++] =3D s->config_lsb; + } break; =20 case TMP105_REG_T_LOW: @@ -220,11 +239,29 @@ static void tmp105_write(TMP105State *s) =20 trace_tmp105_write(s->parent_obj.address, s->pointer); =20 + if (tc->die_id && (s->pointer & 0x0f) =3D=3D TMP105_REG_DIE_ID) { + return; /* Device ID register is read-only */ + } + switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: break; =20 case TMP105_REG_CONFIG: + /* + * The control bits live in the first data byte for every variant = (the + * upper byte of the TMP1075 16-bit register); a second byte is th= e low + * byte, which drives nothing but keeps what it is given. + */ + if (s->len =3D=3D 3) { + if (tc->config16) { + s->config_lsb =3D s->buf[1]; + } + break; + } + if (s->len !=3D 2) { + break; + } config =3D s->buf[0] & tc->config_wmask; if (FIELD_EX8(config & ~s->config, CONFIG, SHUTDOWN_MODE)) { trace_tmp105_write_shutdown(s->parent_obj.address); @@ -334,6 +371,13 @@ static bool fault_count_needed(void *opaque) return s->fault_count !=3D 0; } =20 +static bool config_lsb_needed(void *opaque) +{ + TMP105State *s =3D opaque; + + return TMP105_GET_CLASS(s)->config16 && s->config_lsb !=3D 0xff; +} + static const VMStateDescription vmstate_tmp105_detect_falling =3D { .name =3D "TMP105/detect-falling", .version_id =3D 1, @@ -356,6 +400,17 @@ static const VMStateDescription vmstate_tmp105_fault_c= ount =3D { } }; =20 +static const VMStateDescription vmstate_tmp105_config_lsb =3D { + .name =3D "TMP105/config-lsb", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D config_lsb_needed, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT8(config_lsb, TMP105State), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_tmp105 =3D { .name =3D "TMP105", .version_id =3D 0, @@ -375,6 +430,7 @@ static const VMStateDescription vmstate_tmp105 =3D { .subsections =3D (const VMStateDescription * const []) { &vmstate_tmp105_detect_falling, &vmstate_tmp105_fault_count, + &vmstate_tmp105_config_lsb, NULL } }; @@ -387,6 +443,7 @@ static void tmp105_reset_hold(Object *obj, ResetType ty= pe) s->temperature =3D 0; s->pointer =3D 0; s->config =3D 0; + s->config_lsb =3D tc->config16 ? 0xff : 0; s->faults =3D tc->faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; s->fault_count =3D 0; s->alarm =3D 0; @@ -447,6 +504,8 @@ static void tmp105_class_init(ObjectClass *klass, const= void *data) tc->fixed_res =3D -1; tc->limit_lsb_mask =3D 0xf0; tc->tm_change_clears_alert =3D false; + tc->config16 =3D false; + tc->die_id =3D 0; } =20 static void tmp175_class_init(ObjectClass *klass, const void *data) @@ -482,6 +541,25 @@ static void lm75b_class_init(ObjectClass *klass, const= void *data) tc->tm_change_clears_alert =3D false; } =20 +/* + * The TMP1075 fixes the converter at 12 bits (its R1:R0 bits select the + * conversion rate instead, which this instantaneous model does not track)= , uses + * the TMP75 fault-queue mapping, exposes a 16-bit Config register and ans= wers + * the Device ID register with 0x7500. + */ +static void tmp1075_class_init(ObjectClass *klass, const void *data) +{ + TMP105Class *tc =3D TMP105_CLASS(klass); + + tc->faultq =3D tmp105_faultq[1]; + tc->config_wmask =3D 0xff; + tc->fixed_res =3D 3; + tc->limit_lsb_mask =3D 0xf0; + tc->tm_change_clears_alert =3D true; + tc->config16 =3D true; + tc->die_id =3D TMP1075_DEVICE_ID; +} + static const TypeInfo tmp105_types[] =3D { { .name =3D TYPE_TMP105, @@ -506,6 +584,11 @@ static const TypeInfo tmp105_types[] =3D { .parent =3D TYPE_TMP105, .class_init =3D lm75b_class_init, }, + { + .name =3D TYPE_TMP1075, + .parent =3D TYPE_TMP105, + .class_init =3D tmp1075_class_init, + }, }; =20 DEFINE_TYPES(tmp105_types) diff --git a/include/hw/sensor/tmp105.h b/include/hw/sensor/tmp105.h index 0698aeead7..6a30504c7c 100644 --- a/include/hw/sensor/tmp105.h +++ b/include/hw/sensor/tmp105.h @@ -19,5 +19,7 @@ #define TYPE_TMP175 "tmp175" #define TYPE_TMP75 "tmp75" #define TYPE_LM75B "lm75b" +/* TMP1075 adds a 16-bit Config register and a Device ID register. */ +#define TYPE_TMP1075 "tmp1075" =20 #endif diff --git a/include/hw/sensor/tmp105_regs.h b/include/hw/sensor/tmp105_reg= s.h index ef015ee5cf..ecd0510c2e 100644 --- a/include/hw/sensor/tmp105_regs.h +++ b/include/hw/sensor/tmp105_regs.h @@ -21,6 +21,7 @@ * @TMP105_REG_CONFIG: Configuration register * @TMP105_REG_T_LOW: Low temperature register (also known as T_hyst) * @TMP105_REG_T_HIGH: High temperature register (also known as T_OS) + * @TMP105_REG_DIE_ID: Device ID register (TMP1075 only) * * The following temperature sensors are * compatible with the TMP105 registers: @@ -46,6 +47,10 @@ typedef enum TMP105Reg { TMP105_REG_CONFIG, TMP105_REG_T_LOW, TMP105_REG_T_HIGH, + TMP105_REG_DIE_ID =3D 0x0f, } TMP105Reg; =20 +/* Value returned by the TMP1075 Device ID register. */ +#define TMP1075_DEVICE_ID 0x7500 + #endif --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077164; cv=none; d=zohomail.com; s=zohoarc; b=HB/HSsACr7Kh1ZNwWVlsM9BPoohAgUm0jtJoFh/nllL3Ltl/X0gXIej2JscCUbQWZo8S2BgRZfFUnc61s8ralr10Iucfj/ETinbY4TxDCQ/yW8T/yOTC4WWcskC0qNY0QhGIUwlaaBUm5KAh2ppQS5GbYonkdmvEVR1UtoMf0cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077164; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=MoxM5c4druc6hrP13chgHZYE5IKLOb3cz4rjvIwFDIY=; b=fRoOyxqbMq+13SJub0UXf9MBd/JrUnLOsEgXodqGCJTGRZHhvR07soKR7FlPd4+Kbf/sktPUGTpgInUq/q9yhhocVRb4oOc9I1c5fDyAyTB4AGGCRBRff6Vs/nurD59vnDzIxcIMCHBPwwkFMoY75TQZ3T9L/F2oWyuR1og6CNU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077164623952.8657714125; Thu, 15 Oct 2026 08:12:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN8G-0001eM-5G; Thu, 15 Oct 2026 11:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN8D-0001UW-3A for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:33 -0400 Received: from mail-wm1-f45.google.com ([209.85.128.45]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN8B-00021G-Al for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:32 -0400 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4a1b07c3c5fso20040755e9.1 for ; Thu, 15 Oct 2026 08:12:30 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd97349esm77362195e9.3.2026.10.15.08.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:12:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077150; x=1792681950; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MoxM5c4druc6hrP13chgHZYE5IKLOb3cz4rjvIwFDIY=; b=OkhWm/JZ/8+wj+ud/IS/B4pUfVdkM/W0GaMS8nfAYPJLJY4wwlnW/Zv0vIDHefii16 +woGmb65gLrwarZM3HiaFI9MMWdQNUxSmI3+3IK47MyxBWuWlEYMltvOIoJJAb0C2iRU ebXTSvosNMI5XUrzSAdtdZTJvF5jiOZyb9YrpDaIsQ7V7G/MT+s/HNZAHPiU5oFJ/YIV oZRcn38hc93zeRYbASpbBdDDvZPfhZIEji4a2w6bANA79m1G4ybVOCVlxbrcGvqJQLte RYQYX65uBz1gPmGBUWh6Z9mn1FDZ0SYnmuvBS3t4Haq/GhrJj1kERmnfOCnEHqYT5ziJ xDWw== X-Gm-Message-State: AFq9FYJj1+oBziNm4C0L116l5pG49wUc8fJj4GkXCnhU7TBvSkoaAQuP M995Oa5qvUTzsS6Z9/Mhy2NSSD7mGaBE6LMPX7i/dRBrabGmBbwsA+VVgPoIbQ== X-Gm-Gg: AYBFou3CjnKNU+U5GFs/aZZmwepdapns3J5dTWIBBPQGq51ygV9x/el5xMO8xBiDrHw X9NpvdHAuP010ms5RRX6xavm0kEaDFxVvj797QQZkH9rV81k5TYsei4FeZLWK9M2xz71+/DGWyZ TdygH9pvYG0aMtv9t6+97SdSOOr/K8BYFyemxIw39d30iXpRs4v8YYfrg73PQHcejMkY88mT5cL X+gGMLlzCMRuNoGbJSVRV881jNOxOdVl/50h3by0y6vrTCMKb0BIpJm9HMrra1qQZTPVhIYGIv8 ipRKkPeDuRrvhc//oOU9kRDVMgvyRlaoo6mmiJ1trlRAOLWvsadouXrImcDB4/j+wtuvF9tvCad rOSX2xmSuNpAsa3T568/4RLFY97GLPBzOfxSt41QCIqkHKrAqrFvu6pyQup66BwTIm+N2+xFwjn UlCj2G787Ck69FcCp88Xv7gV5zoshLZs0dcARMyhKiUbkmKle3OysHPR/3FzmjZXmrEIfr2TdGq PlaCyVQnmc5o/EPpfE8nCpR503eudsZfk39PmE23VX48jvdjtuKTY6Vlg== X-Received: by 2002:a05:600c:5251:b0:49f:e772:6ddf with SMTP id 5b1f17b1804b1-4a18e4d5a01mr390564975e9.32.1792077149604; Thu, 15 Oct 2026 08:12:29 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:56 +0200 Subject: [PATCH 18/22] tests/qtest: tmp105: cover the TMP1075 device ID and reset defaults MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-18-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=2634; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=C0jpl30ify3Wt49PXTihQ8qoGkN1Yk7KjYV9D5fof48=; b=W24LohWIJn07GlvfAC0K6rkgtEfFAmB3SfjBgLVXcHNKvDE0iKAavzWFUiik5ERvdx6qEtuPM XCiRz4PcdFUBITs/sREfYhzKoQjX+zMN/vpcaVOFjiEf0+MrHWKpAwt X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.45; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f45.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077166301158500 Add a TMP1075 node and check its power-on Config, limit and Device ID register values, including that the Device ID register is read-only. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp105-test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/qtest/tmp105-test.c b/tests/qtest/tmp105-test.c index 504f6b7202..426c4f9ae7 100644 --- a/tests/qtest/tmp105-test.c +++ b/tests/qtest/tmp105-test.c @@ -28,6 +28,8 @@ #define LM75B_TEST_ID "lm75b-test" #define LM75B_TEST_PATH "/machine/peripheral/" LM75B_TEST_ID =20 +#define TMP1075_TEST_ID "tmp1075-test" + #define TMP105_CONFIG_POL (1 << 2) /* ALERT active-high when set */ #define TMP105_CONFIG_TM (1 << 1) /* interrupt (thermostat) mode */ #define TMP105_CONFIG_FQ_1 (0 << 3) /* fault queue: 1 consecutive fault= */ @@ -419,6 +421,26 @@ static void test_lm75b_shutdown_clears_alert(void *obj= , void *data, g_assert_false(get_irq(0)); } =20 +/* + * The TMP1075 answers a read-only Device ID register and powers up with t= he + * modern reset defaults. + */ +static void test_tmp1075_device_id(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x00ff); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_T_LOW), =3D=3D, 0x4b00); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_T_HIGH), =3D=3D, 0x5000); + + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_DIE_ID), =3D=3D, + TMP1075_DEVICE_ID); + i2c_set16(i2cdev, TMP105_REG_DIE_ID, 0x1234); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_DIE_ID), =3D=3D, + TMP1075_DEVICE_ID); +} + static void tmp105_register_nodes(void) { QOSGraphEdgeOptions opts =3D { @@ -475,5 +497,16 @@ static void tmp105_register_nodes(void) qos_add_test("limits", "lm75b", test_lm75b_limits, NULL); qos_add_test("shutdown-clears-alert", "lm75b", test_lm75b_shutdown_clears_alert, NULL); + + /* TMP1075: 16-bit Config register and a Device ID register. */ + QOSGraphEdgeOptions tmp1075_opts =3D { + .extra_device_opts =3D "id=3D" TMP1075_TEST_ID ",address=3D0x4d" + }; + add_qi2c_address(&tmp1075_opts, &(QI2CAddress) { 0x4d }); + + qos_node_create_driver("tmp1075", i2c_device_create); + qos_node_consumes("tmp1075", "i2c-bus", &tmp1075_opts); + + qos_add_test("device-id", "tmp1075", test_tmp1075_device_id, NULL); } libqos_init(tmp105_register_nodes); --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077409; cv=none; d=zohomail.com; s=zohoarc; b=Eg/Ts5FsKmEfLkUFTMI54uXiPf0sMnFLs/qSWz+91FY4MExnhx8sFaYRuHdlt0BDUeB2db0neN0/s3k4HKQXwbLCT7v7n/ub1Ihp58ODG5aE6So9DKPaiMWfNDdVSo919fV6hfXCCkWWfgDXsQrcCamewCrPYjazYs7pnj9QjKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077409; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=TAKWq5OaS0dmrW3Pgr9SxuBdpwdzx7tYDqztdgweZoA=; b=E0M3wB/yVvj0POYrr6gMZnqEpS5bMzVCQKoElzaVC5AnafIItt2irj63LtiBGYbMkMi8ugnMYHMtLJQKs9Wa6+Y6g7xwgoeG7rmPTCTgQYTbEuzdbDCpe/USdV+XoEC35vjzAYtjEx89xtJw5TepyIs1UY2UsJkuOQHpOkPc3js= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179207740953695.8683906126995; Thu, 15 Oct 2026 08:16:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN8T-0002Cb-DA; Thu, 15 Oct 2026 11:12:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN8R-0002AA-Ek for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:47 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN8O-00022X-QS for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:47 -0400 Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-48c5358fc28so472990f8f.0 for ; Thu, 15 Oct 2026 08:12:44 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48df3cbb78asm5888592f8f.48.2026.10.15.08.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:12:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077163; x=1792681963; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=TAKWq5OaS0dmrW3Pgr9SxuBdpwdzx7tYDqztdgweZoA=; b=0r1SEvMMUBa2+s1wjV66Ohy/stAYXgQSmfYlK0QIXTF5nAaV7CydHX/nyMXjTpCwd4 bxG3QOI/E3e/HYdcQPJr16oTCPFo++DtIbLGfH2o0GtvjZDxba8UrpDdzji1ZovONTIo 04Ryh49FE7Ruu3K3Xusa8I/d11u6aFFB/9u+gC8ENG8OSpDohay48YlQ7aWJOzBZfoXh T8xgIeEOoGgjUwY0goIaXVqHcfAzBwZXQ5Hh7WELrrcUkWVOmnNtVsRkCiQ1D6TkWCVP ZXdRjXRadYqJav6ztnlTWbAd+VaSA+DFawG4+1XLK7V+o8XqSMssGESGVYs/SNZxUb4C 1z0g== X-Gm-Message-State: AFq9FYLjxxvqc2tyZ55tr2p5qO9QTva7hbm/XTKFs60jH+2h+3YevJ73 vuCpyjPciDDQiPHQQIjDxlTo1NLAGjkz34rNMQjb8VUY1CGlmbEMjCVQ6NzonQ== X-Gm-Gg: AYBFou1z5Bq8TYaPBuR+boq7VRMTSlVZdMdiRa3PIKysuktE96MeRzESgg6UuFbKloH 8ZsgSldS0/6HSz+5dVT8GVrr1KJpo+u8UFRuAM/iGgphwGa2p+6eJbd5SHQH611mgGNqIdEX0qy b0k5YqBxKQYla3cfzWLKPBf7wKZ5/T8gx9w91PkWPxg3hV9ZmOJRS12yH9sNdo6YxZewe895jMT MZ5V5MdNnflru4jTxqTmNQXMolQFzrseTh+XfJRXxypEOTYWyuPZXOVrl4Pq1FWVKPvtls9mTIh DsvUCzkr9lWFZUpL2to83+ylrFRh0XccbLzd43viCgzYTlB14MwmlaIbn+no0HoLdLXi3+Twaiq j4V1HeKyCjDGCR5QOckV/GUHbX3CNTduUitEITBCFYDzyXVQgEtZYCDpRxwIQ0fL4Dqtq4w/A8c i4l7DYZiIjfCcKGzMipnquRL5YcsCX1BoCepIB3KiUwP4HMPCfdMwDFDEldyfPJr4aQCaC/Iby4 469DPF4RrZwXNsrdHY1/9oLYxhPF6rzc6ByZgFa7AZz33N2fKDSZzJQ X-Received: by 2002:a05:6000:25ca:b0:48d:f69e:9cfd with SMTP id ffacd0b85a97d-48df69e9e8emr4135417f8f.27.1792077162491; Thu, 15 Oct 2026 08:12:42 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:57 +0200 Subject: [PATCH 19/22] tests/qtest: tmp105: cover the TMP1075 config register width MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-19-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065465; l=2217; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=eKNsPNpZHCrr7lt5jUn9ATmHMoMqISDae/0HeUQWVVY=; b=Xcnz4/tCybsk3M59LoRaorgPeZA/vcFX24JqOolZuEe8iBs41X1FYNu1z00bcD8Q2SZG6WaSB EwpuoU8e7hUBIJCu1hUPosekvvjYsHwe3ZW+0st3NnS0T0pYjqqazqD X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.48; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f48.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077410936158500 Nothing pinned the 16-bit Config register: neither its single-byte compatibility nor the low byte, which drives nothing but keeps what it is given. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp105-test.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/qtest/tmp105-test.c b/tests/qtest/tmp105-test.c index 426c4f9ae7..b21deb1128 100644 --- a/tests/qtest/tmp105-test.c +++ b/tests/qtest/tmp105-test.c @@ -441,6 +441,33 @@ static void test_tmp1075_device_id(void *obj, void *da= ta, TMP1075_DEVICE_ID); } =20 +/* + * The Config register is 16 bits wide but stays compatible with 8-bit acc= ess: + * the control bits are the upper byte, the lower byte drives nothing. + */ +static void test_tmp1075_config_width(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + + /* A single-byte write reaches the control byte and leaves the rest. */ + i2c_set8(i2cdev, TMP105_REG_CONFIG, 0x60); + g_assert_cmphex(i2c_get8(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x60); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x60ff); + + /* A word write keeps both bytes. */ + i2c_set16(i2cdev, TMP105_REG_CONFIG, 0x6200); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x6200); + + /* The low byte survives a single-byte write to the control byte. */ + i2c_set8(i2cdev, TMP105_REG_CONFIG, 0x60); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x6000); + + /* The one-shot bit always reads back as zero. */ + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_OS); + g_assert_cmphex(i2c_get8(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x00); +} + static void tmp105_register_nodes(void) { QOSGraphEdgeOptions opts =3D { @@ -508,5 +535,6 @@ static void tmp105_register_nodes(void) qos_node_consumes("tmp1075", "i2c-bus", &tmp1075_opts); =20 qos_add_test("device-id", "tmp1075", test_tmp1075_device_id, NULL); + qos_add_test("config-width", "tmp1075", test_tmp1075_config_width, NUL= L); } libqos_init(tmp105_register_nodes); --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077324; cv=none; d=zohomail.com; s=zohoarc; b=LvKZ6/7M0VxanOvRwMbWs5QgduC4MVKVJBpOM3LQHI9MckAsLIaWlN1hNliTBs4zwSStQeJSblQOSh1cVDtPgYRfMUbFHppTXTI302WElEX7LjKzrkm2JWegYnSuddWOO2MCvJRg78OcFcVF8ztVKoEY8uOl47l/4eDqk7cnPg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077324; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=6k06hv6TlsIcMhbYVsrL8kcfuMSG0eFTZp4YScCwOos=; b=QeQowjSVirZfTl6+SNrIrqjwpK5k+oxk1jglquklUapQFCbzaRVSxwSfJNZqI1RoNgPdNfw94mDfdWWJBKu+EhZ0ZgDnIAnseoOzA/DpHPFrSjMeifmj2p3HTXY9wtb11wAXh8VXIhwKjubbikDq45SRfgIJ8Vt2j6TSKo+VmKM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179207732396882.4005633052086; Thu, 15 Oct 2026 08:15:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN8q-0002T1-Cs; Thu, 15 Oct 2026 11:13:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN8Y-0002Kj-Cw for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:55 -0400 Received: from mail-wm1-f42.google.com ([209.85.128.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN8W-00023t-O6 for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:12:54 -0400 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4a1635f7c89so22615445e9.2 for ; Thu, 15 Oct 2026 08:12:52 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd99faf3sm76622495e9.14.2026.10.15.08.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:12:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077171; x=1792681971; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=6k06hv6TlsIcMhbYVsrL8kcfuMSG0eFTZp4YScCwOos=; b=I15O6SzTEdDa8CglKHgYeOXju1hCe3xaggYgOBBWPYaT9sse/cmtTG0cjHutkOd+FX AzR68+bMfc8SBzSyfnKaCcHQQ4pafoHUKLBHTLJ/Rj1eJ1FCiQUdIWqqV+U+Y1DKUs74 GjD9ygdLpArO3c0aJ/4AoEsgvRh+yJZ1td3uL24EsdmT4/ZsghcvnokjqOEbpqXisd/2 GmpxOZS+DWzDaqo+Wf/Vp4dEHjbCR1XfnWrgkmXnUrSKqMTV+JPFHcdi2m8+6F4I5MEd i17EZrUtdx9IWqJeb+PqjdnTd3RjyjXpL10t41RjDQlr2IFHsvKa+XZLIEZEujBOf8Ls Hkpg== X-Gm-Message-State: AFq9FYI2ywlHlU076D9x0Oap3l7NSn5PzARVM3wX5LfPcvvJvOs+sQUw 8U5QmPbovih1ned+8oCWz0bKfahdGq+ZBpJKGlgxUdd0cszavLHmHAahDzmOew== X-Gm-Gg: AYBFou1Q2fsQebvgHCy9ADhZfgerY8weLFNgjF64aQastjcaBjkp6YcEnmg5suQsRtR lUR1S6/IsppYtSHYrTVyoMy1R5JdAvovXq7GLWESjZ8bgp37Pl5mQnNPgSfvBKeahpaVvaQ5NWe f/N8GFEMoUQ1//I6OjpF6l+gc7QggAKiW7i5hfpiDLuMp8PP4B+YBT7fuYD0W/oewq3FAPsflYw 9FvGvwyCA1MqQRyTVZ039ILAxq3ftVELzxUZoatxKFknRHGXGqIL6KqAZcEQGpgXhUUpfr+j2RD cDiZ87X2uzT6LmQJznuqP1CNgXcfSXfVUOjVR/TYDUufvRHb6EuQ2PptzeG+FyM2PKhZ2hkO0Jc BYJjGaAVVtNKWMBqxDjuHHRZzWliIIMEgFNxcdSL6DrP2zLELcMluBMaJfNn+JrTSUEARq8gFWM QqYjjo61bOhzJP6OFrjgc/yPOuzZZ9eb8j/QJwRivaUpOjMNsPOvnuETUuSBDRraXM/aImLLALW ZLEpSX7jirvgiWeu4bWrADJEC1depepuJUMY7M/u7JsXw== X-Received: by 2002:a05:600c:6099:b0:4a0:1feb:de6a with SMTP id 5b1f17b1804b1-4a18e4e7a85mr371149685e9.30.1792077171229; Thu, 15 Oct 2026 08:12:51 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:58 +0200 Subject: [PATCH 20/22] tests/qtest: tmp105: cover the Config low byte across a migration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-20-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065466; l=2836; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=/7gRDZ/TdLiUJ6z39Z25ycHPu6U7M4Ou+l3WbL5867o=; b=9HVCBw159TJbTvpleCFrLX+akvmA+h1eaopoTBm07rOrob51X2cIHupH8BTAENgdgD6uUhl08 9vXE+8kPVmTCZXb+epYPi/YVlIZ3NZMxO19BtIfixAw4cX9ReOnc10R X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.42; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f42.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077324839158500 The byte rides in an optional subsection, so a dropped field or a wrong needed() gate would have gone unnoticed. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp105-test.c | 50 +++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 50 insertions(+) diff --git a/tests/qtest/tmp105-test.c b/tests/qtest/tmp105-test.c index b21deb1128..1bb7dcc265 100644 --- a/tests/qtest/tmp105-test.c +++ b/tests/qtest/tmp105-test.c @@ -9,6 +9,9 @@ =20 #include "qemu/osdep.h" =20 +#include + +#include "libqtest.h" #include "libqtest-single.h" #include "libqos/qgraph.h" #include "libqos/i2c.h" @@ -468,6 +471,52 @@ static void test_tmp1075_config_width(void *obj, void = *data, g_assert_cmphex(i2c_get8(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x00); } =20 +/* The low byte of the Config register rides in an optional subsection. */ +static void test_tmp1075_migration(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + g_autofree char *tmpfs =3D NULL; + g_autofree char *mig_path =3D NULL; + g_autofree char *uri =3D NULL; + GString *dest_cmdline; + GError *err =3D NULL; + QTestState *from, *to; + QDict *rsp; + + tmpfs =3D g_dir_make_tmp("tmp1075-test-XXXXXX", &err); + g_assert_no_error(err); + g_assert(tmpfs); + + mig_path =3D g_strdup_printf("%s/socket.mig", tmpfs); + uri =3D g_strdup_printf("unix:%s", mig_path); + + /* A low byte away from its reset value, so the subsection is emitted.= */ + i2c_set16(i2cdev, TMP105_REG_CONFIG, 0x605a); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x605a); + + dest_cmdline =3D g_string_new(qos_get_current_command_line()); + g_string_append_printf(dest_cmdline, " -incoming %s", uri); + to =3D qtest_init(dest_cmdline->str); + + rsp =3D qmp("{ 'execute': 'migrate', 'arguments': { 'uri': %s } }", ur= i); + g_assert(qdict_haskey(rsp, "return")); + qobject_unref(rsp); + + qmp_eventwait("STOP"); + qtest_qmp_eventwait(to, "RESUME"); + + from =3D i2cdev->bus->qts; + i2cdev->bus->qts =3D to; + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x605a); + i2cdev->bus->qts =3D from; + + qtest_quit(to); + g_unlink(mig_path); + g_rmdir(tmpfs); + g_string_free(dest_cmdline, true); +} + static void tmp105_register_nodes(void) { QOSGraphEdgeOptions opts =3D { @@ -536,5 +585,6 @@ static void tmp105_register_nodes(void) =20 qos_add_test("device-id", "tmp1075", test_tmp1075_device_id, NULL); qos_add_test("config-width", "tmp1075", test_tmp1075_config_width, NUL= L); + qos_add_test("migration", "tmp1075", test_tmp1075_migration, NULL); } libqos_init(tmp105_register_nodes); --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077244; cv=none; d=zohomail.com; s=zohoarc; b=Ev9FZ/b4mgSsWyiqfqBBKyx742q9hLk5KF7QXg9scLuOdOOvMunDoHLBU1JJ8Z6eW6dStQgjqKb+pJH3oWxrU/C3S80GvACTFESXvMsc4UD+B4BqI0+7N0ljfpoi0ogdkzpHqs3paySv4eK+GtoxAnNqf56whFts7qQXvHZsp+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077244; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=3yP+FXKcD6pJvxi0D3uT9X7r+VbROBZd6mc1leYlxy0=; b=QmQEpZxxyjAM6gus9Z3oqpPBOxQG+bUcVMg3vxZ9yB3yvs4/i+/vjSAXai1K+8cTN8xPGBEKKWSmmcFoHCTLslC1qNQVgPR+bgb/C5H8QK2s0GJETLQhrdAhPaYyxDkMyNz8t+io4xzTnZ9CdBIZhXaCc6NuuvVu4gQZWxaaZ20= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077244579771.2863504964465; Thu, 15 Oct 2026 08:14:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHN8z-0002dF-WE; Thu, 15 Oct 2026 11:13:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN8h-0002SL-J3 for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:13:04 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN8d-000258-HY for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:13:03 -0400 Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-48870973bddso61118f8f.1 for ; Thu, 15 Oct 2026 08:12:59 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48defca3fd0sm8759732f8f.15.2026.10.15.08.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:12:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077178; x=1792681978; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3yP+FXKcD6pJvxi0D3uT9X7r+VbROBZd6mc1leYlxy0=; b=GVurC5CbOzNRSwI2RAj19dYREn5xaeli8fn1kUJLtYuEVxYxxZiBHzGtlXglJo+W+H RW/v5JekfGjQKwjLNY4wd2pArAMeIv24vAKcMmd5TGiy7rVL7ekC//aZAOyg3KUMY8i6 9UyRPlcKBwGUzL+yneka4aM0W+NDErUst6TCjyGcjW4XkfOrJqIC5Ey4BnXtcOdtq3e8 42gLBhI94N4dSYQG1aeQ8m4nl+KP7ojmcKZJNcQ3BxmneP9qcqmgq5mR0HZ8Q8NpBose PPtvntTcUC679pf4/2QGr+THcDsl4IIigxMpxcUdkaSW/Bsp8dxKdeD0fXlLCPIhN99h muqA== X-Gm-Message-State: AFq9FYKx7InmPHByhyWtyTwfnuoQnxIcybp494wTXo6PZoC3lZ0zrJ0t yHC6ZlnwmHmhOCD6GTm6aPWN02TL8iWgmUy1wNHFD4YycN3KzGRyJ7wiWnzEZg== X-Gm-Gg: AYBFou1+5x9//6wYfB8Y0xNmG1XTnj3yyDSFWws2M7HXmzXd8lK5I7rj1EAiaDV57oi ZbcziHLBOAMuPed95ukbKRwC4g/HPTtUAWkRY/FMcdo3Gp6UQuYlMYwLLR2PPSDmlj6+IhVrFxm XzNUYvRc+b3s6raa7AboX7A4PwfAa19KNyE8aSVfTZvBmxW+r5GD+Z7jzr8BdZj97/e8zv7xCRN vZPfuQzQ+ZDJkXJ1Eo4Mg064pzah1QqDowZdUKhekAl/u2QZTlTIFMK0/99LSPvGR7X+qxoxAEG VZ5Sw4SmLIUIxOB3eau7KX70GFDTNg5vcbPNqy48c2c3UykvZJ/jtYkiOH8p+f0JqauWODkji8U tlUdz/DFUUxs9Yb482V8ngcadsrlVWocEKjZ0FmS1rZatx2wB6MOaz+iMBPxjchmGLw0deAeE4L Roxw3WSZkWuw/pH1FEouyJzldk68zmln2zxW4fiOsFXn/IpfGz/taJg1thcm2qG8zqFR3VmkXgO TjT/rfrKt+nK8lQ0JsmCXLcjf9NRK7SBNg8V21k5hk6FA== X-Received: by 2002:a05:6000:480d:b0:48d:eac6:5c2c with SMTP id ffacd0b85a97d-48dfae65e0cmr805196f8f.15.1792077177782; Thu, 15 Oct 2026 08:12:57 -0700 (PDT) Date: Thu, 15 Oct 2026 13:57:59 +0200 Subject: [PATCH 21/22] hw/arm: clemente: add Facebook Clemente BMC machine MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-21-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065466; l=10967; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=fwMwMQY6LSTYt7Hp6GyO3Lc9Qc0OdqMAb6qHtBu1+ig=; b=ob5hVBrScDNSj5fFqftf6O3Keq9g58N4ApiDtO+GG5qmqXJLSOSwxF7MSQFlCwsb/lccRrmZP x6TZn4gMeesCj+vpDTi8wiUPHwcHrvT0z9KMivtoWmQqwkjaeOw8JF2 X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.43; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f43.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077245458158500 Add the 'clemente-bmc' machine type, an AST2600-based BMC, modelled from its device tree (aspeed-bmc-facebook-clemente.dts). The board uses TMP75, TMP1075, LM75B and TMP421 temperature sensors, PCA9535, PCA9554 and PCA9555 IO expanders, PCA9546 and PCA9548 I2C muxes, AT24C EEPROMs and a DS1338 RTC. Every device the Clemente device tree describes and QEMU already models is instantiated. The remaining ones (LM5066I power monitors, MAX31790 fan controllers, MAX1363 ADCs, RAA228004 voltage regulators, the SLB9670 SPI TPM, SSIF-BMC and MCTP) have no QEMU model and are left documented as comments. Signed-off-by: Emmanuel Blot Reviewed-by: Jamin Lin --- docs/system/arm/aspeed.rst | 1 + hw/arm/aspeed_ast2600_clemente.c | 232 +++++++++++++++++++++++++++++++++++= ++++ hw/arm/meson.build | 1 + 3 files changed, 234 insertions(+) diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst index bbd3d9cdf4..db0035189b 100644 --- a/docs/system/arm/aspeed.rst +++ b/docs/system/arm/aspeed.rst @@ -34,6 +34,7 @@ AST2600 SoC based machines : - ``bletchley-bmc`` Facebook Bletchley BMC - ``fby35-bmc`` Facebook fby35 BMC - ``catalina-bmc`` Facebook Catalina BMC +- ``clemente-bmc`` Facebook Clemente BMC - ``sanmiguel-bmc`` Facebook SanMiguel BMC - ``anacapa-bmc`` Facebook Anacapa BMC - ``minerva-bmc`` Facebook Minerva BMC diff --git a/hw/arm/aspeed_ast2600_clemente.c b/hw/arm/aspeed_ast2600_cleme= nte.c new file mode 100644 index 0000000000..bf5a13bc49 --- /dev/null +++ b/hw/arm/aspeed_ast2600_clemente.c @@ -0,0 +1,232 @@ +/* + * Facebook Clemente BMC + * + * Copyright (c) 2026 Meta Platforms, Inc. and affiliates. + * + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Current limitations: the following devices from the device tree have no + * QEMU model and are therefore not emulated: + * - ti,lm5066i power monitors + * - maxim,max31790 fan controllers + * - maxim,max1363 ADCs (leak sensors) + * - renesas,raa228004 voltage regulators + * - infineon,slb9670 TPM (SPI) + * - ssif-bmc SSIF interface + * - mctp-i2c-controller MCTP endpoints + */ + +#include "qemu/osdep.h" +#include "hw/arm/aspeed.h" +#include "hw/arm/aspeed_soc.h" +#include "hw/i2c/i2c_mux_pca954x.h" +#include "hw/gpio/pca9552.h" +#include "hw/gpio/pca9554.h" +#include "hw/nvram/eeprom_at24c.h" +#include "hw/rtc/ds1338.h" +#include "hw/sensor/tmp105.h" +#include "hw/sensor/tmp421.h" + +/* Clemente hardware values. */ +#define CLEMENTE_BMC_HW_STRAP1 0x00002002 +#define CLEMENTE_BMC_HW_STRAP2 0x00000800 +#define CLEMENTE_BMC_RAM_SIZE (2 * GiB) + +/* + * E1.S backplane hanging off a PCA9546 channel: an FRU EEPROM plus a + * second PCA9546 fronting per-drive NVMe SSD FRU EEPROMs. + */ +static void clemente_e1s_backplane_init(I2CBus *bus) +{ + /* eeprom@56 - atmel,24c128 */ + at24c_eeprom_init(bus, 0x56, 16 * KiB); + + /* i2c-mux@74 - PCA9546 */ + I2CSlave *mux =3D i2c_slave_create_simple(bus, TYPE_PCA9546, 0x74); + /* eeprom@53 - atmel,24c02, channels 0 and 2 */ + at24c_eeprom_init(pca954x_i2c_get_bus(mux, 0), 0x53, 256); + at24c_eeprom_init(pca954x_i2c_get_bus(mux, 2), 0x53, 256); +} + +/* + * IO Mezzanine hanging off a PCA9546 channel: an I/O expander plus the + * mezzanine and OSFP FRU EEPROMs. + */ +static void clemente_io_mezz_init(I2CBus *bus, uint8_t exp_addr) +{ + /* gpio@20/21 - nxp,pca9535 */ + i2c_slave_create_simple(bus, TYPE_PCA9535, exp_addr); + /* eeprom@50 - atmel,24c64 (mezzanine FRU) */ + at24c_eeprom_init(bus, 0x50, 8 * KiB); + /* eeprom@52 - atmel,24c128 (OSFP FRU) */ + at24c_eeprom_init(bus, 0x52, 16 * KiB); +} + +static void clemente_bmc_i2c_init(AspeedMachineState *bmc) +{ + /* Reference: aspeed-bmc-facebook-clemente.dts */ + + AspeedSoCState *soc =3D bmc->soc; + I2CBus *i2c[16] =3D {}; + I2CSlave *i2c_mux; + + for (unsigned idx =3D 0; idx < ARRAY_SIZE(i2c); idx++) { + i2c[idx] =3D aspeed_i2c_get_bus(&soc->i2c, idx); + } + + /* &i2c0 */ + /* i2c-mux@71 (PCA9546) */ + i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x71); + /* channel 1 - HDD FRU eeprom@56 and E1.S backplane */ + clemente_e1s_backplane_init(pca954x_i2c_get_bus(i2c_mux, 1)); + + /* i2c-mux@72 (PCA9546) */ + i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x72); + /* channel 1 - IO Mezz 0 (io_expander7 @20) */ + clemente_io_mezz_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x20); + + /* i2c-mux@73 (PCA9546) - channels empty */ + i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x73); + + /* i2c-mux@75 (PCA9546) */ + i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x75); + /* channel 1 - HDD FRU eeprom@56 and E1.S backplane */ + clemente_e1s_backplane_init(pca954x_i2c_get_bus(i2c_mux, 1)); + + /* i2c-mux@76 (PCA9546) */ + i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x76); + /* channel 1 - IO Mezz 1 (io_expander8 @21) */ + clemente_io_mezz_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x21); + + /* i2c-mux@77 (PCA9546) */ + i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x77); + /* channel 1 - boot drive FRU eeprom@53 */ + at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x53, 256); + + /* &i2c1 */ + /* power-monitor@12/14 - ti,lm5066i (no model) */ + /* fan-controller@20/23/2c/2f - maxim,max31790 (no model) */ + /* adc@34/35 - maxim,max1363 (no model) */ + /* temperature-sensor@4e - ti,tmp1075 */ + i2c_slave_create_simple(i2c[1], TYPE_TMP1075, 0x4e); + /* eeprom@50 - atmel,24c02 (PDB FRU) */ + at24c_eeprom_init(i2c[1], 0x50, 256); + /* vrm@60/61 - renesas,raa228004 (no model) */ + /* i2c-mux@70 (PCA9548) - interposer */ + i2c_mux =3D i2c_slave_create_simple(i2c[1], TYPE_PCA9548, 0x70); + /* channel 5 - interposer */ + /* temperature-sensor@4f - ti,tmp75 */ + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), TYPE_TMP75, 0= x4f); + /* eeprom@54 - atmel,24c64 */ + at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 5), 0x54, 8 * KiB); + /* channel 6 - io_expander5 gpio@27 - nxp,pca9554 */ + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 6), + TYPE_PCA9554, 0x27); + /* channel 7 - FIO */ + /* temperature-sensor@4b - ti,tmp75 */ + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 7), TYPE_TMP75, 0= x4b); + /* eeprom@51 - atmel,24c64 */ + at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 7), 0x51, 8 * KiB); + + /* &i2c2 */ + /* gpio@20/21/27 - nxp,pca9555 */ + i2c_slave_create_simple(i2c[2], TYPE_PCA9555, 0x20); + i2c_slave_create_simple(i2c[2], TYPE_PCA9555, 0x21); + i2c_slave_create_simple(i2c[2], TYPE_PCA9555, 0x27); + /* eeprom@50/51 - atmel,24c64 (module aux) */ + at24c_eeprom_init(i2c[2], 0x50, 8 * KiB); + at24c_eeprom_init(i2c[2], 0x51, 8 * KiB); + + /* &i2c3 - empty */ + /* &i2c4 - empty */ + /* &i2c5 - empty */ + + /* &i2c6 */ + /* gpio@21 - nxp,pca9555 */ + i2c_slave_create_simple(i2c[6], TYPE_PCA9555, 0x21); + /* rtc@6f - nuvoton,nct3018y */ + i2c_slave_create_simple(i2c[6], TYPE_DS1338, 0x6f); + + /* &i2c7 - empty */ + /* &i2c8 - empty */ + + /* &i2c9 */ + /* temperature-sensor@4b - national,lm75b */ + i2c_slave_create_simple(i2c[9], TYPE_LM75B, 0x4b); + /* gpio@4f - nxp,pca9555 */ + i2c_slave_create_simple(i2c[9], TYPE_PCA9555, 0x4f); + /* eeprom@50 - atmel,24c64 (SCM FRU) */ + at24c_eeprom_init(i2c[9], 0x50, 8 * KiB); + /* eeprom@56 - atmel,24c64 (BSM FRU) */ + at24c_eeprom_init(i2c[9], 0x56, 8 * KiB); + + /* &i2c10 */ + /* mctp@10 - mctp-i2c-controller (no model) */ + /* temperature-sensor@1f - ti,tmp421 (OCP NIC0) */ + i2c_slave_create_simple(i2c[10], TYPE_TMP421, 0x1f); + /* eeprom@50 - atmel,24c64 (OCP NIC0 FRU) */ + at24c_eeprom_init(i2c[10], 0x50, 8 * KiB); + + /* &i2c11 */ + /* ssif-bmc@10 - ssif-bmc (no model) */ + + /* &i2c12 */ + /* eeprom@50 - atmel,24c64 (HPM 1 FRU) */ + at24c_eeprom_init(i2c[12], 0x50, 8 * KiB); + /* eeprom@54/55 - atmel,24c02 (CBC 2/3 FRU) */ + at24c_eeprom_init(i2c[12], 0x54, 256); + at24c_eeprom_init(i2c[12], 0x55, 256); + + /* &i2c13 */ + /* eeprom@50 - atmel,24c64 (HPM FRU) */ + at24c_eeprom_init(i2c[13], 0x50, 8 * KiB); + /* eeprom@54/55 - atmel,24c02 (CBC 0/1 FRU) */ + at24c_eeprom_init(i2c[13], 0x54, 256); + at24c_eeprom_init(i2c[13], 0x55, 256); + /* eeprom@57 - atmel,24c02 (HMC FRU) */ + at24c_eeprom_init(i2c[13], 0x57, 256); + + /* &i2c14 */ + /* gpio@10/11/12/13/14 - nxp,pca9555 (PDB CPLD) */ + i2c_slave_create_simple(i2c[14], TYPE_PCA9555, 0x10); + i2c_slave_create_simple(i2c[14], TYPE_PCA9555, 0x11); + i2c_slave_create_simple(i2c[14], TYPE_PCA9555, 0x12); + i2c_slave_create_simple(i2c[14], TYPE_PCA9555, 0x13); + i2c_slave_create_simple(i2c[14], TYPE_PCA9555, 0x14); + + /* &i2c15 */ + /* mctp@10 - mctp-i2c-controller (no model) */ + /* temperature-sensor@1f - ti,tmp421 (OCP NIC1) */ + i2c_slave_create_simple(i2c[15], TYPE_TMP421, 0x1f); + /* eeprom@52 - atmel,24c64 (OCP NIC1 FRU) */ + at24c_eeprom_init(i2c[15], 0x52, 8 * KiB); +} + +static void aspeed_machine_clemente_class_init(ObjectClass *oc, + const void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + AspeedMachineClass *amc =3D ASPEED_MACHINE_CLASS(oc); + + mc->desc =3D "Facebook Clemente BMC (Cortex-A7)"; + amc->soc_name =3D "ast2600-a3"; + amc->hw_strap1 =3D CLEMENTE_BMC_HW_STRAP1; + amc->hw_strap2 =3D CLEMENTE_BMC_HW_STRAP2; + amc->fmc_model =3D "mx66l1g45g"; + amc->spi_model =3D NULL; + amc->num_cs =3D 2; + amc->macs_mask =3D ASPEED_MAC2_ON | ASPEED_MAC3_ON; + amc->i2c_init =3D clemente_bmc_i2c_init; + mc->default_ram_size =3D CLEMENTE_BMC_RAM_SIZE; + aspeed_machine_class_init_cpus_defaults(mc); +} + +static const TypeInfo aspeed_ast2600_clemente_types[] =3D { + { + .name =3D MACHINE_TYPE_NAME("clemente-bmc"), + .parent =3D TYPE_ASPEED_MACHINE, + .class_init =3D aspeed_machine_clemente_class_init, + } +}; + +DEFINE_TYPES(aspeed_ast2600_clemente_types) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index a9e8270b85..4189de2aaa 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -59,6 +59,7 @@ arm_common_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: fil= es( 'aspeed_ast2600_anacapa.c', 'aspeed_ast2600_bletchley.c', 'aspeed_ast2600_catalina.c', + 'aspeed_ast2600_clemente.c', 'aspeed_ast2600_evb.c', 'aspeed_ast2600_fby35.c', 'aspeed_ast2600_fuji.c', --=20 2.53.0-Meta From nobody Mon Nov 23 04:44:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1792077400; cv=none; d=zohomail.com; s=zohoarc; b=dvdPh+Yd7dRxoJO1FD3k1ErwhQJndOy7QGPk7CgEQ1xW+JEwfrsOJ8w/y2UF8t+NLxFb4wJzIjrA18/5Ra63gWJ6aeowo4DtU8Usx+Eygm1mbgZ8Fy+ehFhDIMq3WgAdDM4rlMouwKvKtlY2z0zfD3HXgVamE1RhehLQEgUuFmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792077400; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=M1VJEMESRo8eHt8J5jfpjEpH+YhMvTi1siquZRiiLPM=; b=ctXhU3jlyf/e1PjJBqatMq55nFRTL9VJNa1ujVaOU8SrpXrMtuIWJl/uiXk7MMI9N2Vwj7EUUxrrWWleGVg7vYYKnobflIoSAOVf82zv/Wb4ockPBzRCAwzljT3LNVliUyLtNov+YH3AoBJKyvi0AgAi5UI447nNCdNP/kpjuno= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1792077400369533.5732309229322; Thu, 15 Oct 2026 08:16:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHNAU-0003Bf-NW; Thu, 15 Oct 2026 11:14:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHN8q-0002ZB-UO for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:13:13 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xHN8l-00026H-V8 for qemu-devel@nongnu.org; Thu, 15 Oct 2026 11:13:12 -0400 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4a0e1b0681bso39519805e9.3 for ; Thu, 15 Oct 2026 08:13:05 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1c10fe9d3sm56011005e9.13.2026.10.15.08.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2026 08:13:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792077185; x=1792681985; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=M1VJEMESRo8eHt8J5jfpjEpH+YhMvTi1siquZRiiLPM=; b=neb4O7F18YOThxYChiyD9v9TT95NVxCLJ57KCbrikqf1yqjtlSlKaMgS5iFkpGnDCl MeDcZ6drNJFZ9DbUCEEQyctRG1MRnb7MJ9GUTF1mlNHoNVvqzWS/4h9carx3Oy908cOQ 63qZOYM5lcf19XNWQqc3n2j4hvYeNX9kemkRl2X5xB7hTGp8ieaJxyXC16/ASJCUz/T4 xmvmqAaack2O3uaf6OhGYE2Ey7VggWL4keMLf8dcSpYEr+qzMWt8I+/xc2bw9osZZjWx afKSvHlp8xUZB5BBLV7UiXffpELh7WrxQdBIPM4CRp+RE6hGJZgB6Gbr9wJO+iSSgpgO 5Zug== X-Gm-Message-State: AFq9FYLriRIaG1ooJ+jqui05CRaVRcF8PrZJSh57gmusU+lLX2p2Debf c2im7gM5+xHMbquF9wtHuCtB+E3jkxxMa5u6uvaitmpJw1QIp5j3SUQTL4H3wg== X-Gm-Gg: AYBFou0IsX3raNwXIWBrKH55FOUNfeN4jkzskiW9mzRtXhRhFMRTC3RI+us8Zig4sAu TUayg4sAOFjLnhrCIYXOqlAEpn023V2YuVA7rbboTeLIkXFoFerCSFo99yqNnbFDwn0Hl9c0uP1 xd7TI3tDgxUI3g/CBuGLdPvdnENLNzFNbHku5POEp/LAsit3c/pIfKjU2/GYVtEp+Q0itw4BiI9 HB7wbcPDTCWTlpqXK/PFIAotRne+cIt8vxyXWNkUjX0SS4n2bqi94CTtoCsmL3Y4R7b3nEK8cpv 2O24K5ajvg9UtSl2BHu9pd++1HTw0Ay8YZZfF+3iMesQDmPJcsg7bKc5RKG49ZczieAMeaeeeA8 rEfRR6z8IfZrf2LOoFT5aEh8G0o1YFT5Hwksp+IRhr7evFsCBeXArpEHEoD0HfJvd7ht4IgX0tv Ixh1llzM0IY/wYb9o0eer/pB6PoDy7Zpq0TDQlzMFeCUvKaTJaets/LR+GyOxUPbR0UrqfxCQkX S7Ixh1FPNm2yK1/ve6wfClyXmNL1B6XUM2dYTItlgD1pT3fNUIstoih X-Received: by 2002:a05:600c:8b51:b0:49f:d6f0:6f24 with SMTP id 5b1f17b1804b1-4a18e443b3fmr400128385e9.2.1792077184202; Thu, 15 Oct 2026 08:13:04 -0700 (PDT) Date: Thu, 15 Oct 2026 13:58:00 +0200 Subject: [PATCH 22/22] hw/arm: clemente: populate the FRU EEPROMs MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-bmc-clemente-v1-22-bf591886b5b6@free.fr> References: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> In-Reply-To: <20261015-bmc-clemente-v1-0-bf591886b5b6@free.fr> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Steven Lee , Troy Lee , Jamin Lin , Kane Chen , Andrew Jeffery , Joel Stanley , qemu-arm@nongnu.org, Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Pierrick Bouvier , Emmanuel Blot X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065466; l=57685; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=vcZ8x/OVNytpIvT35o+g2fYLa19fbkS95XrN12567XQ=; b=5nsSzzwFY+N0kBBFp98Bqc1WABLCpaCSdgRPwJ0UsMKNn1w/KaZLeEa040IAKQJ/EQX5247Dn ozxv4Ssr6FNAye+8t9uhub8ZCxvqOvH+NEY5H/Ja13mWU1qS5NzwkVD X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.128.54; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f54.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_03_06=1.592, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1792077402565158500 Back 24 of the 27 FRU EEPROMs with images read from hardware, so guest firmware can identify the boards, the compute and management modules, the network adapters, the I/O mezzanines and the drive backplanes instead of finding them blank. Two EEPROMs were erased on the sampled chassis and one was absent, so those three stay blank. The drive backplane and I/O mezzanine helpers each serve two instances carrying different images, so both now take a descriptor naming the EEPROMs they install. The content is sanitized: part and serial numbers masked, dates fixed, asset tags replaced, distinct originals kept distinct. Several images carry OEM MultiRecords whose contents are undocumented; the records are kept and their bodies zeroed. Signed-off-by: Emmanuel Blot Reviewed-by: Jamin Lin --- hw/arm/aspeed_ast2600_clemente.c | 974 +++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 948 insertions(+), 26 deletions(-) diff --git a/hw/arm/aspeed_ast2600_clemente.c b/hw/arm/aspeed_ast2600_cleme= nte.c index bf5a13bc49..7937097c5b 100644 --- a/hw/arm/aspeed_ast2600_clemente.c +++ b/hw/arm/aspeed_ast2600_clemente.c @@ -32,34 +32,937 @@ #define CLEMENTE_BMC_HW_STRAP2 0x00000800 #define CLEMENTE_BMC_RAM_SIZE (2 * GiB) =20 +/* + * FRU images read back from hardware and sanitized: part and serial + * numbers are masked, manufacturing dates fixed and asset tags replaced, + * so the layout stays faithful while the identifying data is not real. + * + * Names are kept as programmed. The Board Info Area names the board, the + * Product Info Area the system it is installed in, so the boards sourced + * from a third party name their own vendor rather than the platform. + */ + +/* + * FRU: i2c1 @0x50 (PDB) + * Board mfg: Ingrasys + * Board product: Clemente PDB PVT2 + * Board part: 0A00AA000-001-A + * Board serial: 0A00AA00A0000A001 + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver. 0.05A + * Product mfg: Ingrasys + * Product name: CI-Clemente + * Product part: 0A00A0A00-001-A + * Product version: PVT2 + * Product serial: 0AAA00000001 + * Product asset: QEMU + */ +static const uint8_t fru_1_0050[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0xf2, 0x01, 0x0b, 0x19, 0xc0, + 0xc6, 0xf0, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xd1, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x20, 0x50, 0x44, 0x42, + 0x20, 0x50, 0x56, 0x54, 0x32, 0xd1, 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, + 0x30, 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x41, 0x30, 0x30, 0x31, 0xcf, + 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x31, 0x2d, 0x41, 0xce, 0x46, 0x52, 0x55, 0x20, 0x56, 0x65, 0x72, 0x2e, + 0x20, 0x30, 0x2e, 0x30, 0x35, 0x41, 0xc1, 0x00, 0x00, 0x00, 0x00, 0xbd, + 0x01, 0x09, 0x19, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, + 0xcb, 0x43, 0x49, 0x2d, 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, + 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, + 0x30, 0x31, 0x2d, 0x41, 0xc4, 0x50, 0x56, 0x54, 0x32, 0xcc, 0x30, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0xc4, 0x51, + 0x45, 0x4d, 0x55, 0xc0, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, +}; + +/* + * FRU: i2c9 @0x50 (SCM) + * Board mfg: Ingrasys + * Board product: Clemente SCM PVT2 + * Board part: 0A00AA000-002-A + * Board serial: 0A00AA00A000002AA + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver. 0.05A + * Product mfg: Ingrasys + * Product name: CI-Clemente + * Product part: 0A00A0A00-001-A + * Product version: PVT2 + * Product serial: 0AAA00000001 + * Product asset: QEMU + */ +static const uint8_t fru_9_0050[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0xf2, 0x01, 0x0b, 0x19, 0xc0, + 0xc6, 0xf0, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xd1, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x20, 0x53, 0x43, 0x4d, + 0x20, 0x50, 0x56, 0x54, 0x32, 0xd1, 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, + 0x30, 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32, 0x41, 0x41, 0xcf, + 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x32, 0x2d, 0x41, 0xce, 0x46, 0x52, 0x55, 0x20, 0x56, 0x65, 0x72, 0x2e, + 0x20, 0x30, 0x2e, 0x30, 0x35, 0x41, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x9d, + 0x01, 0x09, 0x00, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, + 0xcb, 0x43, 0x49, 0x2d, 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, + 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, + 0x30, 0x31, 0x2d, 0x41, 0xc4, 0x50, 0x56, 0x54, 0x32, 0xcc, 0x30, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0xc4, 0x51, + 0x45, 0x4d, 0x55, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, +}; + +/* + * FRU: i2c9 @0x56 (BSM) + * Board mfg: Ingrasys + * Board product: BMC Storage Module PVT2 + * Board part: 0A00AAA00-003-A + * Board serial: 0A00AAA0A0000A003 + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver. 0.05A + * Product mfg: Ingrasys + * Product name: CI-Clemente + * Product part: 0A00A0A00-001-A + * Product version: PVT2 + * Product serial: 0AAA00000001 + * Product asset: QEMU + */ +static const uint8_t fru_9_0056[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x19, 0xc0, + 0xc6, 0xf0, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xd7, + 0x42, 0x4d, 0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x20, 0x50, 0x56, 0x54, 0x32, 0xd1, + 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, 0x41, 0x30, 0x41, 0x30, 0x30, 0x30, + 0x30, 0x41, 0x30, 0x30, 0x33, 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, + 0x41, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x33, 0x2d, 0x41, 0xce, 0x46, 0x52, + 0x55, 0x20, 0x56, 0x65, 0x72, 0x2e, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x41, + 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x01, 0x09, 0x00, 0xc8, + 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xcb, 0x43, 0x49, 0x2d, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0xcf, 0x30, 0x41, 0x30, + 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x31, 0x2d, 0x41, + 0xc4, 0x50, 0x56, 0x54, 0x32, 0xcc, 0x30, 0x41, 0x41, 0x41, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xc1, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, +}; + +/* + * FRU: i2c10 @0x50 (OCP NIC0) + * Board mfg: Nvidia + * Board product: Nvidia ConnectX-7 OCP3.0 + * Board part: AA00004AAA-AAAA_AA + * Board serial: AA0000A004AA + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver 0.01 + * Product mfg: Nvidia + * Product name: Nvidia ConnectX-7 OCP3.0 + * Product part: AA00002AAA-AAAA_AA + * Product version: A2 + * Product serial: AA0000A002AA + * Product asset: QEMU + * OEM records: 1 (53 bytes, zeroed) + */ +static const uint8_t fru_10_0050[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0e, 0x1c, 0x00, 0xd4, 0x01, 0x0d, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0xd8, 0x4e, 0x76, + 0x69, 0x64, 0x69, 0x61, 0x20, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x58, 0x2d, 0x37, 0x20, 0x4f, 0x43, 0x50, 0x33, 0x2e, 0x30, 0xd8, 0x41, + 0x41, 0x30, 0x30, 0x30, 0x30, 0x41, 0x30, 0x30, 0x34, 0x41, 0x41, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xd5, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x34, 0x41, 0x41, 0x41, 0x2d, 0x41, + 0x41, 0x41, 0x41, 0x5f, 0x41, 0x41, 0x20, 0x20, 0x20, 0xcc, 0x46, 0x52, + 0x55, 0x20, 0x56, 0x65, 0x72, 0x20, 0x30, 0x2e, 0x30, 0x31, 0xc1, 0x00, + 0x00, 0x00, 0x00, 0xbf, 0x01, 0x0e, 0x19, 0xc6, 0x4e, 0x76, 0x69, 0x64, + 0x69, 0x61, 0xd8, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x20, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x58, 0x2d, 0x37, 0x20, 0x4f, 0x43, 0x50, + 0x33, 0x2e, 0x30, 0xd5, 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x32, 0x41, + 0x41, 0x41, 0x2d, 0x41, 0x41, 0x41, 0x41, 0x5f, 0x41, 0x41, 0x20, 0x20, + 0x20, 0xd3, 0x41, 0x32, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xd8, 0x41, 0x41, + 0x30, 0x30, 0x30, 0x30, 0x41, 0x30, 0x30, 0x32, 0x41, 0x41, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc4, 0x51, + 0x45, 0x4d, 0x55, 0xc0, 0xc1, 0x00, 0x00, 0xfb, 0xc0, 0x82, 0x35, 0x00, + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * FRU: i2c12 @0x50 (HPM 1) + * Board mfg: NVIDIA + * Board product: PG548 + * Board part: 000-0A000-0000-A05 + * Board serial: 0000000000005 + * Board mfg date: 2026-01-01T00:00:00Z + * Product mfg: NVIDIA + * Product name: GB300 1CPU:2GPU Board PC + * Product part: 000-0A000-0000-003 + * Product version: C07 + * Product serial: 0000000000003 + * Product asset: QEMU + */ +static const uint8_t fru_12_0050[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x56, 0x49, 0x44, 0x49, 0x41, 0xc5, 0x50, 0x47, + 0x35, 0x34, 0x38, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x35, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x41, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x41, 0x30, 0x35, + 0xc0, 0xc1, 0x00, 0xd8, 0x01, 0x0c, 0x19, 0xc6, 0x4e, 0x56, 0x49, 0x44, + 0x49, 0x41, 0xd8, 0x47, 0x42, 0x33, 0x30, 0x30, 0x20, 0x31, 0x43, 0x50, + 0x55, 0x3a, 0x32, 0x47, 0x50, 0x55, 0x20, 0x42, 0x6f, 0x61, 0x72, 0x64, + 0x20, 0x50, 0x43, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x41, 0x30, 0x30, + 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x33, 0xc3, 0x43, + 0x30, 0x37, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x33, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xcc, 0x46, 0x52, + 0x55, 0x5f, 0x56, 0x65, 0x72, 0x5f, 0x30, 0x2e, 0x30, 0x33, 0xc1, 0x00, + 0x00, 0x00, 0x00, 0x0d, +}; + +/* + * FRU: i2c12 @0x54 (CBC 2) + * Chassis type: Blade Enclosure + * Chassis part: 000-00000-0000-001 + * Chassis serial: 000AAAA000001 + * Board mfg: Nvidia + * Board product: 18x1RU CBL Cartridge + * Board part: 000-0000-006 + * Board serial: 0000000000006 + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: HS33172S03 + * Product name: 18x1RU CBL Cartridge + * Product part: 000-00000-0000-004 + * Product version: E.4 + * Product serial: 0000000000004 + * Product asset: QEMU + */ +static const uint8_t fru_12_0054[] =3D { + 0x01, 0x00, 0x01, 0x07, 0x11, 0x00, 0x00, 0xe6, 0x01, 0x06, 0x1d, 0xd2, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x30, 0x30, 0x2d, 0x30, 0x30, 0x31, 0xcd, 0x30, 0x30, 0x30, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x08, 0x02, 0x00, 0x03, + 0x02, 0x80, 0x12, 0x02, 0x00, 0xc1, 0x00, 0xcc, 0x01, 0x0a, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0xd4, 0x31, 0x38, + 0x78, 0x31, 0x52, 0x55, 0x20, 0x43, 0x42, 0x4c, 0x20, 0x43, 0x61, 0x72, + 0x74, 0x72, 0x69, 0x64, 0x67, 0x65, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0xcc, 0x30, 0x30, 0x30, + 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x36, 0xca, 0x48, 0x53, + 0x33, 0x33, 0x31, 0x37, 0x32, 0x53, 0x30, 0x33, 0xc1, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe7, 0x01, 0x0a, 0x19, 0xc0, 0xd4, 0x31, 0x38, 0x78, + 0x31, 0x52, 0x55, 0x20, 0x43, 0x42, 0x4c, 0x20, 0x43, 0x61, 0x72, 0x74, + 0x72, 0x69, 0x64, 0x67, 0x65, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x34, + 0xc3, 0x45, 0x2e, 0x34, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x34, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xca, + 0x48, 0x53, 0x33, 0x33, 0x31, 0x37, 0x32, 0x53, 0x30, 0x33, 0xc1, 0x39, +}; + +/* + * FRU: i2c12 @0x55 (CBC 3) + * Chassis type: Blade Enclosure + * Chassis part: 000-00000-0000-001 + * Chassis serial: 000AAAA000001 + * Board mfg: Nvidia + * Board product: 18x1RU CBL Cartridge + * Board part: 000-0000-006 + * Board serial: 0000000000007 + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: HS33172S03 + * Product name: 18x1RU CBL Cartridge + * Product part: 000-00000-0000-004 + * Product version: E.4 + * Product serial: 0000000000005 + * Product asset: QEMU + */ +static const uint8_t fru_12_0055[] =3D { + 0x01, 0x00, 0x01, 0x07, 0x11, 0x00, 0x00, 0xe6, 0x01, 0x06, 0x1d, 0xd2, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x30, 0x30, 0x2d, 0x30, 0x30, 0x31, 0xcd, 0x30, 0x30, 0x30, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x08, 0x02, 0x00, 0x03, + 0x02, 0x80, 0x12, 0x02, 0x00, 0xc1, 0x00, 0xcc, 0x01, 0x0a, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0xd4, 0x31, 0x38, + 0x78, 0x31, 0x52, 0x55, 0x20, 0x43, 0x42, 0x4c, 0x20, 0x43, 0x61, 0x72, + 0x74, 0x72, 0x69, 0x64, 0x67, 0x65, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x37, 0xcc, 0x30, 0x30, 0x30, + 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x36, 0xca, 0x48, 0x53, + 0x33, 0x33, 0x31, 0x37, 0x32, 0x53, 0x30, 0x33, 0xc1, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe6, 0x01, 0x0a, 0x19, 0xc0, 0xd4, 0x31, 0x38, 0x78, + 0x31, 0x52, 0x55, 0x20, 0x43, 0x42, 0x4c, 0x20, 0x43, 0x61, 0x72, 0x74, + 0x72, 0x69, 0x64, 0x67, 0x65, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x34, + 0xc3, 0x45, 0x2e, 0x34, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x35, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xca, + 0x48, 0x53, 0x33, 0x33, 0x31, 0x37, 0x32, 0x53, 0x30, 0x33, 0xc1, 0x38, +}; + +/* + * FRU: i2c13 @0x50 (HPM) + * Board mfg: NVIDIA + * Board product: PG548 + * Board part: 000-0A000-0000-A05 + * Board serial: 0000000000008 + * Board mfg date: 2026-01-01T00:00:00Z + * Product mfg: NVIDIA + * Product name: GB300 1CPU:2GPU Board PC + * Product part: 000-0A000-0000-003 + * Product version: C07 + * Product serial: 0000000000006 + * Product asset: QEMU + */ +static const uint8_t fru_13_0050[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf6, 0x01, 0x07, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x56, 0x49, 0x44, 0x49, 0x41, 0xc5, 0x50, 0x47, + 0x35, 0x34, 0x38, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x38, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x41, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x41, 0x30, 0x35, + 0xc0, 0xc1, 0x00, 0xd5, 0x01, 0x0c, 0x19, 0xc6, 0x4e, 0x56, 0x49, 0x44, + 0x49, 0x41, 0xd8, 0x47, 0x42, 0x33, 0x30, 0x30, 0x20, 0x31, 0x43, 0x50, + 0x55, 0x3a, 0x32, 0x47, 0x50, 0x55, 0x20, 0x42, 0x6f, 0x61, 0x72, 0x64, + 0x20, 0x50, 0x43, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x41, 0x30, 0x30, + 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x33, 0xc3, 0x43, + 0x30, 0x37, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x36, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xcc, 0x46, 0x52, + 0x55, 0x5f, 0x56, 0x65, 0x72, 0x5f, 0x30, 0x2e, 0x30, 0x33, 0xc1, 0x00, + 0x00, 0x00, 0x00, 0x0a, +}; + +/* + * FRU: i2c13 @0x54 (CBC 0) + * Chassis type: Blade Enclosure + * Chassis part: 000-00000-0000-001 + * Chassis serial: 000AAAA000001 + * Board mfg: Nvidia + * Board product: 18x1RU CBL Cartridge + * Board part: 000-0000-006 + * Board serial: 0000000000009 + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: HS33172S03 + * Product name: 18x1RU CBL Cartridge + * Product part: 000-00000-0000-004 + * Product version: E.4 + * Product serial: 0000000000007 + * Product asset: QEMU + */ +static const uint8_t fru_13_0054[] =3D { + 0x01, 0x00, 0x01, 0x07, 0x11, 0x00, 0x00, 0xe6, 0x01, 0x06, 0x1d, 0xd2, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x30, 0x30, 0x2d, 0x30, 0x30, 0x31, 0xcd, 0x30, 0x30, 0x30, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x08, 0x02, 0x00, 0x03, + 0x02, 0x80, 0x12, 0x02, 0x00, 0xc1, 0x00, 0xcc, 0x01, 0x0a, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0xd4, 0x31, 0x38, + 0x78, 0x31, 0x52, 0x55, 0x20, 0x43, 0x42, 0x4c, 0x20, 0x43, 0x61, 0x72, + 0x74, 0x72, 0x69, 0x64, 0x67, 0x65, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x39, 0xcc, 0x30, 0x30, 0x30, + 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x36, 0xca, 0x48, 0x53, + 0x33, 0x33, 0x31, 0x37, 0x32, 0x53, 0x30, 0x33, 0xc1, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe4, 0x01, 0x0a, 0x19, 0xc0, 0xd4, 0x31, 0x38, 0x78, + 0x31, 0x52, 0x55, 0x20, 0x43, 0x42, 0x4c, 0x20, 0x43, 0x61, 0x72, 0x74, + 0x72, 0x69, 0x64, 0x67, 0x65, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x34, + 0xc3, 0x45, 0x2e, 0x34, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x37, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xca, + 0x48, 0x53, 0x33, 0x33, 0x31, 0x37, 0x32, 0x53, 0x30, 0x33, 0xc1, 0x36, +}; + +/* + * FRU: i2c13 @0x55 (CBC 1) + * Chassis type: Blade Enclosure + * Chassis part: 000-00000-0000-001 + * Chassis serial: 000AAAA000001 + * Board mfg: Nvidia + * Board product: 18x1RU CBL Cartridge + * Board part: 000-0000-006 + * Board serial: 0000000000010 + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: HS33172S03 + * Product name: 18x1RU CBL Cartridge + * Product part: 000-00000-0000-004 + * Product version: E.4 + * Product serial: 0000000000008 + * Product asset: QEMU + */ +static const uint8_t fru_13_0055[] =3D { + 0x01, 0x00, 0x01, 0x07, 0x11, 0x00, 0x00, 0xe6, 0x01, 0x06, 0x1d, 0xd2, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x30, 0x30, 0x2d, 0x30, 0x30, 0x31, 0xcd, 0x30, 0x30, 0x30, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x08, 0x02, 0x00, 0x03, + 0x02, 0x80, 0x15, 0x01, 0x00, 0xc1, 0x00, 0xca, 0x01, 0x0a, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0xd4, 0x31, 0x38, + 0x78, 0x31, 0x52, 0x55, 0x20, 0x43, 0x42, 0x4c, 0x20, 0x43, 0x61, 0x72, + 0x74, 0x72, 0x69, 0x64, 0x67, 0x65, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x30, 0xcc, 0x30, 0x30, 0x30, + 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x36, 0xca, 0x48, 0x53, + 0x33, 0x33, 0x31, 0x37, 0x32, 0x53, 0x30, 0x33, 0xc1, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xec, 0x01, 0x0a, 0x19, 0xc0, 0xd4, 0x31, 0x38, 0x78, + 0x31, 0x52, 0x55, 0x20, 0x43, 0x42, 0x4c, 0x20, 0x43, 0x61, 0x72, 0x74, + 0x72, 0x69, 0x64, 0x67, 0x65, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x34, + 0xc3, 0x45, 0x2e, 0x34, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x38, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xca, + 0x48, 0x53, 0x33, 0x33, 0x31, 0x37, 0x32, 0x53, 0x30, 0x33, 0xc1, 0x35, +}; + +/* + * FRU: i2c13 @0x57 (HMC) + * Board mfg: NVIDIA + * Board product: P4764-A02 + * Board part: 000-00000-0000-007 + * Board serial: 0000000000011 + * Board mfg date: 2026-01-01T00:00:00Z + * Product mfg: NVIDIA + * Product name: HMC for GB200 NVL72 + * Product part: 000-00000-0000-005 + * Product version: A1 + * Product serial: 0000000000009 + * Product asset: QEMU + */ +static const uint8_t fru_13_0057[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x09, 0x00, 0x00, 0xf5, 0x01, 0x08, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x56, 0x49, 0x44, 0x49, 0x41, 0xc9, 0x50, 0x34, + 0x37, 0x36, 0x34, 0x2d, 0x41, 0x30, 0x32, 0xcd, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x31, 0xd2, 0x30, 0x30, + 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, + 0x2d, 0x30, 0x30, 0x37, 0xc0, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, + 0x01, 0x0b, 0x19, 0xc6, 0x4e, 0x56, 0x49, 0x44, 0x49, 0x41, 0xd3, 0x48, + 0x4d, 0x43, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x47, 0x42, 0x32, 0x30, 0x30, + 0x20, 0x4e, 0x56, 0x4c, 0x37, 0x32, 0xd2, 0x30, 0x30, 0x30, 0x2d, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x35, 0xc2, 0x41, 0x31, 0xcd, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x39, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xcc, + 0x46, 0x52, 0x55, 0x5f, 0x56, 0x65, 0x72, 0x5f, 0x30, 0x2e, 0x30, 0x32, + 0xc1, 0x00, 0x00, 0xcb, +}; + +/* + * FRU: i2c15 @0x52 (OCP NIC1) + * Board mfg: Nvidia + * Board product: Nvidia ConnectX-7 OCP3.0 + * Board part: AA00004AAA-AAAA_AA + * Board serial: AA0000A0012A + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver 0.01 + * Product mfg: Nvidia + * Product name: Nvidia ConnectX-7 OCP3.0 + * Product part: AA00002AAA-AAAA_AA + * Product version: A2 + * Product serial: AA0000A0010A + * Product asset: QEMU + * OEM records: 1 (53 bytes, zeroed) + */ +static const uint8_t fru_15_0052[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0e, 0x1c, 0x00, 0xd4, 0x01, 0x0d, 0x19, 0xc0, + 0xc6, 0xf0, 0xc6, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0xd8, 0x4e, 0x76, + 0x69, 0x64, 0x69, 0x61, 0x20, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x58, 0x2d, 0x37, 0x20, 0x4f, 0x43, 0x50, 0x33, 0x2e, 0x30, 0xd8, 0x41, + 0x41, 0x30, 0x30, 0x30, 0x30, 0x41, 0x30, 0x30, 0x31, 0x32, 0x41, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xd5, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x34, 0x41, 0x41, 0x41, 0x2d, 0x41, + 0x41, 0x41, 0x41, 0x5f, 0x41, 0x41, 0x20, 0x20, 0x20, 0xcc, 0x46, 0x52, + 0x55, 0x20, 0x56, 0x65, 0x72, 0x20, 0x30, 0x2e, 0x30, 0x31, 0xc1, 0x00, + 0x00, 0x00, 0x00, 0xd1, 0x01, 0x0e, 0x19, 0xc6, 0x4e, 0x76, 0x69, 0x64, + 0x69, 0x61, 0xd8, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x20, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x58, 0x2d, 0x37, 0x20, 0x4f, 0x43, 0x50, + 0x33, 0x2e, 0x30, 0xd5, 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x32, 0x41, + 0x41, 0x41, 0x2d, 0x41, 0x41, 0x41, 0x41, 0x5f, 0x41, 0x41, 0x20, 0x20, + 0x20, 0xd3, 0x41, 0x32, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xd8, 0x41, 0x41, + 0x30, 0x30, 0x30, 0x30, 0x41, 0x30, 0x30, 0x31, 0x30, 0x41, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc4, 0x51, + 0x45, 0x4d, 0x55, 0xc0, 0xc1, 0x00, 0x00, 0x0d, 0xc0, 0x82, 0x35, 0x00, + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * FRU: i2c21 @0x54 (interposer) + * Board mfg: Ingrasys + * Board product: Clemente Interposer PVT2 + * Board part: 0A00AA000-008-A + * Board serial: 0A00AA00A0001A3AA + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver. 0.05A + * Product mfg: Ingrasys + * Product name: CI-Clemente + * Product part: 0A00A0A00-001-A + * Product version: PVT2 + * Product serial: 0AAA00000001 + * Product asset: QEMU + */ +static const uint8_t fru_21_0054[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x19, 0xc0, + 0xc6, 0xf0, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xd8, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x20, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x20, 0x50, 0x56, 0x54, 0x32, + 0xd1, 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, 0x30, 0x30, 0x41, 0x30, 0x30, + 0x30, 0x31, 0x41, 0x33, 0x41, 0x41, 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, + 0x41, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x38, 0x2d, 0x41, 0xce, 0x46, + 0x52, 0x55, 0x20, 0x56, 0x65, 0x72, 0x2e, 0x20, 0x30, 0x2e, 0x30, 0x35, + 0x41, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x01, 0x09, 0x00, 0xc8, + 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xcb, 0x43, 0x49, 0x2d, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0xcf, 0x30, 0x41, 0x30, + 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, 0x30, 0x31, 0x2d, 0x41, + 0xc4, 0x50, 0x56, 0x54, 0x32, 0xcc, 0x30, 0x41, 0x41, 0x41, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xc1, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, +}; + +/* + * FRU: i2c23 @0x51 (FIO) + * Board mfg: Ingrasys + * Board product: Clemente FIO PVT2 + * Board part: 0A00A0A00-009-A + * Board serial: 0A00A0A0A0000A14A + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver. 0.05A + * Product mfg: Ingrasys + * Product name: CI-Clemente + * Product part: 0A00A0A00-001-A + * Product version: PVT2 + * Product serial: 0AAA00000001 + * Product asset: QEMU + */ +static const uint8_t fru_23_0051[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0xf2, 0x01, 0x0b, 0x19, 0xc0, + 0xc6, 0xf0, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xd1, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x20, 0x46, 0x49, 0x4f, + 0x20, 0x50, 0x56, 0x54, 0x32, 0xd1, 0x30, 0x41, 0x30, 0x30, 0x41, 0x30, + 0x41, 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x41, 0x31, 0x34, 0x41, 0xcf, + 0x30, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, 0x30, + 0x39, 0x2d, 0x41, 0xce, 0x46, 0x52, 0x55, 0x20, 0x56, 0x65, 0x72, 0x2e, + 0x20, 0x30, 0x2e, 0x30, 0x35, 0x41, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x98, + 0x01, 0x09, 0x00, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, + 0xcb, 0x43, 0x49, 0x2d, 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, + 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, + 0x30, 0x31, 0x2d, 0x41, 0xc4, 0x50, 0x56, 0x54, 0x32, 0xcc, 0x30, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0xc4, 0x51, + 0x45, 0x4d, 0x55, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, +}; + +/* + * FRU: i2c25 @0x56 (E1.S backplane 0) + * Board mfg: Ingrasys + * Board product: Clemente E1.S BP PVT2 + * Board part: 0A00AA000-010-A + * Board serial: 0A00AA00A0001A5AA + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver. 0.05A + * Product mfg: Ingrasys + * Product name: CI-Clemente + * Product part: 0A00A0A00-001-A + * Product version: PVT2 + * Product serial: 0AAA00000001 + * Product asset: QEMU + */ +static const uint8_t fru_25_0056[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0xf2, 0x01, 0x0b, 0x19, 0xc0, + 0xc6, 0xf0, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xd5, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x20, 0x45, 0x31, 0x2e, + 0x53, 0x20, 0x42, 0x50, 0x20, 0x50, 0x56, 0x54, 0x32, 0xd1, 0x30, 0x41, + 0x30, 0x30, 0x41, 0x41, 0x30, 0x30, 0x41, 0x30, 0x30, 0x30, 0x31, 0x41, + 0x35, 0x41, 0x41, 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, 0x30, 0x30, + 0x30, 0x2d, 0x30, 0x31, 0x30, 0x2d, 0x41, 0xce, 0x46, 0x52, 0x55, 0x20, + 0x56, 0x65, 0x72, 0x2e, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x41, 0xc1, 0xbf, + 0x01, 0x09, 0x00, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, + 0xcb, 0x43, 0x49, 0x2d, 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, + 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, + 0x30, 0x31, 0x2d, 0x41, 0xc4, 0x50, 0x56, 0x54, 0x32, 0xcc, 0x30, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0xc4, 0x51, + 0x45, 0x4d, 0x55, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, +}; + +/* + * FRU: i2c29 @0x50 (IO mezzanine 0) + * Board mfg: Nvidia + * Board product: ConnectX-8 800GE 2P NIC + * Board part: 000-0A00A-A1AA-AA1 + * Board serial: AA0000001AA6 + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver 0.01 + * Product mfg: Nvidia + * Product name: ConnectX-8 800GE 2P NIC + * Product part: 000-0A00A-A0AA-AA6 + * Product version: A1 + * Product serial: AA0000001AA1 + * Product asset: QEMU + * OEM records: 1 (25 bytes, zeroed) + */ +static const uint8_t fru_29_0050[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x15, 0x2a, 0x00, 0xbf, 0x01, 0x14, 0x19, 0xc0, + 0xc6, 0xf0, 0xd9, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0xf2, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x58, 0x2d, 0x38, 0x20, 0x38, 0x30, 0x30, 0x47, 0x45, 0x20, 0x32, 0x50, + 0x20, 0x4e, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xdd, 0x41, 0x41, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x31, 0x41, 0x41, 0x36, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0xdd, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x41, 0x30, 0x30, 0x41, 0x2d, + 0x41, 0x31, 0x41, 0x41, 0x2d, 0x41, 0x41, 0x31, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xcc, 0x46, 0x52, 0x55, 0x20, + 0x56, 0x65, 0x72, 0x20, 0x30, 0x2e, 0x30, 0x31, 0xc1, 0x00, 0x00, 0xd4, + 0x01, 0x15, 0x19, 0xd9, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0xf2, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x58, 0x2d, 0x38, 0x20, 0x38, 0x30, 0x30, 0x47, 0x45, 0x20, 0x32, + 0x50, 0x20, 0x4e, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xdd, 0x30, 0x30, 0x30, + 0x2d, 0x30, 0x41, 0x30, 0x30, 0x41, 0x2d, 0x41, 0x30, 0x41, 0x41, 0x2d, + 0x41, 0x41, 0x36, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0xc7, 0x41, 0x31, 0x20, 0x20, 0x20, 0x20, 0x20, 0xdd, 0x41, + 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x41, 0x41, 0x31, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xcc, 0x46, 0x52, + 0x55, 0x20, 0x56, 0x65, 0x72, 0x20, 0x30, 0x2e, 0x30, 0x31, 0xc1, 0x75, + 0xd0, 0x82, 0x19, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * FRU: i2c29 @0x52 (IO mezzanine 0 OSFP) + * Board mfg: Ingrasys + * Board product: Clemente OSFP PVT2 + * Board part: 0A00AAA00-012-A + * Board serial: 0A00AAA0A000017AA + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver. 0.05A + * Product mfg: Ingrasys + * Product name: CI-Clemente + * Product part: 0A00A0A00-001-A + * Product version: PVT2 + * Product serial: 0AAA00000001 + * Product asset: QEMU + */ +static const uint8_t fru_29_0052[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0xf2, 0x01, 0x0b, 0x19, 0xc0, + 0xc6, 0xf0, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xd2, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x20, 0x4f, 0x53, 0x46, + 0x50, 0x20, 0x50, 0x56, 0x54, 0x32, 0xd1, 0x30, 0x41, 0x30, 0x30, 0x41, + 0x41, 0x41, 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x31, 0x37, 0x41, 0x41, + 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, 0x41, 0x30, 0x30, 0x2d, 0x30, + 0x31, 0x32, 0x2d, 0x41, 0xce, 0x46, 0x52, 0x55, 0x20, 0x56, 0x65, 0x72, + 0x2e, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x41, 0xc1, 0x00, 0x00, 0x00, 0x1e, + 0x01, 0x09, 0x00, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, + 0xcb, 0x43, 0x49, 0x2d, 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, + 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, + 0x30, 0x31, 0x2d, 0x41, 0xc4, 0x50, 0x56, 0x54, 0x32, 0xcc, 0x30, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0xc4, 0x51, + 0x45, 0x4d, 0x55, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, +}; + +/* + * FRU: i2c37 @0x56 (E1.S backplane 1) + * Board mfg: Ingrasys + * Board product: Clemente E1.S BP PVT2 + * Board part: 0A00AA000-010-A + * Board serial: 0A00AA00A0001A8AA + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver. 0.05A + * Product mfg: Ingrasys + * Product name: CI-Clemente + * Product part: 0A00A0A00-001-A + * Product version: PVT2 + * Product serial: 0AAA00000001 + * Product asset: QEMU + */ +static const uint8_t fru_37_0056[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0xf2, 0x01, 0x0b, 0x19, 0xc0, + 0xc6, 0xf0, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, 0xd5, + 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x20, 0x45, 0x31, 0x2e, + 0x53, 0x20, 0x42, 0x50, 0x20, 0x50, 0x56, 0x54, 0x32, 0xd1, 0x30, 0x41, + 0x30, 0x30, 0x41, 0x41, 0x30, 0x30, 0x41, 0x30, 0x30, 0x30, 0x31, 0x41, + 0x38, 0x41, 0x41, 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x41, 0x30, 0x30, + 0x30, 0x2d, 0x30, 0x31, 0x30, 0x2d, 0x41, 0xce, 0x46, 0x52, 0x55, 0x20, + 0x56, 0x65, 0x72, 0x2e, 0x20, 0x30, 0x2e, 0x30, 0x35, 0x41, 0xc1, 0xbc, + 0x01, 0x09, 0x00, 0xc8, 0x49, 0x6e, 0x67, 0x72, 0x61, 0x73, 0x79, 0x73, + 0xcb, 0x43, 0x49, 0x2d, 0x43, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x65, + 0xcf, 0x30, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x30, 0x30, 0x2d, 0x30, + 0x30, 0x31, 0x2d, 0x41, 0xc4, 0x50, 0x56, 0x54, 0x32, 0xcc, 0x30, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0xc4, 0x51, + 0x45, 0x4d, 0x55, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, +}; + +/* + * FRU: i2c41 @0x50 (IO mezzanine 1) + * Board mfg: Nvidia + * Board product: ConnectX-8 800GE 2P NIC + * Board part: 000-0A00A-A1AA-AA1 + * Board serial: AA0000019AAA + * Board mfg date: 2026-01-01T00:00:00Z + * Board file ID: FRU Ver 0.01 + * Product mfg: Nvidia + * Product name: ConnectX-8 800GE 2P NIC + * Product part: 000-0A00A-A0AA-AA6 + * Product version: A1 + * Product serial: AA0000012AAA + * Product asset: QEMU + * OEM records: 1 (25 bytes, zeroed) + */ +static const uint8_t fru_41_0050[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x15, 0x2a, 0x00, 0xbf, 0x01, 0x14, 0x19, 0xc0, + 0xc6, 0xf0, 0xd9, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0xf2, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x58, 0x2d, 0x38, 0x20, 0x38, 0x30, 0x30, 0x47, 0x45, 0x20, 0x32, 0x50, + 0x20, 0x4e, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xdd, 0x41, 0x41, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x31, 0x39, 0x41, 0x41, 0x41, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0xdd, 0x30, 0x30, 0x30, 0x2d, 0x30, 0x41, 0x30, 0x30, 0x41, 0x2d, + 0x41, 0x31, 0x41, 0x41, 0x2d, 0x41, 0x41, 0x31, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xcc, 0x46, 0x52, 0x55, 0x20, + 0x56, 0x65, 0x72, 0x20, 0x30, 0x2e, 0x30, 0x31, 0xc1, 0x00, 0x00, 0xc0, + 0x01, 0x15, 0x19, 0xd9, 0x4e, 0x76, 0x69, 0x64, 0x69, 0x61, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0xf2, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x58, 0x2d, 0x38, 0x20, 0x38, 0x30, 0x30, 0x47, 0x45, 0x20, 0x32, + 0x50, 0x20, 0x4e, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xdd, 0x30, 0x30, 0x30, + 0x2d, 0x30, 0x41, 0x30, 0x30, 0x41, 0x2d, 0x41, 0x30, 0x41, 0x41, 0x2d, + 0x41, 0x41, 0x36, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0xc7, 0x41, 0x31, 0x20, 0x20, 0x20, 0x20, 0x20, 0xdd, 0x41, + 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x32, 0x41, 0x41, 0x41, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0xc4, 0x51, 0x45, 0x4d, 0x55, 0xcc, 0x46, 0x52, + 0x55, 0x20, 0x56, 0x65, 0x72, 0x20, 0x30, 0x2e, 0x30, 0x31, 0xc1, 0x63, + 0xd0, 0x82, 0x19, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * FRU: i2c45 @0x53 (boot drive) + * Product mfg: Samsung + * Product name: PM9D3a + * Product part: AAAA00A0AAAA-07AAA + * Product version: + * Product serial: A0AAAA0A000013 + * OEM records: 3 (91 bytes, zeroed) + */ +static const uint8_t fru_45_0053[] =3D { + 0x01, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0xef, 0x01, 0x0e, 0x19, 0xc8, + 0x53, 0x61, 0x6d, 0x73, 0x75, 0x6e, 0x67, 0x00, 0xd8, 0x50, 0x4d, 0x39, + 0x44, 0x33, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x41, 0x41, 0x41, 0x2d, 0x30, + 0x37, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc2, 0x00, 0x00, 0xd4, 0x41, 0x30, 0x41, 0x41, 0x41, 0x41, + 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x31, 0x33, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, + 0x0b, 0x02, 0x3b, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x0b, 0x00, 0xe7, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x82, 0x15, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * FRU: i2c48 @0x53 (E1.S backplane 0 drive 0) + * Product mfg: Samsung + * Product name: PM9D3a + * Product part: AAAA00A0AAAA-08AAA + * Product version: + * Product serial: A0A0AA0A000014 + * OEM records: 3 (91 bytes, zeroed) + */ +static const uint8_t fru_48_0053[] =3D { + 0x01, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0xef, 0x01, 0x0e, 0x19, 0xc8, + 0x53, 0x61, 0x6d, 0x73, 0x75, 0x6e, 0x67, 0x00, 0xd8, 0x50, 0x4d, 0x39, + 0x44, 0x33, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x41, 0x41, 0x41, 0x2d, 0x30, + 0x38, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc2, 0x00, 0x00, 0xd4, 0x41, 0x30, 0x41, 0x30, 0x41, 0x41, + 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x31, 0x34, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x0b, 0x02, 0x3b, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x0b, 0x00, 0xe7, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x82, 0x15, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * FRU: i2c50 @0x53 (E1.S backplane 0 drive 2) + * Product mfg: Samsung + * Product name: PM9D3a + * Product part: AAAA00A0AAAA-08AAA + * Product version: + * Product serial: A0A0AA0A000015 + * OEM records: 3 (91 bytes, zeroed) + */ +static const uint8_t fru_50_0053[] =3D { + 0x01, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0xef, 0x01, 0x0e, 0x19, 0xc8, + 0x53, 0x61, 0x6d, 0x73, 0x75, 0x6e, 0x67, 0x00, 0xd8, 0x50, 0x4d, 0x39, + 0x44, 0x33, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x41, 0x41, 0x41, 0x2d, 0x30, + 0x38, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc2, 0x00, 0x00, 0xd4, 0x41, 0x30, 0x41, 0x30, 0x41, 0x41, + 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x31, 0x35, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, + 0x0b, 0x02, 0x3b, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x0b, 0x00, 0xe7, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x82, 0x15, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * FRU: i2c52 @0x53 (E1.S backplane 1 drive 0) + * Product mfg: Samsung + * Product name: PM9D3a + * Product part: AAAA00A0AAAA-08AAA + * Product version: + * Product serial: A0A0AA0A000016 + * OEM records: 3 (91 bytes, zeroed) + */ +static const uint8_t fru_52_0053[] =3D { + 0x01, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0xef, 0x01, 0x0e, 0x19, 0xc8, + 0x53, 0x61, 0x6d, 0x73, 0x75, 0x6e, 0x67, 0x00, 0xd8, 0x50, 0x4d, 0x39, + 0x44, 0x33, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x41, 0x41, 0x41, 0x2d, 0x30, + 0x38, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc2, 0x00, 0x00, 0xd4, 0x41, 0x30, 0x41, 0x30, 0x41, 0x41, + 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x31, 0x36, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, + 0x0b, 0x02, 0x3b, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x0b, 0x00, 0xe7, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x82, 0x15, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +/* + * FRU: i2c54 @0x53 (E1.S backplane 1 drive 2) + * Product mfg: Samsung + * Product name: PM9D3a + * Product part: AAAA00A0AAAA-08AAA + * Product version: + * Product serial: A0A0AA0A000017 + * OEM records: 3 (91 bytes, zeroed) + */ +static const uint8_t fru_54_0053[] =3D { + 0x01, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x00, 0xef, 0x01, 0x0e, 0x19, 0xc8, + 0x53, 0x61, 0x6d, 0x73, 0x75, 0x6e, 0x67, 0x00, 0xd8, 0x50, 0x4d, 0x39, + 0x44, 0x33, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x41, 0x41, + 0x41, 0x41, 0x30, 0x30, 0x41, 0x30, 0x41, 0x41, 0x41, 0x41, 0x2d, 0x30, + 0x38, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc2, 0x00, 0x00, 0xd4, 0x41, 0x30, 0x41, 0x30, 0x41, 0x41, + 0x30, 0x41, 0x30, 0x30, 0x30, 0x30, 0x31, 0x37, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, + 0x0b, 0x02, 0x3b, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x0b, 0x00, 0xe7, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x82, 0x15, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +typedef struct ClementeFru { + const uint8_t *data; + size_t size; +} ClementeFru; + +/* The images an E1.S backplane needs: its own FRU and its two drives. */ +typedef struct ClementeE1sFru { + ClementeFru backplane; /* @0x56 */ + ClementeFru drive0; /* mux channel 0 @0x53 */ + ClementeFru drive2; /* mux channel 2 @0x53 */ +} ClementeE1sFru; + +static const ClementeE1sFru clemente_e1s_fru[] =3D { + { + .backplane =3D { fru_25_0056, sizeof(fru_25_0056) }, + .drive0 =3D { fru_48_0053, sizeof(fru_48_0053) }, + .drive2 =3D { fru_50_0053, sizeof(fru_50_0053) }, + }, + { + .backplane =3D { fru_37_0056, sizeof(fru_37_0056) }, + .drive0 =3D { fru_52_0053, sizeof(fru_52_0053) }, + .drive2 =3D { fru_54_0053, sizeof(fru_54_0053) }, + }, +}; + +/* The images an IO mezzanine needs: its own FRU and the OSFP one. */ +typedef struct ClementeIoMezzFru { + ClementeFru mezzanine; /* @0x50 */ + ClementeFru osfp; /* @0x52 */ +} ClementeIoMezzFru; + +static const ClementeIoMezzFru clemente_io_mezz_fru[] =3D { + { + .mezzanine =3D { fru_29_0050, sizeof(fru_29_0050) }, + .osfp =3D { fru_29_0052, sizeof(fru_29_0052) }, + }, + { + .mezzanine =3D { fru_41_0050, sizeof(fru_41_0050) }, + /* the OSFP FRU was absent from the sampled chassis */ + }, +}; + /* * E1.S backplane hanging off a PCA9546 channel: an FRU EEPROM plus a * second PCA9546 fronting per-drive NVMe SSD FRU EEPROMs. */ -static void clemente_e1s_backplane_init(I2CBus *bus) +static void clemente_e1s_backplane_init(I2CBus *bus, + const ClementeE1sFru *fru) { /* eeprom@56 - atmel,24c128 */ - at24c_eeprom_init(bus, 0x56, 16 * KiB); + at24c_eeprom_init_rom(bus, 0x56, 16 * KiB, + fru->backplane.data, fru->backplane.size); =20 /* i2c-mux@74 - PCA9546 */ I2CSlave *mux =3D i2c_slave_create_simple(bus, TYPE_PCA9546, 0x74); /* eeprom@53 - atmel,24c02, channels 0 and 2 */ - at24c_eeprom_init(pca954x_i2c_get_bus(mux, 0), 0x53, 256); - at24c_eeprom_init(pca954x_i2c_get_bus(mux, 2), 0x53, 256); + at24c_eeprom_init_rom(pca954x_i2c_get_bus(mux, 0), 0x53, 256, + fru->drive0.data, fru->drive0.size); + at24c_eeprom_init_rom(pca954x_i2c_get_bus(mux, 2), 0x53, 256, + fru->drive2.data, fru->drive2.size); } =20 /* * IO Mezzanine hanging off a PCA9546 channel: an I/O expander plus the * mezzanine and OSFP FRU EEPROMs. */ -static void clemente_io_mezz_init(I2CBus *bus, uint8_t exp_addr) +static void clemente_io_mezz_init(I2CBus *bus, uint8_t exp_addr, + const ClementeIoMezzFru *fru) { /* gpio@20/21 - nxp,pca9535 */ i2c_slave_create_simple(bus, TYPE_PCA9535, exp_addr); /* eeprom@50 - atmel,24c64 (mezzanine FRU) */ - at24c_eeprom_init(bus, 0x50, 8 * KiB); + at24c_eeprom_init_rom(bus, 0x50, 8 * KiB, + fru->mezzanine.data, fru->mezzanine.size); /* eeprom@52 - atmel,24c128 (OSFP FRU) */ - at24c_eeprom_init(bus, 0x52, 16 * KiB); + at24c_eeprom_init_rom(bus, 0x52, 16 * KiB, + fru->osfp.data, fru->osfp.size); } =20 static void clemente_bmc_i2c_init(AspeedMachineState *bmc) @@ -78,12 +981,14 @@ static void clemente_bmc_i2c_init(AspeedMachineState *= bmc) /* i2c-mux@71 (PCA9546) */ i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x71); /* channel 1 - HDD FRU eeprom@56 and E1.S backplane */ - clemente_e1s_backplane_init(pca954x_i2c_get_bus(i2c_mux, 1)); + clemente_e1s_backplane_init(pca954x_i2c_get_bus(i2c_mux, 1), + &clemente_e1s_fru[0]); =20 /* i2c-mux@72 (PCA9546) */ i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x72); /* channel 1 - IO Mezz 0 (io_expander7 @20) */ - clemente_io_mezz_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x20); + clemente_io_mezz_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x20, + &clemente_io_mezz_fru[0]); =20 /* i2c-mux@73 (PCA9546) - channels empty */ i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x73); @@ -91,17 +996,20 @@ static void clemente_bmc_i2c_init(AspeedMachineState *= bmc) /* i2c-mux@75 (PCA9546) */ i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x75); /* channel 1 - HDD FRU eeprom@56 and E1.S backplane */ - clemente_e1s_backplane_init(pca954x_i2c_get_bus(i2c_mux, 1)); + clemente_e1s_backplane_init(pca954x_i2c_get_bus(i2c_mux, 1), + &clemente_e1s_fru[1]); =20 /* i2c-mux@76 (PCA9546) */ i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x76); /* channel 1 - IO Mezz 1 (io_expander8 @21) */ - clemente_io_mezz_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x21); + clemente_io_mezz_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x21, + &clemente_io_mezz_fru[1]); =20 /* i2c-mux@77 (PCA9546) */ i2c_mux =3D i2c_slave_create_simple(i2c[0], TYPE_PCA9546, 0x77); /* channel 1 - boot drive FRU eeprom@53 */ - at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x53, 256); + at24c_eeprom_init_rom(pca954x_i2c_get_bus(i2c_mux, 1), 0x53, 256, + fru_45_0053, sizeof(fru_45_0053)); =20 /* &i2c1 */ /* power-monitor@12/14 - ti,lm5066i (no model) */ @@ -110,7 +1018,8 @@ static void clemente_bmc_i2c_init(AspeedMachineState *= bmc) /* temperature-sensor@4e - ti,tmp1075 */ i2c_slave_create_simple(i2c[1], TYPE_TMP1075, 0x4e); /* eeprom@50 - atmel,24c02 (PDB FRU) */ - at24c_eeprom_init(i2c[1], 0x50, 256); + at24c_eeprom_init_rom(i2c[1], 0x50, 256, fru_1_0050, + sizeof(fru_1_0050)); /* vrm@60/61 - renesas,raa228004 (no model) */ /* i2c-mux@70 (PCA9548) - interposer */ i2c_mux =3D i2c_slave_create_simple(i2c[1], TYPE_PCA9548, 0x70); @@ -118,7 +1027,8 @@ static void clemente_bmc_i2c_init(AspeedMachineState *= bmc) /* temperature-sensor@4f - ti,tmp75 */ i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), TYPE_TMP75, 0= x4f); /* eeprom@54 - atmel,24c64 */ - at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 5), 0x54, 8 * KiB); + at24c_eeprom_init_rom(pca954x_i2c_get_bus(i2c_mux, 5), 0x54, + 8 * KiB, fru_21_0054, sizeof(fru_21_0054)); /* channel 6 - io_expander5 gpio@27 - nxp,pca9554 */ i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 6), TYPE_PCA9554, 0x27); @@ -126,7 +1036,8 @@ static void clemente_bmc_i2c_init(AspeedMachineState *= bmc) /* temperature-sensor@4b - ti,tmp75 */ i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 7), TYPE_TMP75, 0= x4b); /* eeprom@51 - atmel,24c64 */ - at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 7), 0x51, 8 * KiB); + at24c_eeprom_init_rom(pca954x_i2c_get_bus(i2c_mux, 7), 0x51, + 8 * KiB, fru_23_0051, sizeof(fru_23_0051)); =20 /* &i2c2 */ /* gpio@20/21/27 - nxp,pca9555 */ @@ -156,35 +1067,45 @@ static void clemente_bmc_i2c_init(AspeedMachineState= *bmc) /* gpio@4f - nxp,pca9555 */ i2c_slave_create_simple(i2c[9], TYPE_PCA9555, 0x4f); /* eeprom@50 - atmel,24c64 (SCM FRU) */ - at24c_eeprom_init(i2c[9], 0x50, 8 * KiB); + at24c_eeprom_init_rom(i2c[9], 0x50, 8 * KiB, fru_9_0050, + sizeof(fru_9_0050)); /* eeprom@56 - atmel,24c64 (BSM FRU) */ - at24c_eeprom_init(i2c[9], 0x56, 8 * KiB); + at24c_eeprom_init_rom(i2c[9], 0x56, 8 * KiB, fru_9_0056, + sizeof(fru_9_0056)); =20 /* &i2c10 */ /* mctp@10 - mctp-i2c-controller (no model) */ /* temperature-sensor@1f - ti,tmp421 (OCP NIC0) */ i2c_slave_create_simple(i2c[10], TYPE_TMP421, 0x1f); /* eeprom@50 - atmel,24c64 (OCP NIC0 FRU) */ - at24c_eeprom_init(i2c[10], 0x50, 8 * KiB); + at24c_eeprom_init_rom(i2c[10], 0x50, 8 * KiB, fru_10_0050, + sizeof(fru_10_0050)); =20 /* &i2c11 */ /* ssif-bmc@10 - ssif-bmc (no model) */ =20 /* &i2c12 */ /* eeprom@50 - atmel,24c64 (HPM 1 FRU) */ - at24c_eeprom_init(i2c[12], 0x50, 8 * KiB); + at24c_eeprom_init_rom(i2c[12], 0x50, 8 * KiB, fru_12_0050, + sizeof(fru_12_0050)); /* eeprom@54/55 - atmel,24c02 (CBC 2/3 FRU) */ - at24c_eeprom_init(i2c[12], 0x54, 256); - at24c_eeprom_init(i2c[12], 0x55, 256); + at24c_eeprom_init_rom(i2c[12], 0x54, 256, fru_12_0054, + sizeof(fru_12_0054)); + at24c_eeprom_init_rom(i2c[12], 0x55, 256, fru_12_0055, + sizeof(fru_12_0055)); =20 /* &i2c13 */ /* eeprom@50 - atmel,24c64 (HPM FRU) */ - at24c_eeprom_init(i2c[13], 0x50, 8 * KiB); + at24c_eeprom_init_rom(i2c[13], 0x50, 8 * KiB, fru_13_0050, + sizeof(fru_13_0050)); /* eeprom@54/55 - atmel,24c02 (CBC 0/1 FRU) */ - at24c_eeprom_init(i2c[13], 0x54, 256); - at24c_eeprom_init(i2c[13], 0x55, 256); + at24c_eeprom_init_rom(i2c[13], 0x54, 256, fru_13_0054, + sizeof(fru_13_0054)); + at24c_eeprom_init_rom(i2c[13], 0x55, 256, fru_13_0055, + sizeof(fru_13_0055)); /* eeprom@57 - atmel,24c02 (HMC FRU) */ - at24c_eeprom_init(i2c[13], 0x57, 256); + at24c_eeprom_init_rom(i2c[13], 0x57, 256, fru_13_0057, + sizeof(fru_13_0057)); =20 /* &i2c14 */ /* gpio@10/11/12/13/14 - nxp,pca9555 (PDB CPLD) */ @@ -199,7 +1120,8 @@ static void clemente_bmc_i2c_init(AspeedMachineState *= bmc) /* temperature-sensor@1f - ti,tmp421 (OCP NIC1) */ i2c_slave_create_simple(i2c[15], TYPE_TMP421, 0x1f); /* eeprom@52 - atmel,24c64 (OCP NIC1 FRU) */ - at24c_eeprom_init(i2c[15], 0x52, 8 * KiB); + at24c_eeprom_init_rom(i2c[15], 0x52, 8 * KiB, fru_15_0052, + sizeof(fru_15_0052)); } =20 static void aspeed_machine_clemente_class_init(ObjectClass *oc, --=20 2.53.0-Meta