From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785338867; cv=none; d=zohomail.com; s=zohoarc; b=BjpyXkbEEb2g8/Sb1G0FPdun7T5nSf6If0xliugoVfrYcG5Lpbk5QZeDgZE7urzdjWCItFb+F/YcvReZ3CrpVMeyMwPSMVOiL++IJuKnBRCN8bLx251a//zYDAUDcYjCxD92cjb0OP3PHloezZIJn/c5fnEsvAZvIbg7cY7h+OI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785338867; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=W8IM84HQwR+GmEFj4f2b5VofQX2ndjN7l5cc/QZMq3s=; b=CGsv5iLDndMII/cIApAaMTwoNIsKcjC38zvL2ZC1uO7czoYJFSu/qiTFcL8L/2mkNGinWq7KAqAWPgNJUaOUU5QD71B0/sUaHQYIwZO+VkCTgTYb2EsE46Pr46wJbIRtcA72G6iS6WOjdOdfHhJmOSX/kcD35/idOEwo0Y9OLWc= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785338866986326.7441890641454; Wed, 29 Jul 2026 08:27:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6Bw-0000AU-2n; Wed, 29 Jul 2026 11:27: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 1wp6Bu-00007o-B1 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:27:30 -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 1wp6Bs-0007yd-KZ for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:27:30 -0400 Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-495590dde14so11415805e9.0 for ; Wed, 29 Jul 2026 08:27:28 -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-49764d848edsm64808525e9.4.2026.07.29.08.27.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:27:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785338847; x=1785943647; 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=W8IM84HQwR+GmEFj4f2b5VofQX2ndjN7l5cc/QZMq3s=; b=Gd/Ncx+ac9Xh9+6JL+0OGsFpA8+0aFzUQ2khWUR01h0esZPAFuL4mP54i9e5by5DjN oGzDk4srwgVES3tn1QCCe9TMZt1hFdll68yT9dHw8bsExxq6/Hu1og6u+RRU8ITIkUAW MDt8FtcdXRzSPvONQptAzF1BJMN4z8C9QlnmfCyhykOdMNjIDm4L7ZlvI5ZyVT5dv6UO 80fTeIM0s04W9fJYPiEYqJuRmommOqPqz8P9aF/Ht3sG5HV+PD9LwR0qk0Xn4i1t3ZkK K1mslksNJjN7RhBH+9+y0b8snkUgMsC7482Pff9u+c0P9FoyC4knZOQQCEZz81GLRNwq ll3g== X-Gm-Message-State: AOJu0Yxq10l3ADzWm2Zhy8RwEcFHQvc7ya+D+Sf1cQEYdy8NzEIdIfVD 04LXix9MGZWKdHMI56HntuFyLFaGjjqLiwEVkYEF64cTA31wrmkvWklrs6dPgmiv X-Gm-Gg: AR+sD11iCzqZfJi6tZzNEIHEowdEZeKQ17WYglyi2PpHBmuMiTnYEY5w6zXV+sJ8D8A Q/9A0hoqA3W4JXdkvENskRzeWeIcHtnR36VxPisFE0Qjq0cJ2zSrF604MxNsA7XluSMTSFg8enF /5LO+PpstEk16HaIKbXC+4A5j2c6+dS0QSTn0T+fx7Yj+MKjUdrTDIisAGzg8/TtMLhnit8xgyK dJU7T6ez3oL61FwiEqYQGghggw7V6wzWb6oAE/XW9+J/HRKtozgZ4i+zS0kN8nsurNpuqCQxAGf /jsjHYBgJlVZ0zcnFcUQP96x3tshPFGgkBYDG7bf0I4dOsOKftQKWj8p4FTf+eJ721qBXkT6cBf TAkOOWkdrmQlxY+ep9RuHTNNb82bg54lKQe58T9fFpa5yaH2yW+Kp6bP7/lXTbevLL2mOYrRbmK zhYyYbRXAKS3C9CkXjSOw/RBRuJAgVzwiXPImEryCMGjIo7hMX0X/tZidJ2NM9Pd1P8In/AbjCw KhjKmwFa+4AONjuqRPemx4NYCQmWj4FX7zT X-Received: by 2002:a05:600c:8b37:b0:495:5e86:4e59 with SMTP id 5b1f17b1804b1-496c656e67emr81675245e9.22.1785338846628; Wed, 29 Jul 2026 08:27:26 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:37 +0200 Subject: [PATCH 01/25] hw/sensor: tmp105: make device state private to the implementation MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-1-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337963; l=3828; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=2PsFiadmEidEKMJIZBsHzExJztIGcn8WD0wRouSeWs4=; b=NLYgeHPSt3Bu+MqwOD7ajdoxZlU7PXt5BFslFFUTCafKq56C1Kz9iLV8J4heWqX6oUy9UYj+k MzFTQhmL7JCAreQnktP/QfGOQnmWZSDrPnk1w2HlDNhridKQ6PRIWsM 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785338870082158500 The TMP105State struct, its cast macro and typedef are used only within tmp105.c. Move them out of the public header into the source file and drop the now-unused includes; the header is reduced to the TYPE_TMP105 name, with its guard renamed to the path-derived form per current QEMU convention. While here, normalize the source file include order to match the other hw/sensor devices. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp105.c | 45 ++++++++++++++++++++++++++++++++++++++++--= --- include/hw/sensor/tmp105.h | 40 ++-------------------------------------- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index c5089d74f4b..6069c0905d9 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -19,16 +19,51 @@ */ =20 #include "qemu/osdep.h" -#include "hw/i2c/i2c.h" -#include "hw/core/irq.h" -#include "migration/vmstate.h" -#include "hw/sensor/tmp105.h" +#include "qemu/module.h" #include "qapi/error.h" #include "qapi/visitor.h" -#include "qemu/module.h" +#include "qom/object.h" +#include "hw/sensor/tmp105.h" +#include "hw/sensor/tmp105_regs.h" +#include "hw/core/irq.h" #include "hw/core/registerfields.h" +#include "hw/i2c/i2c.h" +#include "migration/vmstate.h" #include "trace.h" =20 +OBJECT_DECLARE_SIMPLE_TYPE(TMP105State, TMP105) + +/** + * TMP105State: + * @config: Bits 5 and 6 (value 32 and 64) determine the precision of the + * temperature. See Table 8 in the data sheet. + * + * @see_also: http://www.ti.com/lit/gpn/tmp105 + */ +struct TMP105State { + /*< private >*/ + I2CSlave i2c; + /*< public >*/ + + uint8_t len; + uint8_t buf[2]; + qemu_irq pin; + + uint8_t pointer; + uint8_t config; + int16_t temperature; + int16_t limit[2]; + int faults; + uint8_t alarm; + /* + * The TMP105 initially looks for a temperature rising above T_high; + * once this is detected, the condition it looks for next is the + * temperature falling below T_low. This flag is false when initially + * looking for T_high, true when looking for T_low. + */ + bool detect_falling; +}; + FIELD(CONFIG, SHUTDOWN_MODE, 0, 1) FIELD(CONFIG, THERMOSTAT_MODE, 1, 1) FIELD(CONFIG, POLARITY, 2, 1) diff --git a/include/hw/sensor/tmp105.h b/include/hw/sensor/tmp105.h index 244e2989feb..daece592e9b 100644 --- a/include/hw/sensor/tmp105.h +++ b/include/hw/sensor/tmp105.h @@ -11,45 +11,9 @@ * This work is licensed under the terms of the GNU GPL, version 2 or * later. See the COPYING file in the top-level directory. */ -#ifndef QEMU_TMP105_H -#define QEMU_TMP105_H - -#include "hw/i2c/i2c.h" -#include "hw/sensor/tmp105_regs.h" -#include "qom/object.h" +#ifndef HW_SENSOR_TMP105_H +#define HW_SENSOR_TMP105_H =20 #define TYPE_TMP105 "tmp105" -OBJECT_DECLARE_SIMPLE_TYPE(TMP105State, TMP105) - -/** - * TMP105State: - * @config: Bits 5 and 6 (value 32 and 64) determine the precision of the - * temperature. See Table 8 in the data sheet. - * - * @see_also: http://www.ti.com/lit/gpn/tmp105 - */ -struct TMP105State { - /*< private >*/ - I2CSlave i2c; - /*< public >*/ - - uint8_t len; - uint8_t buf[2]; - qemu_irq pin; - - uint8_t pointer; - uint8_t config; - int16_t temperature; - int16_t limit[2]; - int faults; - uint8_t alarm; - /* - * The TMP105 initially looks for a temperature rising above T_high; - * once this is detected, the condition it looks for next is the - * temperature falling below T_low. This flag is false when initially - * looking for T_high, true when looking for T_low. - */ - bool detect_falling; -}; =20 #endif --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785338895; cv=none; d=zohomail.com; s=zohoarc; b=CBZOicW9GQ7TCCAWshHCSSLDSm4V9tY7MIFUPCfRFBXKOEsfLLIaGfOv8LDHlk7+UgWoVJ8+2kifkaVrPAk/zVUxVMKaXW/YHtMDPrGDbZnWWvb5MmzeOT/KFWLaQuTHEIkUF6NMMM+dAsPa1soQ5PDjM6ta3lmm92c5L3pMabA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785338895; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=9Rx1so6O2DvHoxNj8RGDiYjwjmDl40dAURIIyBXbKtg=; b=JTe50Z5VTbkv9dy6gyMvLlu9eufNpDz5lLEtBxiYms63YnJxE6joe+VA/hzND2aJYAO3zcWVqwSFtNMu5NgMTIw3UXRJ6Wz41SyVEqlWYclnGYcsay6h/eLh/COz5Holrts0clL6q0UVWa1Zt8MqSTR5sv0J17YDjH4EjSiJ8pw= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785338895024912.4224608259929; Wed, 29 Jul 2026 08:28:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6CQ-0000s3-8W; Wed, 29 Jul 2026 11:28: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 1wp6CO-0000ra-WB for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:28:01 -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 1wp6CN-00080B-Fa for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:28:00 -0400 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-495590dde14so11424485e9.0 for ; Wed, 29 Jul 2026 08:27: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 5b1f17b1804b1-496c44af19bsm158956295e9.3.2026.07.29.08.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:27:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785338878; x=1785943678; 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=9Rx1so6O2DvHoxNj8RGDiYjwjmDl40dAURIIyBXbKtg=; b=Hy/MSbrVbSYmJ3VAOmZmEzss2oNAWQPpY40KDm1YCaVdjVFI/B4/qFrA1GX+xfuc0W FTVIrzdvzaNURdeLG04HUKhQCvWeeivLrbHGbBCYA0e+vfjlwpqL0yiYi8EBf2RyLBsA ar8Q19pCkhsj4jdOrsJRkaEPRT22uw7AFXa6CT5GJPYlxF0Rp8mfAs9eK6yAagWIyAgo xeSE2BlXbAIcdmZG+kH7MetkJPo43xzbAOY/LHyp2sgv89LGv9yDqKk2/WGFTJ317xoP ffMIg0lI0bapFfY9NdwSRurgQMsBtGjTnz6x6fKH1yOA9kEPlw2F7DHmR80vdJfIOZQ9 jqXg== X-Gm-Message-State: AOJu0YzkZj8m7zWgYXRzYMPzzaQAKos+yJWlpXAnZrdLJ58gY8MikScX BSBZgTM8CETlhAQ+o7+pR2HLIA6Ku0K9EqjHdXvgs2vu+VXaIWHqJfC9RXGCBsav X-Gm-Gg: AR+sD13i7xvsk6bp6ZUqZDOvq2qkOobSnYJX6ThEey/cwEaN/m+zs+Cl0Gicok445b3 JTD3+9JWLa5toXb5YUs/bFR6ZDdjByaafO3nQeFR3c3w7SR8hDw93SK9R/cif4/e2+9Da9vPu7Z EW3fhmlnJbrUz0aedbEwS7Nhxi36NQ3X73PNOq+qnsDud8gpasBD5Yem1xX6R+KW8zXEyjmx4Me HG4KF2st4YJRaclSQurliYBq4p59thhCo+rnbZMKuClJ0HRSrn7VtERZmzrWKRE296Isoh26Rye eI1fRKvMlRmLn2delR+rp/w8uvjpZ5HvyeOVbJwd0OooJBtAY3bL4NzUvfUISlJmcwLFevokqLj sukqCjnw1BkH1KRzX0HcWfv34OgXJBFZFJlk2RIsI5gPIwDlz/D5aLVMV5rtiVV5fJZMQ4X3wLt YmT0yIMLbdryx9IfNMmHKvVn5unAed9gpub++JpnJ6HSmyba2ek/jORXcYHK1wE3Z1LGYoUZE0a RSq9gJ9XA/cjl4VZdnB8NnrTZUglnU26ED70zPDLDcOW+k= X-Received: by 2002:a05:600c:e549:20b0:495:71f8:7325 with SMTP id 5b1f17b1804b1-496c6586a5amr55084735e9.32.1785338877905; Wed, 29 Jul 2026 08:27:57 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:38 +0200 Subject: [PATCH 02/25] hw/sensor: tmp105: 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: <20260729-sanmiguel-bmc-locator-v1-2-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337963; l=2294; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=IPpKdB4GNfibCBuZaz5CjB0TPUppqW5ZDDXX0F0+Glo=; b=2yuXF/Z06uJl/0lRd/rMbrEiHrFDmhgqS9xMBmzKyL2dtweSS8cV3iJZzR4xsMbmavJMFfiPU zAMSLLlcVOPDdOX/0TyFKZ1Jim2iZ5spqgsCBFdcHFH2bs4NefMOnd2 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785338897831158500 QEMU coding conventions expect the embedded parent object of a QOM type to be named parent_obj. Rename the TMP105State I2CSlave member accordingly and update its references; the change is purely cosmetic. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp105.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index 6069c0905d..aabeb34f08 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -42,7 +42,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(TMP105State, TMP105) */ struct TMP105State { /*< private >*/ - I2CSlave i2c; + I2CSlave parent_obj; /*< public >*/ =20 uint8_t len; @@ -187,12 +187,12 @@ static void tmp105_read(TMP105State *s) break; } =20 - trace_tmp105_read(s->i2c.address, s->pointer); + trace_tmp105_read(s->parent_obj.address, s->pointer); } =20 static void tmp105_write(TMP105State *s) { - trace_tmp105_write(s->i2c.address, s->pointer); + trace_tmp105_write(s->parent_obj.address, s->pointer); =20 switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: @@ -200,7 +200,7 @@ static void tmp105_write(TMP105State *s) =20 case TMP105_REG_CONFIG: if (FIELD_EX8(s->buf[0] & ~s->config, CONFIG, SHUTDOWN_MODE)) { - trace_tmp105_write_shutdown(s->i2c.address); + trace_tmp105_write_shutdown(s->parent_obj.address); } s->config =3D FIELD_DP8(s->buf[0], CONFIG, ONE_SHOT, 0); s->faults =3D tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUE= UE)]; @@ -305,7 +305,7 @@ static const VMStateDescription vmstate_tmp105 =3D { VMSTATE_INT16(temperature, TMP105State), VMSTATE_INT16_ARRAY(limit, TMP105State, 2), VMSTATE_UINT8(alarm, TMP105State), - VMSTATE_I2C_SLAVE(i2c, TMP105State), + VMSTATE_I2C_SLAVE(parent_obj, TMP105State), VMSTATE_END_OF_LIST() }, .subsections =3D (const VMStateDescription * const []) { @@ -338,7 +338,7 @@ static void tmp105_realize(DeviceState *dev, Error **er= rp) =20 qdev_init_gpio_out(&i2c->qdev, &s->pin, 1); =20 - tmp105_reset(&s->i2c); + tmp105_reset(&s->parent_obj); } =20 static void tmp105_initfn(Object *obj) --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785338914; cv=none; d=zohomail.com; s=zohoarc; b=k8R+IZ8/4P2SPnYYudZlnCDIo8tywb/r8bybPJ4TlZbn6xohKLpySo7lcc6DKawsu/WKwmtKFUXZcP2R/MN4RIuOu3X5XPryZ+G3Rbmobij1Z0kI+y4k/fqPQ7NX1NNS/Oe/b/kr0n9yAKuZifHeZ4U8icg+5Gq74W8hBtdc1nA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785338914; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=3wENbpzNy+/7ZpZ2nV5lBBRvhyhYJ6tzgYJmt0GLaJo=; b=graVROHd63l0zlM+wNRoSrRfLIfN1WF1cjzES4GWnTD891lkPV99BQwB2IzR0cSbUFErTuuYOMduwzWskIgFwn+5Ogam7awZ8TRQFeCK8gjow4P01j2ZoSkAEmaVf3lot+z3jrvIGCS9ZTzcEteVs6eQ8maeRRlfCla/aIHdnCY= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785338914120861.5863931738334; Wed, 29 Jul 2026 08:28:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6Ct-0001TX-RE; Wed, 29 Jul 2026 11:28: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 1wp6Cs-0001TA-0N for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:28:30 -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 1wp6Cq-00082J-6J for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:28:29 -0400 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-49557167508so9538645e9.1 for ; Wed, 29 Jul 2026 08:28:27 -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-496fa88552bsm47835435e9.3.2026.07.29.08.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:28:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785338907; x=1785943707; 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=3wENbpzNy+/7ZpZ2nV5lBBRvhyhYJ6tzgYJmt0GLaJo=; b=Ob0cbtJ+IGhYRHbJ9gjrIq30VjRFDDORT5eexmG2+rXaU2OM+Ydg+KsW+EKch8dYQ/ BeDs1zjSiXM2JUqIamIobpzwWu56zQzCLpOhj41pW7GEMGJn6vrl2LGuyiGkfLRw611k a3SpZn1nwYVNSiB65QOV5eOGLau1B9XqiI80ofgNnn8yfSFy7OOZk5r9gx7ltWxmKwHk tP5YBDaGn+16pX5nhYqH8xFHMbex4lnILYfE4Y4GZNRTrKzrZVkA555Ti/vXqxQxwYRn rOZETFTpoFJkNPIeKLo7VJOwXlX3G8Pn7rs07qEVIdknZS9Bc8tUXVw1QFQevPTQPavn uP1g== X-Gm-Message-State: AOJu0Yy7z++2VgiMrzRriueg7ggLRkR+CmMUKGjwGOexQpA3eY9dgv/b hXilEiQm9FwnaGTiJI6tJOBa1gNFZ9FCuP0kVN5I8tepqq8A+E22QWPD79avmFGh X-Gm-Gg: AR+sD13NblcXdnDIiJigcaQL3DelmvVjBGdTg1ys+cgB4j1Z56Obzc8Mk0Inmyr3vu3 +igRFG3FgMPSF0ePdQAt+S0/NtpYaOX+frdcl9bQ9DF2RI2IX+/oD9FtUw3VgI2nKH6gzTcL6O8 qvHvSFp0Vnc3ScsWXNwl7aRscJoxeltsgldWDp+hlHQag0/M36zl75HWHEBO/6jH2LqxaqjrTT8 Uowi52mA6wcm8wiyI+tUusi7dYfa8wZBhHvCFJ51R9iJSwLHyzfvf1e5wThKs6+FUScmtFKdviF 65GnjiraAs5/v5DvzCf2t4yn7zdYdmIDuTnKQQd8rxZkRcSKas9JOjcm0A0DofPO6qVYMgY1QqN xInZPC4b0aOHt/oBxrv5qVq17dZZaro43omqKMqgyQ+wXE+HP9cC9wAUVfHSqlIMcAQepD+QzZt DnIqPj0Lb+ZVicuujbQ34YjFCbMKWV7oH/K3MxrH/IGA1U+teeiMR+0msclHEqxYuEnkVmGBLuJ 5IT2QSI3zmTf0LY4+XLASFRX9ePjf1UzMzEApoWVraEWVE= X-Received: by 2002:a05:600c:4714:b0:496:bbce:fc with SMTP id 5b1f17b1804b1-496c642c8d1mr89151645e9.12.1785338906579; Wed, 29 Jul 2026 08:28:26 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:39 +0200 Subject: [PATCH 03/25] hw/sensor: tmp105: implement Resettable reset MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-3-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337963; l=1784; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=lLLQDRXOnOUwL5qjxtcvmlFJBgBQ1Ly1Z6iI78mZFws=; b=wmpAoOb1vlCAo4gw1g3e1nycH1UDUEQCPa2rN2iZNatrvc/BYEHslfL0nBj9iv5JnlHiHWGDy WD2Vz50Xe17Bd7GIAeg/wy1qWSviyhqm0WICs7CQRIf9UFPtrywVeD4 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785338914780158500 Previously the device reset routine was invoked once from realize() and never registered with the reset subsystem, so a system or bus reset left the TMP105 registers untouched. Convert tmp105_reset() into a proper Resettable hold phase (tmp105_reset_hold) registered through ResettableClass::phases.hold, and drop the manual call from realize() as the reset framework now drives it. This matches the scheme used by the other hw/sensor I2C devices. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp105.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index aabeb34f08..f7d0c738ca 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -314,9 +314,9 @@ static const VMStateDescription vmstate_tmp105 =3D { } }; =20 -static void tmp105_reset(I2CSlave *i2c) +static void tmp105_reset_hold(Object *obj, ResetType type) { - TMP105State *s =3D TMP105(i2c); + TMP105State *s =3D TMP105(obj); =20 s->temperature =3D 0; s->pointer =3D 0; @@ -337,8 +337,6 @@ static void tmp105_realize(DeviceState *dev, Error **er= rp) TMP105State *s =3D TMP105(i2c); =20 qdev_init_gpio_out(&i2c->qdev, &s->pin, 1); - - tmp105_reset(&s->parent_obj); } =20 static void tmp105_initfn(Object *obj) @@ -352,11 +350,13 @@ static void tmp105_class_init(ObjectClass *klass, con= st void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); I2CSlaveClass *k =3D I2C_SLAVE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 dc->realize =3D tmp105_realize; k->event =3D tmp105_event; k->recv =3D tmp105_rx; k->send =3D tmp105_tx; + rc->phases.hold =3D tmp105_reset_hold; dc->vmsd =3D &vmstate_tmp105; } =20 --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785338942; cv=none; d=zohomail.com; s=zohoarc; b=X+IXRw1I2dScxTHARaim28jSzlKTXhMTYq4/XQDPcQXGdT2rY0GpjXL0laSblSVlZ9T9D2B4mq2w27l0CJH3TyP3v22CPI1LtDJjoS3lWZmsWZ4uu2lNG1G1XwkJe4aF4WdmcovLlazbS4fxbuWqfzMqDJ9WXfqqVrh7usQHfrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785338942; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=6TeMroFC0RkCp4VBi9WC++CXDwcuWrermHZePSESP/4=; b=bdw6KLdt8YtaoTS3ldDQhMs9dStxFRxeR/ylu020w+X9jgaVj+Zc1kRzn63FI+BuWCovwtA32KBg2H54g+BjZFEq24fa6KdUtZnk5vAyPWCcn2ZJICiwOj/gHTlX0LgEz8MbhS2srtox+IGmTp3/agoYKtvfbiqIDZWbYrJzCNk= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785338942217910.1634972897205; Wed, 29 Jul 2026 08:29:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6DC-0001f5-KK; Wed, 29 Jul 2026 11:28:50 -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 1wp6DA-0001dt-Kj for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:28:48 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6D8-00083g-KT for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:28:48 -0400 Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4954a9e8490so12588845e9.1 for ; Wed, 29 Jul 2026 08:28:46 -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-497fecfccc7sm51853475e9.12.2026.07.29.08.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:28:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785338925; x=1785943725; 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=6TeMroFC0RkCp4VBi9WC++CXDwcuWrermHZePSESP/4=; b=CDTkniNY620/9GmcqtJbVjY3FMIwcmHhyuBDjcaq9Yo5YM3A39wiVxd7ZnY+ygB3mK QzT6qsxrkdkaAZ2Wd+qDoW0zmkTGY1tIQRsVjK1mfd2+U9wcUQdlSjIxEjrcrKw/TXwx KUdaovKnuhcUn/E3T5W1Qj08+Z2R99tJsu2F9GqIjOnwhBWzuzanVfcEILGPp10vuyBf 7mA66JmqEV0g8K/fvQxOdfghOpN+ehLh7uvwmZ10q/3Ot5yx6xhykU2CCodlLpYsLC77 XoDBbUE1AOJY34hnvVrc+PIODNVcqE0SZT5aLBBrkR1RqZqhzqS/irhEE7BRWL5K2VU0 S/Yg== X-Gm-Message-State: AOJu0YzpqOAgJrfLdsnS4zX7QboDxYQkMvgX6Y29IEEnFVWmzJ285GUk jKIxIrilAFKAXyxaLKmVRAf98eK8L+nXXuVmftl1USyoDGGS3KdAW9H463RqS0TV X-Gm-Gg: AR+sD10+V53wSxGIrtKDL+hLxoHNtoLgbb7n6fatcQdZ/lEN5cYwJ11vuDdcZBNxBFv smSpDPa2yXakKik0XxdaDlJ1FE4o6e0c/Vn+mbpcbbOS4s5cDsaioxEoHszJvB+EsfWEmhDj+rw UbP0UEbmS4KbxD2c9xJNpwPB7IG1tMtCkMBP4RI2syuBowrIiYwHuYR0wFZVbj9sXYq4EK40oZV ZEllHCwp3A2hz/sk7/QQ4OP6SC9eEPa4w/g1UARrIGrZFBEQzU3AnP3/iwfbQZc7N1S2G21neoO ExtPwh3UrZJu6aDVq39LOv3GjgXKILsSe0rJ+H+XDNKNvrM0fnQ7MUIzrg5U3vcVrPSaGgpf+2o x7q4ZZPfEoPihwI4EslLmQc/77HZmEk6XdZfqmMj4npw+i2GtDaL0Eq83yOTnunlMvdEWEdNAdm E54ZjiP4lAcmocHG1WL7LNiLAxcmOLYc2m/n69NxNgV9AHLkqwhl5sxkxgPIyINvp5MAogSA6Zu idVlQ54rR+QPaONgoDiGGxA6l4k4IiHMVQa X-Received: by 2002:a05:600c:1e0a:b0:495:6193:c6c0 with SMTP id 5b1f17b1804b1-497fd31a32dmr31294815e9.18.1785338925020; Wed, 29 Jul 2026 08:28:45 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:40 +0200 Subject: [PATCH 04/25] hw/sensor: tmp105: enforce the configurable fault queue MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-4-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337963; l=5924; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=wwzB72eiHroHgVASMgeEaV/IOYNCK41LnLDKlIYNhaw=; b=qclnMbBBl89pIwmlJvsnRWjTsMVMyTUqwR/avwjEkWmoLp/xHt+doV+8U+o+2UNYZYU4OaumB ZCrLNsP4RdWDc49Z8abnmLy2Is/aXArBzkpgxUYGsK1tF2hIl+yYPdx 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.52; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f52.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785338943296158500 The fault-queue depth selected in the configuration register was decoded but never consulted, so the ALERT pin tripped on the very first out-of-limit conversion regardless of the programmed depth. Track the consecutive-fault count and only change the ALERT state once it reaches the programmed depth; any in-range conversion clears the count. The default configuration keeps the previous behaviour. The count is migrated through an optional subsection so existing streams stay compatible. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp105.c | 87 ++++++++++++++++++++++++++++++++++----------------= ---- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index f7d0c738ca..5c77f991cc 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -54,6 +54,7 @@ struct TMP105State { int16_t temperature; int16_t limit[2]; int faults; + uint8_t fault_count; uint8_t alarm; /* * The TMP105 initially looks for a temperature rising above T_high; @@ -78,43 +79,40 @@ static void tmp105_interrupt_update(TMP105State *s) =20 static void tmp105_alarm_update(TMP105State *s, bool one_shot) { + bool fault; + if (FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE) && !one_shot) { return; } =20 - if (FIELD_EX8(s->config, CONFIG, THERMOSTAT_MODE)) { - /* - * TM =3D=3D 1 : Interrupt mode. We signal Alert when the - * temperature rises above T_high, and expect the guest to clear - * it (eg by reading a device register). - */ - if (s->detect_falling) { - if (s->temperature < s->limit[0]) { - s->alarm =3D 1; - s->detect_falling =3D false; - } - } else { - if (s->temperature >=3D s->limit[1]) { - s->alarm =3D 1; - s->detect_falling =3D true; - } - } + /* + * A fault is a conversion that lies outside the limit currently being + * watched: above T_high while looking for the alarm to trip, below T_= low + * afterwards. + */ + if (s->detect_falling) { + fault =3D s->temperature < s->limit[0]; } else { - /* - * TM =3D=3D 0 : Comparator mode. We signal Alert when the tempera= ture - * rises above T_high, and stop signalling it when the temperature - * falls below T_low. - */ + fault =3D s->temperature >=3D s->limit[1]; + } + + if (!fault) { + s->fault_count =3D 0; + } else if (++s->fault_count >=3D s->faults) { + s->fault_count =3D 0; if (s->detect_falling) { - if (s->temperature < s->limit[0]) { - s->alarm =3D 0; - s->detect_falling =3D false; - } + /* + * Temperature fell back below T_low. In comparator mode (TM = =3D=3D 0) + * the alarm is released; in interrupt mode (TM =3D=3D 1) it is + * asserted again and the guest is expected to clear it by rea= ding + * a register. + */ + s->alarm =3D FIELD_EX8(s->config, CONFIG, THERMOSTAT_MODE); + s->detect_falling =3D false; } else { - if (s->temperature >=3D s->limit[1]) { - s->alarm =3D 1; - s->detect_falling =3D true; - } + /* Temperature rose to or above T_high: assert the alarm. */ + s->alarm =3D 1; + s->detect_falling =3D true; } } =20 @@ -204,7 +202,12 @@ static void tmp105_write(TMP105State *s) } s->config =3D FIELD_DP8(s->buf[0], CONFIG, ONE_SHOT, 0); s->faults =3D tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUE= UE)]; - tmp105_alarm_update(s, FIELD_EX8(s->buf[0], CONFIG, ONE_SHOT)); + if (FIELD_EX8(s->buf[0], CONFIG, ONE_SHOT) && + FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE)) { + tmp105_alarm_update(s, true); + } else { + tmp105_interrupt_update(s); + } break; =20 case TMP105_REG_T_LOW: @@ -213,7 +216,7 @@ static void tmp105_write(TMP105State *s) s->limit[s->pointer & 1] =3D (int16_t) ((((uint16_t) s->buf[0]) << 8) | (s->buf[1] & 0xf0)); } - tmp105_alarm_update(s, false); + tmp105_interrupt_update(s); break; } } @@ -281,6 +284,13 @@ static bool detect_falling_needed(void *opaque) return s->detect_falling; } =20 +static bool fault_count_needed(void *opaque) +{ + const TMP105State *s =3D opaque; + + return s->fault_count !=3D 0; +} + static const VMStateDescription vmstate_tmp105_detect_falling =3D { .name =3D "TMP105/detect-falling", .version_id =3D 1, @@ -292,6 +302,17 @@ static const VMStateDescription vmstate_tmp105_detect_= falling =3D { } }; =20 +static const VMStateDescription vmstate_tmp105_fault_count =3D { + .name =3D "TMP105/fault-count", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D fault_count_needed, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT8(fault_count, TMP105State), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_tmp105 =3D { .name =3D "TMP105", .version_id =3D 0, @@ -310,6 +331,7 @@ static const VMStateDescription vmstate_tmp105 =3D { }, .subsections =3D (const VMStateDescription * const []) { &vmstate_tmp105_detect_falling, + &vmstate_tmp105_fault_count, NULL } }; @@ -322,6 +344,7 @@ static void tmp105_reset_hold(Object *obj, ResetType ty= pe) s->pointer =3D 0; s->config =3D 0; s->faults =3D tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; + s->fault_count =3D 0; s->alarm =3D 0; s->detect_falling =3D false; =20 --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785338972; cv=none; d=zohomail.com; s=zohoarc; b=UzXzl4EIFYxzseKTCTcZ6+a1Nng90ndTUGvG+XSRoTBKh08YjC2eZiWJYA/F68OXvkCSdyeRjJfxxeOUNrURXjwtSCe4ptKb9vi7VgpYLajMOJ+GEA2kzOnWzNgHNisFM5n9+wTix2Bwe7o4gaUO3WjTh8QhYEqTrMPV3jcdOuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785338972; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=9UU67IURNj8PURmFA5VKoABWjQcNQzhVJM3O/Bwow3E=; b=ghwvniBP8lv8R6ctwjVikoxU0frSyHKnKrnIQYOPdxNse2GtQu3pxNb2gYaP1qMWs94O9udbh5qIMUsgcOceqCY3mMAzYfEU5Po1/UXIY7giCP8UZ1fBO/1GFEYtnNxoWiXh75HzmTeab5drEuk5XJjnohMAND0SgsqWV5sDLa0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785338972595457.1112747947161; Wed, 29 Jul 2026 08:29:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6Dc-0002IO-HF; Wed, 29 Jul 2026 11:29: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 1wp6Db-0002I4-De for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:29:15 -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 1wp6Da-0008Ec-1k for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:29:15 -0400 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-47df43bfb07so466159f8f.1 for ; Wed, 29 Jul 2026 08:29: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 ffacd0b85a97d-47fbf0a4a00sm2558113f8f.34.2026.07.29.08.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:29:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785338952; x=1785943752; 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=9UU67IURNj8PURmFA5VKoABWjQcNQzhVJM3O/Bwow3E=; b=K8Pr/JXnEQxYdX6rtSG6EQpLieHdKxi8x6JNcv+sBDFQbTEfI0XopvmEF6+Xz5aG/H XQgWe+OWJLq7/41b0g/ubnNYXxo2V+h2AxtCvDm2IOxzpsyOu3c+9y5ImFzK6ikHsF0F +ZO5ubJ/LtbEtfqxRBnUk5Aw3rrlV8+6e9ORqrMyv1Fetd/He2oSZGLonH/ESKqug9iB QGVcXddze5/e5Nbg1OScNQGtTJE8QCpb4swprptBh2K22sjtqkcd6nD+fJDbs4o34lV3 EUm714HkUjF8TGmzeLnb2k1dFElaQtoCaCwKf00LbsXMnRf5JrVfT1iX1UyHB0bodTHZ Ce2g== X-Gm-Message-State: AOJu0YyLgh8OumntibQmBJpm0HfZQO6RYmPZb8issELI5nbLKyd3Fb2K PODgfma5Dx4uresBf0jlkmYXWv3KpT7hNhXDanYmpLRDqfhsmf9oIzwLKZDJOAdc X-Gm-Gg: AR+sD127StHEYPsMiiEY8JYbIQ8ZwhJjG+Z4S2bpWPqVIieDxb7t6nARaq+sgJY91pj WzKM/JE6L45sfiOuQrPbqurfvIMKrAqnmgRPYymW4IRanCxzF7bp2/9bxFXSNM1M5olxq4kABK8 zlSq9ZrslwiQfV1gUoAvZRjct6eA2EnusgvXR/0UyMi0JKMYsFNLKFZ6phSOgWyc3XpTiH7ypok hWAZs5/W5NxByg1Ol57zGP1R8FF5bLRFhnxdzrYv5giiNQDcX2diJuCFwnCfR5THUNgWW9gcCDN ei19V+DZGtU0WAKJticfZyNTePQHgpmwc//qk9QwLasEHhcQ59DUW7WSQ66qtGt6zdMLmr/JoLW +LlnIpCDI2Yi7sVEx6aeaJHhKQ6oaTdPY6Hs1ibA6+rbMFgIwg+AOcUGjepc0SBbs4ZGGE5GeNT zFTLSVRs/PmFJAyboKCcgw9MwoWdiHpaktlUfI6KkDn1OdADHFo6rBqvoHntsGr966drRRDjF/t aV6elvK1/IlFIxzBNfsxiIwBLjoA864h4cr/o0DJ7PEFA1o X-Received: by 2002:a05:6000:2dc4:b0:47d:ed1d:e0e6 with SMTP id ffacd0b85a97d-47fb1f2a08dmr9196249f8f.55.1785338952567; Wed, 29 Jul 2026 08:29:12 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:41 +0200 Subject: [PATCH 05/25] hw/sensor: tmp105: describe the temperature property MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-5-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337963; l=972; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=dtFmKtAlRiVXJztXMlux9lIKLH6pMshNOkJwipbdeOQ=; b=AT4qhv0C1pJItpktotlJxfRrfF3wClzk3gbUDiD8QoHK4O7xdJCyXzg4+vTmT7Ot0Qmsdptxq y0EWOgJSQguAi5l2aqyt2Dj11hdGl+iW/BbjvgmlbJsUqO2OjDuc3Ik 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785338973299158500 Attach a description to the dynamic "temperature" QOM property so it is documented in the QOM introspection output (qom-list-properties), like the injection properties of the INA230/INA238 models. The value is expressed in millidegrees Celsius. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp105.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index 5c77f991cc..fefa661711 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -367,6 +367,8 @@ static void tmp105_initfn(Object *obj) object_property_add(obj, "temperature", "int", tmp105_get_temperature, tmp105_set_temperature, NULL, NULL); + object_property_set_description(obj, "temperature", + "Temperature, in millidegrees Celsius"= ); } =20 static void tmp105_class_init(ObjectClass *klass, const void *data) --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339016; cv=none; d=zohomail.com; s=zohoarc; b=VS0T4qsG75sbPLeWiL09pdQ4XyuP50mRYKCYjpcmUz2TltCBerLKb8ADGps9Z8sd/Xb64spdWOlb+YXcMwSBXmgF9jqJFUr9/z4fZByXr9ntEwnHrfHdSzFQY9zv7ZayrgzMf/6UXBFZNhEeeKGz43AoE9sfMaBxfKZnFis/cLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339016; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=CfEjIUkd1zt60lZLBgFbE1W+Iz0xdud8IZhMTmuXKvc=; b=cyvON1Ff7W8U+q113MIF5Se5z3kLZqJPrMZsMwts4pDVOQoTB31sBh0Wdyjk6KCIsM2Yqj2mMOoq9MZnMDlJKh1PZZnbftAAnlGGl4ydt8bIyBVJKkagmreBrExricBLnvliRv9p9Do9OUY/kT8SPfV2aPlQtaMM9XqRmwUXU1s= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339016621196.84717452750317; Wed, 29 Jul 2026 08:30:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6EC-0002rk-H9; Wed, 29 Jul 2026 11:29:52 -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 1wp6E9-0002rV-9O for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:29:50 -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 1wp6E6-0008HC-Ly for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:29:49 -0400 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-49553515a8bso13857035e9.1 for ; Wed, 29 Jul 2026 08:29: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 5b1f17b1804b1-496fa42effasm51998495e9.2.2026.07.29.08.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:29:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785338984; x=1785943784; 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=CfEjIUkd1zt60lZLBgFbE1W+Iz0xdud8IZhMTmuXKvc=; b=sG4Kvv1BKSAsU5idgxh/Jwgd0qV0nFsrN7D8XXrLUnRCnii6Itj/Vna2b9caEJCGCF 0zhvolujWLBsJS/1HEMeP4SVlG/WZgl2T/4BAeTyhLMBIlwJXg9IyUSfun+QypH3Ni2g 8i8BDahCui/zC9w/MVbqQqNsGYJ2D84dqmeuan7QAoejjlxU88W5OSoh93gsadeYwQqj HPOGj76X1tDuX+whBxHuaoLZXYjkB+SP2P2LruxygWGd3Hanvgn6LmUHyOA+o9aXYJET jnlI15msIbmeH6t57pKfb/lliAGlVwOMPUmEYEjl7o0BrUTOUTvnpqXPnjwURY7gPWsM VhOA== X-Gm-Message-State: AOJu0Yx0yebXgOoGGZNydUDbCuodqSKJcsjsi+V0ciyKPYcx2WvIljrt ZYWaoa0UU/IPmGfDIqp2bv+z+GTi0A5a5ydf5SPHC6URSOWGxTcFhdq7I2AVLy31 X-Gm-Gg: AR+sD13Jmjux8PZhdIKU6DhsxlCptoSAhvMCJKpJS8eQThYxUPr6cV0FNftCg0k+DeQ ymdehahoWe3p3wbPAcu8OtWftoYuq55cZbeky8LcYF7/Matrvi4+FIiKXbp4Wsn9wJpkF/gzftJ pH38HkJgTYkqGP524W7UMFgrqeGhS9/X6cs6edoFvacD8PJylEo0VE2+LhVf8qeRtBlp3z+auQN lLePvorf89sqaVFfsP8YQQ5WE48seQKAsIzpZ+1ei48AhbUnyX2IEsIYCz+5QE+psgS2Zof12Vt xLCEBTJRGTLUNcW9RgOpYN1AhR1H1KPSS8pB/GlSNShOWRDPogq1xMJw17xxjqlYgKltadCqTHv eZ84Gd9mWtTGGjHa+y6UNtq12ed9Dw4Kke2rSQcJvkZBPXY3XbraTygOD9NmWXEBqHeSUXotG6c mxiCHD4K7GMUJYdNPtC0bzfb2aM3BuE47PZNVSk+aBUnJILqhlgBK0LZ0d+ddQZ0XCMZipvySXj UNpnk2wqdfYllC97DQFJNcxgxNsYBIrEXIs X-Received: by 2002:a05:600c:1d1b:b0:493:bb0:3b43 with SMTP id 5b1f17b1804b1-496c6426bc8mr88334435e9.2.1785338983588; Wed, 29 Jul 2026 08:29:43 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:42 +0200 Subject: [PATCH 06/25] hw/arm: aspeed: guard board-local temperature-sensor aliases MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-6-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337963; l=1761; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=0daG7vmYYOhBzkb799hhbKaLINYeD4dhpsEpss5vX3s=; b=/Hx/kpQyWinE0jKj7tGWmxccvsmNreGxOPzUT/P9BqQZIjlL7eZFPq9UzQfrZ48K+ziC+zm5l l+xRsImQyi4DTDc6/oziggsZPMRmAIPJ+sKLYbETBgfLz2NgtyuP6B3 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339017913158500 The Catalina and Fuji machines define TYPE_TMP75 (and, on Fuji, TYPE_LM75) as local aliases of TYPE_TMP105 because no distinct model existed. A following change adds a canonical TYPE_TMP75 to hw/sensor/tmp105.h that would clash with these aliases. Guard each alias with an #undef so the header definition can be introduced without a redefinition warning, ahead of switching the boards to the real models. No functional change. Signed-off-by: Emmanuel Blot --- hw/arm/aspeed_ast2600_catalina.c | 5 +++++ hw/arm/aspeed_ast2600_fuji.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/hw/arm/aspeed_ast2600_catalina.c b/hw/arm/aspeed_ast2600_catal= ina.c index f714c9d1b32..33e75338efc 100644 --- a/hw/arm/aspeed_ast2600_catalina.c +++ b/hw/arm/aspeed_ast2600_catalina.c @@ -22,6 +22,11 @@ #define CATALINA_BMC_HW_STRAP2 0x00000800 #define CATALINA_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) =20 +/* + * Guard the alias against the TYPE_TMP75 that hw/sensor/tmp105.h now + * defines. + */ +#undef TYPE_TMP75 #define TYPE_TMP75 TYPE_TMP105 #define TYPE_TMP421 "tmp421" #define TYPE_DS1338 "ds1338" diff --git a/hw/arm/aspeed_ast2600_fuji.c b/hw/arm/aspeed_ast2600_fuji.c index 37db252e276..6dc3535f0cb 100644 --- a/hw/arm/aspeed_ast2600_fuji.c +++ b/hw/arm/aspeed_ast2600_fuji.c @@ -15,7 +15,13 @@ #include "hw/sensor/tmp105.h" #include "hw/nvram/eeprom_at24c.h" =20 +/* + * Guard the aliases against the TYPE_TMP75 that hw/sensor/tmp105.h now de= fines; + * TYPE_LM75 is guarded too for consistency (no LM75 model exists yet). + */ +#undef TYPE_LM75 #define TYPE_LM75 TYPE_TMP105 +#undef TYPE_TMP75 #define TYPE_TMP75 TYPE_TMP105 #define TYPE_TMP422 "tmp422" =20 --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339033; cv=none; d=zohomail.com; s=zohoarc; b=XXSTia+dgxZONhJesH3uA/wf1cFnDC9GUjmaDRuP1GvU5g4/YbVK1vC4RD492dyMzEMCORZI7RsXfTyQYuf36aKjevUREnweSlViZwjnmieBvGfS/4a+kuYCBR/m8Iopfn8A8JTOhlyOmHRSApw9d3aYsPOucsRGfQqechm2ECk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339033; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=2NJzAdGamh6q0UofkS1blWw4H+aSbe43q4hTcBp6DSQ=; b=WNmZmIbcgrCltLR9LYeeGTR9AJLn/8oZ2kLlJpMGe1+ONn1r4nULBWyDKq6DWbjRzZXpqFDdepVuiDwn7v+/8fApxkj+qE3OvVvPMKGrIfaWX8ZJjHNIDVSbWaVGLV/ZC6VL1VUzXHPFUYDAKQQxKIhQu0XEkmOlxzV3RODKgQY= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339033894543.266337763184; Wed, 29 Jul 2026 08:30:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6Ed-0003lC-6T; Wed, 29 Jul 2026 11:30:19 -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 1wp6Ea-0003hg-ER for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:30:16 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6EW-0008Kd-Ju for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:30:16 -0400 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4921eed3fa2so7537585e9.0 for ; Wed, 29 Jul 2026 08:30:07 -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-47fb6aa3935sm9202485f8f.4.2026.07.29.08.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:30:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339006; x=1785943806; 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=2NJzAdGamh6q0UofkS1blWw4H+aSbe43q4hTcBp6DSQ=; b=iTUZLIJsuEJcWYpMURuu+Y9LegHaUuNXIdks8aoehKq7KM5cTUBEAxnsVVY1GzIplE 6xw+RtdZHu3D9hD6kYPtVmy4yxA6shUQDZA8fM4cyPiY/yAPkwsr4byR7Kby7OwY3CU9 0y1La7e3UU66rWelb1dTPPAu44qFrCU15ZzRs5JbKNU2BryRycEjWQBmsbLcfCZV3bte Jn2etpTke8OIEUDyJIGqgeKLvD4ONbLZJcm/MVXFBsMwJtqyXEharTvGcGPjSrIRIo8A YJoNu/0vaxW0cTRti5TS9ybET1Yd5RFYUqOX8+yV9ej5/pFudW8wDczG0Gu9nBew0Hc9 MN8A== X-Gm-Message-State: AOJu0Yxv/Sw8Xbc9Oi0A8s/9q8V5F2OB6vTUUyypHs8YBAOXhUOmWvAz oeaYYM1Y2NisqFj+UaRPDd4eoNp2gWEWROxolaGgkNi/rkb24Hwl7NVTZWfwChbt X-Gm-Gg: AR+sD12M3HApA7hIfPJuf1h+movGiyGsFUcdJRjY8F1FU2r5sLLHQsjeDe3o/m2Ip0x h7TP711DkYqkJqw8ae1r32pCzmIdNeEupfeK9XVjWRjW50dt/cLMXyCtpIPM2uh+se1QZXXmlc9 YwpjhqDwJzBda08Tele0XWqM6I8le8I6SA8f7eVfHmYrRlIXfDIobqtnE+sSciwpB06GstN3Bse HEkvmTfrOluZY8ua8pjTuQcaQHp9jIpFd1MfmfRJARECwPk6ik5zdvc/LxeQ8+q+rb6zrlYxJ4X eshS7jrvM79ocOal3fJ+wjeuflSYSq4LZvLfNm8DkbludWolzw7rBJohEAesh715HFk4hfL28ZE ra5L7VrUWPbWvG/6ztOcPQjuMAz3ieGHX7jAKldLq1f08B8t+VxxZ1CUOdWWKJHvTT9UuNBoYdl OKpaKitY/8dvnD76czWG669jHbb2TYlECqZ3Nl29KRK8dBlpJu8X7T8V5zIGK+B5D2oEpf0UpfY mTdQaetRvrIyO5y6jp4618EF3xKnGokauOk X-Received: by 2002:a05:600c:81c8:b0:495:401d:9f4f with SMTP id 5b1f17b1804b1-496c65764e0mr81396345e9.25.1785339006277; Wed, 29 Jul 2026 08:30:06 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:43 +0200 Subject: [PATCH 07/25] hw/sensor: tmp105: add TMP75, TMP175 and LM75B variants MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-7-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337963; l=11789; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=L67/MdlXgO5Di25siwtmOLs/rlQN0tXp5n3l9YtfUhA=; b=9098N82rvqT/Eev7J+05+WlgNRCGk7PBnrH5qj7rxchuGr63xqOSrsln89uvGKOGDldswFpTT PstM+YevBg4Bhon81exesWgyVXyNDGn1mEtXhtyOurk17ZBRCptxX2E 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.47; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f47.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339036136158500 The TI TMP75/TMP175 and the NXP LM75B share the TMP105 register map and control semantics, differing only in a few details. Model them as variants of the TMP105, parameterised by a small per-type class descriptor covering the fault-queue depths, the writable config bits, the converter resolution, the set-point masks and the TMP75's alert-clear on thermostat-mode change. The variant is class data, not migrated state, so the wire format is unchanged and all variants share the existing vmstate. While here, align the shared shutdown handling with the hardware: entering shutdown now clears the ALERT/OS output in interrupt mode, correcting the base TMP105 as well. Signed-off-by: Emmanuel Blot --- hw/sensor/tmp105.c | 171 +++++++++++++++++++++++++++++++++++++----= ---- include/hw/sensor/tmp105.h | 6 +- 2 files changed, 147 insertions(+), 30 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index fefa661711..69ade2013d 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -1,5 +1,5 @@ /* - * Texas Instruments TMP105 temperature sensor. + * Texas Instruments TMP105/TMP75/TMP175/LM75B temperature sensor. * * Copyright (C) 2008 Nokia Corporation * Written by Andrzej Zaborowski @@ -16,6 +16,13 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, see . + * + * Limitations: + * - The SMBus Alert Response Address protocol and the general-call comman= ds + * are not implemented. + * - The over-limit comparison uses the full 8.8 fixed-point temperature a= nd a + * ">=3D" boundary for every variant. The LM75B's 9-bit comparison quant= isation + * and strict-exceed boundary are therefore only approximated. */ =20 #include "qemu/osdep.h" @@ -31,15 +38,29 @@ #include "migration/vmstate.h" #include "trace.h" =20 -OBJECT_DECLARE_SIMPLE_TYPE(TMP105State, TMP105) +OBJECT_DECLARE_TYPE(TMP105State, TMP105Class, TMP105) =20 /** - * TMP105State: - * @config: Bits 5 and 6 (value 32 and 64) determine the precision of the - * temperature. See Table 8 in the data sheet. + * TMP105Variant: + * Per-device-model parameters. The TMP105, TMP75, TMP175 and LM75B share = the + * same register map and control semantics; they differ only in a handful = of + * details captured here. * - * @see_also: http://www.ti.com/lit/gpn/tmp105 + * @faultq: fault-queue length table selected by Config bits + * @config_wmask: writable Config bits. The LM75B has no resolution (R1:R0= ) or + * one-shot (OS) bits. + * @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. */ +typedef struct TMP105Variant { + const uint8_t *faultq; + uint8_t config_wmask; + int8_t fixed_res; + uint8_t limit_lsb_mask; + bool tm_change_clears_alert; +} TMP105Variant; + struct TMP105State { /*< private >*/ I2CSlave parent_obj; @@ -53,7 +74,7 @@ struct TMP105State { uint8_t config; int16_t temperature; int16_t limit[2]; - int faults; + uint8_t faults; uint8_t fault_count; uint8_t alarm; /* @@ -65,6 +86,11 @@ struct TMP105State { bool detect_falling; }; =20 +struct TMP105Class { + I2CSlaveClass parent_class; + const TMP105Variant *var; +}; + FIELD(CONFIG, SHUTDOWN_MODE, 0, 1) FIELD(CONFIG, THERMOSTAT_MODE, 1, 1) FIELD(CONFIG, POLARITY, 2, 1) @@ -152,10 +178,11 @@ static void tmp105_set_temperature(Object *obj, Visit= or *v, const char *name, tmp105_alarm_update(s, false); } =20 -static const int tmp105_faultq[4] =3D { 1, 2, 4, 6 }; - static void tmp105_read(TMP105State *s) { + const TMP105Variant *var =3D TMP105_GET_CLASS(s)->var; + int res; + s->len =3D 0; =20 if (FIELD_EX8(s->config, CONFIG, THERMOSTAT_MODE)) { @@ -165,9 +192,11 @@ static void tmp105_read(TMP105State *s) =20 switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: + res =3D var->fixed_res >=3D 0 ? var->fixed_res : + FIELD_EX8(s->config, CONFIG, CONVERTER_RESOLUTION); s->buf[s->len++] =3D (((uint16_t) s->temperature) >> 8); s->buf[s->len++] =3D (((uint16_t) s->temperature) >> 0) & - (0xf0 << (FIELD_EX8(~s->config, CONFIG, CONVERTER_RESOLUTI= ON))); + (0xf0 << (3 - res)); break; =20 case TMP105_REG_CONFIG: @@ -190,6 +219,10 @@ static void tmp105_read(TMP105State *s) =20 static void tmp105_write(TMP105State *s) { + const TMP105Variant *var =3D TMP105_GET_CLASS(s)->var; + uint8_t config, one_shot; + bool waking; + trace_tmp105_write(s->parent_obj.address, s->pointer); =20 switch (s->pointer & 3) { @@ -197,14 +230,27 @@ static void tmp105_write(TMP105State *s) break; =20 case TMP105_REG_CONFIG: - if (FIELD_EX8(s->buf[0] & ~s->config, CONFIG, SHUTDOWN_MODE)) { + config =3D s->buf[0] & var->config_wmask; + if (FIELD_EX8(config & ~s->config, CONFIG, SHUTDOWN_MODE)) { trace_tmp105_write_shutdown(s->parent_obj.address); + if (FIELD_EX8(config, CONFIG, THERMOSTAT_MODE)) { + s->alarm =3D 0; + } } - s->config =3D FIELD_DP8(s->buf[0], CONFIG, ONE_SHOT, 0); - s->faults =3D tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUE= UE)]; - if (FIELD_EX8(s->buf[0], CONFIG, ONE_SHOT) && - FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE)) { + if (var->tm_change_clears_alert && + FIELD_EX8(config ^ s->config, CONFIG, THERMOSTAT_MODE)) { + s->alarm =3D 0; + s->fault_count =3D 0; + s->detect_falling =3D false; + } + waking =3D FIELD_EX8(s->config & ~config, CONFIG, SHUTDOWN_MODE); + one_shot =3D FIELD_EX8(config, CONFIG, ONE_SHOT); + s->config =3D FIELD_DP8(config, CONFIG, ONE_SHOT, 0); + s->faults =3D var->faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE= )]; + if (one_shot && FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE)) { tmp105_alarm_update(s, true); + } else if (waking) { + tmp105_alarm_update(s, false); } else { tmp105_interrupt_update(s); } @@ -214,7 +260,8 @@ static void tmp105_write(TMP105State *s) case TMP105_REG_T_HIGH: if (s->len >=3D 3) { s->limit[s->pointer & 1] =3D (int16_t) - ((((uint16_t) s->buf[0]) << 8) | (s->buf[1] & 0xf0)); + ((((uint16_t) s->buf[0]) << 8) | + (s->buf[1] & var->limit_lsb_mask)); } tmp105_interrupt_update(s); break; @@ -265,8 +312,9 @@ static int tmp105_event(I2CSlave *i2c, enum i2c_event e= vent) static int tmp105_post_load(void *opaque, int version_id) { TMP105State *s =3D opaque; + const TMP105Variant *var =3D TMP105_GET_CLASS(s)->var; =20 - s->faults =3D tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; + s->faults =3D var->faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; =20 tmp105_interrupt_update(s); return 0; @@ -339,11 +387,12 @@ static const VMStateDescription vmstate_tmp105 =3D { static void tmp105_reset_hold(Object *obj, ResetType type) { TMP105State *s =3D TMP105(obj); + const TMP105Variant *var =3D TMP105_GET_CLASS(s)->var; =20 s->temperature =3D 0; s->pointer =3D 0; s->config =3D 0; - s->faults =3D tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; + s->faults =3D var->faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; s->fault_count =3D 0; s->alarm =3D 0; s->detect_falling =3D false; @@ -376,6 +425,7 @@ static void tmp105_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); + TMP105Class *tc =3D TMP105_CLASS(klass); =20 dc->realize =3D tmp105_realize; k->event =3D tmp105_event; @@ -383,19 +433,82 @@ static void tmp105_class_init(ObjectClass *klass, con= st void *data) k->send =3D tmp105_tx; rc->phases.hold =3D tmp105_reset_hold; dc->vmsd =3D &vmstate_tmp105; + tc->var =3D data; } =20 -static const TypeInfo tmp105_info =3D { - .name =3D TYPE_TMP105, - .parent =3D TYPE_I2C_SLAVE, - .instance_size =3D sizeof(TMP105State), - .instance_init =3D tmp105_initfn, - .class_init =3D tmp105_class_init, +/* + * Fault-queue length selected by Config F1:F0. Row 0 (1/2/4/6) is used by= the + * TMP105, TMP175 and LM75B; row 1 (1/2/3/4) by the TMP75. + */ +static const uint8_t tmp105_faultq[][4] =3D { + { 1, 2, 4, 6 }, + { 1, 2, 3, 4 }, }; =20 -static void tmp105_register_types(void) -{ - type_register_static(&tmp105_info); -} +/* The F1:F0 field must never index past a fault-queue table row. */ +QEMU_BUILD_BUG_ON((1 << R_CONFIG_FAULT_QUEUE_LENGTH) - 1 >=3D + ARRAY_SIZE(tmp105_faultq[0])); + +static const TMP105Variant tmp105_variant =3D { + .faultq =3D tmp105_faultq[0], + .config_wmask =3D 0xff, + .fixed_res =3D -1, + .limit_lsb_mask =3D 0xf0, + .tm_change_clears_alert =3D false, +}; + +static const TMP105Variant tmp175_variant =3D { + .faultq =3D tmp105_faultq[0], + .config_wmask =3D 0xff, + .fixed_res =3D -1, + .limit_lsb_mask =3D 0xf0, + .tm_change_clears_alert =3D false, +}; + +static const TMP105Variant tmp75_variant =3D { + .faultq =3D tmp105_faultq[1], + .config_wmask =3D 0xff, + .fixed_res =3D -1, + .limit_lsb_mask =3D 0xf0, + .tm_change_clears_alert =3D true, +}; + +static const TMP105Variant lm75b_variant =3D { + .faultq =3D tmp105_faultq[0], + .config_wmask =3D 0x1f, /* R1:R0 and OS are reserved */ + .fixed_res =3D 2, /* fixed 11-bit resolution, 0.125 C */ + .limit_lsb_mask =3D 0x80, /* 9-bit limits, 0.5 C */ + .tm_change_clears_alert =3D false, +}; + +static const TypeInfo tmp105_types[] =3D { + { + .name =3D TYPE_TMP105, + .parent =3D TYPE_I2C_SLAVE, + .instance_size =3D sizeof(TMP105State), + .class_size =3D sizeof(TMP105Class), + .instance_init =3D tmp105_initfn, + .class_init =3D tmp105_class_init, + .class_data =3D &tmp105_variant, + }, + { + .name =3D TYPE_TMP175, + .parent =3D TYPE_TMP105, + .class_init =3D tmp105_class_init, + .class_data =3D &tmp175_variant, + }, + { + .name =3D TYPE_TMP75, + .parent =3D TYPE_TMP105, + .class_init =3D tmp105_class_init, + .class_data =3D &tmp75_variant, + }, + { + .name =3D TYPE_LM75B, + .parent =3D TYPE_TMP105, + .class_init =3D tmp105_class_init, + .class_data =3D &lm75b_variant, + }, +}; =20 -type_init(tmp105_register_types) +DEFINE_TYPES(tmp105_types) diff --git a/include/hw/sensor/tmp105.h b/include/hw/sensor/tmp105.h index daece592e9..0698aeead7 100644 --- a/include/hw/sensor/tmp105.h +++ b/include/hw/sensor/tmp105.h @@ -1,5 +1,5 @@ /* - * Texas Instruments TMP105 Temperature Sensor + * Texas Instruments TMP105/TMP75/TMP175/LM75B Temperature Sensor * * Browse the data sheet: * @@ -14,6 +14,10 @@ #ifndef HW_SENSOR_TMP105_H #define HW_SENSOR_TMP105_H =20 +/* TMP75, TMP175 and NXP LM75B are register-compatible with TMP105. */ #define TYPE_TMP105 "tmp105" +#define TYPE_TMP175 "tmp175" +#define TYPE_TMP75 "tmp75" +#define TYPE_LM75B "lm75b" =20 #endif --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339103; cv=none; d=zohomail.com; s=zohoarc; b=T6stwQRX9m6ogAFuQxvYic37I1UHZDP3G+dVWh2NsA7HPLuMfUd94NwSSJ74Kjb3r5lxarS/KstRXQstXuog7jyiqLgqCrhluo9HYFRQ9+IXXzCrAHA070NS/+nxuxjxEuwdIVTXerjsNYs1lQ2Ym4BtgnbEIbwLI4AtcliboRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339103; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=jDYA5Xg1AcjoGqaDT6Y+c4Ycg06GuzHzyiFnFNhge4E=; b=XciyQe1ob9b8F2EqbxQf7Papv1fhotl060z0uir3Kix91g/wVAQSS/kUJyqlWWYTIlMxNmjPwLUHVcV6pOCLoUCNGFsr7QgcqRNiYn81qVney+tdRHoAO1lsA4yqYeV3KnBLZ6mhgK5fqCb31B3hwLVPeKfU3gjdeWK3wrYRync= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339103074383.60997059163117; Wed, 29 Jul 2026 08:31:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6FW-0004SN-7N; Wed, 29 Jul 2026 11:31:14 -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 1wp6FS-0004P4-DY for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:31:10 -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 1wp6FQ-0000EW-De for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:31:10 -0400 Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-47f96c5b722so683320f8f.0 for ; Wed, 29 Jul 2026 08:31:07 -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-47fb6b19653sm9241418f8f.30.2026.07.29.08.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:31:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339066; x=1785943866; 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=jDYA5Xg1AcjoGqaDT6Y+c4Ycg06GuzHzyiFnFNhge4E=; b=tSl2P6/QNZyetkjrtbLH57HtB2lc69P6OToR/iGMBboBuzIlUxARqukUGAx8hNmVH8 411OMswGvFfDGGq1kqyBFjmO6XPicP0bWX1WeTyO2hioZoF30HUVJ/8cActqkaJpS24M CXiHuC/xkugnXLMf3msK4kiEVUIs8lsvGE356nntO5gG4Nw6jcC2sMveva5ZKyUtZHD1 odTuAb/nR7dCLKAPqroh3yeU+5L2qEOLVeEUEt2SemDReT4tfu0sy9DcO4ukK8LgR4JQ eXVEypa2chE0QTYGytw9LavPC/4x8MSIpMpCMUWLU7lMz3sZfT9dZ6mCVjkWbDZeQkzR j0uw== X-Gm-Message-State: AOJu0YwmKYhPniVx2DFoE2eIgv+k/VmNFdg5Rjum9UkDkZaWEDSVdsrd b9oingcxLcqZduN6alv6GOnVATEDZXQwspBAKfrqOJkTjp/3P2qyaAceLMhArfuO X-Gm-Gg: AR+sD1361PiimkHc+ajYe5BKPBZC7VZcISN4CLp6jK46EiikLl/s6XW+fsRG9P2aLMI +eROi80SgkZrRPz98CeGtRkPTKe0l8p0ZqAz2Ph6F+pYIcAyJh0n9FHqd8v8Fc4CQ3tnlpW4ECH P9R0D7TzKNkintmZ63XieDhU9Yoj5iLx0E6noLNN5cfVJt8r0KUVKy11N8b5Wd4+wC/lkNCy14V usDykYEHYoIWcbb5NvNWw1f8STtxZPBXomryhftEpIuOrjtNAqlf4RjkucYH9i8v7E5VCHamiiN Zp/2upUv3Y+oOz+WexsCnGpmMBHaBUFu5nlD9MYfe1K6ymzPk3B+wDWYGcp0QLHBQZNGTdg/WPt NzBWsdvEwujI17FPFVG2Q5wwQZIEh62Oe9JZAMMFWsluSmhOJ26f+TCG7MjgQ/LMuq/CmSdLRMN xUOnZNbrZukhg1YOJRtwkY/G5HyAnNyd3fYVIUco4WPrm7X12oTL1SqutIjeWDjBTYSu7new//K l8Pk7uG4ZjVdmVieloQzGEV/LaangNdM7ep X-Received: by 2002:a05:6000:2505:b0:47f:93e2:a07b with SMTP id ffacd0b85a97d-47fb1f139bemr7833148f8f.30.1785339066052; Wed, 29 Jul 2026 08:31:06 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:44 +0200 Subject: [PATCH 08/25] tests/qtest: tmp105: cover the ALERT fault queue MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-8-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337963; l=3508; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=STa9fNUK+ufnQgeeZ6iWhS9xfz1DLS6Eh0Aq6teT5tE=; b=xtY694VImiCxYAX0qVieR4ERcGUo2zzwI4PDzEuYHi94dRFnY9GdIDtdgSu+C4m6898aqkBLc eugd46uxI4rD6qYoFHqjM+CUOx6BFnK0KArniCyu2zO6AK9pd5BhvOC 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339104154158500 Add two qgraph tests exercising the ALERT pin, the only way the TMP105 exposes its alarm state. One checks the default single-fault behaviour; the other checks a deeper fault queue, including the running-count reset on an in-range conversion and its effect on both asserting and releasing the alarm. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp105-test.c | 63 +++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 63 insertions(+) diff --git a/tests/qtest/tmp105-test.c b/tests/qtest/tmp105-test.c index 3b114a50f55..29a031fb7bf 100644 --- a/tests/qtest/tmp105-test.c +++ b/tests/qtest/tmp105-test.c @@ -17,6 +17,11 @@ =20 #define TMP105_TEST_ID "tmp105-test" #define TMP105_TEST_ADDR 0x49 +#define TMP105_TEST_PATH "/machine/peripheral/" TMP105_TEST_ID + +#define TMP105_CONFIG_POL (1 << 2) /* ALERT active-high when set */ +#define TMP105_CONFIG_FQ_1 (0 << 3) /* fault queue: 1 consecutive fault= */ +#define TMP105_CONFIG_FQ_4 (2 << 3) /* fault queue: 4 consecutive fault= s */ =20 static int qmp_tmp105_get_temperature(const char *id) { @@ -105,6 +110,62 @@ static void send_and_receive(void *obj, void *data, QG= uestAllocator *alloc) g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_T_HIGH), =3D=3D, 0x4230); } =20 +/* + * The TMP105 exposes its alarm state only through the ALERT pin. + */ +static void test_alert_single_fault(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + + qtest_irq_intercept_out(global_qtest, TMP105_TEST_PATH); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | TMP105_CONFIG_= FQ_1); + g_assert_false(get_irq(0)); + + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_true(get_irq(0)); + + qmp_tmp105_set_temperature(TMP105_TEST_ID, 70000); + g_assert_false(get_irq(0)); +} + +static void test_fault_queue(void *obj, void *data, QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + int i; + + qtest_irq_intercept_out(global_qtest, TMP105_TEST_PATH); + + /* Comparator mode, active-high ALERT, fault queue of four. */ + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | TMP105_CONFIG_= FQ_4); + g_assert_false(get_irq(0)); + + for (i =3D 0; i < 3; i++) { + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_false(get_irq(0)); + } + + qmp_tmp105_set_temperature(TMP105_TEST_ID, 25000); + g_assert_false(get_irq(0)); + + for (i =3D 0; i < 3; i++) { + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_false(get_irq(0)); + } + + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_true(get_irq(0)); + + for (i =3D 0; i < 3; i++) { + qmp_tmp105_set_temperature(TMP105_TEST_ID, 70000); + g_assert_true(get_irq(0)); + } + + qmp_tmp105_set_temperature(TMP105_TEST_ID, 70000); + g_assert_false(get_irq(0)); +} + static void tmp105_register_nodes(void) { QOSGraphEdgeOptions opts =3D { @@ -116,5 +177,7 @@ static void tmp105_register_nodes(void) qos_node_consumes("tmp105", "i2c-bus", &opts); =20 qos_add_test("tx-rx", "tmp105", send_and_receive, NULL); + qos_add_test("alert-single-fault", "tmp105", test_alert_single_fault, = NULL); + qos_add_test("fault-queue", "tmp105", test_fault_queue, NULL); } libqos_init(tmp105_register_nodes); --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339129; cv=none; d=zohomail.com; s=zohoarc; b=dA6yfmUm8KKmYixvxQk32HYL41SGcJpQasyv3AS11pDaAOL0QOq3XcNNQSSJ/n7PStO2ckiSGZqru8KdEdFTPQn5g2hscMlUTp4/ek85iygmKHXfva/KcQ/JUx8PHkUcBQZ+qzs6znp8xbrZV7vkPKCS/Wk//S1cDWEtejhbTqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339129; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=9ybIPSWx99Q7+Eklnb4vS/+BIhbklG+PwBUudNNw6Z0=; b=NYS84BzP2ESJ0ZsSzAscws4Q976oFWeK+XwRA6eLIvsgsN+2YHME4XZaXqkDPSuT+OVR3Ao5wzdCS/fIPknWsj6YavNT6hd9sYuAA3FHNRtYAdhtv7J83f0SHFNrQ+8TQwpCaxOKtDe5DZjvmsIsQCW9CFdV2zty8BTFBKH/JTs= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339129894996.4323706122149; Wed, 29 Jul 2026 08:32:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6GF-00051a-Qx; Wed, 29 Jul 2026 11:31:59 -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 1wp6GE-0004zO-GX for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:31:58 -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 1wp6GC-0000tL-IV for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:31:58 -0400 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-496bb7cdf51so11315295e9.2 for ; Wed, 29 Jul 2026 08:31:56 -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-496c462512dsm154212875e9.13.2026.07.29.08.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:31:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339115; x=1785943915; 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=9ybIPSWx99Q7+Eklnb4vS/+BIhbklG+PwBUudNNw6Z0=; b=nhrG9Hv9UKcVKYcmrKgX2260tM3C0C2G+3hUIlpM1AvTTmTdKNemtSxDUhrySi9aQn SXUZLB0VC2bd9rfztrk2PlLxSFXB78P6DRetOT8v8zlzt7nx8dV/pPHoiP17tfEBVZWB 0JmWuoEWjXU1hlz2ILMkZT+4ysiwDKKF2vd/TvETuwx1n10gsXdCrY2ns5IbrTvyLHe9 igHCaZRbOQxuFRRWKlhtfUoptUfUEmifFyiMqQqBhvDDBCMKd4QAXkDxRlYxOLXeGZXR 3Dy5cnQgPnGlGlldRwwCswlcu2eNr05AINwOJk1P3FcriJmrgUX/48VeZpmzQehZ9bva WYIA== X-Gm-Message-State: AOJu0YzQvadRQOovkaBuPszbRIId23XobNo3XHi8qtpzA/+J6t8mUln7 3jY7lM4CqhoEnjp3kYo846iMDWKm7h88Dx/NVnP6TAqIzNFs7XjVQiUaM7KayDkA X-Gm-Gg: AR+sD10BguGZDTxal2+BH/o7b8O+iku/93GqW2u9E7k4YLaAr4g1C5laV5Pq44IFwQK VRG4GD5T/r/aoYoUoVNecIggprOxxu1oQ3sab5DLbXYJl0VGp7omk3jVLMApM2biQZkZIAU6vtI LN90IeJdyn87InL7gWBr0UOSLhEagQyKbngXtM0QYzVcn97tMeaIYS7V45M4tvWIO3g/NuXOJ0K 5gTaaaflB4DgnyeRbmyuekPB/QCmFbbZyeQEJLQB6PsvIws+JT/vL2xSXPx1wCpV1a0htyGLAe4 VAoXM/9fBBKlJDcNhWiRl87yudKUa4cK7b7At7Q81vCp9QQh+i7ASTSzCjrfD2rQBoo70vjMotR i51B0n24akiW4tsVXyw1HveqcIgXt/vNMYjQ0DqCkpR0qdSidWZ3+SZbr8vB2o0p7J+yJV/1uyd XtZaMl2AS6TWBHdU2QlGAAPZAQdegF/PrdFRXv6DLHBqcATN2wbpaqv0AeV9tAbPl7piqDfeaBb 890H3FB3tkuflLDlCAhKcInw81yr5uaB8n8k46f5H7UO10J X-Received: by 2002:a05:600c:3485:b0:493:b243:8ffc with SMTP id 5b1f17b1804b1-496c6586bbcmr75755845e9.35.1785339114505; Wed, 29 Jul 2026 08:31:54 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:45 +0200 Subject: [PATCH 09/25] tests/qtest: tmp105: cover the TMP75, TMP175 and LM75B variants MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-9-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=6772; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=q1iz7++LpszDUzhYyAvlbngfO8Xpf8a9SAQco0QYEVY=; b=k+TNF2J9GPHuZ0C4ZRaXa+OHNSQHSoASjrM5dS/XqQ65Zx/AHuhFauzyLslx3EAfUGDlIUlch oJ5mnbbM0osDHuSy3NZNSvi2wuPsoBDfD6MPpWiR0nvTk4IY1t+nDHy 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339130591158500 Exercise the per-variant differences added to the model: the TMP75 and TMP175 fault-queue depths, the TMP75 alert-clear on thermostat-mode change, and the LM75B's reserved config bits and fixed set-point and temperature resolutions. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp105-test.c | 138 ++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 138 insertions(+) diff --git a/tests/qtest/tmp105-test.c b/tests/qtest/tmp105-test.c index 29a031fb7b..ea6803715a 100644 --- a/tests/qtest/tmp105-test.c +++ b/tests/qtest/tmp105-test.c @@ -19,9 +19,20 @@ #define TMP105_TEST_ADDR 0x49 #define TMP105_TEST_PATH "/machine/peripheral/" TMP105_TEST_ID =20 +#define TMP75_TEST_ID "tmp75-test" +#define TMP75_TEST_PATH "/machine/peripheral/" TMP75_TEST_ID + +#define TMP175_TEST_ID "tmp175-test" +#define TMP175_TEST_PATH "/machine/peripheral/" TMP175_TEST_ID + +#define LM75B_TEST_ID "lm75b-test" +#define LM75B_TEST_PATH "/machine/peripheral/" LM75B_TEST_ID + #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= */ #define TMP105_CONFIG_FQ_4 (2 << 3) /* fault queue: 4 consecutive fault= s */ +#define TMP105_CONFIG_FQ(f) ((f) << 3) /* raw F1:F0 fault-queue field valu= e */ =20 static int qmp_tmp105_get_temperature(const char *id) { @@ -166,6 +177,98 @@ static void test_fault_queue(void *obj, void *data, QG= uestAllocator *alloc) g_assert_false(get_irq(0)); } =20 +/* + * Drive @need consecutive over-limit conversions and check that the ALERT= pin + * only asserts on the last one. This exercises the fault-queue length. + */ +static void check_fault_queue(QI2CDevice *i2cdev, const char *id, + const char *path, uint8_t fq_field, int need) +{ + int i; + + qtest_irq_intercept_out(global_qtest, path); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ(fq_field)); + g_assert_false(get_irq(0)); + + for (i =3D 0; i < need - 1; i++) { + qmp_tmp105_set_temperature(id, 85000); + g_assert_false(get_irq(0)); + } + qmp_tmp105_set_temperature(id, 85000); + g_assert_true(get_irq(0)); +} + +/* The TMP75 maps F1:F0 =3D 10b to 3 consecutive faults. */ +static void test_tmp75_fault_queue(void *obj, void *data, + QGuestAllocator *alloc) +{ + check_fault_queue(obj, TMP75_TEST_ID, TMP75_TEST_PATH, 2, 3); +} + +/* The TMP175 keeps the TMP105 mapping: F1:F0 =3D 10b means 4 faults. */ +static void test_tmp175_fault_queue(void *obj, void *data, + QGuestAllocator *alloc) +{ + check_fault_queue(obj, TMP175_TEST_ID, TMP175_TEST_PATH, 2, 4); +} + +/* + * Toggling the thermostat mode (TM) bit clears any active alert on the TM= P75. + */ +static void test_tmp75_tm_clears_alert(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + int i; + + qtest_irq_intercept_out(global_qtest, TMP75_TEST_PATH); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ(3)); + for (i =3D 0; i < 4; i++) { + qmp_tmp105_set_temperature(TMP75_TEST_ID, 85000); + } + g_assert_true(get_irq(0)); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ(3) | TMP105_CONFIG_TM); + g_assert_false(get_irq(0)); +} + +/* + * The LM75B has a fixed 11-bit (0.125 C) converter: the resolution and on= e-shot + * Config bits are reserved (read/write as zero) and the temperature regis= ter is + * always masked to 11 bits regardless of what is written to Config. + */ +static void test_lm75b_resolution(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + uint16_t value; + + i2c_set8(i2cdev, TMP105_REG_CONFIG, 0x60); + g_assert_cmphex(i2c_get8(i2cdev, TMP105_REG_CONFIG), =3D=3D, 0x00); + + qmp_tmp105_set_temperature(LM75B_TEST_ID, 20938); + value =3D i2c_get16(i2cdev, TMP105_REG_TEMPERATURE); + g_assert_cmphex(value, =3D=3D, 0x14e0); +} + +/* The LM75B set-point registers store only 9 bits. */ +static void test_lm75b_limits(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + + i2c_set16(i2cdev, TMP105_REG_T_HIGH, 0x4231); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_T_HIGH), =3D=3D, 0x4200); + + i2c_set16(i2cdev, TMP105_REG_T_LOW, 0x12b4); + g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_T_LOW), =3D=3D, 0x1280); +} + static void tmp105_register_nodes(void) { QOSGraphEdgeOptions opts =3D { @@ -179,5 +282,40 @@ static void tmp105_register_nodes(void) qos_add_test("tx-rx", "tmp105", send_and_receive, NULL); qos_add_test("alert-single-fault", "tmp105", test_alert_single_fault, = NULL); qos_add_test("fault-queue", "tmp105", test_fault_queue, NULL); + + /* TMP75: register-compatible, but with a 1/2/3/4 fault queue. */ + QOSGraphEdgeOptions tmp75_opts =3D { + .extra_device_opts =3D "id=3D" TMP75_TEST_ID ",address=3D0x48" + }; + add_qi2c_address(&tmp75_opts, &(QI2CAddress) { 0x48 }); + + qos_node_create_driver("tmp75", i2c_device_create); + qos_node_consumes("tmp75", "i2c-bus", &tmp75_opts); + + qos_add_test("fault-queue", "tmp75", test_tmp75_fault_queue, NULL); + qos_add_test("tm-clears-alert", "tmp75", test_tmp75_tm_clears_alert, N= ULL); + + /* TMP175: like the TMP105, with a 1/2/4/6 fault queue. */ + QOSGraphEdgeOptions tmp175_opts =3D { + .extra_device_opts =3D "id=3D" TMP175_TEST_ID ",address=3D0x4a" + }; + add_qi2c_address(&tmp175_opts, &(QI2CAddress) { 0x4a }); + + qos_node_create_driver("tmp175", i2c_device_create); + qos_node_consumes("tmp175", "i2c-bus", &tmp175_opts); + + qos_add_test("fault-queue", "tmp175", test_tmp175_fault_queue, NULL); + + /* LM75B: fixed 11-bit conversion and 9-bit set-point registers. */ + QOSGraphEdgeOptions lm75b_opts =3D { + .extra_device_opts =3D "id=3D" LM75B_TEST_ID ",address=3D0x4c" + }; + add_qi2c_address(&lm75b_opts, &(QI2CAddress) { 0x4c }); + + qos_node_create_driver("lm75b", i2c_device_create); + qos_node_consumes("lm75b", "i2c-bus", &lm75b_opts); + + qos_add_test("resolution", "lm75b", test_lm75b_resolution, NULL); + qos_add_test("limits", "lm75b", test_lm75b_limits, NULL); } libqos_init(tmp105_register_nodes); --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339180; cv=none; d=zohomail.com; s=zohoarc; b=GW2KM0gBxmX3UpJcr6GCDH/O0ZSHcCBL1XWGro3tj55xhHdjuri1tPyWQFp7bQTjPUa1DA+F7fzJH084iHPukFD26yvHN58SP/TF19X7Mta/wuEcjJIsgdCoT/bU028SVOZ/Rl6MmJFryD17wuW//N/TXkbwqhKV/CrU9hirTEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339180; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=ifMbamIfJSoLu7/f73249giIpMXwm2cmTQROI/W8L9A=; b=mkeBU+Whq5mYTHT4V7qUFmzzjF9fZW5/U1NSchKtvnXO4RWkFoYOf3M1lR7I2ypp+at0Ywez85ZiL/8Y4jk2bjAYTxUglyMDe13h6BXgOj0CJTghpGZj12FGhSe2auJ9j3LRV0tgodrIHEOQUJWkZTt2T1Ru3HsSS/HJEEAO7uI= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339180799290.93096446822244; Wed, 29 Jul 2026 08:33:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6Gz-0005ZA-H9; Wed, 29 Jul 2026 11:32:45 -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 1wp6Gx-0005XV-6f for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:32:43 -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 1wp6Gv-0000wK-HB for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:32:42 -0400 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4954a32cf1eso5647375e9.3 for ; Wed, 29 Jul 2026 08:32:41 -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-496c44af19bsm159261115e9.3.2026.07.29.08.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:32:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339160; x=1785943960; 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=ifMbamIfJSoLu7/f73249giIpMXwm2cmTQROI/W8L9A=; b=GK0bjNjKh0DqpVUDZG2mob8+UVOuP/4n/z250psI3JZL62u5y3gAWSmnGWNf8TsmDW Coqp1KoziO2dYGJ+PX4H5nLKKuypWyB2O7WU94OiSJ7mItIePt4adFI9WDWf7PNeUC7f QoF8pjzkVocSrytcHrh8ROlZj9K3JWTt7CqsUjCDN55X4Ijd8y8bjvt9as8HVjbXbQKe 4sbbqxmIc8pPwyjukDDLAaeu3cA0l0H5bBDeN7thgPSx9FQ5z+rvUogMnB1J2SJxErHJ djfl7RdtqHopQqmsCuKV3P3/GpG9oQVMuvCmoaKmyVHmZwsvgQqM+0nZ70Gsb7yw98JG LLcg== X-Gm-Message-State: AOJu0YxnbDO30gxAvjzdV4NnbsABXGMGgojGvkc/xCMyPWFT7ee0pCOJ Jiw9QbwemJ2XQDFNrNTrVHMTqhzBZ75EYkcg1le0+qY39EQymCLJ+op0OtKWCCoV X-Gm-Gg: AR+sD11mmWHM8wC3d+wv/IIk7xNGcxGb7WhQLef65mnqfPqAnZvwy8CwhcNCR54vnUI G3Tms1M6TI4sgXVi3t9updUSCEL+MqN+LjBWHjTAc4GAyeE6KwPUPYZqGeSIZhQsAyFDNL5TvUy 265YGgmMgtRBNzzE81/NTcXxXzQKfwtXtvbbmGKhOzh6w+fgEr0a+W06O4PLScRDEfIXWyOuN+u TCpO7m/ghJ6PjRZnHMdHfaxoPBGfwOuSYFHn7H0ff1N4CqVi7AU1uSpL0t5aAIujgz7LYOMfGii p80EXljILFl53nxeeEKmSlNOTenCovgWH+WHUaAVO9R+fBYzv9uTO5HnZdsefNtAsqA+gPdA4Jb Qv9CqItHE80CRyQuiH9biSuqKBQtWL3SbrMJSN+Wws+ZBDPD5wFeZ0lD0e8Jxpueu0h9mtvNSpx aSXNctlaPxBZmtL+ws4ZUU46U+rC2Lm8GyExWbKgUrOtNtfQVinvUcp7daH0EsUKwNrwixn8UUD mmL0Iwp80RmAsHgLxaMd6wWH6eNZWg5e7HN X-Received: by 2002:a05:600c:3b25:b0:495:39aa:1359 with SMTP id 5b1f17b1804b1-496c641309bmr84499585e9.3.1785339159476; Wed, 29 Jul 2026 08:32:39 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:46 +0200 Subject: [PATCH 10/25] tests/qtest: tmp105: cover one-shot and fault-queue write immunity MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-10-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=5455; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=bmmLFTJHN8a4jRPifYNuZA58n5LYCH8vK49esOFrf4o=; b=gzXZno2rMJ0Bb7mSKOBu0MMioeykpTqvAF+/sxsiODGbvUWfDtPmjEFYkp7hDFJZ8gmEqeTMV 3iLn4vm1KxFDg4nRvvlDK24yKD/xNlNYLR+daza7VrOLQ6a2HivNDW1 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339182943158500 Verify that the one-shot (OS) bit triggers a conversion only in shutdown mode and is ignored in continuous mode, and that configuration/limit-register writes never advance the fault queue =E2=80=94= only real conversions do. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp105-test.c | 102 ++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 102 insertions(+) diff --git a/tests/qtest/tmp105-test.c b/tests/qtest/tmp105-test.c index ea6803715a..e586a634d8 100644 --- a/tests/qtest/tmp105-test.c +++ b/tests/qtest/tmp105-test.c @@ -33,6 +33,8 @@ #define TMP105_CONFIG_FQ_1 (0 << 3) /* fault queue: 1 consecutive fault= */ #define TMP105_CONFIG_FQ_4 (2 << 3) /* fault queue: 4 consecutive fault= s */ #define TMP105_CONFIG_FQ(f) ((f) << 3) /* raw F1:F0 fault-queue field valu= e */ +#define TMP105_CONFIG_SD (1 << 0) /* shutdown mode */ +#define TMP105_CONFIG_OS (1 << 7) /* one-shot conversion */ =20 static int qmp_tmp105_get_temperature(const char *id) { @@ -200,6 +202,102 @@ static void check_fault_queue(QI2CDevice *i2cdev, con= st char *id, g_assert_true(get_irq(0)); } =20 +/* + * The one-shot (OS) bit starts a conversion only in shutdown mode. In + * continuous mode it is ignored, so writing it must not advance the fault + * queue; in shutdown each OS write performs one conversion that does. + */ +static void test_one_shot(void *obj, void *data, QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + int i; + + qtest_irq_intercept_out(global_qtest, TMP105_TEST_PATH); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | TMP105_CONFIG_= FQ_4); + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_false(get_irq(0)); + + for (i =3D 0; i < 8; i++) { + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ_4 | TMP105_CONFIG_OS= ); + g_assert_false(get_irq(0)); + } + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ_4 | TMP105_CONFIG_SD); + for (i =3D 0; i < 2; i++) { + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | + TMP105_CONFIG_FQ_4 | TMP105_CONFIG_SD | TMP105_CONFIG_OS); + g_assert_false(get_irq(0)); + } + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | + TMP105_CONFIG_FQ_4 | TMP105_CONFIG_SD | TMP105_CONFIG_OS); + g_assert_true(get_irq(0)); +} + +/* + * Configuration and limit-register writes are not conversions and must not + * advance the fault queue. + */ +static void test_fault_queue_ignores_writes(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + int i; + + qtest_irq_intercept_out(global_qtest, TMP105_TEST_PATH); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | TMP105_CONFIG_= FQ_4); + g_assert_false(get_irq(0)); + + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_false(get_irq(0)); + + for (i =3D 0; i < 8; i++) { + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ_4); + i2c_set16(i2cdev, TMP105_REG_T_HIGH, 0x5000); + i2c_set16(i2cdev, TMP105_REG_T_LOW, 0x4b00); + g_assert_false(get_irq(0)); + } + + for (i =3D 0; i < 2; i++) { + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_false(get_irq(0)); + } + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_true(get_irq(0)); +} + +/* + * Leaving shutdown (SD 1->0) resumes continuous conversion, which must + * re-evaluate the current temperature against the limits. + */ +static void test_wake_from_shutdown(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + + qtest_irq_intercept_out(global_qtest, TMP105_TEST_PATH); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | TMP105_CONFIG_= FQ_1); + g_assert_false(get_irq(0)); + + qmp_tmp105_set_temperature(TMP105_TEST_ID, 85000); + g_assert_true(get_irq(0)); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ_1 | TMP105_CONFIG_SD); + g_assert_true(get_irq(0)); + + qmp_tmp105_set_temperature(TMP105_TEST_ID, 70000); + g_assert_true(get_irq(0)); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | TMP105_CONFIG_= FQ_1); + g_assert_false(get_irq(0)); +} + /* The TMP75 maps F1:F0 =3D 10b to 3 consecutive faults. */ static void test_tmp75_fault_queue(void *obj, void *data, QGuestAllocator *alloc) @@ -282,6 +380,10 @@ static void tmp105_register_nodes(void) qos_add_test("tx-rx", "tmp105", send_and_receive, NULL); qos_add_test("alert-single-fault", "tmp105", test_alert_single_fault, = NULL); qos_add_test("fault-queue", "tmp105", test_fault_queue, NULL); + qos_add_test("fault-queue-ignores-writes", "tmp105", + test_fault_queue_ignores_writes, NULL); + qos_add_test("one-shot", "tmp105", test_one_shot, NULL); + qos_add_test("wake-from-shutdown", "tmp105", test_wake_from_shutdown, = NULL); =20 /* TMP75: register-compatible, but with a 1/2/3/4 fault queue. */ QOSGraphEdgeOptions tmp75_opts =3D { --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339195; cv=none; d=zohomail.com; s=zohoarc; b=XtSxET4RmLdkXjVvRZxgZ4/3GTvnmisBKGg/oPqU3xB8bOYOObAoftL9D5kevaY9gfPOzA4+gTs+1bRbqDAS7OplDQlfXzRdLKLgPwRVQAxvgRMQp5I70tDwgRlfCsnhrjFjd3I6Ds9WRIvKJTW/ypRMS/Bu9ralPZPjiJDKhpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339195; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=cgbT+Nkm1dADHvR/4vLeWGsR4IryoIoADhqYOAUzjvs=; b=PXqp+ddkfBQPmEYG7B6wsOp3vccFjMLuye+So3M4Nm0ghpX8o8/YHqXhQDLtuMpSLtEPFnSOxkBjZ1TbivJN66on44aRqpdv0vEapqjULKrr4OdbrV9lsI16qujUzHyLWVOFncb5MX0ZzxC2Q71kvP/Ng06EfGqutTSYlHuAni4= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339195444745.2627533605931; Wed, 29 Jul 2026 08:33:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6HM-0005ym-Al; Wed, 29 Jul 2026 11:33:08 -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 1wp6HJ-0005u7-TR for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:33:05 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6HI-0000yD-4J for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:33:05 -0400 Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-4720f3bf164so1478412f8f.1 for ; Wed, 29 Jul 2026 08:33: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 5b1f17b1804b1-4975abdca42sm60790855e9.0.2026.07.29.08.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:33:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339182; x=1785943982; 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=cgbT+Nkm1dADHvR/4vLeWGsR4IryoIoADhqYOAUzjvs=; b=lhigqG3Cf3AJMcV8mmZbzGqkO/oBOJij9FN+Pxjxw8DpGR7EnhjU2vgIMdFWnua6iX EWB2z4q8ofmd1+CgXb8JKeMmYgdbcKraWUMUZRY/3lJCPgVCM7m1hUKs/VT7J2CdobeU QV/rG7a/miwZi7YZATw8zQT1E0HybcYxxwN9DlLdPM3bnDld5VmAj4rCktKR5J1N2/6s CBUU2yhgBQ1w790caNQoxeVxCN9dGS489vS4R8z9Ltgj+hvbn+CbEjjNWD0gR7iBr+4q I/CZXLYNrmXPhX+GHIU7BzTV1YX6jxtfk6CZl9qYE7DJFJjPL0LafHJBuecnbr1fu8zl 052w== X-Gm-Message-State: AOJu0YznsKJkMaMIk1mWObKHVe81+Jf/m4HDsG7GZH9zT8R9t9EVTPT7 3kXwfG93wt3Pyq4+u3rPREdfoK40NLDdPlXMQZQn/KAO6LaccHgyZuEWW1JKrbbM X-Gm-Gg: AR+sD13jh3irtQOodj+a4Dj6HRmK/6hCBCattTQPa0WTRiWg8bgPYmLsbVMBOti1qv4 a6UKcAbL5or16KPgMvaYnOCcxf2L7QzgfZi0z/n6k6Ts5FGe+M/jnHKYOArPRTc62qBpYcoEUhR lXogX7T5rN7jxEULhQXDL7qYSvlAGuZSByFC0fBUWsebM5DDyzAdaQdFNCI0aIMKYTePMH6CKqo vOd+62OMiBwaX6PV6JBJL0sAYqAAsuPsvqMxsjdSzoBKbg2vYrgPX1E8FaEoi/M06lVOVBIWBsj 5VTog9el1jCvtdZ0dhEj8PVK2fM0H2AA6zbUZZwvyyr0MPlFyQMrK5Kr6i+ztwXdJeguDaIiBSY o/pHkC78UX7vvlqr68ry8+Zv0AuvLHKLWruN/5JGZdyXWPPbwrTUz0KuFpa1mvyQhWX30+0b4nE a18ktlHGVD72jS9FfSoCOOD0CGqdn5emBW7agnToWyaDQ//B/LYjymC/l023EF3sXbW5NJYt+VH lput4aTdj7stiGgnv1OHTybVbfTb0l+f+YS X-Received: by 2002:a05:600c:358e:b0:495:3bc6:d381 with SMTP id 5b1f17b1804b1-497fd2f5086mr28589775e9.2.1785339182079; Wed, 29 Jul 2026 08:33:02 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:47 +0200 Subject: [PATCH 11/25] tests/qtest: tmp105: cover shutdown clearing the ALERT across variants MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-11-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=3738; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=2fRBCplKTjlFLd6EsRzXdhUj/5B9QVDOaJYG5Z5CWwc=; b=ty8a/k/ujSutVNNcgu669a5d0V/dOb2uCq8keSwUJuEwSZnrvlhu7q4rXhxa17VBW24566y0b QJmzBrb7aYUCIVyoJ0Wbgm7qUZZeCrXFX8Cu20rrh1tygXIUdl9eVAx 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.42; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f42.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339197240158500 Verify that entering shutdown clears the ALERT/OS output in interrupt mode but leaves it asserted in comparator mode, for both the TMP75 and the LM75B. Signed-off-by: Emmanuel Blot --- tests/qtest/tmp105-test.c | 56 +++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 56 insertions(+) diff --git a/tests/qtest/tmp105-test.c b/tests/qtest/tmp105-test.c index e586a634d8..504f6b7202 100644 --- a/tests/qtest/tmp105-test.c +++ b/tests/qtest/tmp105-test.c @@ -335,6 +335,41 @@ static void test_tmp75_tm_clears_alert(void *obj, void= *data, g_assert_false(get_irq(0)); } =20 +/* + * Entering shutdown clears the ALERT in interrupt mode but leaves it asse= rted + * in comparator mode. + */ +static void test_tmp75_shutdown_clears_alert(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + int i; + + qtest_irq_intercept_out(global_qtest, TMP75_TEST_PATH); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_TM | TMP105_CONFIG_FQ(3)); + for (i =3D 0; i < 4; i++) { + qmp_tmp105_set_temperature(TMP75_TEST_ID, 85000); + } + g_assert_true(get_irq(0)); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_TM | TMP105_CONFIG_FQ(3) | + TMP105_CONFIG_SD); + g_assert_false(get_irq(0)); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ(3)); + for (i =3D 0; i < 4; i++) { + qmp_tmp105_set_temperature(TMP75_TEST_ID, 85000); + } + g_assert_true(get_irq(0)); + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_FQ(3) | TMP105_CONFIG_SD); + g_assert_true(get_irq(0)); +} + /* * The LM75B has a fixed 11-bit (0.125 C) converter: the resolution and on= e-shot * Config bits are reserved (read/write as zero) and the temperature regis= ter is @@ -367,6 +402,23 @@ static void test_lm75b_limits(void *obj, void *data, g_assert_cmphex(i2c_get16(i2cdev, TMP105_REG_T_LOW), =3D=3D, 0x1280); } =20 +/* The LM75B likewise resets its OS output on shutdown in interrupt mode. = */ +static void test_lm75b_shutdown_clears_alert(void *obj, void *data, + QGuestAllocator *alloc) +{ + QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + + qtest_irq_intercept_out(global_qtest, LM75B_TEST_PATH); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, TMP105_CONFIG_POL | TMP105_CONFIG_= TM); + qmp_tmp105_set_temperature(LM75B_TEST_ID, 85000); + g_assert_true(get_irq(0)); + + i2c_set8(i2cdev, TMP105_REG_CONFIG, + TMP105_CONFIG_POL | TMP105_CONFIG_TM | TMP105_CONFIG_SD); + g_assert_false(get_irq(0)); +} + static void tmp105_register_nodes(void) { QOSGraphEdgeOptions opts =3D { @@ -396,6 +448,8 @@ static void tmp105_register_nodes(void) =20 qos_add_test("fault-queue", "tmp75", test_tmp75_fault_queue, NULL); qos_add_test("tm-clears-alert", "tmp75", test_tmp75_tm_clears_alert, N= ULL); + qos_add_test("shutdown-clears-alert", "tmp75", + test_tmp75_shutdown_clears_alert, NULL); =20 /* TMP175: like the TMP105, with a 1/2/4/6 fault queue. */ QOSGraphEdgeOptions tmp175_opts =3D { @@ -419,5 +473,7 @@ static void tmp105_register_nodes(void) =20 qos_add_test("resolution", "lm75b", test_lm75b_resolution, NULL); qos_add_test("limits", "lm75b", test_lm75b_limits, NULL); + qos_add_test("shutdown-clears-alert", "lm75b", + test_lm75b_shutdown_clears_alert, NULL); } libqos_init(tmp105_register_nodes); --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339312; cv=none; d=zohomail.com; s=zohoarc; b=iou7RjDKqUr9IIHkWIw+dyvAwidAscO8uY6IEeIAqVtlBQyUpa65PaV63PtE8AwAfehbZMXk3uQfmL69GQr8ieK5gWC3FGPRtLIxMQyjpxhHOpGM46lnWsJ+VBQTwxDEiDPScF0PXMexbp6X3aNSKPB7Hl1nXlh/nbUXg1/cwNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339312; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=waRQgwYJZyfJZTnlp7ivy6wT8uIy6YjpVb6bYaBZS7g=; b=kNFQyEFv7XhXaXTxaj5v4QybywbO0wIcfNXOMj9DYfazyJQmO7wpGs3MBhaWAjTosLhT/JPkw4i+rHxANHIJlR3hq4dBkAeymvw7ITBua6G5oDNpciRfgmYmhJoXyTz07hAshkSnxaNo6EvOp23KOEqgfOkEyq/EHk3w0hff2rg= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178533931201222.612232015991594; Wed, 29 Jul 2026 08:35:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6JA-0006ak-9G; Wed, 29 Jul 2026 11:35:00 -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 1wp6J8-0006Za-GI for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:34:58 -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 1wp6J6-00018l-MJ for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:34:58 -0400 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-493b966dd74so6934145e9.3 for ; Wed, 29 Jul 2026 08:34:56 -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-4976bd7d4e5sm47960965e9.0.2026.07.29.08.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:34:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339295; x=1785944095; 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=waRQgwYJZyfJZTnlp7ivy6wT8uIy6YjpVb6bYaBZS7g=; b=bZXaYwUQJ2kbS8JJefqEhwEiu0RN1ZmEcV7J/VR/uFuOMYjtifxa91OBFQcFQ9fIsl 2FoYMsIDXSJWeL+jIYOEvabyc7BBrx6M1ZUxzj4oKXgMSC0RNUWb017RTlBVw6f2BeeJ 856OJXMkqXnbozUkFLkc12EftidgRuuQEmsyJouByslDvi1LyAhXh/qBYgws3XwOnw15 82Qk8GnICXopvqC6jhal4OVMCeJ40JCA4RxzH1QyEKqQ1RL1YR3fWuzlpTCIHmCvZyps cKh4pzx1XJLyCS9zfSMCpRHdjmGefWT3rXsQ8dNc4MfoMfH9oGUeQ+KioZDcmKZR/Ljl wwMw== X-Gm-Message-State: AOJu0Yy7SAQRf++RgSJxr3YH42C5I8LvdeZK9GSNIedBeqUkbdHCj1Ji IwoHGyZfTKJjJqZK6v1kZalVnjjaRzJBGB/dfChHasJv6jM1jb+ZusJJYthj2Phy X-Gm-Gg: AR+sD10bAdzVT4EnHF5aD6Z2EyCo8gFm0dHIUz0qoiOH7gypX5wgUTB/P16gmfpfVLb oFeb45KRetG/88KmEloqoQycOSQgYu6cBN5oS0IRHfXkG0UuYm9QIX3EI6zGt+qZWE6XPaOvd1z L8mT4tBgLlafyROyQTwO6noF6At8BFPcs8u5VHwv3QiZbNOhxTL96mHE5/4Ccdkf45zMSfM1Zr7 w2rMTW6tSk5FXMWLZRQ9KpS/Bin9bco7CrCr7uhxIDH7MdxamFqdV+/zcQoFY6iPW8eeh7PmOVd Ow2SxR66BHTcsIT6AagTDdVlUzkh1VLI38yCl2jodZDUivypKn9Za15VAFxxgGq1+V4jNg+NPpL 16cKyfHeiE+BAezqZdodcwsjJHjKGLGTeJ0z99NF0PogTHLVrzErfwknpVUKsB0nBrG8W8Ws5nN /BwXmQE2E6AlOHh8bJkg1InaP6/uICESFtyFziAX36z3BY3WG8ikBQTBLjBA5C35QQQLnsIeCy2 3x9TG3ee/lhHVxXsItcG3K6lw+jBzY2s1KKIgX68dcUvOka X-Received: by 2002:a05:600c:c48f:b0:493:a623:d090 with SMTP id 5b1f17b1804b1-496c642d64amr81488645e9.10.1785339295012; Wed, 29 Jul 2026 08:34:55 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:48 +0200 Subject: [PATCH 12/25] hw/arm: sanmiguel: add Facebook SanMiguel BMC machine MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-12-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=6006; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=IIGp7JMpwq/OH+NFukTrNiRzNgl7XKdaJGt6qK4dT9k=; b=Eob/FrvxJDWrPaoYGCADNo4jLQQQrqx1Lnu2OZRaVgmo+eNy/vpSpZdprngZxMV9bq89i8Ba5 cuvb5hTnrQwAaZmnCL32mOZaIH1Xlqn71rZRG6NbYNAxpJF07F6q8kT 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339313581158500 Add an AST2600-based machine for the Facebook SanMiguel BMC, derived from the aspeed-bmc-facebook-sanmiguel.dts device tree. The board wires up three TMP75 temperature sensors across its I2C buses, alongside IO expanders, FRU EEPROMs, an I2C mux and an RTC, with 2 GiB RAM, dual FMC flash and RGMII networking. Signed-off-by: Emmanuel Blot --- hw/arm/aspeed_ast2600_sanmiguel.c | 142 ++++++++++++++++++++++++++++++++++= ++++ hw/arm/meson.build | 1 + 2 files changed, 143 insertions(+) diff --git a/hw/arm/aspeed_ast2600_sanmiguel.c b/hw/arm/aspeed_ast2600_sanm= iguel.c new file mode 100644 index 0000000000..0f766449ae --- /dev/null +++ b/hw/arm/aspeed_ast2600_sanmiguel.c @@ -0,0 +1,142 @@ +/* + * Facebook SanMiguel BMC + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/arm/machines-qom.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/sensor/tmp105.h" + +/* SanMiguel hardware values */ +#define SANMIGUEL_BMC_HW_STRAP1 0x00002002 +#define SANMIGUEL_BMC_HW_STRAP2 0x00000000 +#define SANMIGUEL_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) + +#define TYPE_DS1338 "ds1338" + +static void sanmiguel_bmc_i2c_init(AspeedMachineState *bmc) +{ + /* Reference: aspeed-bmc-facebook-sanmiguel.dts */ + + AspeedSoCState *soc =3D bmc->soc; + I2CBus *i2c[16] =3D {}; + + for (unsigned idx =3D 0; idx < ARRAY_SIZE(i2c); idx++) { + i2c[idx] =3D aspeed_i2c_get_bus(&soc->i2c, idx); + } + + /* &i2c0 */ + /* ssif-bmc@10 =E2=80=94 no QEMU model */ + + /* &i2c1 =E2=80=94 empty */ + + /* &i2c2 =E2=80=94 HPM0 */ + /* hpm0_ioexp_20: pca9555@20 */ + i2c_slave_create_simple(i2c[2], TYPE_PCA9555, 0x20); + /* hpm0_ioexp_21: pca9555@21 */ + i2c_slave_create_simple(i2c[2], TYPE_PCA9555, 0x21); + + /* &i2c3 =E2=80=94 empty */ + /* &i2c4 =E2=80=94 empty */ + + /* &i2c5 =E2=80=94 SMM */ + /* smm_ioexp_20: pca9555@20 */ + i2c_slave_create_simple(i2c[5], TYPE_PCA9555, 0x20); + /* smm_ioexp_21: pca9555@21 */ + i2c_slave_create_simple(i2c[5], TYPE_PCA9555, 0x21); + /* smm_temp: lm75@48 */ + i2c_slave_create_simple(i2c[5], TYPE_TMP75, 0x48); + /* smm_fru: eeprom@50 (24c128 =3D 16 KiB) */ + at24c_eeprom_init(i2c[5], 0x50, 16 * KiB); + /* rtc@6f =E2=80=94 nct3018y (ds1338 stand-in) */ + i2c_slave_create_simple(i2c[5], TYPE_DS1338, 0x6f); + + /* &i2c6 =E2=80=94 HMC */ + /* hmc_ioexp: tca6408@20 (pca9554 stand-in) */ + i2c_slave_create_simple(i2c[6], TYPE_PCA9554, 0x20); + /* i2c-mux@70 (PCA9546) =E2=80=94 4 channels (imux16-19), all empty */ + i2c_slave_create_simple(i2c[6], TYPE_PCA9546, 0x70); + + /* &i2c7 =E2=80=94 HPM1 */ + /* hpm1_ioexp_20: pca9555@20 */ + i2c_slave_create_simple(i2c[7], TYPE_PCA9555, 0x20); + /* hpm1_ioexp_21: pca9555@21 */ + i2c_slave_create_simple(i2c[7], TYPE_PCA9555, 0x21); + + /* &i2c8 =E2=80=94 empty */ + + /* &i2c9 =E2=80=94 PDB */ + /* mp5926@10-16, lm5066i@11-17 =E2=80=94 no QEMU model (power monitors= ) */ + /* pdb_ioexp_20: pca9555@20 */ + i2c_slave_create_simple(i2c[9], TYPE_PCA9555, 0x20); + /* pdb_temp: lm75@4e */ + i2c_slave_create_simple(i2c[9], TYPE_TMP75, 0x4e); + /* pdb_fru: eeprom@50 (24c128 =3D 16 KiB) */ + at24c_eeprom_init(i2c[9], 0x50, 16 * KiB); + + /* &i2c10 =E2=80=94 SCM */ + /* scm_temp: lm75@48 */ + i2c_slave_create_simple(i2c[10], TYPE_TMP75, 0x48); + /* scm_fru: eeprom@50 (24c128 =3D 16 KiB) */ + at24c_eeprom_init(i2c[10], 0x50, 16 * KiB); + + /* &i2c11 =E2=80=94 Switch Config */ + /* sw_config: eeprom@50 (24c64 =3D 8 KiB) */ + at24c_eeprom_init(i2c[11], 0x50, 8 * KiB); + + /* &i2c12 =E2=80=94 empty */ + + /* &i2c13 =E2=80=94 SMM extension */ + /* mctp@10 =E2=80=94 no QEMU model */ + /* smm_ext_ioexp: pca9554@38 */ + i2c_slave_create_simple(i2c[13], TYPE_PCA9554, 0x38); + /* smm_ext_fru: eeprom@55 (24c128 =3D 16 KiB) */ + at24c_eeprom_init(i2c[13], 0x55, 16 * KiB); + + /* &i2c14 =E2=80=94 FIO */ + /* fio_ioexp: pca9555@20 */ + i2c_slave_create_simple(i2c[14], TYPE_PCA9555, 0x20); + /* fio_fru: eeprom@50 (24c64 =3D 8 KiB) */ + at24c_eeprom_init(i2c[14], 0x50, 8 * KiB); + + /* &i2c15 =E2=80=94 empty */ +} + +static void aspeed_machine_sanmiguel_class_init(ObjectClass *oc, + const void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + AspeedMachineClass *amc =3D ASPEED_MACHINE_CLASS(oc); + + mc->desc =3D "Facebook SanMiguel BMC (Cortex-A7)"; + amc->soc_name =3D "ast2600-a3"; + amc->hw_strap1 =3D SANMIGUEL_BMC_HW_STRAP1; + amc->hw_strap2 =3D SANMIGUEL_BMC_HW_STRAP2; + amc->fmc_model =3D "mx66l1g45g"; + amc->spi_model =3D "mx66l1g45g"; + amc->num_cs =3D 2; + amc->macs_mask =3D ASPEED_MAC0_ON; + amc->i2c_init =3D sanmiguel_bmc_i2c_init; + mc->default_ram_size =3D SANMIGUEL_BMC_RAM_SIZE; + aspeed_machine_class_init_cpus_defaults(mc); +} + +static const TypeInfo aspeed_ast2600_sanmiguel_types[] =3D { + { + .name =3D MACHINE_TYPE_NAME("sanmiguel-bmc"), + .parent =3D TYPE_ASPEED_MACHINE, + .class_init =3D aspeed_machine_sanmiguel_class_init, + .interfaces =3D arm_machine_interfaces, + } +}; + +DEFINE_TYPES(aspeed_ast2600_sanmiguel_types) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index 4233a800be..2d5f4a0fe4 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -65,6 +65,7 @@ arm_common_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: fil= es( 'aspeed_ast2600_fuji.c', 'aspeed_ast2600_gb200nvl.c', 'aspeed_ast2600_rainier.c', + 'aspeed_ast2600_sanmiguel.c', 'aspeed_ast10x0.c', 'aspeed_ast10x0_evb.c', 'aspeed_ast1040.c', --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339352; cv=none; d=zohomail.com; s=zohoarc; b=CF7yBqHhV5MReCBz9cIi4lEtPgOarYZp1a56mhqFFuCSY0oFRmfmXQt8vfSs0a66zAb8aJKvue2RXOnpdsfEagin6P/84AdlBbnwnHndlEOeaTowvkwqPBIljN0+n2FlOEquhj5z5WehLfErTTRJYTY3NYYvck4dZHzydnKbYOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339352; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=ogMt4crJWDo6PYGzlk1TY5iOKCqgyyJHlofJjFEnZzk=; b=hTQLna5KXzXKKC9N9NDFt9Mk9cboJ0m96G1E2J+pz02V3IeGkdjb7nTCFJ4n+cSRnkyFMxnD24VA2uD8uyraYNwLj3ccA+D9vL41+M+ccZQ6O2l5x4c0FM5rK5X1IlONeV++NIm/djLuRfW9ysejkFQGGYnLDtG+r1DH2t+VzXI= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339352682401.37720468876273; Wed, 29 Jul 2026 08:35:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6Jw-00009U-8E; Wed, 29 Jul 2026 11:35:48 -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 1wp6Jv-000054-Dp for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:35:47 -0400 Received: from mail-wr1-f44.google.com ([209.85.221.44]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6Jt-0001NF-1A for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:35:47 -0400 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-47f7854678bso578120f8f.3 for ; Wed, 29 Jul 2026 08:35: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-47fb6abd0a6sm7366595f8f.10.2026.07.29.08.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:35:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339343; x=1785944143; 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=ogMt4crJWDo6PYGzlk1TY5iOKCqgyyJHlofJjFEnZzk=; b=F0O8YYCeTcH+9wAWiHGrms1E6tPAGpYXylsO9ufvv2cty+9DSpKHugflTSbh+GZhdM d6ltQ5XAqIRKW4RzTIYwnOrYmd8rb29CrgEI3PoRMVIlUgcQmKhx/wol/TdKP1D169my fkVuyk3zm2o7vn06A0hQb6/ATaidMNsrlYfh2tfCDHsxXZE8kpMLF3UyVg3Ng3kF0+Zk IXPyQVGau5GXCguD5f9Lao1sIyb4c+OI9FG8dk1IMMqn/xfKIvinLjy5IGrmqolw4RV3 cWbKaoZIx7Vf+aoztOBYFur0SZcpdKJueqYw31xHN1+9GbXW/SXiG6zjlaOl9PrPAvLr Vsyg== X-Gm-Message-State: AOJu0YwpKgJQh9GWIv4LirhEKcblVO3CY7IYa0joMu2Zdjf8+Jsa2xFS QZ6k/UZmOfRVf210siucXZKUJFzRlUSHDPdv+IhPMC7Bk/sBNlgVfhlCsjwz4FZf X-Gm-Gg: AR+sD10NuQ5tB9FOOTMDO+1wWn2DMH3/+tbXbWu9Rnw84tyZZXqADhp31Gows5MO+Ux dvLa9HLUH+f//jBDyR8CBK2IS3XaPXwQDrVKm+RhYgyBj1ZJwXxWBVD2KT/3Q1ZiR2LvZOqrYlc xODms8h0wcpnso0Chp3SzzmVEQDAnbYAZ6Wd2Yzmo2wZNJ0UdKHGkD0iNmj22HIoHukbu9trH4S UmuEsa29Jtven1fOtC/M9+lt/pY1XO3cH2oX7DUlvagfTmX2atwTF8WGRG6MscZhEHQci8/g/k7 3aPb2rgAqTg2W6K29wEuqCg6VAz+MWNlOpTRNyoOC2hxxR2mu0TpJAi1pHFr0bwM3hej9GcXoSx lTYoE8NXJjgZv4kBswxgL/VfwD1FC1uq6NZpZcrk8K0PMhrZ2Es9y8PO9qLIUjqNsNT1ztprQBz 5F5nbJWoPHpvCCxJ4wDMyvQtYBLwqU7BaEkTwjeSjZOwnMKlaelZ8empXSijQHI4yrVVzc0hIxT ZeAOf5+lumsvw7ywPTeYf6ENH8gq3XefQBY X-Received: by 2002:a5d:64e9:0:b0:47f:93be:dabd with SMTP id ffacd0b85a97d-47fb1f1013bmr8293718f8f.28.1785339343345; Wed, 29 Jul 2026 08:35:43 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:49 +0200 Subject: [PATCH 13/25] hw/arm: sanmiguel: populate EEPROM data MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-13-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=14818; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=Jld+a09RcEg7ydF2r01UnpNy9pLWdU2S/Lj75qahoCM=; b=B4nV7mbhHIw2m9h33Jii0bw3rqGSTQqyWXih4E3PNWPvu8y79TCwt8k1hqYvazhM6F9FQL6xF E1s2nuB8Do5CvNVkCuRw55QhtSVFlVz0Ps9CzZfjLTaWLk8Taq3R0Ve 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.44; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f44.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339353997158500 Populate AT24C FRU EEPROMs with real data from physical device. Signed-off-by: Emmanuel Blot --- hw/arm/aspeed_ast2600_sanmiguel.c | 275 ++++++++++++++++++++++++++++++++++= +++- 1 file changed, 269 insertions(+), 6 deletions(-) diff --git a/hw/arm/aspeed_ast2600_sanmiguel.c b/hw/arm/aspeed_ast2600_sanm= iguel.c index 0f766449ae..2748ef054d 100644 --- a/hw/arm/aspeed_ast2600_sanmiguel.c +++ b/hw/arm/aspeed_ast2600_sanmiguel.c @@ -23,6 +23,267 @@ =20 #define TYPE_DS1338 "ds1338" =20 +/* + * "Front IO" FRU data. Generated with frugen. + * + * { + * "board": { + * "mfg": "Quanta", + * "pname": "San Miguel FIO EVT (QEMU)", + * "pn": "00000000000", + * "serial": "0000000000000", + * "date": "03/10/2026 00:00", + * "custom": ["19-101243"] + * }, + * "product": { + * "mfg": "Quanta", + * "pname": "CI-San Miguel", + * "pn": "10000000001", + * "ver": "EVT", + * "serial": "10000000000000001" + * "atag": "QEMU", + * } + * } + */ +static const uint8_t fio_eeprom[] =3D { + 0x01, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x00, 0xf4, 0x01, 0x09, 0x19, 0x90, + 0xd2, 0xf6, 0xc6, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x61, 0xd9, 0x53, 0x61, + 0x6e, 0x20, 0x4d, 0x69, 0x67, 0x75, 0x65, 0x6c, 0x20, 0x46, 0x49, 0x4f, + 0x20, 0x45, 0x56, 0x54, 0x20, 0x28, 0x51, 0x45, 0x4d, 0x55, 0x29, 0x8a, + 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x89, 0x10, + 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x01, 0xc0, 0x87, 0x51, 0xd6, + 0x44, 0x50, 0x24, 0x51, 0x13, 0xc1, 0x00, 0xf5, 0x01, 0x08, 0x19, 0xc6, + 0x51, 0x75, 0x61, 0x6e, 0x74, 0x61, 0xcd, 0x43, 0x49, 0x2d, 0x53, 0x61, + 0x6e, 0x20, 0x4d, 0x69, 0x67, 0x75, 0x65, 0x6c, 0x89, 0x11, 0x04, 0x41, + 0x10, 0x04, 0x41, 0x10, 0x14, 0x01, 0x83, 0xa5, 0x4d, 0x03, 0x8d, 0x11, + 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x11, + 0x83, 0x71, 0xd9, 0xd6, 0xc0, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff +}; +static const size_t fio_eeprom_len =3D sizeof(fio_eeprom); + +/* + * "Power Distribution Board" FRU data. Generated with frugen. + * + * { + * "chassis": { + * "type": 23, + * "pn": "", + * "serial": "" + * }, + * "board": { + * "mfg": "Quanta", + * "pname": "San Miguel PDB EVT (QEMU)", + * "pn": "00000000000", + * "serial": "0000000000000", + * "date": "03/10/2026 00:00", + * "custom": ["19-101240"] + * }, + * "product": { + * "mfg": "Quanta", + * "pname": "CI-San Miguel", + * "pn": "10000000001", + * "ver": "EVT", + * "serial": "10000000000000001", + * "atag": "QEMU", + * } + * } + */ +static const uint8_t pdb_eeprom[] =3D { + 0x01, 0x00, 0x01, 0x02, 0x0b, 0x00, 0x00, 0xf1, 0x01, 0x01, 0x17, 0xc0, + 0xc0, 0xc1, 0x00, 0xa6, 0x01, 0x09, 0x19, 0x90, 0xd2, 0xf6, 0xc6, 0x51, + 0x75, 0x61, 0x6e, 0x74, 0x61, 0xd9, 0x53, 0x61, 0x6e, 0x20, 0x4d, 0x69, + 0x67, 0x75, 0x65, 0x6c, 0x20, 0x50, 0x44, 0x42, 0x20, 0x45, 0x56, 0x54, + 0x20, 0x28, 0x51, 0x45, 0x4d, 0x55, 0x29, 0x8a, 0x10, 0x04, 0x41, 0x10, + 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x89, 0x10, 0x04, 0x41, 0x10, 0x04, + 0x41, 0x10, 0x04, 0x01, 0xc0, 0x87, 0x51, 0xd6, 0x44, 0x50, 0x24, 0x51, + 0x10, 0xc1, 0x00, 0x00, 0x01, 0x08, 0x19, 0xc6, 0x51, 0x75, 0x61, 0x6e, + 0x74, 0x61, 0xcd, 0x43, 0x49, 0x2d, 0x53, 0x61, 0x6e, 0x20, 0x4d, 0x69, + 0x67, 0x75, 0x65, 0x6c, 0x89, 0x11, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, + 0x14, 0x01, 0x83, 0xa5, 0x4d, 0x03, 0x8d, 0x11, 0x04, 0x41, 0x10, 0x04, + 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x11, 0x83, 0x71, 0xd9, 0xd6, + 0xc0, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff +}; +static const size_t pdb_eeprom_len =3D sizeof(pdb_eeprom); + +/* + * "Secure Control Module" FRU data. Generated with frugen. + * + * { + * "chassis": { + * "type": 23, + * "pn": "", + * "serial": "", + * "custom": [""] + * }, + * "board": { + * "mfg": "Quanta", + * "pname": "San Miguel SCM EVT (QEMU)", + * "pn": "00000000000", + * "serial": "0000000000000", + * "date": "03/10/2026 00:00", + * "custom": ["19-101242"] + * }, + * "product": { + * "mfg": "Quanta", + * "pname": "CI-San Miguel", + * "pn": "10000000001", + * "ver": "EVT", + * "serial": "10000000000000001", + * "atag": "QEMU", + * } + * } + */ +static const uint8_t scm_eeprom[] =3D { + 0x01, 0x00, 0x01, 0x02, 0x0b, 0x00, 0x00, 0xf1, 0x01, 0x01, 0x17, 0xc0, + 0xc0, 0xc0, 0xc1, 0xe6, 0x01, 0x09, 0x19, 0x90, 0xd2, 0xf6, 0xc6, 0x51, + 0x75, 0x61, 0x6e, 0x74, 0x61, 0xd9, 0x53, 0x61, 0x6e, 0x20, 0x4d, 0x69, + 0x67, 0x75, 0x65, 0x6c, 0x20, 0x53, 0x43, 0x4d, 0x20, 0x45, 0x56, 0x54, + 0x20, 0x28, 0x51, 0x45, 0x4d, 0x55, 0x29, 0x8a, 0x10, 0x04, 0x41, 0x10, + 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x89, 0x10, 0x04, 0x41, 0x10, 0x04, + 0x41, 0x10, 0x04, 0x01, 0xc0, 0x87, 0x51, 0xd6, 0x44, 0x50, 0x24, 0x51, + 0x12, 0xc1, 0x00, 0xf1, 0x01, 0x08, 0x19, 0xc6, 0x51, 0x75, 0x61, 0x6e, + 0x74, 0x61, 0xcd, 0x43, 0x49, 0x2d, 0x53, 0x61, 0x6e, 0x20, 0x4d, 0x69, + 0x67, 0x75, 0x65, 0x6c, 0x89, 0x11, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, + 0x14, 0x01, 0x83, 0xa5, 0x4d, 0x03, 0x8d, 0x11, 0x04, 0x41, 0x10, 0x04, + 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x11, 0x83, 0x71, 0xd9, 0xd6, + 0xc0, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9b, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff +}; +static const size_t scm_eeprom_len =3D sizeof(scm_eeprom); + +/* + * "SMM Carrier" FRU data. Generated with frugen. + * + * { + * "chassis": { + * "type": 23, + * "pn": "", + * "serial": "" + * }, + * "board": { + * "mfg": "Quanta", + * "pname": "San Miguel SMM Carrier EVT (QEMU)", + * "pn": "00000000000", + * "serial": "0000000000000", + * "date": "03/11/2026 17:36", + * "custom": ["19-101238"] + * }, + * "product": { + * "mfg": "Quanta", + * "pname": "CI-San Miguel", + * "pn": "10000000001", + * "ver": "EVT", + * "serial": "10000000000000001", + * "atag": "QEMU", + * } + * } + */ +static const uint8_t smm_eeprom[] =3D { + 0x01, 0x00, 0x01, 0x02, 0x0c, 0x00, 0x00, 0xf0, 0x01, 0x01, 0x17, 0xc0, + 0xc0, 0xc1, 0x00, 0xa6, 0x01, 0x0a, 0x19, 0x4c, 0x85, 0xf7, 0xc6, 0x51, + 0x75, 0x61, 0x6e, 0x74, 0x61, 0xe1, 0x53, 0x61, 0x6e, 0x20, 0x4d, 0x69, + 0x67, 0x75, 0x65, 0x6c, 0x20, 0x53, 0x4d, 0x4d, 0x20, 0x43, 0x61, 0x72, + 0x72, 0x69, 0x65, 0x72, 0x20, 0x45, 0x56, 0x54, 0x20, 0x28, 0x51, 0x45, + 0x4d, 0x55, 0x29, 0x8a, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, + 0x41, 0x10, 0x89, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x01, + 0xc0, 0x87, 0x51, 0xd6, 0x44, 0x50, 0x24, 0x4d, 0x18, 0xc1, 0x00, 0x84, + 0x01, 0x08, 0x19, 0xc6, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x61, 0xcd, 0x43, + 0x49, 0x2d, 0x53, 0x61, 0x6e, 0x20, 0x4d, 0x69, 0x67, 0x75, 0x65, 0x6c, + 0x89, 0x11, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x14, 0x01, 0x83, 0xa5, + 0x4d, 0x03, 0x8d, 0x11, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, + 0x10, 0x04, 0x41, 0x11, 0x83, 0x71, 0xd9, 0xd6, 0xc0, 0xc1, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x9b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff +}; +static const size_t smm_eeprom_len =3D sizeof(smm_eeprom); + +/* + * "SMM Extender" FRU data. Generated with frugen. + * + * { + * "chassis": { + * "type": 23, + * "pn": "", + * "serial": "" + * }, + * "board": { + * "mfg": "Quanta", + * "pname": "San Miguel SMM Extender EVT (QEMU)", + * "pn": "00000000000", + * "serial": "0000000000000", + * "date": "03/10/2026 00:00", + * "custom": ["19-101239"] + * }, + * "product": { + * "mfg": "Quanta", + * "pname": "CI-San Miguel", + * "pn": "10000000001", + * "ver": "EVT", + * "serial": "10000000000000001", + * "atag": "QEMU", + * } + * } + */ +static const uint8_t smm_ext_eeprom[] =3D { + 0x01, 0x00, 0x01, 0x02, 0x0c, 0x00, 0x00, 0xf0, 0x01, 0x01, 0x17, 0xc0, + 0xc0, 0xc1, 0x00, 0xa6, 0x01, 0x0a, 0x19, 0x90, 0xd2, 0xf6, 0xc6, 0x51, + 0x75, 0x61, 0x6e, 0x74, 0x61, 0xe2, 0x53, 0x61, 0x6e, 0x20, 0x4d, 0x69, + 0x67, 0x75, 0x65, 0x6c, 0x20, 0x53, 0x4d, 0x4d, 0x20, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x45, 0x56, 0x54, 0x20, 0x28, 0x51, + 0x45, 0x4d, 0x55, 0x29, 0x8a, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, + 0x04, 0x41, 0x10, 0x89, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, + 0x01, 0xc0, 0x87, 0x51, 0xd6, 0x44, 0x50, 0x24, 0x4d, 0x19, 0xc1, 0x7b, + 0x01, 0x08, 0x19, 0xc6, 0x51, 0x75, 0x61, 0x6e, 0x74, 0x61, 0xcd, 0x43, + 0x49, 0x2d, 0x53, 0x61, 0x6e, 0x20, 0x4d, 0x69, 0x67, 0x75, 0x65, 0x6c, + 0x89, 0x11, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x14, 0x01, 0x83, 0xa5, + 0x4d, 0x03, 0x8d, 0x11, 0x04, 0x41, 0x10, 0x04, 0x41, 0x10, 0x04, 0x41, + 0x10, 0x04, 0x41, 0x11, 0x83, 0x71, 0xd9, 0xd6, 0xc0, 0xc1, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x9b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff +}; +static const size_t smm_ext_eeprom_len =3D sizeof(smm_ext_eeprom); + static void sanmiguel_bmc_i2c_init(AspeedMachineState *bmc) { /* Reference: aspeed-bmc-facebook-sanmiguel.dts */ @@ -56,7 +317,8 @@ static void sanmiguel_bmc_i2c_init(AspeedMachineState *b= mc) /* smm_temp: lm75@48 */ i2c_slave_create_simple(i2c[5], TYPE_TMP75, 0x48); /* smm_fru: eeprom@50 (24c128 =3D 16 KiB) */ - at24c_eeprom_init(i2c[5], 0x50, 16 * KiB); + at24c_eeprom_init_rom(i2c[5], 0x50, 16 * KiB, smm_eeprom, smm_eeprom_l= en); + /* rtc@6f =E2=80=94 nct3018y (ds1338 stand-in) */ i2c_slave_create_simple(i2c[5], TYPE_DS1338, 0x6f); =20 @@ -81,16 +343,16 @@ static void sanmiguel_bmc_i2c_init(AspeedMachineState = *bmc) /* pdb_temp: lm75@4e */ i2c_slave_create_simple(i2c[9], TYPE_TMP75, 0x4e); /* pdb_fru: eeprom@50 (24c128 =3D 16 KiB) */ - at24c_eeprom_init(i2c[9], 0x50, 16 * KiB); + at24c_eeprom_init_rom(i2c[9], 0x50, 16 * KiB, pdb_eeprom, pdb_eeprom_l= en); =20 /* &i2c10 =E2=80=94 SCM */ /* scm_temp: lm75@48 */ i2c_slave_create_simple(i2c[10], TYPE_TMP75, 0x48); /* scm_fru: eeprom@50 (24c128 =3D 16 KiB) */ - at24c_eeprom_init(i2c[10], 0x50, 16 * KiB); + at24c_eeprom_init_rom(i2c[10], 0x50, 16 * KiB, scm_eeprom, scm_eeprom_= len); =20 /* &i2c11 =E2=80=94 Switch Config */ - /* sw_config: eeprom@50 (24c64 =3D 8 KiB) */ + /* sw_config: eeprom@50 (24c64 =3D 8 KiB) =E2=80=94 blank (content not= modelled) */ at24c_eeprom_init(i2c[11], 0x50, 8 * KiB); =20 /* &i2c12 =E2=80=94 empty */ @@ -100,13 +362,14 @@ static void sanmiguel_bmc_i2c_init(AspeedMachineState= *bmc) /* smm_ext_ioexp: pca9554@38 */ i2c_slave_create_simple(i2c[13], TYPE_PCA9554, 0x38); /* smm_ext_fru: eeprom@55 (24c128 =3D 16 KiB) */ - at24c_eeprom_init(i2c[13], 0x55, 16 * KiB); + at24c_eeprom_init_rom(i2c[13], 0x55, 16 * KiB, smm_ext_eeprom, + smm_ext_eeprom_len); =20 /* &i2c14 =E2=80=94 FIO */ /* fio_ioexp: pca9555@20 */ i2c_slave_create_simple(i2c[14], TYPE_PCA9555, 0x20); /* fio_fru: eeprom@50 (24c64 =3D 8 KiB) */ - at24c_eeprom_init(i2c[14], 0x50, 8 * KiB); + at24c_eeprom_init_rom(i2c[14], 0x50, 8 * KiB, fio_eeprom, fio_eeprom_l= en); =20 /* &i2c15 =E2=80=94 empty */ } --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339492; cv=none; d=zohomail.com; s=zohoarc; b=ivmzyh4CoHlzCoF6t7PPkoI7020WgwDK1wHav4beOILH4zCJ5JrEQhrLLHV6XCdLjFYD1AVr3ayHpk/4cmKKf6l0ZBcFj7IjX2Bu3vACOru0SVdX5JSu1QI7caDrYaJes4VfiJu1Y+Nf4XSKDFIAaRoD6nxnKqn7bPgI8VPDLT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339492; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=H0i9wFR+0jszuSIzriUDQZoOMEXHplug+y13hr3wwAQ=; b=gMfNgW52hRojRWv4w/BkSDVh/g7HiKo/H4ygFtHPseRqSnnAB5f/sIFp8asUDD9HGoSHDU1WjdrtbwUqDFmZ3ThCeQHAZiIjB7sR1BcqqYG5zhlR4gRJDfJ0ugfVj0rDsaqABkSfqTWs0BIFcuDcfdrZWBB0R4JdVbpqms+v78M= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339492334564.6873960217129; Wed, 29 Jul 2026 08:38:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6M1-0004c5-54; Wed, 29 Jul 2026 11:37:57 -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 1wp6Lz-0004bM-Ln for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:37:55 -0400 Received: from mail-wm1-f48.google.com ([209.85.128.48]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6Ly-0001YI-BW for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:37:55 -0400 Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4953de5be0aso8193035e9.0 for ; Wed, 29 Jul 2026 08:37:53 -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-4957bfc2ff2sm335559385e9.4.2026.07.29.08.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:37:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339473; x=1785944273; 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=H0i9wFR+0jszuSIzriUDQZoOMEXHplug+y13hr3wwAQ=; b=eCmnuE/loQs30Yy5iyz/uCQUUJ/GIun6GVxzyqCSAM7CtRG2FAsQpoXQVjTuBGFsOM JI3Z8X3Ld5dG+9YvwTux7/ZzkOUAS+6+efIBa2mrnRnd/vJ0IGaj3aYIOE7cNp/ig69H mtuVGCRtiC+Yy1RiFEwpqLJMcl3bFSICMqFhGWOgHg89u0/58k63GhPlU/hyiXfdIJEb 4Di5nxuKzakoc4ACziJqAmurRAXJjEpjBPq77Xit4sP9JIu0JgwZru9B0gKmbMbWcTzq eXB77I1yU95zsT3AdLIbdR0+Elfv7YLnYrKh46XAdaERY+Vi2G+eu/ERfx+WEikoCep8 R8ew== X-Gm-Message-State: AOJu0YzGxwZs9BPEUOM8ra0rckCLDCbU4ltQ3lSRwGpLE67JZmWCUgJR SCzuVVbrDtXJR0Czpi5+R3o68aKkkBNPs2pA0UuWqmyMnZFjsZXxFe8USSFSfLD0 X-Gm-Gg: AR+sD10ZcNb3ffY/HpLdjAD5bB0G9dEUHlB8D5N3Ccg7eOjylJeLTykyyZlocnIqQ88 XUSQirwQOgxaftawMVVx3xcU+UUJdbf0/bZmwYcoUmBDN/IuMVSFPzi1B/rRvmc4E94R3VGlIuT 86PKT/OLVNDXPqx68rSyiSKQUnlQUZpl8lrpNB67kcPmN3Zcz2IncBhOt/cqOjw64OLGy/8g7T1 HttyPPsO5Yfp50zfW+Ztcy3X6t7REZr94eyL3xKTAwJpeEeE3Koa5ARkAI4Xzl01IASFguCDr6i r2Rnf7Jul0CsHCupDzRcKxj6mfWR5sWL9Xe8ZqM/n+tFBIQ6ltFoUSeqFOihaQ8HP0aHEwcDuWe iDSy0SUZmGbDBhJXocUgzcw5H45FfW4cBElaKY924eVgavZXMHyNPPS418NExk2yy7rjco58cyv 18cZeEMmaUOL0Bs0lHobWurHkUJusMzY2PBuAswolHthcpfrzOdT9sEzZs6KAPrCkUuDWn91LXf Y0OAq9/3cv8IajujtTY5Z4/W/NZ6rUd6A7zXyLxEVaJMYI= X-Received: by 2002:a05:600c:350e:b0:495:4811:7998 with SMTP id 5b1f17b1804b1-496c655e6e1mr84036055e9.17.1785339472591; Wed, 29 Jul 2026 08:37:52 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:50 +0200 Subject: [PATCH 14/25] hw/arm: catalina: use the real TMP75 model MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-14-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=948; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=yr6ARhHsRJdWelmON/tAwpVgyc94u96MVCdEOI7hMno=; b=6Lig/q7xj+IHJLXLGZFw1HA8W3BPThEM/YZac7dWZPjeFwCwzVHetNboH65BktroYWxO/s3Ev aN9SI7Ga8AiBfvW3WxJj86RZhkDw+G8Ek/b+IHgJmD5ZBlXgz4QpyRv 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.48; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f48.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339495182158500 The Catalina BMC instantiates several ti,tmp75 temperature sensors. Now that hw/sensor/tmp105.h provides a proper TMP75 model, drop the local TYPE_TMP75 alias (and its guard) so the board instantiates the accurate device rather than a plain TMP105. Signed-off-by: Emmanuel Blot --- hw/arm/aspeed_ast2600_catalina.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/arm/aspeed_ast2600_catalina.c b/hw/arm/aspeed_ast2600_catal= ina.c index 33e75338ef..928e140b21 100644 --- a/hw/arm/aspeed_ast2600_catalina.c +++ b/hw/arm/aspeed_ast2600_catalina.c @@ -22,12 +22,6 @@ #define CATALINA_BMC_HW_STRAP2 0x00000800 #define CATALINA_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB) =20 -/* - * Guard the alias against the TYPE_TMP75 that hw/sensor/tmp105.h now - * defines. - */ -#undef TYPE_TMP75 -#define TYPE_TMP75 TYPE_TMP105 #define TYPE_TMP421 "tmp421" #define TYPE_DS1338 "ds1338" =20 --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339584; cv=none; d=zohomail.com; s=zohoarc; b=RlVsjkWxYvIo0KkWvsSqbPqdUzKk38YB5jdBxpupLMYf4wVV03JSNvCHVI4kwVEIiti5jxc7rHGLRqTJ3kOVvCyrn6l0llVfqf1T8J+H/siC9LH6jUPLH3iQzdxuwj5h8wLYvVXWCI7W5ghCzYyRq6xnq6/II0B+edSUjheRQcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339584; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=yyemhKIbNDI0dfV54rPviOfcsJPqmPO4g32wuNZQnWs=; b=npNelNKe+3ayHZbNifeIHDNAgn4sEEd7cmxYtftm15N1IcJTkVknlLViL5sYcaj/7XqWKleqAG7oMQ8Vo4uxvciU3fDOD760wJIHf2BEzKOGtX/6IRDtJOuvIRBn6IXixkw+ktfVxDz5EraYxv2Fv0ydrfn+qdv5ewDfO2Ckkcg= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339584359496.703562593593; Wed, 29 Jul 2026 08:39:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6ND-00059Z-MZ; Wed, 29 Jul 2026 11:39: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 1wp6NC-00058t-Gi for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:39:10 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6NB-0001dK-26 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:39:10 -0400 Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-495437bb891so9276655e9.1 for ; Wed, 29 Jul 2026 08:39:08 -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-496c462512dsm154633125e9.13.2026.07.29.08.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:39:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339547; x=1785944347; 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=yyemhKIbNDI0dfV54rPviOfcsJPqmPO4g32wuNZQnWs=; b=BkTkbU7AYYFKjwXYJ14RgfY+lUMZ8xfdunGUJ8kF3JG2pLkYoqFeNiOEMPTsC+ZTHn 8I37LhLvt+HbkdC7pFzrwFIzWIgJMvc575fkPivGQa7JYszraxiRGHupZj1Tkvz3NagW fRi8pt8TrrsR+6InOzVuWBouXt90+dFLW8qkTL2iI1tal2ybVVD36JXsaskP8mDgA6Ca xHr3dHEs2F3+pnp/bSCq8uNcRAidxMec/wsy4HWbzW/Duc2vYo+NRgsA7opYaZ7Q+0Of AKeCtAF1UlMUdOXMQqCvH4b8uStn0jZ8t/hQYZkOSYCrV/8AebVP+Hts2vt/m0b7Gz9Q CQFQ== X-Gm-Message-State: AOJu0YyeymoTjfB4oxcep/7ZxtmweSd96ZXnWdQdZVBGoYUAY1Go+wF+ A6303YF7/2S04Hp/oZVMExqCJGrT0ouH/cYH0Lk6yOgrTXwZ3DtPYVMQSuehzxVR X-Gm-Gg: AR+sD12hIrb9Bh9JoqM7MF2tfTFmvBz+Lbytgby7hRU+F0iNtH9lNM78GHPy4X3U5qf 7Tsye0llBCSv6E/i6fQot84hEgoT/afIsRaA2/ryaOR2shFuHp+fUcLtP0ILt2a5uIMxSGdKJ4M fVdvjyoVYOcKsHa6URLVWLO3nGD9J93ftVlC3dTC6/H6J03t5QIyCt5fhwCGcCLaK2fmxvNrGxj zdKwyj3pnyXuTZo+f3i3/scyIIY9YUwbzGBMdhg6YHTrAPDb0E7UeBvLJqZRPRpPHfIhozNgdQz BDPNZ5o4q2MnsEH/GhGjn6efHKE8Bv+4Zt09aR5ZGhlunPosemJbTE1B5wK2Ftf8yNrj88iOa8A 07xTqiJkL9ZTMHr6GScsMYqBHegTqtq9qyqBO3WvxHUeo1OxUAYCzqFhzWh8AyJXfB8emC/Q9bl 2HWb8/qYfnT2CAYtVJle5PSsmuGioXnxGcW4nkC9K3mThz57IeFvG/dii68bfDElrRlR/yBoLy/ tnL3fcA3/b2lCCLxeatbJWJhm5azTTB3fI2 X-Received: by 2002:a05:600c:8710:b0:492:6f5c:fd8c with SMTP id 5b1f17b1804b1-497fd311860mr30695555e9.15.1785339547088; Wed, 29 Jul 2026 08:39:07 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:51 +0200 Subject: [PATCH 15/25] hw/arm: fuji: use the real TMP75 and LM75B temperature sensors MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-15-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=2648; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=3Z2LgNf5NONtKdqbZ6IR/+v7877ewZwsl3F8BgLX3xg=; b=c4/xi9dVdrmq4Gb6hhrV7h2lN96P0ySNSmm3xHFsWb4HZHVBk9iSs4KSPx7QikBqfLxbvUfdI Dte8Sm01v2EADnUZ/CbogUMI0hmLbSEgk3tPZwmDb4LR3aBzhazf8Mb 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.50; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f50.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339585482158500 The Fuji BMC instantiates many ti,tmp75 sensors and several NXP LM75B sensors; the original board code approximated both with a plain TMP105 via local TYPE_TMP75 and TYPE_LM75 aliases (the latter mislabelling the LM75B parts as LM75). Now that hw/sensor/tmp105.h provides proper TMP75 and LM75B models, drop the local aliases (and their guards) and instantiate the accurate devices. Signed-off-by: Emmanuel Blot --- hw/arm/aspeed_ast2600_fuji.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/hw/arm/aspeed_ast2600_fuji.c b/hw/arm/aspeed_ast2600_fuji.c index 6dc3535f0c..fe0c294e14 100644 --- a/hw/arm/aspeed_ast2600_fuji.c +++ b/hw/arm/aspeed_ast2600_fuji.c @@ -15,14 +15,6 @@ #include "hw/sensor/tmp105.h" #include "hw/nvram/eeprom_at24c.h" =20 -/* - * Guard the aliases against the TYPE_TMP75 that hw/sensor/tmp105.h now de= fines; - * TYPE_LM75 is guarded too for consistency (no LM75 model exists yet). - */ -#undef TYPE_LM75 -#define TYPE_LM75 TYPE_TMP105 -#undef TYPE_TMP75 -#define TYPE_TMP75 TYPE_TMP105 #define TYPE_TMP422 "tmp422" =20 /* Fuji hardware value */ @@ -63,8 +55,8 @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc) get_pca9548_channels(i2c[40 + i], 0x76, &i2c[80 + i * 8]); } =20 - i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4c); - i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4d); + i2c_slave_create_simple(i2c[17], TYPE_LM75B, 0x4c); + i2c_slave_create_simple(i2c[17], TYPE_LM75B, 0x4d); =20 /* * EEPROM 24c64 size is 64Kbits or 8 Kbytes @@ -74,15 +66,15 @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc) at24c_eeprom_init(i2c[20], 0x50, 256); at24c_eeprom_init(i2c[22], 0x52, 256); =20 - i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x48); - i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x49); - i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x4a); + i2c_slave_create_simple(i2c[3], TYPE_LM75B, 0x48); + i2c_slave_create_simple(i2c[3], TYPE_LM75B, 0x49); + i2c_slave_create_simple(i2c[3], TYPE_LM75B, 0x4a); i2c_slave_create_simple(i2c[3], TYPE_TMP422, 0x4c); =20 at24c_eeprom_init(i2c[8], 0x51, 8 * KiB); - i2c_slave_create_simple(i2c[8], TYPE_LM75, 0x4a); + i2c_slave_create_simple(i2c[8], TYPE_LM75B, 0x4a); =20 - i2c_slave_create_simple(i2c[50], TYPE_LM75, 0x4c); + i2c_slave_create_simple(i2c[50], TYPE_LM75B, 0x4c); at24c_eeprom_init(i2c[50], 0x52, 8 * KiB); i2c_slave_create_simple(i2c[51], TYPE_TMP75, 0x48); i2c_slave_create_simple(i2c[52], TYPE_TMP75, 0x49); --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339661; cv=none; d=zohomail.com; s=zohoarc; b=hTKUsRYw3peLsq855BUU4Xphw4ULb1+soZX2fH8RtovZ3Gw2sKp2KArcEhBoxUdcFDBp/BtaabCQp3ZeOaXgRXtzRrvuGk7098Rpsg/L+7rbEiF1zyUAqO10/GK/Ng/oV4VERKRT/Mlk7O/F8CmUPOhFjU2s43KtcJpp0jG4iKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339661; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=T3QJvSJZGpsccP9EvkOCqQcE/jNtNeeQY/Ifg8+pe0I=; b=AQ9/vvhhem/Okdu3P8UkXEdWHVKVATxnzUGRU4hncQTOrL4YBHRss4ns8Qp+6iLnewaKu7grcUMj3TBeh/VfYlu+kyAo6tuud+XNJ+6UoMDrfS5u1fHVvyGSm06UCna4SHjvR+B6OwQCJPA3lp+ji0CNa1Jw+cL49GGKAm9DyY0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339661975822.6383689144524; Wed, 29 Jul 2026 08:41:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6Oh-0006BY-02; Wed, 29 Jul 2026 11:40:43 -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 1wp6Of-0006B4-OS for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:40:41 -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 1wp6Oe-0001wS-8O for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:40:41 -0400 Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-47f7854678bso583189f8f.3 for ; Wed, 29 Jul 2026 08:40:39 -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-47fb647a8d4sm9038598f8f.0.2026.07.29.08.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:40:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339639; x=1785944439; 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=T3QJvSJZGpsccP9EvkOCqQcE/jNtNeeQY/Ifg8+pe0I=; b=GIE1f8Qn0zmt3tVWcOopvCRWJlanE6gvm1Np7gVjoou2MCu4YJFZgNY4DwZBnbYSkM 1iukn/f3ardNyW55sh1FeI7bUrfy8stgKLUwoJC4yfxIsp4ngjAthv4oU9FgpOf6y/j1 jjZecXs2sli5iE99nHnPdX21nB/e8C+asTfUhFjl5srrrNdcTv4flSWMH44HXM5yoAZ8 U/LMUuoXu9/r9g8HZD1d/BfT1Zkz3ugaTuTKhBkF5jh1Bjhv0Z5Cw2zeVZFr1d8wBrqj DqfzMzuW1yxsDQytoLbPCky2KS0e8tWuON+JW0UHn6q612UeZvv6/x9NQjSxH0M8HFAD 14+g== X-Gm-Message-State: AOJu0YzA1YLKUve7cmWIvcVRAx1daN3OkTBS6Yfih/eTGuYdt+3Yf9mh SirM95KAVFLBZmhOjIsWM+r5jmNCAKB6jg4fE1aSb9M0R2HqZDY7qifFEJ6HqK5W X-Gm-Gg: AR+sD125W2MBI9dS2gT/zgQH5gJinG/hsa/jeoNgeA3VglSCIBWbdrHI4Q1AoikB7Cu XW3p+0WfbJY9znbs1QAlygkdU2SIaKpsiURZqYoOIzf6M6JYUStm+Lr3W6L2AzbVxI6Vt6kJf73 VB4+vPnNVumot3Sef0At5W1Cmr2uKQ8puYnHsM4sAP1+Z3/F8xbsY7i2rMKzMu8TpdXmxLU8x/7 7JG1fGqtIC4EaObsXg6MgOb9+EFIAo/K/7NbwSMbva2//4BmUjpelRd0owO0hKvCzowAZd+DMVX wNPddpiUGBQAbfU6Id8FRDbz49q0i9PHnB58sELL6AyRFFOEA1gNDPd1ckwnc4VqI3/NMwDIAov ARpNTivnVEj8M4ZME21JTEq5dEBA918xda6gidNVJdTjU7JyjeJSFswLau/TibLCDr5mSLjq3jE 0rfinhdOEe6MRb/Vm7Da4mpHIFBLSbVE/JJ1M8NI/dMNyoSYlnq4QtwHFVszVqNjNS/sCNI3kIF dSeWcTsc7schK0GdNpr9kpi76rpzRZ4bJf0 X-Received: by 2002:a05:6000:1787:b0:47f:5371:1b15 with SMTP id ffacd0b85a97d-47fb1ee2366mr8768400f8f.26.1785339638711; Wed, 29 Jul 2026 08:40:38 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:52 +0200 Subject: [PATCH 16/25] tests/functional: aspeed: optionally check the device tree model on boot MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-16-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=1664; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=cY6O6mrVrai7NMYpMfMfQOtbJnyb/EZq8fgGv1TgVEA=; b=AQ838ecWOWwFlpkOwwRhntcyWOI8dzW7kvtPnC3tGjFbVBZtLn17rgPtFJ1xHgzM538PwMyl6 BrrNfBaCySPCA6QAwmenQtUOHlmRsrLclEX5O3GhdNCEWK22+y8Xssl 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339663632158500 Add an optional 'dt_model' argument to do_test_arm_aspeed_openbmc(). When provided, the helper also waits for the kernel's "Machine model: ..." line, letting a test confirm the booted image actually matches the expected board device tree rather than only the SoC revision. Signed-off-by: Emmanuel Blot --- tests/functional/aspeed.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/functional/aspeed.py b/tests/functional/aspeed.py index 076da1036c..08af6b4839 100644 --- a/tests/functional/aspeed.py +++ b/tests/functional/aspeed.py @@ -8,7 +8,8 @@ class AspeedTest(LinuxKernelTest): =20 def do_test_arm_aspeed_openbmc(self, machine, image, uboot=3D'2019.04', - cpu_id=3D'0x0', soc=3D'AST2500 rev A1'): + cpu_id=3D'0x0', soc=3D'AST2500 rev A1', + dt_model=3DNone): self.set_machine(machine) self.vm.set_console() self.vm.add_args('-drive', f'file=3D{image},if=3Dmtd,format=3Draw', @@ -19,6 +20,8 @@ def do_test_arm_aspeed_openbmc(self, machine, image, uboo= t=3D'2019.04', self.wait_for_console_pattern('## Loading kernel from FIT Image') self.wait_for_console_pattern('Starting kernel ...') self.wait_for_console_pattern(f'Booting Linux on physical CPU {cpu= _id}') + if dt_model: + self.wait_for_console_pattern(f'Machine model: {dt_model}') self.wait_for_console_pattern(f'ASPEED {soc}') self.wait_for_console_pattern('/init as init process') self.wait_for_boot_complete() --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339707; cv=none; d=zohomail.com; s=zohoarc; b=P7mUZDc/n1tqkHAOQMpAcNGIWr36bq18Xtyk1vICcpRw1BAMag7KjGRqalPG7eraTQsxAr0YXPy/Nmmo/jl8ZDMP/1dGqAbecHjDKMwvCSVUrvGDQR0W/xbPChjJ2l8u4ydvrZ7jTxd6njNnvVPXE8OEw9FJzdcXq0TaHwFAPzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339707; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=Wfgnax45aICt6Jk7Ro6ypa6BY2EaCT+RRKjj6PSNFs8=; b=VSKKLT/INBYDgIAw5FoM7Fkc7htgf66HPRJwC3t7eh08/QIQeZ02knLgrVbHIN4O1XvsLpVTcLnpx3aanVWFyWJxaaMnqufz3C/l+G4mkVnBnH5yNZhEk7hEwE/ZXa4C8+fzm1rmznxwFGdH30kKymf0rBtQteYDlRN6S9xghoY= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339706844710.0384254001397; Wed, 29 Jul 2026 08:41:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6PN-0006ib-75; Wed, 29 Jul 2026 11:41:25 -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 1wp6PI-0006i6-8Z for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:41:20 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6PD-00024W-HV for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:41:16 -0400 Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-47de0093c42so891802f8f.3 for ; Wed, 29 Jul 2026 08:41:15 -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-47fb6b0ef88sm9908108f8f.23.2026.07.29.08.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:41:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339674; x=1785944474; 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=Wfgnax45aICt6Jk7Ro6ypa6BY2EaCT+RRKjj6PSNFs8=; b=ovIwKbR3rKH9Z21MmE+GHz8SajN4cRnzQ/txqWCubnDAOJ3mJSS4ZqY59dUDSjIto4 fm7uWEla1o9sKbUZ1nqT4hHzfgeCJxJPr/1ANNzcWDtkqLBMZWyR4eIAYk+CtyHWHFpt wgphhSFsde5vlyQcNtPcbGLdx74Wz7ET9fXYQR/3N2BXRTD2ptLqa7xA/ZqI7bEyuQUs NxfzNPphOfcOC1woBdRowI8wOZEychnP72XfiGfKED5VbBVf98Hrv7r+YxKovy/4o7ex giki9OuOyc2JDaNPp9JqQHlf6zT/To+3kbh7YSRL4rC1uUzfTU0tpSgCI2tKlR7mBP7x KdAQ== X-Gm-Message-State: AOJu0Yy+5O5hT6hMwBx5iUYyzzMJBjtr1/r5o8Tn/mcgXCwMVDqnglaQ GNHGw+9dl2XwicxHiDq0D1UChnE7rn4knGYPIcVyiZWPsCX5fvge13BXU9Wg8wU7 X-Gm-Gg: AR+sD11j0FH6f1adAfHMhfKkpFmYjPlRZjS0Yci1egufvh3ZyaaUbneD/t15SHUCzzc 2g/b2qz70i9LYv6oh9bzA2w+R/YGG/hdXlFXMB/wRhcgXORK8d5e+lIy7XxL0WzoNLL0NFi6SIE cPjOEgr0sglzRWD+i/6P/Wt7B+H/jPR2GA6JxgGJekPzmLAub0EfsyGKHKE4aDX1XWNd4QCFNa1 uS9HEoEMK9wpcYMfe6TRN9mQb4+NwEDH4A2cU1Cwi9eO4zmpTFtdDyvHuGm8NCpmKM5VIDXswVP QY+jm9pWiEOqbmoFjzR5eOOuf4b68i6VODMsVyTA+VAHKtEDj7ap0fEs3CR2tolgeOdEf94wii2 38Wkj0A5xeQXoAqSW1CPNZqw9nP+Sk4/SZSUmKh6LWGLv33ng+kyemECbtJfWq1ALJ0KcoKPgz2 sPEZSewaMbfTH2dWzH3p8oYYGesyMRSMyOI4hwTWW4gPs+AgKbEqUEeWaJMO3Gk79GuJ3G9kMpu KohanyGAM3wZ4xDWqFSMlR5pKNzedERu/xX X-Received: by 2002:a05:6000:4902:b0:47f:9096:3c57 with SMTP id ffacd0b85a97d-47fb1eab364mr9370179f8f.40.1785339674061; Wed, 29 Jul 2026 08:41:14 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:53 +0200 Subject: [PATCH 17/25] tests/functional: give the set_machine probe VM the test workdir MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-17-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337964; l=1100; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=Z+1yI9ZlM43E+k0NqAp1ImIMvg64cZpfA63qBC1lq6E=; b=p3ZPoaVQaMoUhqcwXzxowFOcrqom/B2Cp0ujOdgH6gbdM+Zxbt3P9FzbwLrV6TlMqb5yG/W/g 8hz+FG8ZFUKAyWKhBcoEq5yUDoj871e1agFAVXejpUyQyLBWcF2pT4a 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.42; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f42.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339708045158500 set_machine() launches a throwaway QEMUMachine to query the available machine types, but constructs it without base_temp_dir, so it falls back to the hardcoded "/var/tmp" default instead of the writable per-test workdir that the actual test VM already uses. Pass base_temp_dir=3D self.workdir for consistency; this also fixes VM launch on hosts where /var/tmp is not writable. Signed-off-by: Emmanuel Blot --- tests/functional/qemu_test/testcase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu= _test/testcase.py index e4179d165c..ed861709e1 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -317,7 +317,7 @@ def set_machine(self, machinename): cls =3D type(self) =20 if not hasattr(cls, "_machines"): - tmp_vm =3D QEMUMachine(self.qemu_bin) + tmp_vm =3D QEMUMachine(self.qemu_bin, base_temp_dir=3Dself.wor= kdir) tmp_vm.set_machine('none') =20 try: --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339828; cv=none; d=zohomail.com; s=zohoarc; b=Uj7/N8Q+nJgaW+N0WqEMhiKNQslhF7+a5dm8npIBCa/kjSS/1NIa1L9A7usShdKJ0evHcEjzJyCjR0MhDDtsY2/YdfyhpBOXgg469xBbqGeBoSDNzHm5eTTDdK2UeAAG/uOd6pRpAozUqA3uSfH68zTy2gRw+u9jHsHTOCsCIfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339828; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=F4nZHdINTnucSq7Z8OlpkEOEdhRIl21v1VFou+xFxuI=; b=SlrVE2rKYvwRxksRPyoPuZC5KM/ZPkHRdoC9pnIJHZNd9ZgjkjGZKiqJ5Fcx/tfGMSkjPeZ2ZPIxa6HcAxwWoEwjXNhmw5XncNxhZTjG7TT7o1iXStNjterAyoIQKo28H8HOf2tusQPjyavggp4z15xibx5w3fYx90tkYjZcpug= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339828644785.3896041155768; Wed, 29 Jul 2026 08:43:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6RI-0007QS-7b; Wed, 29 Jul 2026 11:43:24 -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 1wp6RG-0007Q2-7H for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:43:22 -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 1wp6RD-0002PB-1r for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:43:21 -0400 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-49555a0e68bso5946085e9.2 for ; Wed, 29 Jul 2026 08:43:18 -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-4976bd6e179sm72738865e9.9.2026.07.29.08.43.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:43:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339797; x=1785944597; 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=F4nZHdINTnucSq7Z8OlpkEOEdhRIl21v1VFou+xFxuI=; b=dokUZBQWu0Z8Fz/5RJdAs5E3wgWwINKg4hlqjQaCETMV95o+2lftWFfI7fwIvKJe4O PUBnW4lceFrkXyI06jTQG0SAGI607hwKkJ9sDtqHQsZop3/11tU1+Y8BW/lcnn0MgfLP Ab0NksTe8PkPVGZRD+3S1nPUDk80CFevblaZ9YaxAiiYlqcC/K8gFNg5pOVA2F8Mbd4q KyBi6E3C0mGeE55plcplIkPXOS2swQszRzobF9Fr8rudXVoITN42RhtwUVIuCoHfNBlw Xk4tOsW94XnLjcHoF3Bmt3ebT0zQA+b4sk+rswUvEpaNYVxzZAe5gAizaiEhqyfxePsR AS1g== X-Gm-Message-State: AOJu0YzdqVAvLaAJiXt3j2Q2Xt/rI/vePXz3XJ3E7TN2wCR8HHfgbRCQ MzMpn827F+/I7Wl88og2OE0CGtmyB7VO1HieQtS3PB0iUy9M3WCzQn/RxjlepNHV X-Gm-Gg: AR+sD12ZQJlCSf0BmSHbPTD0YkmDRkU7ZGsQPChQsoPTzjMCF4sNdKHFJfhvieauKi8 pSPOOBk/14YrEwnz5x9LO6ApzK8op2oAGNEd+VrdrxzVE6QG5gjc/WPS5iBOYYcR4VCjEnGN2Pu Y+b9YEmQthRiwOnyGMSWR2HV/OegD83ITVWebU05w8LLDworqkxneF2wcnNWKkWZumdST2RmNad xCJWYeQVEHyK0CAjuBwXhcuPmrBSo9b7Ky85MAhSNU51Km4pjT9f9E2C6kGp8KD10WHYKK4Cqci MHD1YKWfmfph+Axqp3NIJCAIw1i7geDaMWb4DtlVR0m1MKzeATHXop1OC/RBSv+BoJHhl4R7Sdo r/8m0e0O5CnZRzzOlWD5oQ17PX5tZc1EnGImMTYRo6ic815rOPUyeU5lN4hAB842zbHC++LjRRI 8NdHM8vE5DKsC3v9neZMpQSi4WBYR8c1jio0VRzu9iiUKgyiBIxbr96n/Gm3T29OnPfw06Pzrbp +rixSVF/J0mFs8VBtgl4qa2G+OC9YZmg+tmIJKey2hE4Fk= X-Received: by 2002:a05:600c:3144:b0:495:6a50:3fb8 with SMTP id 5b1f17b1804b1-496c642d855mr73577715e9.1.1785339797269; Wed, 29 Jul 2026 08:43:17 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:54 +0200 Subject: [PATCH 18/25] tests/functional: add a pure-Python device-locator resolver MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-18-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337965; l=25422; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=7fD1yFWWWP8lDPwkjc60ENxjrgiLOYsAzw1MFakslyM=; b=q5unU7AAbpz66K2eRgianaM1zbWMPQwBsy4NI6bWcaS8oSvVn06Kmar5ITnm7QErfhGd/pW8U S79SONxm+w2CPSYl1RoHT2uX9l0Rc0B6teY9JpLc2j+ix/5NzKt2+Vz 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339831255158500 Add DeviceLocator, a helper that addresses a device by its position on the bus -- bus, address, type or index -- rather than by a QOM path. A QOM path locates a device under the object that owns it, by enumeration order, and so says nothing about where the device actually sits in the bus topology. From a QOM anchor DeviceLocator instead walks the bus and device hierarchy, alternating bus and device hops, to reach the target. It relies only on standard QOM queries over QMP, needing no custom commands or changes to QEMU. QEMU still supports Python 3.9, but 3.9 reached end of life on 2025-10-31. This new, optional helper therefore adopts the clearer type-hint syntax introduced in Python 3.10 (such as "X | Y" unions) rather than the more verbose 3.9 equivalents. Its import is guarded so the module still loads on 3.9; tests that use the resolver are skipped there. Signed-off-by: Emmanuel Blot --- tests/functional/qemu_test/locator.py | 578 ++++++++++++++++++++++++++++++= ++++ 1 file changed, 578 insertions(+) diff --git a/tests/functional/qemu_test/locator.py b/tests/functional/qemu_= test/locator.py new file mode 100644 index 0000000000..a735c0710d --- /dev/null +++ b/tests/functional/qemu_test/locator.py @@ -0,0 +1,578 @@ +# Device locator: resolve a device from a QOM anchor plus a typed +# bus/device traversal, entirely over QMP. +# +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import re +import sys +from collections.abc import Callable, Iterable +from typing import Any, NamedTuple + +from qemu.qmp import ExecuteError + + +# The type hints below use PEP 604 unions ("X | None") and PEP 585 built-in +# generics ("list[...]"), which require Python 3.10+. +# Fail with a clear message rather than a cryptic TypeError from the +# annotations when run on an older interpreter. +if sys.version_info < (3, 10): + version =3D ".".join(map(str, sys.version_info[:3])) + raise RuntimeError( + f"qemu_test.locator requires Python 3.10+; " + f"interpreter is Python {version}") + + +BusDomain =3D tuple[str, str | None] +"""A bus domain: ``(bus_typename, address_property_or_None)``.""" + + +class LocatorError(Exception): + """Raised when a locator cannot be resolved.""" + + +class DeviceSelectors(NamedTuple): + """Parsed selectors of a single device hop ("type@addr#index=3Did").""" + typename: str | None =3D None + """QOM type name.""" + addr: int | None =3D None + """Bus address.""" + on_bus_index: int | None =3D None + """On-bus (BusChild) index.""" + ident: str | None =3D None + """Device id.""" + + +class DeviceLocator: + """ + Find a device by traversing the bus and device hierarchy, addressing + it by position -- bus, address, type or index -- rather than by a + fragile canonical QOM path. + + A locator string is a QOM anchor followed by a typed traversal that + alternates bus and device hops. Resolution runs against a live guest + over QMP, using only qom-list / qom-get / qom-list-types, so it works + against any QMP-capable QEMU without extra commands. + + Grammar:: + + [ '::' ( '~' )* ] + + '::' leaves the QOM anchor and enters typed traversal; '~' crosses + the device<->bus boundary (either direction). Because bus<->bus is + impossible and the only object->object hop is the leading controller + (which follows '::' directly, never '~'), every '~' marks a + device<->bus crossing. + + is a QOM path: absolute ("/machine/soc"), partial ("soc", + matched as a component suffix), or empty for /machine. + + Hops alternate between object context and bus context. Starting from t= he + anchor a hop is one of: + + object hop [ '[' index ']' ] + Descend to a direct (child<>) child whose concrete QOM type is-a + (e.g. "aspeed.i2c-ast2600"), picked by [index] when + several match. This names a controller by its real QOM type, with + no keyword table involved. + + bus hop [ '[' channel ']' ] + Select a bus owned by the current object. is a domain keyword + ("i2c", "spi") or a bus QOM type ("i2c-bus", "SSI"); [channel] pic= ks + among the buses of that type, ordered by their trailing number. On= ly + bus domains are tabulated, and solely to map a keyword to its bus + type and to the device address property used by '@' below. + + device hop [type] [ '@' addr ] [ '#' index ] [ '=3D' id ] + Match a device on the current bus by QOM type, bus address (the I2C + address or SPI chip-select), on-bus (BusChild) index and/or id. + + Example: "/machine/soc::aspeed.i2c-ast2600[0]~i2c[9]~tmp75@0x4b". + """ + + DEFAULT_BUS_DOMAINS: dict[str, BusDomain] =3D { + "i2c": ("i2c-bus", "address"), + "spi": ("SSI", "cs"), + } + """Keyword -> ``(bus_typename, address_property_or_None)``.""" + + BUS_BASE =3D "bus" + """The QOM base type every bus derives from.""" + + def __init__( + self, + qmp: Callable[..., Any], + bus_domains: Iterable[tuple[str, str, str | None]] | None =3D None, + ) -> None: + """ + :param qmp: a callable ``qmp(command, **args)`` returning the QMP + payload and raising on error -- e.g. ``QEMUMachine.cmd= ``. + :param bus_domains: optional iterable of ``(keyword, bus_typename, + address_property)`` tuples registered up front; the + "i2c" and "spi" bus domains are always registered. + """ + self._qmp =3D qmp + self._bus_domains: dict[str, BusDomain] =3D dict( + self.DEFAULT_BUS_DOMAINS) + self._qom_subtypes_cache: dict[str, set[str]] =3D {} + for keyword, bus_typename, address_property in bus_domains or (): + self.register_bus_domain(keyword, bus_typename, address_proper= ty) + + def register_bus_domain(self, keyword: str, bus_typename: str, + address_property: str | None =3D None) -> None: + """ + Register an additional bus domain. + + :param keyword: domain keyword used in a bus hop (e.g. "i2c"). + :param bus_typename: the QOM bus type backing the domain. + :param address_property: device property holding the bus address, = or + None when the domain has no address selec= tor. + """ + self._bus_domains[keyword] =3D (bus_typename, address_property) + + # -- QOM access over QMP --------------------------------------------- + + def _qom_list(self, path: str) -> list[dict[str, Any]]: + """ + List the QOM child/link properties of an object. + + :param path: canonical QOM path to enumerate. + :return: the ``qom-list`` payload, one dict per property. + """ + return self._qmp("qom-list", path=3Dpath) + + def _qom_get(self, path: str, prop: str) -> Any: + """ + Read one QOM property. + + :param path: canonical QOM path of the object. + :param prop: property name to read. + :return: the property value. + """ + return self._qmp("qom-get", path=3Dpath, property=3Dprop) + + def _qom_type_of(self, path: str) -> str: + """ + Return an object's concrete QOM type name. + + :param path: canonical QOM path of the object. + :return: the QOM type name. + """ + return self._qom_get(path, "type") + + def _qom_subtypes(self, typename: str) -> set[str]: + """ + Return the set of every type that is-a @typename (itself included). + + :param typename: the base or interface type name. + :return: the implementing type names, cached per base. + """ + cached =3D self._qom_subtypes_cache.get(typename) + if cached is None: + listed =3D self._qmp("qom-list-types", implements=3Dtypename, + abstract=3DTrue) + cached =3D {entry["name"] for entry in listed} + cached.add(typename) + self._qom_subtypes_cache[typename] =3D cached + return cached + + def _qom_is_a(self, concrete: str, base: str) -> bool: + """ + Report whether one QOM type is-a another. + + :param concrete: a concrete QOM type name. + :param base: a base or interface type name. + :return: True if @concrete is or derives from @base. + """ + return concrete =3D=3D base or concrete in self._qom_subtypes(base) + + # -- QOM tree helpers ------------------------------------------------ + + @staticmethod + def _inner_type(proptype: str) -> tuple[str | None, str | None]: + """ + Split a "child"/"link" property type. + + :param proptype: a QOM property type string. + :return: ``(kind, inner)`` with kind "child" or "link", or + ``(None, None)`` for any other property. + """ + match =3D re.match(r"(child|link)<(.+)>$", proptype) + if match: + return match.group(1), match.group(2) + return None, None + + @staticmethod + def _order_key(name: str) -> tuple[int, str]: + """ + Ordering key for a QOM path component: the last run of decimal dig= its + in the name ("aspeed.i2c.10" -> 10), or -1 when it carries no numb= er. + + :param name: a canonical path component. + :return: ``(index, name)``, with the name as tie-breaker. + """ + runs =3D re.findall(r"\d+", name) + return (int(runs[-1]) if runs else -1, name) + + def _canonical_children(self, path: str) -> list[tuple[str, str, str]]: + """ + Enumerate the canonical (child<...>) children of an object. + + :param path: canonical QOM path to enumerate. + :return: ``(name, property_type, child_path)`` per canonical child. + """ + children: list[tuple[str, str, str]] =3D [] + for prop in self._qom_list(path): + kind, inner =3D self._inner_type(prop["type"]) + if kind =3D=3D "child" and inner is not None: + children.append((prop["name"], inner, + path + "/" + prop["name"])) + return children + + def _collect_buses(self, root: str, + bus_typename: str) -> list[tuple[str, str]]: + """ + Collect the domain buses reachable under @root, pruned at each fou= nd + bus so buses nested behind a downstream device (e.g. an I2C mux) a= re + not gathered. + + :param root: QOM path to search from. + :param bus_typename: the domain's QOM bus type. + :return: ``(name, path)`` per bus, sorted by component order. + """ + found: list[tuple[str, str]] =3D [] + for name, concrete, child_path in self._canonical_children(root): + if self._qom_is_a(concrete, bus_typename): + found.append((name, child_path)) + else: + found.extend(self._collect_buses(child_path, bus_typename)) + found.sort(key=3Dlambda item: self._order_key(item[0])) + return found + + def _bus_children(self, bus: str) -> list[tuple[int, str]]: + """ + Enumerate the devices attached to a bus. + + :param bus: canonical QOM path of the bus. + :return: ``(on_bus_index, device_path)`` per attached device, sort= ed + by index. + """ + kids: list[tuple[int, str]] =3D [] + for prop in self._qom_list(bus): + match =3D re.match(r"child\[(\d+)\]$", prop["name"]) + kind, _ =3D self._inner_type(prop["type"]) + if match and kind =3D=3D "link": + kids.append((int(match.group(1)), + self._qom_get(bus, prop["name"]))) + kids.sort(key=3Dlambda item: item[0]) + return kids + + # -- anchor / plain-path resolution --------------------------------- + + def _exists(self, path: str) -> bool: + """ + Report whether a QOM path resolves to an existing object. + + :param path: an absolute QOM path. + :return: True if the object exists. + """ + try: + self._qom_list(path) + return True + except ExecuteError: + return False + + def _all_paths(self, root: str =3D "/machine") -> list[str]: + """ + Collect every canonical object path under @root, @root included. + + :param root: QOM path to search from. + :return: the list of canonical paths. + """ + paths: list[str] =3D [root] + for _name, _concrete, child_path in self._canonical_children(root): + paths.extend(self._all_paths(child_path)) + return paths + + def _resolve_anchor(self, anchor: str) -> str: + """ + Resolve a QOM anchor: empty -> /machine, an absolute path used + verbatim, otherwise a component-suffix search over the whole tree. + + :param anchor: the anchor part of a locator. + :return: the resolved canonical QOM path. + :raises LocatorError: if the anchor is missing or ambiguous. + """ + if anchor =3D=3D "": + return "/machine" + if anchor.startswith("/"): + if not self._exists(anchor): + raise LocatorError(f"anchor '{anchor}' not found") + return anchor + + wanted =3D anchor.split("/") + matches =3D [path for path in self._all_paths() + if path.split("/")[-len(wanted):] =3D=3D wanted] + if not matches: + raise LocatorError(f"anchor '{anchor}' not found") + if len(matches) > 1: + raise LocatorError(f"anchor '{anchor}' is ambiguous " + f"({len(matches)} found)") + return matches[0] + + # -- hop parsing ---------------------------------------------------- + + @staticmethod + def _parse_indexed(token: str) -> tuple[str, int | None]: + """ + Parse an object or bus hop ("name" or "name[index]"). + + :param token: the hop token. + :return: ``(name, index_or_None)``. + :raises LocatorError: on a malformed hop. + """ + match =3D re.match(r"([^\[]+)(?:\[(\d+)\])?$", token) + if not match: + raise LocatorError(f"malformed hop '{token}'") + index =3D int(match.group(2)) if match.group(2) is not None else N= one + return match.group(1), index + + @staticmethod + def _parse_device(token: str) -> DeviceSelectors: + """ + Parse a device hop into its selectors. + + :param token: the device-hop token ("type@addr#index=3Did"). + :return: the parsed selectors. + :raises LocatorError: on a malformed or empty hop. + """ + typename: str | None =3D None + addr: int | None =3D None + index: int | None =3D None + ident: str | None =3D None + pos =3D 0 + length =3D len(token) + # A leading bare run (no sigil) is the QOM type selector. + if pos < length and token[pos] not in "@#=3D": + start =3D pos + while pos < length and token[pos] not in "@#=3D": + pos +=3D 1 + typename =3D token[start:pos] + seen =3D typename is not None + while pos < length: + sig =3D token[pos] + pos +=3D 1 + start =3D pos + while pos < length and token[pos] not in "@#=3D": + pos +=3D 1 + value =3D token[start:pos] + if sig =3D=3D "@": + try: + addr =3D int(value, 0) + except ValueError: + raise LocatorError(f"malformed address '@{value}'") + elif sig =3D=3D "#": + try: + index =3D int(value, 10) + except ValueError: + raise LocatorError(f"malformed on-bus index '#{value}'= ") + elif sig =3D=3D "=3D": + ident =3D value + seen =3D True + if not seen: + raise LocatorError("empty device hop") + return DeviceSelectors(typename, addr, index, ident) + + def _is_bus_token(self, token: str) -> bool: + """ + Report whether a hop names a bus (a domain keyword or a bus QOM ty= pe) + rather than an intermediate object. + + :param token: an object-or-bus hop token. + :return: True for a bus hop. + """ + name =3D token.split("[", 1)[0] + return name in self._bus_domains or self._qom_is_a(name, self.BUS_= BASE) + + @staticmethod + def _pick(items: list[str], index: int | None, what: str) -> str: + """ + Select one entry from an ordered match list. + + :param items: the ordered candidate paths. + :param index: the requested index, or None to require a single mat= ch. + :param what: a description used in error messages. + :return: the selected path. + :raises LocatorError: if nothing matches, the match is ambiguous, = or + the index is out of range. + """ + if index is None: + if not items: + raise LocatorError(f"no {what} found") + if len(items) > 1: + raise LocatorError(f"{what} is ambiguous " + f"({len(items)} found); add an index") + return items[0] + if index >=3D len(items): + raise LocatorError(f"{what} index {index} out of range " + f"({len(items)} found)") + return items[index] + + # -- resolution ----------------------------------------------------- + + def resolve(self, locator: str, typename: str | None =3D None) -> str: + """ + Resolve a locator to a canonical QOM path (usable with qom-get). + + :param locator: the locator string (see the class grammar). + :param typename: if set, the leaf is verified to be-a this QOM typ= e. + :return: the resolved canonical QOM path. + :raises LocatorError: if the locator does not resolve to exactly o= ne + object (not found, ambiguous, unknown bus or + malformed), or the leaf fails the type check. + """ + sep =3D locator.find("::") + if sep < 0: + return self._apply_type(self._resolve_anchor(locator), typenam= e) + + cur =3D self._resolve_anchor(locator[:sep]) + bus: str | None =3D None + bus_concrete: str | None =3D None + dom: BusDomain | None =3D None + + for token in locator[sep + 2:].split("~"): + if token =3D=3D "": + raise LocatorError(f"empty hop in locator {locator!r}") + if bus is not None: + cur =3D self._hop_device(bus, bus_concrete, dom, token) + bus =3D None + elif self._is_bus_token(token): + bus, bus_concrete, dom =3D self._hop_bus(cur, token) + cur =3D bus + else: + cur =3D self._hop_object(cur, token) + + return self._apply_type(cur, typename) + + def _hop_object(self, cur: str, token: str) -> str: + """ + Apply an object hop, descending to a direct child by QOM type. + + :param cur: current QOM path to search under. + :param token: the object-hop token ("type" or "type[index]"). + :return: the matched child's canonical QOM path. + :raises LocatorError: if zero, several (without an index) or an + out-of-range child matches. + """ + name, index =3D self._parse_indexed(token) + matches: list[tuple[str, str]] =3D [] + for child_name, _inner, child_path in self._canonical_children(cur= ): + if self._qom_is_a(self._qom_type_of(child_path), name): + matches.append((child_name, child_path)) + matches.sort(key=3Dlambda item: self._order_key(item[0])) + return self._pick([path for _name, path in matches], index, + f"object '{name}'") + + def _hop_bus(self, cur: str, + token: str) -> tuple[str, str, BusDomain | None]: + """ + Apply a bus hop, selecting a bus owned by the current object. + + :param cur: current QOM path to search under. + :param token: the bus-hop token ("bus" or "bus[channel]"), where + "bus" is a domain keyword or a bus QOM type. + :return: ``(bus_path, bus_concrete, domain)``; @domain is the mapp= ed + domain for a keyword, or None for a raw bus type (its add= ress + property is then inferred at the device hop). + :raises LocatorError: on an unknown bus, or a missing, ambiguous or + out-of-range bus. + """ + name, index =3D self._parse_indexed(token) + if name in self._bus_domains: + dom: BusDomain | None =3D self._bus_domains[name] + bus_typename =3D dom[0] + elif self._qom_is_a(name, self.BUS_BASE): + dom =3D None + bus_typename =3D name + else: + raise LocatorError(f"'{name}' is not a bus domain or bus type") + + buses =3D self._collect_buses(cur, bus_typename) + bus_path =3D self._pick([path for _name, path in buses], index, + f"bus '{name}'") + return bus_path, self._qom_type_of(bus_path), dom + + def _hop_device(self, bus: str, bus_concrete: str | None, + dom: BusDomain | None, token: str) -> str: + """ + Apply a device hop, matching one device on the current bus. + + :param bus: canonical QOM path of the current bus. + :param bus_concrete: the bus's concrete QOM type, for domain infer= ence. + :param dom: the active domain, or None to infer it from the bus. + :param token: the device-hop token. + :return: the matched device's canonical QOM path. + :raises LocatorError: if zero or several devices match. + """ + sel =3D self._parse_device(token) + + if dom is None and bus_concrete is not None: + for spec in self._bus_domains.values(): + if self._qom_is_a(bus_concrete, spec[0]): + dom =3D spec + break + + matches: list[str] =3D [] + for index, dev_path in self._bus_children(bus): + if self._device_matches(dev_path, index, sel, dom): + matches.append(dev_path) + + if not matches: + raise LocatorError(f"no device matches '{token}'") + if len(matches) > 1: + raise LocatorError(f"device hop '{token}' is ambiguous " + f"({len(matches)} matches)") + return matches[0] + + def _device_matches(self, dev_path: str, index: int, + sel: DeviceSelectors, dom: BusDomain | None) -> bo= ol: + """ + Test one device against a hop's selectors. + + :param dev_path: canonical QOM path of the candidate device. + :param index: the device's on-bus (BusChild) index. + :param sel: the parsed selectors to match. + :param dom: the active domain (provides the address property), or = None. + :return: True if the device satisfies every selector. + """ + if sel.typename is not None: + if not self._qom_is_a(self._qom_type_of(dev_path), sel.typenam= e): + return False + if sel.addr is not None: + address_property =3D dom[1] if dom else None + if address_property is None: + return False + if self._qom_get(dev_path, address_property) !=3D sel.addr: + return False + if sel.on_bus_index is not None and index !=3D sel.on_bus_index: + return False + # '=3Did' matches the object's canonical-path leaf, which for a de= vice + # created with '-device ...,id=3DX' is X. + if sel.ident is not None and dev_path.rsplit("/", 1)[-1] !=3D sel.= ident: + return False + return True + + def _apply_type(self, path: str, typename: str | None) -> str: + """ + Verify a resolved object's type, if requested. + + :param path: canonical QOM path of the resolved object. + :param typename: expected QOM type, or None to skip the check. + :return: @path unchanged. + :raises LocatorError: if the object is not of @typename. + """ + if typename is not None and not self._qom_is_a(self._qom_type_of(p= ath), + typename): + raise LocatorError(f"resolved object is not of type '{typename= }'") + return path --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785339979; cv=none; d=zohomail.com; s=zohoarc; b=Ew5egkH6Rn6e5Udstts7srRbG5WGn5FPFo+kcBsbr4AH2NoqqBr7qNcDfEUwT5yPV0bTAIYlvYoZOY42JOZDQUTr52KrWvfHtbS867KgJKJntxyqPgiGFDUQsMCy/Q0j5XnGjXcdLQYm5UFu75aPfCAxs6dGcaOxJB1vh5R0g3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785339979; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=OAjwt6a8vdNB+oG797ToKY41wPbzvFgL3YkCXxogL1g=; b=AZIrEsJeiLjgCHri6V3Ab7YUtABVKoMPMvmaIxOkXx88b0oEMJPEdO7UuaDh1+oa0r4s2aNoawimAC+JfOXf0EcEHpMtNaH0k9J7WVRcjQKq6NHZiUkPOTubhyhyNQzTW6ju01EaBr76eRQes8AOKEbncxSoXp7gUovQQiBGIHg= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785339979555741.6991173277091; Wed, 29 Jul 2026 08:46:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6U1-0000i8-PP; Wed, 29 Jul 2026 11:46: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 1wp6Ti-0000fI-UU for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:45:55 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6Tf-0003C1-M0 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:45:53 -0400 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-47640541585so873680f8f.1 for ; Wed, 29 Jul 2026 08:45:51 -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-47fb6aa392asm8506629f8f.5.2026.07.29.08.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:45:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785339950; x=1785944750; 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=OAjwt6a8vdNB+oG797ToKY41wPbzvFgL3YkCXxogL1g=; b=CO8u9fms3sWFETqCu0JFlpMWFQvjmOx7px/VPYikhz6E4N4TJikaH8YZvlXzMS6llS r93H8T3aWHUjZLmG7sj092OD+b7CXvNkEU+cf+j3ARuUMFnij7YkZq1YAqq8XuqMY0PD H4tGA6LSQ74CNJHmP2f/fDuEdfLgRMJmLMEZkXRTl1Nbsent7Bnt/d9lkHvnBLVW9RyQ IxT/JeGefITEz1ngYLwrlsKUBvijIVbp9FI/R2PyPZw4gmV9kK5Cw6sNIaqBQHSHzB5P EFfRFw7FKS63ZHHFWatpQ7/+fG2Jn72Wia74r6jP7ZoAffWozRSUwI2thMGuL2I/KNhx TQgQ== X-Gm-Message-State: AOJu0YynxEH0x0FazGxEtnRvVlxV6v0dID+g1ERuDwcUO0Rt/qvmP0V5 HJJCGzTDVR92kSLUWgjt/wIRd5F/ao3ItCeod8fH4eOJrvCQwXFXq2ebumS5dmVR X-Gm-Gg: AR+sD11yWaIip7TCUIc7zNYPk0GVg+ElnGPHY2z+yQZkC7HL30jR5RMKvR+am/zfaU5 6L8F1WUwDxEO+i2BM3+urAygo/QK3YlltHrSJW0Pqp8UlVJRC2SWYSG0OHa+tVh7dfizmYQYSe9 JPuL9JQzz5GgKHqt1MSWX+i6Zn7w8z5uA2sZ2nMjTPYx3PFYvZT7YWXF3mMmbufHbqkXdQn/VEE aAxlpn2Smq47mRR6fkWwfBkWqVw7z/K7CnL+hWfVON2XR/Ew/ZqpITe4n7ye2Q28x1n74547LoK EaqRF4+gPnrj8Ix2XXlLQhVai3Pm3lz0j7uLlWISWG7XWSw009jHsdc/jUUJOFi1VBGX5rZdRCt IEfTs67bJqwkPfAB+F633mUQvq8pmnIq4Jo5jM4/pgBq9kCOQM7DZckMeT3wB+VjEon9WdozkCz AF8q0MbLyR9F/5z0QshdQyTpQXHi23TwDWLqvL+kkbyjYxu2aVTzHBIw5a5IMCsfoJHmA7YTZq7 P51mzrxb1Rz4acZld06mc6mNYW6rDuJeiQy X-Received: by 2002:a05:6000:430c:b0:47f:9201:6409 with SMTP id ffacd0b85a97d-47fb1f17008mr8304563f8f.40.1785339949822; Wed, 29 Jul 2026 08:45:49 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:55 +0200 Subject: [PATCH 19/25] tests/functional: add a device-locator self-check MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-19-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337965; l=6533; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=jqZZfMhZoTV1zdg+ZdDlImYNATVoR6jePLxXWf0xlWU=; b=HYfooY7CInYj++mKmoH/0/6rc3MAbtUIUtmjuPYaLYJLZERco/dEhFEX22LL8T3UzJlOtyq9J fdzxwclRiVUB5VMaeyUIn3Ef5dfsTLakVvyH6k8ld4VjqANIZjiSEU3 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.51; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f51.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785339982096158500 Launch the SanMiguel BMC paused (-S) and resolve its I2C temperature sensors and SPI flashes by position over QMP, exercising the DeviceLocator grammar: controller/bus hops, the address/type/on-bus-index selectors, the leaf type assertion and the ambiguous/unknown/out-of-range error paths. The test needs no disk image and completes in about a second, so it joins the quick arm test set. Signed-off-by: Emmanuel Blot --- tests/functional/arm/meson.build | 1 + tests/functional/arm/test_device_locator.py | 114 ++++++++++++++++++++++++= ++++ 2 files changed, 115 insertions(+) diff --git a/tests/functional/arm/meson.build b/tests/functional/arm/meson.= build index 61b00932db..bb78dcf3e4 100644 --- a/tests/functional/arm/meson.build +++ b/tests/functional/arm/meson.build @@ -29,6 +29,7 @@ test_arm_timeouts =3D { } =20 tests_arm_system_quick =3D [ + 'device_locator', 'migration', ] =20 diff --git a/tests/functional/arm/test_device_locator.py b/tests/functional= /arm/test_device_locator.py new file mode 100644 index 0000000000..eea88f4fb0 --- /dev/null +++ b/tests/functional/arm/test_device_locator.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python3 +# +# Functional self-check for the pure-Python DeviceLocator helper. +# +# It launches the SanMiguel BMC paused (-S) and resolves its I2C sensors a= nd +# SPI flashes by position over QMP, so it needs no disk image and runs in +# about a second. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import sys + +from unittest import skipIf + +from qemu_test import QemuSystemTest + +# DeviceLocator's type hints require Python 3.10+; import it only when +# available so this module still loads (and skips) on the 3.9 baseline. +if sys.version_info >=3D (3, 10): + from qemu_test.locator import DeviceLocator, LocatorError + + +@skipIf(sys.version_info < (3, 10), 'DeviceLocator requires Python 3.10+') +class DeviceLocatorTest(QemuSystemTest): + + def setUp(self): + super().setUp() + self.set_machine('sanmiguel-bmc') + # Launch paused with defaults enabled so the aspeed board instanti= ates + # its SPI flashes (created only under defaults_enabled()); still no + # disk image is needed. + self.vm.add_args('-S', '-display', 'none') + self.vm.launch() + self.locator =3D DeviceLocator(self.vm.cmd) + + def _address(self, path): + return self.vm.cmd('qom-get', path=3Dpath, property=3D'address') + + def _cs(self, path): + return self.vm.cmd('qom-get', path=3Dpath, property=3D'cs') + + def test_resolve_tmp75_sensors(self): + # The SanMiguel board wires ti,tmp75 sensors on I2C buses 5, 9 and= 10 + # behind the aspeed.i2c-ast2600 controller. + ctrl =3D '/machine/soc::aspeed.i2c-ast2600[0]' + for locator, addr in ((f'{ctrl}~i2c[5]~@0x48', 0x48), + (f'{ctrl}~i2c[9]~@0x4e', 0x4e), + (f'{ctrl}~i2c[10]~@0x48', 0x48)): + path =3D self.locator.resolve(locator, 'tmp75') + self.assertEqual(self._address(path), addr) + + def test_device_selectors(self): + bus =3D '/machine/soc::aspeed.i2c-ast2600[0]~i2c[5]' + by_addr =3D self.locator.resolve(f'{bus}~@0x48') + # A type selector combined with the address must reach the same de= vice. + self.assertEqual(self.locator.resolve(f'{bus}~tmp75@0x48'), by_add= r) + # The on-bus (BusChild) index selector addresses a device position= ally. + by_index =3D self.locator.resolve(f'{bus}~#0') + self.assertTrue(by_index.startswith('/machine')) + # A bus hop also accepts the raw bus QOM type in place of the keyw= ord. + raw =3D '/machine/soc::aspeed.i2c-ast2600[0]~i2c-bus[5]~@0x48' + self.assertEqual(self.locator.resolve(raw), by_addr) + + def test_type_assertion(self): + # The leaf type is validated when a type argument is passed. + self.assertRaises(LocatorError, self.locator.resolve, + '/machine/soc::aspeed.i2c-ast2600[0]~i2c[5]~@0x4= 8', + 'ds1338') + + def test_resolution_errors(self): + ctrl =3D '/machine/soc::aspeed.i2c-ast2600[0]' + # No device sits at that address on the bus. + self.assertRaises(LocatorError, self.locator.resolve, + f'{ctrl}~i2c[5]~@0x99') + # A bare bus hop under /machine/soc spans every i2c bus on both the + # i2c and i3c controllers, so it is ambiguous without a controller= hop. + self.assertRaises(LocatorError, self.locator.resolve, + '/machine/soc::i2c') + # Unknown object type in a controller hop. + self.assertRaises(LocatorError, self.locator.resolve, + '/machine/soc::nope') + # Out-of-range bus index. + self.assertRaises(LocatorError, self.locator.resolve, + f'{ctrl}~i2c[99]~@0x48') + # A stray or doubled '~' yields an empty hop, which is malformed. + self.assertRaises(LocatorError, self.locator.resolve, + f'{ctrl}~~i2c[5]~@0x48') + + def test_resolve_spi_flashes(self): + # The FMC controller carries two flashes on chip-selects 0 and 1; = the + # first SPI controller carries one on chip-select 0. + for locator, cs in ( + ('/machine/soc::aspeed.fmc-ast2600[0]~spi[0]~@0', 0), + ('/machine/soc::aspeed.fmc-ast2600[0]~spi[0]~@1', 1), + ('/machine/soc::aspeed.spi1-ast2600[0]~spi[0]~@0', 0)): + path =3D self.locator.resolve(locator, 'ssi-peripheral') + self.assertEqual(self._cs(path), cs) + + def test_spi_selectors(self): + bus =3D '/machine/soc::aspeed.fmc-ast2600[0]~spi[0]' + by_cs =3D self.locator.resolve(f'{bus}~@0') + # A type selector plus the chip-select reaches the same flash. + self.assertEqual( + self.locator.resolve(f'{bus}~ssi-peripheral@0'), by_cs) + # The on-bus index selector resolves positionally. + self.assertTrue( + self.locator.resolve(f'{bus}~#1').startswith('/machine')) + # A wrong-type assertion on an SPI leaf is rejected. + self.assertRaises(LocatorError, self.locator.resolve, + f'{bus}~@0', 'tmp75') + + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785340127; cv=none; d=zohomail.com; s=zohoarc; b=jDey3qTDfsKx7Pn5VywA+IcQTTKzLfE3KUjHyONVJFwfbCUOuhpO/7k38fkNyh99zIm86gAc06Y88HD2wUxwxc4Gg6XXb+Op+bpjwFq8GywO28KjfbFYLbCU/XJbzHRVRVlxu+b09HCARoiUoa0mG38AnLerWDVNh1eRSjUAiIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785340127; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=5ltDudjYe8pxHl7XxlWpSMq7ZVdlJnNvkY4t3t1H/f4=; b=hy0pKmUv/ooJHnzPQ5z7JrQhP5dIXH+ShJR6qUoekHk3pQHV882K+ugPMBy4Y78gwUXEB0KkH+skVnfy17jqMJqwVgp3klPv+cOwgYDfcTWIhhNcTM1zmPWSXpgCrMeyRP25oML2vjo6obeWiF5uTXBCdvJY/2w8PobuQt9P8pQ= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785340127112773.2668104581547; Wed, 29 Jul 2026 08:48:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6WA-0001CI-M6; Wed, 29 Jul 2026 11:48:26 -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 1wp6W9-0001CA-BJ for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:48:25 -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 1wp6W7-0003ME-Rp for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:48:25 -0400 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4954afac04bso12548785e9.0 for ; Wed, 29 Jul 2026 08:48:23 -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-49764d8e826sm76409705e9.8.2026.07.29.08.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:48:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785340102; x=1785944902; 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=5ltDudjYe8pxHl7XxlWpSMq7ZVdlJnNvkY4t3t1H/f4=; b=ohl82RqbmA0rf12xBOO/JZ8ad1SwZay65Ulp35oAfT9SIiOIVJJsxKJpKXFuI+HNfN mXSlgHHXjTNTHFwPCQ7qdfifrikknbkL0FOHHnD/A+JYq0SEoAMRT8aovsgIKWlwQftC gSiHc0GbCZFpkaFW31O792hPK3ppilyCMlw2RctRfThvjYwfjBOMZVYllJeA4GJwZz7E Km0c+G9+fM8iK24WAU+lu9PKUWNPwfxQIsfxImTaz6ZPQ+LvaTIbaF+IcXtorbNlcksR D7WkrL5YroHMwNOWIr9+So43OlBB3HWR+sd0n558+sMhalSBn2oJMEDvByezVhoINnM6 43Sw== X-Gm-Message-State: AOJu0Yx+6ahFUF+mahDexADzbyGj2KomC7o8NIkAUBi3DGO10GXeA6Uk oCJvAU4PPiB0YRb3CApCfSqCHFoY/GzaYkOPiuZu9454KXY+EDOlk20ZuTlaNTYN X-Gm-Gg: AR+sD12na/kMlmOo+5JVPzJ83WLNq5o7jhwMrkvIfhwMchyPoHi0NZ75D+Q/16pG1IX MBq1ERDQu3VdjWdteHgcsvvntOaZaDEKve6N8nxnPSYN7oeqO4bFF1r/JuQnhYhNTm9UIfPzdA7 u4V+gn+/KQsyRENT/iAMXmsmc4kjlb84l/IZHAtc3ufYd/r7h6/hVuPAtu7Lwbxn2g+ccpzSmPf 8LOtqWMwLwttfNR29Va3Sxrw6YUh5IpYWqcVHIBFzDbzHYPLCg0rnrWvlovVrcG58EWN97LhR/W 5x6raPEBMkCpLAO19uc17Vx8odAP3K4G0zDQqr6/fLY4QndFFrwRpCqt5ybviz2OXWTtsx+a9c9 5fYjERf8BqS7aMHwvA9R9pC1HWqUX2sWT47cWpEYmF4wOH3t18lRo9AkHE8Wkn6+xZrh3o6vjqM 1hShtoi1kHcDoa8owOIWIXIUSls88ZdHRIy6IccMTTrpUFGhS5nnQiEpb0FYOU8F0kI6flY0A58 a3qnMswBrRxls06s9EqdmZjn53XfB0K6qsjk8Kwjd2Z2lg= X-Received: by 2002:a05:600c:c162:b0:495:4589:cea6 with SMTP id 5b1f17b1804b1-496c65c071cmr90396795e9.34.1785340102104; Wed, 29 Jul 2026 08:48:22 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:56 +0200 Subject: [PATCH 20/25] tests/functional: aspeed: add hwmon sensor read helpers MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-20-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337965; l=1618; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=OWHYGLs9Qe48IkzshR4rzRcrC9b6ZFXaLE+JZF/S+fM=; b=AWknD4yiasxBSfKYStR/C9DNNvTETapWBjxW+mYR/B1Of/Y2V7/3H2kcbUliBivT3zQl4W5rO yhVxaIaHHA4A75jbhq4X4Beov6AiCvkxixA4oix+g6i3Lwtqy/EpQrm 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785340129157158500 Add read_hwmon()/wait_hwmon_value() to AspeedTest so board tests can read a sysfs hwmon attribute over the console and poll it until it reaches an expected value, instead of each test carrying its own copy. Signed-off-by: Emmanuel Blot --- tests/functional/aspeed.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/functional/aspeed.py b/tests/functional/aspeed.py index 08af6b4839..84d40fc0e9 100644 --- a/tests/functional/aspeed.py +++ b/tests/functional/aspeed.py @@ -2,6 +2,9 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 +import re +import time + from qemu_test import exec_command_and_wait_for_pattern from qemu_test import LinuxKernelTest =20 @@ -29,6 +32,19 @@ def do_test_arm_aspeed_openbmc(self, machine, image, ubo= ot=3D'2019.04', def wait_for_boot_complete(self): self.wait_for_console_pattern('login:') =20 + def read_hwmon(self, hwmon, attr): + return exec_command_and_wait_for_pattern( + self, f'cat {hwmon}/{attr}', self.PROMPT) + + def wait_hwmon_value(self, hwmon, attr, expected): + pattern =3D re.compile(rb'(?m)^%d\r*$' % expected) + if pattern.search(self.read_hwmon(hwmon, attr)): + return + time.sleep(2) + out =3D self.read_hwmon(hwmon, attr) + if not pattern.search(out): + self.fail(f'{attr} did not reach {expected}: {out!r}') + def do_test_arm_aspeed_buildroot_start(self, image, cpu_id, pattern=3D= 'Aspeed EVB'): self.require_netdev('user') self.vm.set_console() --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785340155; cv=none; d=zohomail.com; s=zohoarc; b=BW2wZAdHMmX5Cz6rus8NgzgB4ww2r8oU6DaWKr08YlIrMqOkH47BS6Rv3IcfjbBO6aOd0f1VwPthrtz0S7g8N5CSrzJzupqAUDwrroam6/qDi9Y511SBiGlsctypc7Yxmkk8izGzxNAAHPrbKnTM0pQhKGHQXtslRitqFAaX2Ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785340155; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=7GAlPRK+FUlIvHrrHmY3hq8ta1s+tUUrFH5KYLEatV8=; b=TxJDz3beDvU6/riUscW0ZpwC6dB1u8RezSfB+9fYtjc02oEISHKRsBXkL6cemNeJQsJ7GMbkK/TmBjFpbeyq8UGADB+oKlYsHvi/QUPaMqbsindyicJWRTroEHlNGJITBb7ZIzTxjuvAVsc7RfNitJUuB3WvvpkcD05FYfZAsjI= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785340154907135.94479518864568; Wed, 29 Jul 2026 08:49:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6WY-0001KW-Cv; Wed, 29 Jul 2026 11:48:50 -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 1wp6WW-0001JE-TB for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:48:48 -0400 Received: from mail-wr1-f51.google.com ([209.85.221.51]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6WU-0003Nm-L5 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:48:48 -0400 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-47f7027ca11so754514f8f.3 for ; Wed, 29 Jul 2026 08:48:46 -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-49764d70042sm62675855e9.1.2026.07.29.08.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:48:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785340125; x=1785944925; 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=7GAlPRK+FUlIvHrrHmY3hq8ta1s+tUUrFH5KYLEatV8=; b=csWm5D8PQDL9wW2q4tRWlKRdw1fmjgeUFKmqEL4mwxgP1rIfPZ+bqtEotk93O4aQiC FB27q6pi+2qhZw+5wCN7qAs8EL5lSjbHFB8gk+dtBpEwaAfIUcfx2xB60s9X0NJ9P3s/ /9TgwN//wnxnAvpVGreCwiBCQQ2kYkB8SsOyImM9//RZacUDnn0qpbNqIJ/V9Xw0qzSx 2wQETtcuHzXuII4HOnwTp3mrXVZ81v1JwP8w4OnxBTfwsUpXmgxIdZDsrEeKrAxUmBdo Z6L+ErCyOlKHi0JEdxvvHmeXrqb6Fls2OuCEFP3aiODZ4oG/vOoa2jOsHAmBwl8kNMs/ VVgg== X-Gm-Message-State: AOJu0YwYoalWODOwFoH/zr/jUw9wuSiCqRfmNebwp2Pp2NRcdzuZWWSj bupptRM8v0CAqy1wllqOrJaK6GEUor0Fbho5yyHK4Lm65louT8F8rXGg06eWBG4+ X-Gm-Gg: AR+sD13tjafipDHlGS89f+POZhmrByEn25cXRSc2tWyaQbzQ32IlNf2GqjXc24eeYQC twa292rZt7zLPnwZu/Z92jlx0b7YwOBT/QXeY7O2ybRgCEhA1+HENcnIF7XweN36bROYBXSLg1l 2o4s1DnUy68ikH8lkV4XD11TLxwLjMRUeokLlGNVZaXOfwG5kvmFqbHXxQOgq0kC0FldpC+A2bp HtqiN/j1xbqbW0Y4bpEsgOMgakN7tSkPhnh6pVQRDumwPww6N08k8tYdqJu1For+iq/wg0lODtK DzXBKAKfMgXcczoj3WNeZOjA+LFaJvEWtgBA0h2EtfZzndBltZrM8p3Ke+QCPtBq4vt858m3+h2 gR771mWHoB3GzYRqfaSJ/A41oPgPAaTzpv5/6fo/pmzPwBerJeNiH4YAkHVFN8U7zgfNEVoP4ET Bm35rZCXD93heFJHlND0n7MTkWHc2swjXeQ3kFDmvdEcoGJMmSDLu+7R9F8bpLhnRJAfl4d9oC3 WCOh5i7D3k/D+Ak7bsnrIlIcmLSm8VxsZRF+V5AF9YCTKU= X-Received: by 2002:a05:600c:468c:b0:495:4dea:f7f5 with SMTP id 5b1f17b1804b1-496c6596732mr77723795e9.29.1785340125051; Wed, 29 Jul 2026 08:48:45 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:57 +0200 Subject: [PATCH 21/25] tests/functional/arm: sanmiguel: add BMC boot test MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-21-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337965; l=4763; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=3rFxFx4Yry9jkNAk1yr11//RJi6X7ARRmYJTQcfmW/U=; b=KQtHSzxysOyeJ4kdFcQR4UiRWC94/4/00yygclSP5yjIKXD/qMKoZp54ixgMpqKhCbQw84d3C tctODHch6dzBPKGQQi0n3fIwsuFfaTfpzdIxqxn9vcuzcWKX5qJmZiM 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.51; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f51.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785340157022158500 Boot the SanMiguel BMC from its OpenBMC image and exercise its three TMP75 sensors: inject a temperature into each over QOM and check the guest hwmon interface reports it back. Address the sensors through the device locator rather than hardcoded QOM paths. The boot image is currently hosted in a personal fork (github.com/eblot/qemu-aspeed-boot); the asset URL will be updated to the Aspeed maintainer repository (github.com/legoater/qemu-aspeed-boot) once the machine image is accepted there. Signed-off-by: Emmanuel Blot --- tests/functional/arm/meson.build | 2 + tests/functional/arm/test_aspeed_sanmiguel.py | 72 +++++++++++++++++++++++= ++++ 2 files changed, 74 insertions(+) diff --git a/tests/functional/arm/meson.build b/tests/functional/arm/meson.= build index bb78dcf3e4..4b263dd3e0 100644 --- a/tests/functional/arm/meson.build +++ b/tests/functional/arm/meson.build @@ -17,6 +17,7 @@ test_arm_timeouts =3D { 'aspeed_catalina' : 480, 'aspeed_gb200nvl_bmc' : 480, 'aspeed_rainier' : 480, + 'aspeed_sanmiguel' : 480, 'bpim2u' : 500, 'collie' : 180, 'cubieboard' : 360, @@ -53,6 +54,7 @@ tests_arm_system_thorough =3D [ 'aspeed_catalina', 'aspeed_gb200nvl_bmc', 'aspeed_rainier', + 'aspeed_sanmiguel', 'bpim2u', 'canona1100', 'collie', diff --git a/tests/functional/arm/test_aspeed_sanmiguel.py b/tests/function= al/arm/test_aspeed_sanmiguel.py new file mode 100644 index 0000000000..3d35e4aa86 --- /dev/null +++ b/tests/functional/arm/test_aspeed_sanmiguel.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +# +# Functional test that boots the Facebook SanMiguel BMC machine +# +# Copyright (c) 2026 Meta Platforms, Inc. and affiliates. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import sys + +from qemu_test import Asset +from qemu_test import exec_command_and_wait_for_pattern +from aspeed import AspeedTest + +# DeviceLocator's type hints require Python 3.10+; import it only when +# available. On the 3.9 baseline the module still loads and the boot +# test still runs; only the locator-based sensor checks are skipped. +if sys.version_info >=3D (3, 10): + from qemu_test.locator import DeviceLocator + + +class SanMiguelMachine(AspeedTest): + + ASSET_SANMIGUEL_FLASH =3D Asset( + 'https://github.com/eblot/qemu-aspeed-boot/raw/5a972e968856bdf0493= e4040ccc70455d1879511/images/' + 'sanmiguel-bmc/openbmc-20260616025450/obmc-phosphor-image-sanm= iguel-20260616025450.static.mtd.xz', + 'f0b79a09cd861d79919facc16af1dbdc85a3df55b06dd62ba0318a01580d447b') + + TMP75_SENSORS =3D ( + ('/machine/soc::aspeed.i2c-ast2600[0]~i2c[5]~tmp75@0x48', + '/sys/bus/i2c/devices/5-0048/hwmon/hwmon*'), + ('/machine/soc::aspeed.i2c-ast2600[0]~i2c[9]~tmp75@0x4e', + '/sys/bus/i2c/devices/9-004e/hwmon/hwmon*'), + ('/machine/soc::aspeed.i2c-ast2600[0]~i2c[10]~tmp75@0x48', + '/sys/bus/i2c/devices/10-0048/hwmon/hwmon*'), + ) + PROMPT =3D 'root@sanmiguel:~#' + + def test_arm_ast2600_sanmiguel_openbmc(self): + image_path =3D self.uncompress(self.ASSET_SANMIGUEL_FLASH) + + self.do_test_arm_aspeed_openbmc('sanmiguel-bmc', image=3Dimage_pat= h, + uboot=3D'2019.04', cpu_id=3D'0xf00= ', + soc=3D'AST2600 rev A3', + dt_model=3D'Facebook SanMiguel BMC= ') + + exec_command_and_wait_for_pattern(self, 'root', 'Password:') + exec_command_and_wait_for_pattern(self, '0penBmc', self.PROMPT) + + # The sensor round-trip below resolves devices with DeviceLocator,= which + # requires Python 3.10+; skip just that part on older interpreters. + if sys.version_info < (3, 10): + return + + locator =3D DeviceLocator(self.vm.cmd) + + # Drive each sensor through QOM and check the kernel hwmon interfa= ce + # reports it back; a distinct 0.5 C per-sensor step (the finest the + # TMP75 register round-trips at any resolution) catches a mis-reso= lved + # locator hitting the wrong sensor. + for idx, (sensor, hwmon) in enumerate(self.TMP75_SENSORS): + path =3D locator.resolve(sensor, 'tmp75') + self.assertIn(b'lm75', self.read_hwmon(hwmon, 'name')) + offset =3D idx * 500 + for milli_c in (55000 + offset, 30000 + offset): + self.vm.cmd('qom-set', path=3Dpath, + property=3D'temperature', value=3Dmilli_c) + self.wait_hwmon_value(hwmon, 'temp1_input', milli_c) + + +if __name__ =3D=3D '__main__': + AspeedTest.main() --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785340237; cv=none; d=zohomail.com; s=zohoarc; b=anhl+44lpHh22dWBjkC7DeSmI0rUOcOh6+fNnDyVxmXKvFyTn0loPOtONy0gBCFrLrKCvJQVPYTKh950leAGU7C1mJ8ggR+Bxc7ccO8uve936vx1ktOQppEQ7Yb9RGcIs5z85OgyYrqOZrK1sbC3QZNlL0sc8yScQjvE+1SdSek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785340237; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=74jbyL6fPJ4k+KuBJbacmztdNW2KvwZdLLnAZhfQEFc=; b=FOiH6W72UlnbVdGk2b2OTnIE7FBeaXfrMKYWQED4PKRqIBvNnd+2jTgk4eCU6qrrsxRcmJm9vF8XqSsqD6GAS8EGqFwMZ0ZcsAehiVTnFirKl+E9NiPwI8fDM5LSWTlvcatTa6bJVKNf/HSn6YVrSMBaXy/U3ZTnLCIS/wgu52I= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785340237276581.7292914273613; Wed, 29 Jul 2026 08:50:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6Xm-00024N-93; Wed, 29 Jul 2026 11:50:06 -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 1wp6Xl-00023v-8V for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:50:05 -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 1wp6Xj-0003TI-JR for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:50:05 -0400 Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-47f3b39f2a1so1121682f8f.2 for ; Wed, 29 Jul 2026 08:50: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-47fb6b0ef25sm8802118f8f.24.2026.07.29.08.50.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:50:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785340202; x=1785945002; 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=74jbyL6fPJ4k+KuBJbacmztdNW2KvwZdLLnAZhfQEFc=; b=g/GWUErr/eXhN/qUBH5wdrFF0xHJKgFEv+Xq5C1j82H3TfYP8YcA4yi2DVkJpDt6pE vu4g81egF75pTKUO26ikkJNunjK72QEUBLJ7a+XDo16npFnQW0hFMMc5bC/YteMqbgAt ee5Sc3LhjOg2h5Bmmnqh1hbzBmXS1RaCxb+Dz6bgrcsfufo53wkNaDcZX4E5xY3TN81E U3drxAk+Fwgrf0cZhy7yoowPPUUHlMKgNUbIAQTjeRUb+zxAZTL75GaUdVLskpWwBc9P nrWh/MUekk8gYslIXcJCLR6k9D0lptA8quWaPhcHAMfbwNsveoVxM/aeMCG5/NXNrSv8 wCqg== X-Gm-Message-State: AOJu0YwwPKzEK737um+FlJDmCE4Nb8aogUxE0A9+nva/DO8HgBBLuaT6 b1oXiSBycP8qJamA2d1TWKE/yZJkFeifbaGuWl3OTiyPkgG8VSQAbQKZVcamLFhW X-Gm-Gg: AR+sD10R6ZkcqNDQYVeICFPKzm9JfBm6nBWFHugfTjs/Ydb6SrBrBTs+YqENX/9aC2H b95ezSk234XromYqIdSnTHtnHSw5dOcOrsE9lEYsZVJiFoMTsGMsHok8/rufe5JBGfQMLdeUcuQ t9PPWaj3MDG9Sxh064l2uXnZtykeyr2z4TqPdisunpsojpbVR5Rtw4RUxFJ7wZYXi8/cmQfCDaa zbHwlOaDW/YDl1LXzU4emsmuqtLC8GW9RDZ+V1eZ1mujKYeZXewbWUrpxQb/fO8SOMQpXXRhP0b TI6iOkk7yHgCKBZ2Ebl7Y5oBOkmoY/vkAgFYQD8JtSfqbooaDIfcFhV9lke5MGEQtwpL5gcOw3Z 6WPsO88TtcSe65AxaErf1IfGo7bbWGtY3nEUEabiQh0oRtKk0FPOq6h3btMfFYqh0/wGPN7ItFs 3enctlrCVEPEOVB2mS7jyNHMAs+yBxdw+7mRImxzjI8iLRNSPYkR2b9jvxbwHxQzYdmbPEXeZ0z fvhI/SwUFWC3vQEYLd0zEq/+qaVNdJW3Mvl X-Received: by 2002:a05:6000:2903:b0:47f:703b:1851 with SMTP id ffacd0b85a97d-47fb1ebc30bmr9494680f8f.59.1785340201799; Wed, 29 Jul 2026 08:50:01 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:58 +0200 Subject: [PATCH 22/25] tests/functional/arm: catalina: test TMP75 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-22-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337965; l=3329; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=ltFXNfKtRdSz7pZKawpvHBeNBUB93gRly05M45TjzOE=; b=b96I6KvOhE3yNyfiSzW/G2sSbG45qrIKXE/XqtrNTS4RqZuGWlJt39quP9qgp1GVT/Vwww5Eh jpLgJNM/0/5DQmGoKEdvfwlOVXlKLsAJIjMftfiTqJYAup5ai4XYfBZ 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785340239473158500 Extend the Catalina boot test to exercise the TMP75 sensor on i2c9: confirm the guest exposes it through hwmon, then drive the temperature over QOM and check hwmon reports the injected value back. Address the sensor through the device locator rather than a hardcoded QOM path. Signed-off-by: Emmanuel Blot --- tests/functional/arm/test_aspeed_catalina.py | 37 ++++++++++++++++++++++++= +++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tests/functional/arm/test_aspeed_catalina.py b/tests/functiona= l/arm/test_aspeed_catalina.py index dc2f24e7b43..b80b5fe92b7 100755 --- a/tests/functional/arm/test_aspeed_catalina.py +++ b/tests/functional/arm/test_aspeed_catalina.py @@ -4,16 +4,30 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 +import sys + from qemu_test import Asset +from qemu_test import exec_command_and_wait_for_pattern from aspeed import AspeedTest =20 +# DeviceLocator's type hints require Python 3.10+; import it only when +# available. On the 3.9 baseline the module still loads and the boot +# test still runs; only the locator-based device checks are skipped. +if sys.version_info >=3D (3, 10): + from qemu_test.locator import DeviceLocator + =20 class CatalinaMachine(AspeedTest): =20 ASSET_CATALINA_FLASH =3D Asset( - 'https://github.com/legoater/qemu-aspeed-boot/raw/a866feb5ef81245b= 4827a214584bf6bcc72939f6/images/catalina-bmc/obmc-phosphor-image-catalina-2= 0250619123021.static.mtd.xz', + 'https://github.com/legoater/qemu-aspeed-boot/raw/a866feb5ef81245b= 4827a214584bf6bcc72939f6/images/' + 'catalina-bmc/obmc-phosphor-image-catalina-20250619123021.stat= ic.mtd.xz', '287402e1ba021991e06be1d098f509444a02a3d81a73a932f66528b159e864f9') =20 + TMP75_LOCATOR =3D "/machine/soc::aspeed.i2c-ast2600[0]~i2c[9]~tmp75@0x= 4b" + TMP75_HWMON =3D "/sys/bus/i2c/devices/9-004b/hwmon/hwmon*" + PROMPT =3D "root@catalina:~#" + def test_arm_ast2600_catalina_openbmc(self): image_path =3D self.uncompress(self.ASSET_CATALINA_FLASH) =20 @@ -21,5 +35,26 @@ def test_arm_ast2600_catalina_openbmc(self): uboot=3D'2019.04', cpu_id=3D'0xf00= ', soc=3D'AST2600 rev A3') =20 + exec_command_and_wait_for_pattern(self, 'root', 'Password:') + exec_command_and_wait_for_pattern(self, '0penBmc', self.PROMPT) + + self.assertIn(b"tmp75", self.read_hwmon(self.TMP75_HWMON, "name")) + + # The QOM round-trips below resolve devices with DeviceLocator, wh= ich + # require Python 3.10+; skip just those on older interpreters. + if sys.version_info < (3, 10): + return + + tmp75 =3D DeviceLocator(self.vm.cmd).resolve(self.TMP75_LOCATOR, "= tmp75") + + # temp1_input reports the temperature in millidegrees Celsius. Dri= ve it + # through QOM (units of 0.001 C) and check the kernel hwmon interf= ace + # reports the injected value back. + for milli_c in (55000, 30000): + self.vm.cmd("qom-set", path=3Dtmp75, + property=3D"temperature", value=3Dmilli_c) + self.wait_hwmon_value(self.TMP75_HWMON, "temp1_input", milli_c) + + if __name__ =3D=3D '__main__': AspeedTest.main() --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785340302; cv=none; d=zohomail.com; s=zohoarc; b=JohtYlwCekOZETQ7q4lwt7u2Z2qvmthtpYgj0PxbLKVuwbTTTKvTOcDLCcn9Lq+wEX889CHtGARPFnio8qUk1q1wSaOp/WEeNQ3NnKJlmX90kpvFEkOS+gNIfZTl87KjZAu27yXKMtWbRtB/S7MIpQug+MuYou77wOYI2B1/2GQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785340302; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=QZUm9tfsjEjTtlnBZiVGDO9i7PQPNiLnEUF75edt6r8=; b=lyvtZWouEZLXs3Ic/MPpLSoEGIULPcxOiab3E+AEBCuM4F+VSdYd9ZSgTr/cgsEYtiiWv+YI2IuJTgXmBoA6MhHt8DgopUQaWHS33tFBzMp6GCIAg8yzhN7doPrIpAZ4oQf9O4sfLWoSjd8aaXJdYxxPlozuUjbNmZYd+0FQavE= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785340302683218.18320619525775; Wed, 29 Jul 2026 08:51:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6ZB-0002eW-Cb; Wed, 29 Jul 2026 11:51:33 -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 1wp6Z9-0002dv-KI for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:51:31 -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 1wp6Z7-0003ib-Dd for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:51:31 -0400 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-493f6de72faso180295e9.0 for ; Wed, 29 Jul 2026 08:51:29 -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-4976bd83fabsm67580295e9.15.2026.07.29.08.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:51:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785340288; x=1785945088; 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=QZUm9tfsjEjTtlnBZiVGDO9i7PQPNiLnEUF75edt6r8=; b=Vi1y2WPI9LuhddbhgYkTya+12etVvU9aBjutSdp1wRADAbzOZz0KmlltKLio1JwXP/ Sln6FPQWLCqA1uJlCLRxiL+MyBnNww4lmNEjVyk+3FS19jnnGcWXPrrpcn7IVwhZAR2S wRtixuFsxAU6LonRv4XM2FIkG+4gaQC9fzwGatSJsU+UmyuD41S4Sy4qMs1yeXUHzKPy BERUcyEAeN1S2neKKEEO+Uam5BI/0NHLivkVfvJvs8vDOwRpxzYVa+DSLqQLw2GTti6z lzOffKt8BTb7Yc9c5LtU0uQkRYG50zyULlN8z9U2pdgaFyCPO/jlVfb8ZuKPtD5OxXdJ oa5w== X-Gm-Message-State: AOJu0Yzu4gM3ax/5aXB1FQrTKVYHZ+ewnsvShEeQwmyAJv04rhWc0fL4 pU47ltuiegRn60LOvN/S8k68khcd8E9Bf5KoEEmHwnkXm6+6kpRftu9KH4HT30ZZ X-Gm-Gg: AR+sD102IupzSR4GE7jkNGH7WkvQShdjhyLjmK3Dl4Wf3Upw6RC1AmBcmWgp73YuaT9 2BOdXHMohHPiSCt9+iWkdsI+sGyX9UL+sSEPWERY8dDL4T4OQGpcdmaTYco6xHsz/j8zmJGy2hM KLgMaXDGxMGyMwPApfQQRnfubnwoXACFstGK9xtwtvB2avCJjgA0cO3tugGfR4c+cj/P2YYP74F s7j4Nj6WeuT7fM47sj49KEJt6P19d4SpSfb1toTNy2fufcYrTcJVgCTxjW0D0YAspf20avqatSF T/VEVbmMraHW/qWwyv8NosO6/8tt+gIS2EINipJsaxWeWmpiSPq02XqbTROOXiuNgnDydbxN3aC y8b5a9A3RzYPHwUhhb5pouICjtuv6uMEIs7v/DTkslZx5xo+nZw/8708k2tNPiztlVY6GGXp3WD rWHqn3sePJWu1uQP6iJMN5ldSl4Z9+XhH8JSNHnrp0aqj90eZj3oK3Bj09sOlk0+DGz56Fua/mC Q4/kUF/ZEWJ8U57pY4BR6lLPfsu4yj7qm/n X-Received: by 2002:a05:600c:4746:b0:495:3c6f:7c18 with SMTP id 5b1f17b1804b1-497fd2f50bbmr29949825e9.3.1785340287675; Wed, 29 Jul 2026 08:51:27 -0700 (PDT) Date: Wed, 29 Jul 2026 17:12:59 +0200 Subject: [PATCH 23/25] tests/functional/arm: catalina: test PCA9555 IO expander via QOM MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-23-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337965; l=4869; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=x+swaeJ/f66FZ473PfGW+ic8eASLYIskyDGJo0YAj4k=; b=L2VjD8kMI40onDaVTPP/4MaReFi085o/rT1wZ2U7xAYYJ/98Vm7oKDkvClup9EVTwfq7WB5Bm VqGK1rrbdd6DI7w3UrzkqIT/QJ3C2ofhun0yaZ47z7+3bEyvOJPr0X5 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785340303676158500 Drive the io_expander0 (pca9555@20 on i2c2) input pins from the host through the pin%d QOM properties and read each one back both via qom-get and via the guest kernel gpiochip (libgpiod), spanning both 8-bit ports and both ends, then check two pins on different ports are reported independently. Introduce a check_ioexp() helper doing that round-trip so further expanders can reuse it. Address the expander through the device locator rather than a hardcoded QOM path. Signed-off-by: Emmanuel Blot --- tests/functional/arm/test_aspeed_catalina.py | 64 ++++++++++++++++++++++++= +++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/tests/functional/arm/test_aspeed_catalina.py b/tests/functiona= l/arm/test_aspeed_catalina.py index b80b5fe92b..5624774891 100755 --- a/tests/functional/arm/test_aspeed_catalina.py +++ b/tests/functional/arm/test_aspeed_catalina.py @@ -2,6 +2,8 @@ # # Functional test that boots the ASPEED machines # +# Copyright (c) 2026 Meta Platforms, Inc. and affiliates. +# # SPDX-License-Identifier: GPL-2.0-or-later =20 import sys @@ -28,6 +30,10 @@ class CatalinaMachine(AspeedTest): TMP75_HWMON =3D "/sys/bus/i2c/devices/9-004b/hwmon/hwmon*" PROMPT =3D "root@catalina:~#" =20 + # io_expander0: pca9555@20 on i2c2, a 16-bit expander directly on the = bus. + IOEXP0_LOCATOR =3D "/machine/soc::aspeed.i2c-ast2600[0]~i2c[2]~pca9555= @0x20" + IOEXP0_GPIODETECT =3D r"\[2-0020\]" + def test_arm_ast2600_catalina_openbmc(self): image_path =3D self.uncompress(self.ASSET_CATALINA_FLASH) =20 @@ -45,7 +51,9 @@ def test_arm_ast2600_catalina_openbmc(self): if sys.version_info < (3, 10): return =20 - tmp75 =3D DeviceLocator(self.vm.cmd).resolve(self.TMP75_LOCATOR, "= tmp75") + locator =3D DeviceLocator(self.vm.cmd) + tmp75 =3D locator.resolve(self.TMP75_LOCATOR, "tmp75") + ioexp0 =3D locator.resolve(self.IOEXP0_LOCATOR, "pca9555") =20 # temp1_input reports the temperature in millidegrees Celsius. Dri= ve it # through QOM (units of 0.001 C) and check the kernel hwmon interf= ace @@ -55,6 +63,60 @@ def test_arm_ast2600_catalina_openbmc(self): property=3D"temperature", value=3Dmilli_c) self.wait_hwmon_value(self.TMP75_HWMON, "temp1_input", milli_c) =20 + # pca9555@20 spans two 8-bit ports (pins 0-7 and 8-15). + self.check_ioexp(ioexp0, self.IOEXP0_GPIODETECT, (0, 7, 8, 15)) + + def check_ioexp(self, qom, gpiodetect, pins): + # The guest drives these lines as inputs: set_pin injects an exter= nal + # level, read back over QOM and gpioget. Outputs are covered by qt= ests. + chip =3D self.resolve_gpiochip(gpiodetect) + for pin in pins: + self.set_pin(qom, pin, "low") + self.assert_pin(qom, pin, "low") + self.assert_gpio_line(chip, pin, 0) + self.set_pin(qom, pin, "high") + self.assert_pin(qom, pin, "high") + self.assert_gpio_line(chip, pin, 1) + + # Drive two pins to opposite levels at once to confirm they are + # reported back independently. + lo, hi =3D pins[0], pins[-1] + self.set_pin(qom, lo, "low") + self.set_pin(qom, hi, "high") + self.assert_pin(qom, lo, "low") + self.assert_pin(qom, hi, "high") + self.assert_gpio_line(chip, lo, 0) + self.assert_gpio_line(chip, hi, 1) + + def read_catalina_console(self, command): + return exec_command_and_wait_for_pattern(self, command, self.PROMP= T) + + def resolve_gpiochip(self, gpiodetect): + # awk already prints the "gpiochipN" name; just pick it out of the + # console output (the command echo and prompt hold no such token). + out =3D self.read_catalina_console( + f"gpiodetect | awk '/{gpiodetect}/{{print $1}}'") + for token in out.split(): + if token.startswith(b"gpiochip"): + return token.decode() + self.fail(f"could not resolve gpiochip {gpiodetect}") + + def set_pin(self, qom, pin, level): + self.vm.cmd("qom-set", path=3Dqom, property=3Df"pin{pin}", value= =3Dlevel) + + def get_pin(self, qom, pin): + return self.vm.cmd("qom-get", path=3Dqom, property=3Df"pin{pin}") + + def assert_pin(self, qom, pin, expected): + level =3D self.get_pin(qom, pin) + self.assertEqual(level, expected, + f"pin{pin} QOM read {level!r}, expected {expected= !r}") + + def assert_gpio_line(self, chip, pin, expected): + out =3D self.read_catalina_console( + f"echo LINE{pin}=3D$(gpioget {chip} {pin})") + self.assertIn(f"LINE{pin}=3D{expected}".encode(), out) + =20 if __name__ =3D=3D '__main__': AspeedTest.main() --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785340388; cv=none; d=zohomail.com; s=zohoarc; b=lvuW7jYZhCXN6slda66XM1V+zccfo2vhXbKVktLF+1f1UJ13rFJUlq7s8uV9ra9r+yjyUtENfdUZ1fvLdxJws+ZGqWIZXMWb5HiCM8j1BK/btj8AtCyKSE8N47i1U1WHMnN/mBR1oi2eRenMvttR+ozMhtWD12iXcjoydxMlQTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785340388; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=S23pR2ZvsSLYFR0+0DeQ83TbuXFd8+C0obNCg2DOLig=; b=Ywe7zlT0vAidEGhb/owPUSPwM1EBy82G/JP9kDwHzniCSLyaohbVP557C8x+9tHCotF8wAnCdXiHFo96JntORdcObUYfohhcikbuCuJ7+tKXdCkjo5FkEXDZ+83+lxVYY9EpzRp0tTnC/lFDQCpczLhoYusGl0Dr5WWGATvBQd0= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785340388450530.0740564415981; Wed, 29 Jul 2026 08:53:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6a4-00034n-Vj; Wed, 29 Jul 2026 11:52:29 -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 1wp6Zu-00034B-Tp for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:52:19 -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 1wp6Zt-0003ks-HP for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:52:18 -0400 Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-493f75f7172so9093695e9.1 for ; Wed, 29 Jul 2026 08:52:15 -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-47fb6abc703sm9232200f8f.9.2026.07.29.08.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:52:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785340335; x=1785945135; 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=S23pR2ZvsSLYFR0+0DeQ83TbuXFd8+C0obNCg2DOLig=; b=DmdAKJaCPvzgTLCNQpu6Es6YtMZMThDqKxlajy7zW3xH5rMrSPrOOhdbwf50TTfPtO y6sBQ+WyDKpmruG1h6aGsdWDRprUZR8lro7WM4KGiNF0DRp7olwRP20/WneZkN4ci2Cu 1I3v1BOPAltcGWvD5C3+NTnddy/+Mc1pfLhYmBx5lYz1VWmvgxbgZKItGfAZ4DG2gjqU 7tA9pSb8aNLWT1KZ6iCtvBxyzIUjkR5mnYVid1r9PdeFrbmaakLfmt2CSWG5L3dbkstg kF7TqMBn72ixZCuAoG8b2aTuNIx9Ja/dshFcWhgkiku3QjlHxHbav3wTdAt2Il7ThhoH 2H+w== X-Gm-Message-State: AOJu0YzjJ2B72Exo6nhwmxZrOtgXiwsVdjAjOXGtIAGcI63Vy2E0xeyC V55GCQEFL7GQiAUYwam4/W7MYAfp0jNwjxdDpG/Vae2hhmiO/XzLQrK1SJuVQLWe X-Gm-Gg: AR+sD12wdB5gX4GYC7g1+geOMQrwza9FPA+zp/1VilzzeoZaKb7OX11gUSE1FRIhh/q Zs0IGrVJyc+0TrV2vROXJNhA8mGEoERXsX2wj1ekKmSBp/9ujmn1YFlDuws5IfFmblCwr/qkrWJ ie+vf0orWYL/sEdl6PMhLZArYAiZCnI14tu2Frtf6uFm1OZVCSqXKeTA6895RkmjOVS9ndYc6AZ 4/dno6ccK38ePWC+XWiIy63qD+UBYMdnjLnUFS8181imgrD7Z8NgpzrXzWje3ktHpl3DThSwxEa 3kh7/FP63oIzuakrg71hPxwCYFIq0bNsS99rNo0i46vJaBW5YNXX4BE//+GmxZU1agtjtldqj4j 48FHMQGBxXp262Tx2RL+k66l9c23mhNnC3F9nHAxFVCwoCOnYV7NaC5AqNajXndvjmlilCxUpnb h6QWNZf+dAVV3QdFOM2Tif2sCxvHdOsBH26CQbFzSXrtJLfx7DMXQjIwbqt+okAVMjDQzfUkmSc /+pdYiPVMgluaSmiALfenzssZCTW8UnR/Q+ X-Received: by 2002:a05:600c:37c9:b0:495:5062:17f9 with SMTP id 5b1f17b1804b1-496c6586ef5mr82687305e9.30.1785340334609; Wed, 29 Jul 2026 08:52:14 -0700 (PDT) Date: Wed, 29 Jul 2026 17:13:00 +0200 Subject: [PATCH 24/25] hw/arm: catalina: drive pca9554 io expander input pins externally MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-24-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337965; l=1675; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=EtxfxNQ4ajDXh5xrjgZPSfhgjy+Z8hKW5J2/81txDi0=; b=rMYVawj86TmRdA0ZIqeU6Z7QP5vJDeB+O4/UTS57BG0oWEM0HD+J4VbxBfuUdzBnPGrCnZPwi ZXM6tiNJQltAPqBOviArDenJybTyKeu4hoeENAHh4HHDK8asFxYIuHo 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: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785340390025158500 Create io_expander5 (pca9554@27) with hw-dir=3Dtrue so its pin%d QOM properties drive the external input level of each pin, matching the pca9555 expanders, instead of the legacy behaviour that forces the pin to an output. This lets external agents, including tests, stimulate the input pins and have the guest read them back. Signed-off-by: Emmanuel Blot --- hw/arm/aspeed_ast2600_catalina.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/arm/aspeed_ast2600_catalina.c b/hw/arm/aspeed_ast2600_catal= ina.c index 928e140b21..69e072c932 100644 --- a/hw/arm/aspeed_ast2600_catalina.c +++ b/hw/arm/aspeed_ast2600_catalina.c @@ -545,9 +545,16 @@ static void catalina_bmc_i2c_init(AspeedMachineState *= bmc) i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), TYPE_TMP75, 0= x4f); =20 /* i2c1mux0ch6 */ - /* io_expander5 - pca9554@27 */ - i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 6), - TYPE_PCA9554, 0x27); + /* io_expander5 - pca9554@27 (external agents drive its input pins) */ + { + I2CBus *bus =3D pca954x_i2c_get_bus(i2c_mux, 6); + I2CSlave *ioexp =3D i2c_slave_new(TYPE_PCA9554, 0x27); + + object_property_add_child(OBJECT(bus), "0x27", OBJECT(ioexp)); + object_property_set_bool(OBJECT(ioexp), "hw-dir", true, + &error_abort); + i2c_slave_realize_and_unref(ioexp, bus, &error_abort); + } /* io_expander6 - pca9555@25 */ i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 6), TYPE_PCA9555, 0x25); --=20 2.50.1 From nobody Mon Sep 28 02:03:02 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=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1785340403; cv=none; d=zohomail.com; s=zohoarc; b=ZF7ulbiSlkS5v65ohaIz7E6lVRa2XPwuNCEiZVUdhEe2Vs2SpWV48Q5t1RcRveGhBgYfWZOkVRfr7GyPtBLBLvfQ/VpD2Q9YfV3fDlGVccanPnHjwnHwOclrxUzAMH6OFDr5PJ2GejRM/T4iQ+N7cyqd5dajGxpY/ylDPjbDkfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785340403; 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:References:Sender:Subject:Subject:To:To:Message-Id; bh=AD/ctxxaJ0c1UGixC9zPix/cWBFWLdoXJO6RiTcZO2E=; b=X1eMINPNr1apEPVNCxzNH/p963eWBx0pUK24p4kGl45S/eVVOYpMTTxZTTeNCDrcd2PaRiR/4c26AHgcFZi0ufofgfQI3UvSyeQ7QHjWUw8Kphld+9soPNLRMEA97dG/ZfoAHQbyUPnXFics8d3eO5JDsM8jdWPTxOlPc0ZAPBs= 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=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785340403612285.92418503541376; Wed, 29 Jul 2026 08:53:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wp6ac-0003Zf-0H; Wed, 29 Jul 2026 11:53: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 1wp6aY-0003Ya-Np for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:52:58 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wp6aX-0003qN-9b for qemu-devel@nongnu.org; Wed, 29 Jul 2026 11:52:58 -0400 Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4954a9e8490so15105e9.1 for ; Wed, 29 Jul 2026 08:52:56 -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-49764d72d9asm69319645e9.3.2026.07.29.08.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 08:52:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785340376; x=1785945176; 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=AD/ctxxaJ0c1UGixC9zPix/cWBFWLdoXJO6RiTcZO2E=; b=anCEyy7BwWfVW7HjAhknLwNQ0OE/uC1q/bRVh/tBCbX+ndC5XXztnJqnuSZbsbpFw4 6195UCGrnGSRHCMt5yK07VogXxrJWiC5KTJQ6NsMoPay1bCCCnQllTxIOgF878iEkNZB 73kFPpaqYtwXIPNQGsRcqk6TQxk0HPGar1pY/UPWFJS+KJZmBWMsWDI7HB39hq7YZguD /H0fS9o62xDg3PtJFOEIWvgo7980FRPGZ04KK2FyFbGgA2fbQWw5O8O/eBxj6e5mWlfR uvSkwZFVS4WAlBxMaw8cA02xlIf2pinHZ6i3vU77G2oCqwZu22N8mLqsId67Hi7NV3Hy TknA== X-Gm-Message-State: AOJu0YyvXdgw1LdXbXONtY1vegPbqp100liIO3xLL8yWxg7mXiHHOARu xFbnSTNDhKDkQ08VyrCFv4AGRoe4QgIXFCbi7TQtoDr/kv8CdRu7zXtAo5lFuD+9 X-Gm-Gg: AR+sD12BHBBGXeY2V9hVbpOYuCoFluEyQHws04mBJDNS8Qx22x3DQCNd/mhE5CWgjPA 244PReLqo4D4lAg3QJVeKlyLZRQfLmWiM7IcT2c6vroWSoZpW9ubX+WaaZvFwDrFEdfmBaQG7kx ZOacdXt94ZurscocXWyScXUalxug2HlFkXfDxin6sjy3pWexXjvtiVN+CXXGGSQ8ph2WKHl0wtU ln9HZF0NSIq4AyknDjBAETRwtvroSy9S65D3IEvvOcxXSBuYOEOR2/wkQ6tNoR/IN7HzA49sZMI SgdI6E6qBQeey2S9wC3G1iKdWytJGXyy6v4Q8x/E3pzSWh1hcRFxGFoRlytNxefB7jTWezFJM2s vCNomt10HvSHhR3gp7Y86v9wrb/8wdOuUghMRltJDmg+AjcsNxgYnYQ1DH6sRGghsRVMAdhLeN8 Fi+HvmAFS/pG7Z8BpzI9859G2KxzA5IRQSeuEgnLNk5c0yFSdRO2Lpq588LS8iHhXR0sq7Cvr7D kVZiW4ml+2F4Iy6JnPsCdjI3JEZzsKLLgMl X-Received: by 2002:a05:600c:3b1f:b0:495:6022:5a23 with SMTP id 5b1f17b1804b1-497fd321f45mr31393405e9.19.1785340375806; Wed, 29 Jul 2026 08:52:55 -0700 (PDT) Date: Wed, 29 Jul 2026 17:13:01 +0200 Subject: [PATCH 25/25] tests/functional/arm: catalina: test PCA9554 IO expander via QOM MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260729-sanmiguel-bmc-locator-v1-25-c8f9a8d101f6@free.fr> References: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@free.fr> In-Reply-To: <20260729-sanmiguel-bmc-locator-v1-0-c8f9a8d101f6@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 , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Emmanuel Blot , Emmanuel Blot X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785337965; l=2183; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=8aTFJBX4+2Zfb9dvqeKFk8XY5h03hnbOmzH0dpRmEzQ=; b=BAjG5Wy4c7yHMBsCnKjOPpH/zt7w96VxJuztwuKqrjhTP0l1eFGjVbe1BXKIpiznBUsVdhfAt niP4X1dJuweDLofPmVHlZJqYA2rzeYkuy5VXcUbOnMLNeKCX/ZL5b4G 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.52; envelope-from=eblot.ml@gmail.com; helo=mail-wm1-f52.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, 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: 1785340404139158500 Cover io_expander5 (pca9554@27, behind pca9548@70 channel 6 on i2c1), an 8-bit expander reached through the pca9548 mux. Signed-off-by: Emmanuel Blot --- tests/functional/arm/test_aspeed_catalina.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/functional/arm/test_aspeed_catalina.py b/tests/functiona= l/arm/test_aspeed_catalina.py index 5624774891..f9ee62260b 100755 --- a/tests/functional/arm/test_aspeed_catalina.py +++ b/tests/functional/arm/test_aspeed_catalina.py @@ -33,6 +33,11 @@ class CatalinaMachine(AspeedTest): # io_expander0: pca9555@20 on i2c2, a 16-bit expander directly on the = bus. IOEXP0_LOCATOR =3D "/machine/soc::aspeed.i2c-ast2600[0]~i2c[2]~pca9555= @0x20" IOEXP0_GPIODETECT =3D r"\[2-0020\]" + # io_expander5: pca9554@27 behind pca9548@70 channel 6 on i2c1, an 8-b= it + # expander reached through the mux; gpiodetect confirms its 8 lines. + IOEXP5_LOCATOR =3D ("/machine/soc::aspeed.i2c-ast2600[0]" + "~i2c[1]~pca9548@0x70~i2c[6]~pca9554@0x27") + IOEXP5_GPIODETECT =3D r"-0027] \(8 lines\)" =20 def test_arm_ast2600_catalina_openbmc(self): image_path =3D self.uncompress(self.ASSET_CATALINA_FLASH) @@ -54,6 +59,7 @@ def test_arm_ast2600_catalina_openbmc(self): locator =3D DeviceLocator(self.vm.cmd) tmp75 =3D locator.resolve(self.TMP75_LOCATOR, "tmp75") ioexp0 =3D locator.resolve(self.IOEXP0_LOCATOR, "pca9555") + ioexp5 =3D locator.resolve(self.IOEXP5_LOCATOR, "pca9554") =20 # temp1_input reports the temperature in millidegrees Celsius. Dri= ve it # through QOM (units of 0.001 C) and check the kernel hwmon interf= ace @@ -65,6 +71,8 @@ def test_arm_ast2600_catalina_openbmc(self): =20 # pca9555@20 spans two 8-bit ports (pins 0-7 and 8-15). self.check_ioexp(ioexp0, self.IOEXP0_GPIODETECT, (0, 7, 8, 15)) + # pca9554@27 is a single 8-bit port. + self.check_ioexp(ioexp5, self.IOEXP5_GPIODETECT, (0, 3, 7)) =20 def check_ioexp(self, qom, gpiodetect, pins): # The guest drives these lines as inputs: set_pin injects an exter= nal --=20 2.50.1