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=1785500720; cv=none; d=zohomail.com; s=zohoarc; b=GbgAwj11cRyisRssMbzMiWHgYgz71vwhAeIL6GURBfZ/etfhPC6pwOYFe3KI4am8f1DvNZddJtL8j8j38Cg9e4EKZsaTQUkvoK9Fctle2gtRjQqwNrG2f9wTYUHzX32Lls2HSDv02JebrYbJ4Tq+dot0dEr4OtabEtcUENuNWN0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785500720; 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=aKq+W1aol4VSrYo1ezg9T0WMsOBGDbVoIbwK0w7LDMgk2RIHSq1jzK4HWOrVG5FuiPVSCxHz3LEFwVRs0UL/D/+yrFbNKYHiUmmpBT66EL8Wg8rLMhqv6aW1TKfwmg4+E65+4rpL6EnCDTjxf1TaDJ7swZONd/fQ1Yol+TZRS8c= 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 178550071993658.618043275179275; Fri, 31 Jul 2026 05:25:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmIK-0000Cc-U4; Fri, 31 Jul 2026 08:24:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpmIJ-0000C1-G5 for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:24: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 1wpmIH-0006wO-SD for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:24:55 -0400 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-47f707e5d75so692726f8f.1 for ; Fri, 31 Jul 2026 05:24: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 ffacd0b85a97d-47fd456a5a4sm4341229f8f.20.2026.07.31.05.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:24:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785500692; x=1786105492; 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=e5cR4TiykPdMBTR5ejX2OO9DKRPLrt+WqGVftGYPnb+Wh8D1i82aXChBiWMkuDl9tu 147xTVRjYJLdQL+N2hLJhZA09QUcdTNGZISUadzjCjubH9ad0fduNpqSNKm5Sgt6L0uh swyungrNlAkWRUp01oxkkS1HRVxv2p0ZJiBVNPqzRVduYLPNt7hz3pj2puuqBe9pqd38 Mz/j+Ye1waB6OMM1aZLQ6SR7mV8c/+sy25zv0GI+WdhfMKkXM3JXlHofmFbGDyRnMKIG nYxkZ2rNcAvnDNTkBoOleCdDtjMpKtn2/fq4EXkb6yhxXvR2ojCCwSeytKblLVAAtEHB RKVg== X-Gm-Message-State: AOJu0YxjN8WN0jAVuzXkKbLBxy0BQ7XHgdYkgJ3NbmvuTwU20HAsZSRq Bu0IKh51m0YFgIwrXU5V42Zi0I3kY51LciSEHjzXtRH8yQSe/+dEKRpTE3+yuI8b X-Gm-Gg: AR+sD11Nt9GSIDmBQhCTbaAM/4fvxJSK6bAiIZK9aiN2m6H8WbsiwxLcrOxZYB68qwQ kCjG6gfQrBgoAPkFWEIpzpLPnJa4D3cpByVeNPGrZPsy5LEKKN4IXPEOqwNPe+//Nc+nhLYmYat 0tEkQ8cQbsdR66J+D8r3JPJJFi5C6N92BQnlRVEzR0ZAAKuK6745ndhWebyhuYpIEE+bfbTwRBB obhNvPQCc0KgH/E2AKHUGev9RcCoMbDxUuqf+EJ6oUiruL/3y60gJ6GGw6tKoWSpffGpyZwBmew 2u/hOSsjqDiE1uo9OoM0J84YwDFOkLUJUJcqH28KtXtpJ1NIEcPi3C8wPQ4Et8DVTSsU+TDhOha JRHpvczgyMpBvE5eyfFB6vNrdYxDnb9togAzgCj9ZX2AViP1FqqVUzLKabzikICks4ZbKgbDi9a hmGwJhYuIX28Z6N2OjRcuPFN7THdb+8p1BjilTe7JkPHLrPh51305tx7CUA0pOdmc1p6qXNqqxo ltEeAtCER8zvj3mt3dgD0vuywNmozieF7m7 X-Received: by 2002:a05:6000:178a:b0:47f:d072:87d7 with SMTP id ffacd0b85a97d-47fd2abab7bmr3954083f8f.9.1785500692238; Fri, 31 Jul 2026 05:24:52 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:00 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-1-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=3828; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=2PsFiadmEidEKMJIZBsHzExJztIGcn8WD0wRouSeWs4=; b=qI6Pe1NAfhoE3o3F7JNmzS9/eZ20JQVfOwpYafN0/yieFYcg5BQruxFL9rY4vFS9U+E+9nOaR n+/8JHlBGpfDaJNxkE4Ok0LI2s+pe8kDPAXAugXd1aGa4Kv8qDGdMbE 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: 1785500721519158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785500788; cv=none; d=zohomail.com; s=zohoarc; b=OplaVZ7MaKOKWQ19Kw+4yOKRnqKYXwNew4kxjrYKcCKWP+MOpb7DmUDcpbNuiVJjMzWnEEyhoYqiFfhknkEjnTmJ6Majgfs0zEdeWjWNjUwEDxhY6Q5x8HPfDRJlH4Hh0UIY+WzTZlXsi4YkyoB8riKkwAvPFlOZZ5O947pD8fA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785500788; 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=KuSPbDcSm5/uVFaD02S0M3QQnz5BQcjizWPhsQ+N3sOXlJn+DwLYQQcuRt22Yv1PRcrRJV+Cydit6IWQXV86Wdel9nbCrrCxIyhKGZUKvzblyKF7VEMOF0cdXz6huFZDcnZ97knjNljFWVxFHjKULXYe0irNTPtQPJPUxOAun/M= 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 178550078804079.58892158093772; Fri, 31 Jul 2026 05:26:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmJK-0001jG-FV; Fri, 31 Jul 2026 08:25:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpmJI-0001iw-M5 for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:25:56 -0400 Received: from mail-wr1-f46.google.com ([209.85.221.46]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmJH-0007Tu-7C for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:25:56 -0400 Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-472326ca506so642862f8f.2 for ; Fri, 31 Jul 2026 05:25:54 -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-47fd456a6d7sm4455881f8f.19.2026.07.31.05.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:25:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785500754; x=1786105554; 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=iiUGxTg6MYIthJ4CDI+QEXcwyz6yD/xHc9rTHnx5C6QZ535W/+yvcluXSm9V3x/5L/ VBLAgjVOg2Xs3YMyx1hBFO9Qf0oqNbpu+ISGnGyjEra8t8SyWwE/i0d8sLMrO4m/eG81 Ets0duL95ZvNCn/QgNFaYMpno28nWpdZDmYULsQlaZ0dkCocbeiz3iiOYW4Hkxtm22sc OG0+ER1UykfM4FmAaL5iTliSRXSGrLL8OuscHhqu8XwGoBcDF05pKxUrHli9wmS4Cy09 eULSNc85EQA+2/qr/tVoYVG3bgNaWoc/NPPPTyXmkzeNIgCJxTCQgmW7JumXEWPqSIIT jv7w== X-Gm-Message-State: AOJu0YxJsc8JVE1W38I7pDlkqZjuvpn3ucuS56YcWRfOStf3B6bo/WCc LTv+aoCvBGqEFeanHOFK0AyMze2+ytQzWXGKTQLDsFgAxmuXp1RSYdydNRvDw6yR X-Gm-Gg: AR+sD12VZJ+07Ozh3TTGOwS/mUUnXZBLz18WxrbcAvpvCgt02w1xxhWJlmRjQifib9O hVJrkNfTU0eFTsP7XXiMSSPIxjCm2/x41FVxmJXhX7+QLErVw7oRsIQ1dNt+HY2oF8hYFPMWFoK 3gQGshpx0JX8z11WasBpOT+TUapqB6km3TZGUnpsX+1iG6TObuOHNEASxbqw2U3rvAOPMnxsRWQ Mj5jke/GxJvK7zUB6xl0Tqt2yiCxZgD6vSBX7P4v9zcSpmhH9Yso9QEUaHKQx6z9TKG+oQJnhOf 9FXwbYhBVLgIIrLfgbrIkDmLNxKklS7D2wcWryvx1E/S2byR896qqGrkYBiNEvCbefmITTnqFYr IwesvA9yKZq45EcZy8CaA5KmLP4EWtgxEYlmzr1VQjz86gqgPd96YpOWM8kIdQDPVZkDW4a72cc cakM1RsiPPvf8XclgnZgGYKqWkhfZib5NTtdBlOgnrEawdwt7V4nnD4Kw/fTAf2HFWbrRgdEB+s M0VAhGiUNiekxpuPrzH+m3hj+MT0XIsMjRt X-Received: by 2002:a05:6000:2c02:b0:475:f0f0:9ef7 with SMTP id ffacd0b85a97d-47fd2b653e6mr4749189f8f.60.1785500753574; Fri, 31 Jul 2026 05:25:53 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:01 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-2-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=2294; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=IPpKdB4GNfibCBuZaz5CjB0TPUppqW5ZDDXX0F0+Glo=; b=eZW/p0A+N6UUAczLR7SIkQA4mEdwYgg4QdPiKGpwSCI4ay9LnsvtdaVbJEi9mxOdIgLtkyCRk Fpu/jwFsk6IAoBWndOiQz8363WM7HDhwsW8sCaS+1QqK7u3z2Shr5Ty 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.46; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-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: 1785500790409158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785500856; cv=none; d=zohomail.com; s=zohoarc; b=hWV+ATHSAAAJT7VMgCp/8ExvmAOYZyuGj3E2kQT/EInzs0fPRVc/rcuzlMKDTEYllEk5UFLl2TWODs5z9Tkfxe6kHJm8tq0rYnCLM064wD5+cTR4g9NIFIbuyVMaZmV9nGdYdp4uULD95isCUmU1OLecGxksbTRNu1TNMyRKSM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785500856; 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=HykXu58LnWNNvUJmGV3ZjfAIrMpIpbTyHnxeurlKJNgoHZ/FZcb2cdoQQZpNxlclj4HgWGtKuz12X5Xfq1spyby/J9/tXbx9mmBXaJLyVe/7CQ3CdYVeGzK5nNo82i4NGPliKehEo0sKVQdCAsUbps8xaNv9RIFj5YOIh1CO+n8= 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 17855008569501013.328365842639; Fri, 31 Jul 2026 05:27:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmKK-0002OX-Dm; Fri, 31 Jul 2026 08:27: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 1wpmKI-0002Nk-CK for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:26:58 -0400 Received: from mail-ed1-f44.google.com ([209.85.208.44]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmKG-0007X5-SY for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:26:58 -0400 Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-69e2266b07fso1549603a12.2 for ; Fri, 31 Jul 2026 05:26: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 ffacd0b85a97d-47fd458b73asm3745852f8f.29.2026.07.31.05.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:26:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785500815; x=1786105615; 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=iAFcGQcEOmeq2sWxSDGxrJ+UvGPvdC/wwMmcTfIiv9pH7Z/GfXPs5gK0STHPQzUAHC SfEYDGZfYIUXf4jKhfZ5ETO25FLwjqmsXtdaD2oiUZcFVfKHpRalLZ8xPcoWzvMH6GMb 3ttBA/7STECcDFOkLAUrGiW4nMLaGA35slJJXuQywB6ovOQ19tazHY4a2v4dbSkYODSF jWnERtElZ26JUNGOWpchijQnNg9ka5Gj1Op0qN5eRb+O8/hEn5UUlyju/uhl6SmAqKpq gz9QPYfWPucmCzyrpEoGpE9wfU0rzR1LVdTVdbOwA+5yBqocasdv0c7OBjYGorAMLQNm nRZA== X-Gm-Message-State: AOJu0YziapGnkIDyf0+V85xIuRIqAsgkd5W8v39kcpVyy6Lw0Ht7MoiI SbvFfqAm14klK2u/8zeaojaY24mN6UXiyI1CzO8RwQELjhBJ1O6d1yr4k7KwNAKD X-Gm-Gg: AR+sD10yfuFEfg6OKK3UOPkrkdWM1ndeQXU86gSLKwoRWPFasYVBp5PFgbm5r4bQ8ex HgMBLGICNizhTi2at19HDrKJwBWelv7tvOphOCj1CklLM/jWTJXDLJ1wbe5Lu5E7yx6/JERSWv6 YGXkE2itUkwUHVYupdzmnZxuSuF+c3WBB/GUAw2DQM2UF3Mgen+Owi4CO/P36tEy5FT9jYePo0r 9IxL9t7eJ1KqsYo8PJN8PRkC9RjLzqfKEhlXlaaxOnsHTvqUCwzZzZa4u78R/SEqmd030aVAD2T zLNNxZN+0iNg0f/zZz6HaLmdNDOFM7B8UdAJWTnud7YFxnzLLjJLN3Zb3rNxUxsop6Ftl5M6I1P L+z1REKlldvh/sDeign3DIZcoryB+XrguAUesYjWZRoEyhGtDQBWf4N19brjeUvwsLu+v0Z7wu0 TOSlbbEYyclyg22HlBsa7ET456ZsOcgriaIKXR0GNRH2byVaWl505vYONFhQX8lKqZTzF4L3HGP 7yRFE5N4rl3SvxIdpSFdFU1Kt0EGn46Ro9Xq77gDU+kVh0= X-Received: by 2002:a17:907:d12:b0:c19:8408:5b54 with SMTP id a640c23a62f3a-c1fd23bf417mr107265366b.60.1785500815072; Fri, 31 Jul 2026 05:26:55 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:02 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-3-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=1784; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=lLLQDRXOnOUwL5qjxtcvmlFJBgBQ1Ly1Z6iI78mZFws=; b=6ff3sW5/LgtO78dRx0lJRIDtGD0GUi0ab6nkhIWFAZhkmYWw3OqHtoFaqn+oNOIl+nKXSKQHT YnFgxVnnK7rAZPgdpYwAsk1wdSHT0cpL8gWccPbLsW/GSaHFcrpMPs7 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.208.44; envelope-from=eblot.ml@gmail.com; helo=mail-ed1-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: 1785500858067158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785500919; cv=none; d=zohomail.com; s=zohoarc; b=F7CiFxvVpIxdSlBuKvWDKPmVmBmZ68qUnWbnmEzk8XCzEBjiUGV9xEOuUqS8+1GVwgF6Arsy1no6L1kcEtBEctefK+vEkbDkO9St5d3jlaXnP5llvtNv5Kjf5EhXz9KfeJzTXR8QCYG5+u86TgCTuGdwuERV61ArQyYKqBy+7Bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785500919; 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=RD+TpAQrIw2WR3RH/7GKLKuk8HEuWt0VCyUnhLnIkFMSc7YBnz1NSgkMR7U8GOUUXJzMoKH8j80ODmoIHvb2bUTL44uHicmSY5xiM8HKnGIMePYIsFiZ6fcM3fsF5MAtiPEwPT9yygw+GmUL4lJe0nasVNEvpEMYttk5UvqPKbg= 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 1785500919669278.0238245431419; Fri, 31 Jul 2026 05:28:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmLJ-0002sc-9Q; Fri, 31 Jul 2026 08:28:01 -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 1wpmLH-0002sD-Vd for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:27:59 -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 1wpmLG-0007ZH-97 for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:27:59 -0400 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-47f64ca1c2dso295080f8f.2 for ; Fri, 31 Jul 2026 05:27:57 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fd4562a38sm4099451f8f.21.2026.07.31.05.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:27:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785500877; x=1786105677; 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=MkZlSz0CSukqCeORCvbo8wKuwJP0s0pBPHxtlmE7SH1ut0chKibOWnezU8ldgSt4c6 qdcuhXzHRAH7os+A0KdLYylLg3zVCDS7vNkMn8tvCEt/K9KRZSQvnyWfA66YcdZ/mLkt 8e/bNbYWiiaUm/dltWd57RK7fm2ZuSe2ekSviVfQKVu2zBSo35/d/nxiaLL930ZKVy6y aDCINg6yCuJCmANZDkDeCtA6/8SYhKsZIRo8l5BvBdqCQrWpBil8QcEZLtKGgm9gili9 2w40QIpc9sBfia/aOE0Wjo6ORPtfEXC3g5GJdviUIVB6oYyLgnhLKSyrtgfzWHxFwJwI d+UQ== X-Gm-Message-State: AOJu0Yyarb0kx/DeDG0dMdHn0PbLU3EX2dOXMgNcBGKLTUWvLLiBc4VT wI3Pajoyh5TTQMce7vWbUWX9H4rQOePbZmaEfRPN5Ildqpra56SxvOzEcOWQxUBM X-Gm-Gg: AR+sD13B81e12pKWJNTJTlKWuHaDeTtcRlNUeW94ho1NTVeSWOKo9iIGeSl8GCAjfV1 RSLUttIh6j3L6pEBUdxlBw31xg+zs2XKEX/uJbA2QoaMDMNS55yFbU63Uxm77C6yHp78zRacO7n irnNVu+mpL/Ck4TXxIWuHLJQRrRP58IzKrEaO2lcpNQnLiCM35wHDlO0O9unC+yDMJf/UJeZ5g1 bPYOnlIBK/dI3eGzbYwlIPpxoJ3VFPOf6iXQ9rdw2kNZEJxKlFx2prRA0B1sjTiDZz1cqJdW1kD Xy4zzLxLtQdVk7xkQVcV+NH/c00byxiCQy/4mhuR5znWrw+spzUxeviz7k4fA2oervMxfpfhJTg voouDm1O8DdZ7ousKB5gUWwl1sFQFO5kPNCWF9avLOyqT1hZlvh2lO/+aUczuk0GaKB1ZP19pQC TIYnN7RIV1Orp9X57h7DJQLpX1ONVey3x7uK1Ie+Un0uNTR564tD++xFokGKNcVzIEcX80n4WAr YjnGtUtmh5zxT80tCJcf/k8BHX3/deS+OpyCyClsT/pPcE= X-Received: by 2002:a05:6000:3113:b0:47f:ca33:bf75 with SMTP id ffacd0b85a97d-47fd2add8a5mr4441559f8f.23.1785500876731; Fri, 31 Jul 2026 05:27:56 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:03 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-4-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=5924; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=wwzB72eiHroHgVASMgeEaV/IOYNCK41LnLDKlIYNhaw=; b=18R8JcDmLfnA+lcx7zutTYA+uaxbS7TxPDL8ZPnAYexaNmQEgWW4p/Q4IiKzdazi0EjmnXmeZ 7YMksW6Efm1DNLnYX0LDf1FMrKflJ6LNwZur6l+bDW25vsv1m1ImVqo 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: 1785500920636158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785500959; cv=none; d=zohomail.com; s=zohoarc; b=ZxOCjJKCgLTnVyeheYcrQdymmdP+R4fNvUySoYqC6Srh+QqCPByVyEk9M8/CNSJw2Md8/DPbOEZ6t5j4MBjl085WksrtjrYSCf2iXYS4URxEC3b3pW+1wunZG8FG1iTqsw8iMp3q/odc62sbe3TEe/9aKLtmknXlm1obdVHcbRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785500959; 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=3HXSIeK8mWZ2PnMbAWCWa/yBZfh8RAlza6b/3uHsW2c=; b=kiOJapV1y8fUJPXLgq5yZBIG3DokVOuSkzO6lPcI1xBFZ3ZxWM/F0OkbpYHT5st9LsORbhlvd3p4GPBlTmkm1mBohGOvezM9SE6ltQdc/wN+vQxugkJdtJKAtvNKhpnTxh2e5STthmOGrCth6Y/Fs/HnOd7lVu2uyxqJchOK0y8= 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 1785500959833171.28667512550874; Fri, 31 Jul 2026 05:29:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmMJ-0003h4-Jh; Fri, 31 Jul 2026 08:29:03 -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 1wpmMI-0003go-86 for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:29:02 -0400 Received: from mail-ej1-f45.google.com ([209.85.218.45]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmMG-0007oz-RA for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:29:01 -0400 Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-c1f5208b38dso163847266b.0 for ; Fri, 31 Jul 2026 05:29:00 -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-47fd458b05fsm4427813f8f.28.2026.07.31.05.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:28:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785500939; x=1786105739; 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=3HXSIeK8mWZ2PnMbAWCWa/yBZfh8RAlza6b/3uHsW2c=; b=joS/YYQ2BDtZzV//e9jj7D5pFUJ1H6aMUvwjfDMvJhVDl8CykPntPyEabk28xhf0wo eR6Xpzr7blETylMHLsGpzAOjhIajUl4jJdnimkKqz7ZV1NG/tWNxtmJnsazWQqv8MXMh NNhgrlmcr1nU+Sub2pKJSMpNkqBJlzcfbtVgr7s80x00vWCpO23cEPl/kMTrEctL9jGn OYQUegQ27kLRWHwl82JTRvoFPKxdjpC8Sa76dqm0M8aTuQnE3eqMHssG7MixnLus390L fT2k+5UdS7e/eRF+ReVQ08pq5Kda7xYVGPhhCFrT0atiQ/d7LobeIpaOFBhuLHUJ7Tfc RvQg== X-Gm-Message-State: AOJu0Yy0eEytkYe3wOb0PEoG1+aQKxroqPtvSXNifmpVRLwdSmU96Uuz V0D93XgwL+ohY3/1Cye36a+8vKDGe7g+qxaravQgTgnHX5zq8qxbYgWeJ1SgtoDS X-Gm-Gg: AR+sD13gLzh//TC3i5yDXpKXpLp8k3C0kHOqAI7TQVIFK3Lpv9ZkBollI5eBoJQj279 uZTy0RiFsGk+4KOhdfSG/0fCOefj5onBBdYyD8fmH7rCXVJrXdlWOqLQVPNBY2zdBqOSgSppFSD mNYdf3eXYl5E68jO46kFgkc7QWSD0aJ8BiraxdxA5C2Legrx6/NKY2OA8Tu/i5TYZDdn7KwkiL1 4A7Cv7tSPPsbZ3pAWT+Ch2JSpYQR1NA1hA6ehW1NUJbiHw+7KNRmpjxuPo6BhcvXNGedkn0cLBi 3b4NbSZ0xv5Lym5kRC+9L6vX8VNBqQUvIBCMfhkmEizOVraOvIENOsPgr6NTxRzO1K/Gcp/3Egk AGGe/AKwT7wd4Es0fcdghFntZntfZWinzW3a2kclsTEWFojy1cHQlSfjLIUHFkrOGcIxptGNvw4 5QeiocdfMFN1KrLEOiB4TyF2GejFh1z1uDw+9Upq2hoYGCXhEDQ1l7UIA5cCpz+nSh7qWZO5k3G Ix2HABP6CMdwRX2/hgnxJTuEYRdZQS/Q480 X-Received: by 2002:a17:907:ea8c:b0:c1c:4d19:f733 with SMTP id a640c23a62f3a-c1fd253ca8fmr123373466b.40.1785500938847; Fri, 31 Jul 2026 05:28:58 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:04 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-5-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=912; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=g8A8gv76U0FMm8xBATGnot2HwMPDfcx9sBsIePg5EDM=; b=M4vWqPJGaRiiRPGeGTbq9yhgPt9jN61jcU/MNTm71Vxb1iVNuBSYLNwkqop+u/hA3LumQo2tp 4+km/3BMqirAZ0DMsobg+Kst9lkM+szNMYhzLBMv5/c1cSAPWcsSfWV X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.218.45; envelope-from=eblot.ml@gmail.com; helo=mail-ej1-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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Emmanuel Blot From: Emmanuel Blot via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1785500960630158500 Attach a description to the dynamic "temperature" QOM property so it is documented in the QOM introspection output (qom-list-properties). The value is expressed in millidegrees Celsius. Signed-off-by: Emmanuel Blot Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501018; cv=none; d=zohomail.com; s=zohoarc; b=Bpk0hSKk4LD+eGgGTCGRVE3aG4QROBXdGSapl8vCMeGcxUNC+1ZHxPgrhOZE8iEyOHNauda3DjkuN+8Kb7YTpCiMAP0yry9b0K67JWpbSi/ae2zfDoESU7BpryYikwStdrKJpfFeox8wcvC4yEH1tvvGO5NpHPyaXbfr2Ha0ipI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501018; 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=MTgPCA/kdQ7qf/TYpzmaR0zYlmEugRsLOiBk7Lfsgr3eJ9WnHCb7kOVOKL1pn5Q9Hj3ELCB/pg17d02yW29DHecn0PDL/HfD/867Iw0nk96oEms1zy81nTSee2BN1jULNuw6wGavr4dQh8qRVCcV505WUFm+zWCem/Jm405P180= 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 1785501018900656.3036446798372; Fri, 31 Jul 2026 05:30:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmNL-0004Qe-6f; Fri, 31 Jul 2026 08:30:07 -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 1wpmNH-0004Q7-Nb for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:30:05 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmNF-0000EU-SV for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:30:03 -0400 Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-47f752b3423so814125f8f.3 for ; Fri, 31 Jul 2026 05:30:01 -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-47fd41e296csm4410974f8f.12.2026.07.31.05.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:29:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501000; x=1786105800; 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=lvAXbwHZ/t/W9QyPV99WE8+Swoz4qgu6/TuIRntG5gnD8QT7L3spr1GCc8bqRRWi2Z KS+BsHZ7EUisUwq8hbX1kextoFZ7gAAVo2xCQ6Ew+hy6QKhEz88/Jn5CE0KB+Q3047JB otlAijKtrqQkohpnBdB1Fa94yzLO9bOjrYfhUwjaIBLZyw67j7MBUzrTJr6CMur/A2cU CM4SSQKs0aAIAFq6nAeT1Wx0xyqn6AEya9dSmpWntVRZCG7ERBfUhfxI178NMwYtBfq/ GFmW+8DMCocNh0aQppFVadkV7+LXunGmMciGd9gEuP2S69N+sA6b7mc13/i/yCbfBSRh mmBg== X-Gm-Message-State: AOJu0YyLKDWQaSH8VvOvlm3O8rYBRgEVqUgd8U7oXftD62vKt1ctbyUt JSX+otE2wOMN1RdUtGDZPxL28vroYbAyL0HMprDXRpS0Zx8pVcLg2cvTXvtk8C3T X-Gm-Gg: AR+sD13IpRz1E4zKM7EtF2LsrbPx7aaHY4Q4H+21ec4PS2d5wIDQVVBD97L0l5AHyem GRFpl6QwVyPzUzSgysurnJMK4WcFHTRtkYIeOMdI9nS/MrKTU7iRfh45o6zumnL1eVrJxXWJlfc mZq09tZZ8Gm7LawyHFRmRMUhN5WW9dHSRDFcUDJkI3iHs40KIGgDeKdP/2/s1iNuDgtJbdtX8zz Z+lBIF2ESu7ePcykB8IGEwTvBUgzx8DmdvVFcredRh5JZSp4Hlihfo6E9f4DgaVqL48U1/I004u CpfUFVXk6QccR8ONuer+kT17TKLjF8u14fk4O3f3hlii5984xc0bgATlToMnfzWYITTfwPxW9Ee YFg2JhTbCIy+StDpeCXGzxcMuBdelj197yQkZKJ9lYMQWEHje7KizX4DvZLF6cAFwUz0KK+LdWi MCgX+G/4TL2hp6mbt2UyCQTHYfbyVEo7S4C0ROXjRmfxIWWsFHoDwTGg950nvY8t6hzsbgyHU64 czE8zhSmhVhk1uXxzUCTmnfxJOt8ZGaJ7HTI2W4GoHd45o= X-Received: by 2002:a05:6000:41c5:b0:47f:7526:598 with SMTP id ffacd0b85a97d-47fd2abbb81mr4753469f8f.12.1785501000152; Fri, 31 Jul 2026 05:30:00 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:05 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-6-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=1761; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=0daG7vmYYOhBzkb799hhbKaLINYeD4dhpsEpss5vX3s=; b=X6XAvRIGXOe0nU6oj3CGAdAZ28H4gnbOLnb1J3bnnFcb3+FODW6RJMzWUeOGOpiV0Uv+QO+dv Q8xHBheY5RhCoJZXbu5wm2pDnejfc2CVUXBSehwXCt3axX+cIOzwkxZ 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.50; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-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: 1785501021773158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501085; cv=none; d=zohomail.com; s=zohoarc; b=nV42pa4OpzHDvDIxM04WABHh2BM3iMNyToylsg7rhnVkRfgUNRJRhMIGvNRFTkmWM/88cWrXg0YdvusIbh2r5d0q7ijHCgffg8TgUqOVYz18AGneJ+kuYYEiF7K7yaF0TlkJ8kQ9PAAdRjCIA1lZBVs2tjtkbNQ/flzyUrRpRIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501085; 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=l3WpTee/4RoiCaj0VXXex9ekWr7UzvNx0KKU+t7qV7I=; b=kr0hUT4EA5c0UM8nA+n/BKWeIDRW6CmL9SkPKgc4UwMwy7bfwRuU27oB8/8l2voe/urJN+eePE1RxasjBdgwzp8n5NArzVYdpEuc/boucisEo46Y/bzfjiUATA0iSLJsDABNl7JOdq8oe+KzQcjy4GhgXLX0cAQXxiveuD1rxRQ= 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 1785501085759243.58829624906343; Fri, 31 Jul 2026 05:31:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmOK-00052t-13; Fri, 31 Jul 2026 08:31: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 1wpmOH-00051q-SI for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:31:06 -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 1wpmOF-0000Uh-Nr for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:31:05 -0400 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-47f71156e1aso507338f8f.3 for ; Fri, 31 Jul 2026 05:31: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-47fd41e2484sm4503184f8f.11.2026.07.31.05.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:31:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501062; x=1786105862; 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=l3WpTee/4RoiCaj0VXXex9ekWr7UzvNx0KKU+t7qV7I=; b=qIV3VLz4hCbHqV4OmNXu1nRVDB2A77Q6QbDfel/YS1OO+7uwmIE2/eTBc75mLFzVlY jGlgc/sHVsmk7b1EXV9XZPEdb6g2DNGAsFzTHuuDLrZSZD8IZWWAUYbngjrpHJbvjc99 wDG2L58AnobmJdwuBwCOtMUexMVx3Rz3gi/u/J+LpeToUGjmnKqheX0COePlb2c+eRvw Lpr29ruf1IDqvwOxzfDOXI1vjz62aKBfe7mY4/ncCkXR7ZuvVAbNmkKIjsXMNmSQgEil ZdNDYGziBHHzrBiNzeIEdUusd4kzGcrcbC/AyaKjl9HWTsCPQSibXj5txyxKlmK5Csrj VG5w== X-Gm-Message-State: AOJu0YyrugHnkwKTNmi541LFqk4qT7bvpmHV8FjHqZadJxxahBlfC5l5 Tg3IJwmggEMNGNVRsmH38lozqbUDcbDB79kDesY1ZKBtbFFrRNZM4biIAIASECKJ X-Gm-Gg: AR+sD10AyU5pdKYNRTqpMXvh+IFNFqy8KxOqj/GnlUk0YmFhSo0/pBu/rHME1HS2F2x M80NzrSYhnPwQzIyLkRVFzwDIvf5ISlDXTIJhiKhy0xCXF9WLv4Zxus1adH9+uH/C69UDnaw7Mt YdbaVaVEjttURqsu/BGxjiarYjv3RA3sKwoIeQSHbw8qWo7bv9evg0Bqc7OBONUZTQW8j6HTaJ9 t64UJbPmezlhVU4s2golcgA2ZNcWjMnMT3dAH8OrPkrpkwFsDKllTO5zQsVYilJyD5EO1EvSFAQ Omnzqhd7iDJG3WXDVwU0BodwwMkLmx5278C7OIAaa4XAxWfCIDp3XU4NHlncEDPw4chnZt2UY/i hb47TaVo9kwba2c7p11waWeaGAAvr/AaYB3ZoHk/YtOtsgJPCTind9eK+cK1IUVCZSxrN1bWjPb M+GfFWI2NVr1mvdOoxaGyQPToeKHBOtC+yKH1sQZixMH5udWfPH1ADbzXSdcwmttBrfqAuqDCe9 S+i/zuVhGmUvSzBHhH55nijeSZexJS8YDzE X-Received: by 2002:a05:6000:18a3:b0:47f:25db:8161 with SMTP id ffacd0b85a97d-47fd2b41707mr4545331f8f.28.1785501062069; Fri, 31 Jul 2026 05:31:02 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:06 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-7-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=11711; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=lPIoQyprA+KEMRKHRKV5S5+kFK23vviUH2t6jGqoAuY=; b=SX2tA1C9iyS6Z9ggUR6t68npY/SDQu/QIlq87cZhVTAYgot2BpJktUmsHCoafrA3ufiZWVVB2 uNnV0lQBizsCxJ9BHTgZHT7IyiTQtxPruljF7yKukzxX2f4SsXIxpUz 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: 1785501088007158500 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 Reviewed-by: C=C3=A9dric Le Goater --- hw/sensor/tmp105.c | 176 ++++++++++++++++++++++++++++++++++++-----= ---- include/hw/sensor/tmp105.h | 6 +- 2 files changed, 148 insertions(+), 34 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index fefa661711..ece0650d70 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,8 @@ #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. - * - * @see_also: http://www.ti.com/lit/gpn/tmp105 - */ struct TMP105State { /*< private >*/ I2CSlave parent_obj; @@ -53,7 +53,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 +65,27 @@ struct TMP105State { bool detect_falling; }; =20 +/* + * 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. + * + * @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. + */ +struct TMP105Class { + I2CSlaveClass parent_class; + const uint8_t *faultq; + uint8_t config_wmask; + int8_t fixed_res; + uint8_t limit_lsb_mask; + bool tm_change_clears_alert; +}; + FIELD(CONFIG, SHUTDOWN_MODE, 0, 1) FIELD(CONFIG, THERMOSTAT_MODE, 1, 1) FIELD(CONFIG, POLARITY, 2, 1) @@ -152,10 +173,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 TMP105Class *tc =3D TMP105_GET_CLASS(s); + int res; + s->len =3D 0; =20 if (FIELD_EX8(s->config, CONFIG, THERMOSTAT_MODE)) { @@ -165,9 +187,11 @@ static void tmp105_read(TMP105State *s) =20 switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: + res =3D tc->fixed_res >=3D 0 ? tc->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 +214,10 @@ static void tmp105_read(TMP105State *s) =20 static void tmp105_write(TMP105State *s) { + const TMP105Class *tc =3D TMP105_GET_CLASS(s); + uint8_t config, one_shot; + bool waking; + trace_tmp105_write(s->parent_obj.address, s->pointer); =20 switch (s->pointer & 3) { @@ -197,14 +225,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] & tc->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 (tc->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 tc->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 +255,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] & tc->limit_lsb_mask)); } tmp105_interrupt_update(s); break; @@ -265,8 +307,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 TMP105Class *tc =3D TMP105_GET_CLASS(s); =20 - s->faults =3D tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; + s->faults =3D tc->faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; =20 tmp105_interrupt_update(s); return 0; @@ -339,11 +382,12 @@ static const VMStateDescription vmstate_tmp105 =3D { static void tmp105_reset_hold(Object *obj, ResetType type) { TMP105State *s =3D TMP105(obj); + const TMP105Class *tc =3D TMP105_GET_CLASS(s); =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 tc->faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; s->fault_count =3D 0; s->alarm =3D 0; s->detect_falling =3D false; @@ -371,11 +415,25 @@ static void tmp105_initfn(Object *obj) "Temperature, in millidegrees Celsius"= ); } =20 +/* + * 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 }, +}; + +/* 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 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 +441,71 @@ 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->faultq =3D tmp105_faultq[0]; + tc->config_wmask =3D 0xff; + tc->fixed_res =3D -1; + tc->limit_lsb_mask =3D 0xf0; + tc->tm_change_clears_alert =3D false; +} + +static void tmp175_class_init(ObjectClass *klass, const void *data) +{ + TMP105Class *tc =3D TMP105_CLASS(klass); + + tc->faultq =3D tmp105_faultq[0]; + tc->config_wmask =3D 0xff; + tc->fixed_res =3D -1; + tc->limit_lsb_mask =3D 0xf0; + tc->tm_change_clears_alert =3D false; +} + +static void tmp75_class_init(ObjectClass *klass, const void *data) +{ + TMP105Class *tc =3D TMP105_CLASS(klass); + + tc->faultq =3D tmp105_faultq[1]; + tc->config_wmask =3D 0xff; + tc->fixed_res =3D -1; + tc->limit_lsb_mask =3D 0xf0; + tc->tm_change_clears_alert =3D true; +} + +static void lm75b_class_init(ObjectClass *klass, const void *data) +{ + TMP105Class *tc =3D TMP105_CLASS(klass); + + tc->faultq =3D tmp105_faultq[0]; + tc->config_wmask =3D 0x1f; + tc->fixed_res =3D 2; + tc->limit_lsb_mask =3D 0x80; + tc->tm_change_clears_alert =3D false; } =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, +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, + }, + { + .name =3D TYPE_TMP175, + .parent =3D TYPE_TMP105, + .class_init =3D tmp175_class_init, + }, + { + .name =3D TYPE_TMP75, + .parent =3D TYPE_TMP105, + .class_init =3D tmp75_class_init, + }, + { + .name =3D TYPE_LM75B, + .parent =3D TYPE_TMP105, + .class_init =3D lm75b_class_init, + }, }; =20 -static void tmp105_register_types(void) -{ - type_register_static(&tmp105_info); -} - -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=1785501153; cv=none; d=zohomail.com; s=zohoarc; b=apEIhI/xa0m4NyOnQLnLd6rXnyBZrl2fRSY2KFCm8wBxX8bEBdpqiwWHtNUOTY/VvvXzenjI19+bxy2zzE0Kn3SeCxTs7XOTdqk/ORGHYQaZ6uI4by29ViT/0D2m0xqlOkowXfRc3/i6dF5nZHsmHhNPQaOFD3QJwSIKJDy5wWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501153; 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=l/iOF+bdz3V8MPRcb8GN6ViyoEDW7v/Rf0yAE6p0dfUtdClDMNgq73l9VEqmFzIVA1DCeJafUUKIap98tkzBiSTU+MdAlQHz8FrmLju26Twg1+4/hmvmZItfPlmOYp198Ye3fCT5dWKDSxIJW6nT5c4Ky+3KNkdnke/z7UW03lE= 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 1785501153052232.56839359734363; Fri, 31 Jul 2026 05:32:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmPJ-0005Wj-0t; Fri, 31 Jul 2026 08:32:09 -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 1wpmPG-0005Ve-JL for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:32:06 -0400 Received: from mail-wr1-f52.google.com ([209.85.221.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmPF-0000Yo-0N for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:32:06 -0400 Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-47c6e9a694bso583985f8f.1 for ; Fri, 31 Jul 2026 05:32:04 -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-47fd456220esm4525736f8f.18.2026.07.31.05.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:32:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501123; x=1786105923; 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=Gm0OqdHoopl3sBtTWwrZfxAT7LxSHNy+UWFj2bkaukSzIf/FAMrX7VzuCXjzmTwPkB bu8EMqrVG8wsjuKxh3fiD9miO6rLjkE6Dy790UpJZMJDtU/uxfeJNsUJoC6ngOv89c1v t771DmG1nq/BHwXqXjENOGnCxJuP5ujznhgoM86VqQnKp/gm+4u1vMz6vR8MdI4qj+gj JU7XylLXlrsuUKcHdoaMYIbpe+PsGGZkEV1dnEnUbnNVT/4uB6bHFHo3mbh4s87QSQO9 2JNnwpach8UZoSA/1zaz49blR74OHUzvgyRRhazpofxyYpPvSV0kztnK0pB4WzjkRl1B FAgw== X-Gm-Message-State: AOJu0Yx3EZtMgaZYFv9uhGkUtJq1Dhf1NqeUl7UbuFndnMP09dfWV+qV VqfXRZgdTLNFEwbiJlItyCorKjJB/4VY2rmpXjiDeYVgCqyVvQG/bKmtpICxxr+k X-Gm-Gg: AR+sD13PjmHbZ0ZdTlB6HCQI+bYAbWPRlcnt1ES9pDbjxkcyBN2OBoHbpWRbcC5DeRs 4ZhiuIVQdZtg1Jywzrbj4b5ezyx+g5lTyA+79I0osU1Jy9WEqAZCgtImUn2LAqGiL300zzS5S5v 9JZ6+Ck2rBr3hX6LQGFht9Ja7YzSmdesVAAPJSOvb3e5/U1IDuJpWauiwWtm9NF/BbeW0DnMD8M PTEfrJAt24BVDucFGwpS0OuWElhr617GbL/xxlX+pOw9xRI2zcffXqu0nsAlUZGmmMIjOqi0p6O EMszmvZcbxHyPCwlq/VPqqvft9XgMn09aYceMak8iVSWNqNWq/TS3ZQs6Mq9cd5L3+By1uR9szD YIMN9Xf+mXM4DMrNCqBqpBs01ponm/BUOWtc8sWuPQJMBwli8p8cSKB2hlPp8LbprDNa1y/nptr 9jMGtX80aGulOUp1KDNRCtxepIFSE4dZUbf+N9VlC3p7bwjaBOP2nbP7R6PgIELLZ9nKm8uYkx5 vBThql17leiNGCIW2B/P1Im3+DeDv+uBo6H X-Received: by 2002:a05:6000:290a:b0:47f:c206:7d0 with SMTP id ffacd0b85a97d-47fd2b648fbmr4369004f8f.52.1785501123434; Fri, 31 Jul 2026 05:32:03 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:07 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-8-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=3508; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=STa9fNUK+ufnQgeeZ6iWhS9xfz1DLS6Eh0Aq6teT5tE=; b=6XmVQsZ66/Bw9+YAmfrKhBbf4l4TfAyq4U6bmZN57njvEe0cDzVwUtfIIw5o63M/r1k+L5T27 kGpw6/NdFrsDWeOXEPrz2jRMim4+M9UsjbRXtCDX+LXDGzxqBA/PEv1 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.52; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-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: 1785501153742158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501203; cv=none; d=zohomail.com; s=zohoarc; b=RyF44tLGJs09dZr3e70c0/Wt1pDpL36fz92PNxBFNVeaqy4qHFFWDCKN/YkhbiTcLngknRom8e+M/FGDS++5uEoyxw34pp2m6PEPGORf1rLIXZQBnXHRaOHr+NEmyD/pzLic91IyGNND+2i5XSAIrKSESO+iqvlnQ3b8WHGr02g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501203; 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=bM9qbfj5LrgAcMLpo2SkwIoO8nIOnpSjUxteOjTxrSLKy5JZoUEYtuAS6Tkz9iSGxc98qbzmOnUNWda19GHQ/MBNzpxfkrREKf9iI6kb3EmnNDfhJZVXRKfQd95sE4Op1P1WY89N0XS8PtGslW/sqAlDlHvaFlvJLKAi6xMU8mU= 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 1785501203136704.0420013664669; Fri, 31 Jul 2026 05:33:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmQP-0005ya-W1; Fri, 31 Jul 2026 08:33:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpmQG-0005yB-Gp for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:33:08 -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 1wpmQE-0000ce-P1 for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:33:08 -0400 Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-47f3b39f2a1so249470f8f.2 for ; Fri, 31 Jul 2026 05:33:06 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fd458ab61sm4379525f8f.25.2026.07.31.05.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:33:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501185; x=1786105985; 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=WkgKjpqPXV6/+oGlGKodVOh0JIhb7r7NJ2lhvG8Dp+hg8je/79dzSh6XMU9N7hqIJG Hzl9GXK0rD0ZlmPXkZBLqJ58Zgg7zTDYg9jxoI4lpR/GFKroWWT5Ixqz/pQKBanf4aGU awtTSDTcDrF7nP/Ydy9Al/cnCjoGpOz3CKl6TzSDI545ueEg17VNP5dSw9RZU+yuyQ2O eG7WfnkxIu50IZ+SYWgLxVZg7U3LuW0KDgleFPasS+LFSYRtGE/7Em0bLTXcnSaAEu0A lCJ6keiOwSRdNJmwb0FzQN2HR31735DDen2mbUY4gK6dTYaKgXgfNPQvTUzkNlwaXtbw yIlg== X-Gm-Message-State: AOJu0YwMNHRGZCKppLGi5PWm0NqRKwliYVmzl6Qj3ONaImqpxoi/gamI 58qPL/rZhBxSS7exLNQqZBBwZtmT+wt9Atl6gYEWCF+GEleGMj69neV/rpRPoo4k X-Gm-Gg: AR+sD12C3qIjgQByQzubzkKhD9UDFfd+7ZCqrWto9jycIrTx1/Af9T1/rQcMIbyR/MI DDvVkK0Jj5RiV+xO7V4qRTVNR/FEYpuyGbiO+RYOozW+FTssgV58yjFEuT1L6QIHN/h5GlYjtQx YgnWcbQLXbM18Xcd7vmxgYqTUWn3p1DMdD6TaBUPzFIwCBs0ktAOD10Ee2Fyl+k2qdJEcHLIa8T ojpnUVCNa9xfpb1jhBmDDqQcc7giehrxTrtr96Q6jwKYzwNZ1VxMWfk8+jTlDIGOoK3DF8G7Uix exzkMLdr2qu9DqptfKhnPnE0fDI+xCjT6T+4Y4Lt/r+RpGfLYGKAoRj9v+NsGbMI71KpNJ3BF1w d9IT+J1bSgtytlltDC6Ta7OT7JMPsTozPOkDp6hmLtTZYm8hMIwMXpjNoESmCqNTLeQFHB1ndiC tqkbkddP4xzJRnBUeWpYUTDK6bhAD4joMVgg6WYg7rdJjy1lBgyGqTQekV9MCik0Fy6h5OTlS+2 sxdsl02X2fP5paQX5LokkiIqLeAC2v/p8Zz X-Received: by 2002:a5d:5e92:0:b0:47f:9763:9870 with SMTP id ffacd0b85a97d-47fd2b40d2cmr4352161f8f.35.1785501184944; Fri, 31 Jul 2026 05:33:04 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:08 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-9-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494707; l=6772; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=q1iz7++LpszDUzhYyAvlbngfO8Xpf8a9SAQco0QYEVY=; b=R66a86lWmprJH57UOQW7MCirOjDwMPG8+XCGBY1CJDwnRtw6j6rOHxUC2S++/a7JkJu3rMKE6 +ri/vGXWz+IDB+mWbAItcWjF2sqMTFoR1+fin2BFFRoYcXSJSpmuR+s 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: 1785501204228158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501285; cv=none; d=zohomail.com; s=zohoarc; b=OgkLuzmDc9zhMe1a2MjFaDx9vf1fPPEwSLUsLHLzcw5zf9KVh/y2wJF892vw6r9PnYuL1oIlrSkw5hhdO+F4DfeZWentxGb8Wb4RDJjKTiDRFRCrmvdzqEjYR1iC4xCrtqpoH/ACuoV66oHLXknp0c4PiyCoXfJabMl3a5s4N1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501285; 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=YLDksudoH5HK5CAKZVXeQCRxW0YjlsmYAGzus2ABv7WibWVdVPBZIroXvg1vawyaYt17iTvE76OxbLlX6o/f5J7RYk0foD0QQ3b/7rMtw3bOX43dJa8/f6r7Sgtw+f6vXCL9Mdwp7qjnFQ2GQMkVoi2mHjiU/vLTHPfah0fcSRY= 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 1785501285802403.5774235501268; Fri, 31 Jul 2026 05:34:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmRJ-0006oJ-K1; Fri, 31 Jul 2026 08:34: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 1wpmRF-0006k9-HQ for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:34:09 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmRD-0000gZ-UE for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:34:09 -0400 Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-47f84023916so960913f8f.3 for ; Fri, 31 Jul 2026 05:34: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-47fd41e2abbsm4345519f8f.9.2026.07.31.05.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:34:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501246; x=1786106046; 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=HJTDnfdGoCvFU2sZkErr3V0YK1ISz+8bkwrRSDUKjl5LT5833KcsE3QOeZKW4qaQ1P IcPuIvnwig5JMRRG899x7EkjCz9aHlXRnCUccXjJby1jGU3xk3RMk1VLfEJMocFJGVi1 lUguOCqKrPTHWa43pHhMPEzAKxI6r89xRo+qF0jzIl5VLJc0kDEXAJ7dDZ596LWPr82a f982ZrkgwElYdJzWzKe4eGC92MNgDO4YYblDyj7OyEDYu3KgQP2yWrpi3iUc0T2zWniL pwco4rtoyXPayfZiUy1jaRmmttnnao8k0ZJcrWLMwNWLIs0vdZbCAmLRdZKb5MP2HYPp zjEg== X-Gm-Message-State: AOJu0Yx1t4yf8w9uwLI8nErJlScxtvBGAdWOlmCTEYLh9aOYg1K7hoGm hRawStzq4i0fuXqKdkwVqZIwXd3Q2tvmP5m058b+xpn/snPGG+x+3YQ6NONJBkHh X-Gm-Gg: AR+sD12QWJIu8WPcN/wnI2K39aYLSe0Y44QNTHCHKBA5rHIHXzAZDY13eZrad9r+8rV TYeOxiXkSRIySopaFa+6kDmYKXwOuVtjrjk4MMHAYVFjiCjyCrHp/+kB75r0uuaHjToXqDSVz/K /wDjKG/MKR47wvtTV2/U7LFLg8AGn2VE5FvVjJpTG2JA3LP6IpEZQuSjgel4PGiozYddJPukVOI pGngV1KjqZD4sJhDdvyc4/gx/Blg1/eLXyK1V7CaKPRhY3mhVgDQXW01HAzCFt6Ngos2spHVlXT YVkquLt6ETvUu9RkjSJej+z0Y7XlMzoLSknv9HTZw+TG0sn9L+27cjCVF8EbFNZAnkxA6/JgFrQ cfPSCTuwk8LrKrAj2d4QueR4euuvhZWcEY3z/6a0dnGILnzT/VJpOE/u+p9AVua1g1dTn/+9IzQ 0yIyw5vk6OOZtwqBSIgzp0pbwu0d8bo1vKazke1aDNJ69Kp1z4PPGf7BnydGm1Cx8U/pIYTCGwH fMM5B+TL+Z6pWS5tmfwEEgpIUgGwsZUr3aNZ1U0m9cGNZA= X-Received: by 2002:a05:6000:385:b0:47f:d0fb:ea40 with SMTP id ffacd0b85a97d-47fd2add54fmr4435535f8f.21.1785501246321; Fri, 31 Jul 2026 05:34:06 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:09 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-10-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=5455; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=bmmLFTJHN8a4jRPifYNuZA58n5LYCH8vK49esOFrf4o=; b=VE3J4rAQZ+CX0YQwXuO1U0Zal5PI/MwDee/JsD7ayPXRzONhWAnQ4vwX4mWjT68c3zYjA8cKh TZMN6n8H2Q4B6WBMemkfhcmo5udauNlNT0sB/sH0hUC7hUH0SeHwWBN 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.50; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-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: 1785501286982158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501326; cv=none; d=zohomail.com; s=zohoarc; b=FqWE0q+BStT0ZZgRXTZfOqHiyWzcjMc+WHf1xMvnHEJlAZ01Oz21GhzLi/FJ8kkq0P+etXQMmrY9TS06RRKQcrBi2/u3tI39lcvGfW6ZI1VkynI9HM9HnbbFUEnZnQbFiy1VFQiy7QlJxfk153ia7bEdO7BA/2JqUlrJdk2xWsI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501326; 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=O+IXscTgkfcz6MYBgu+s19w6E7ggRXF0A0DZ13GxnVZU47uvCR1my4RRSWjISDdP/voLyBv6f3Xubt2RCTQD0kinw0oJKJ9/oSHhP8ZQsIlq3VcRa4L9zRFzwtYc4rtg2S8sT+HR5NidHzhBEtQMJZiswE1K3zZwnERyovjZ0KM= 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 178550132614425.7781485782574; Fri, 31 Jul 2026 05:35:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmSG-0007N5-Ts; Fri, 31 Jul 2026 08:35:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpmSE-0007MZ-My for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:35:10 -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 1wpmSD-0000v5-5y for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:35:10 -0400 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-47f93b2fe4cso592152f8f.0 for ; Fri, 31 Jul 2026 05:35: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 ffacd0b85a97d-47fd4562a38sm4162627f8f.21.2026.07.31.05.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:35:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501308; x=1786106108; 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=pXng6LGhuhdg6yknsU9vcHHeOLeYnjLWwwTDI590QgmgykvoISLr4Wgv91E3tCCeUt /J0LjnC0U5Az6OPcs2wiJYssW4Xa7FyVIMKrFY0S0pOMisp5+Wtz8P8MaxxwpluDuE4Q 4hBgZF6UYh5wyiqbC5U1i9VfMkAdt3QU0X8MuhXCkKv+N9/bRyidcZo9MD92eTsSdQmT mtQ0Mdmtu7ph3lCfUAdR66C5nlwAQEmpWziOadRz8Xs+CtXR/rNqWLa/juQ2RjRWm1Pm 5qMrUtrIrGPRWKcm6aM6/HgXfTNCwXwMskgfk0D7WKchE6sOUt1kQLGlyGqIDR9rv3WI MbGQ== X-Gm-Message-State: AOJu0Yyto7HfVAr/SRE5Z4S49q9+ZUj03DksExzYb+c/XZds809uovOj SJd7H8LXUMDoP8HZc9pMx95S9nFl27Ww65PxYehzTYy4sUK3mGtWsIUwXvHXcsjk X-Gm-Gg: AR+sD12ufBVoGiHn7STqvgDBYfEYQfFK5d+TGCBQfsUIBuzwuQ/R1DIp27okFCV/Vza aI8DWJA0sFVZGxL7UEsf2cFIS2bTnxWw64N86o3Bn/4N66xBvALT+5XahgC5fQ0NM5KFJcs8TiG FszqwiweAY85VAmrb3PQqNtmBPbTkf4FOEo+0zT0ju8N0Msp6uvHsyYzIHsn4/DuBJ0XuD2wn1y fLbGxehbJHVQ1n18Vn2RRf/HNMmaOt+7ZQbOuPJn0t+scHjerKg/+qCt+VXu5y8eEhdGvv3uoXz c5cDwWutxQubGzymMnRu7lpsEvyOQox2vya0/RYHNG58ghtGhHFTdhyLpUouygiwSx7f1Ns5N6D YgB0GbuKUOtXOAbHK0mU5tWyD8C2JWYkkYIS2eyCnxNqlKh3pAnfqLRHAK8wgpX2I9yZfp23unr fSsKWIon2oyMaXLlLFXa97hP22gv8BnU/Ut3eJNsQjND5FUUZ+ZxGupkKL3v9Hax9H6xcSfPIkV kicukH9J3fHvt+fGoXzSkPawuKGoCdZVUBk X-Received: by 2002:a05:6000:2994:20b0:47f:8fb6:c32e with SMTP id ffacd0b85a97d-47fd2b578damr3454076f8f.46.1785501307713; Fri, 31 Jul 2026 05:35:07 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:10 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-11-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=3738; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=2fRBCplKTjlFLd6EsRzXdhUj/5B9QVDOaJYG5Z5CWwc=; b=3oPlxId5SWQ2928LfG4btUnPH189fpHIha7nQppuFkIJ9+uXf+Ofh3wiHE38jShW05QjqR5rL yvY+L+QuG4XA2Elxtcj5VqniL6MpixKAq21fMUkJslEnLr+TO5+z3C0 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: 1785501326997158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501410; cv=none; d=zohomail.com; s=zohoarc; b=n+6RiUjWyRsgSa07zVzdwhYyfYrj3T7Kp5xho4UUgU+HUxo051wPsln+QK1qXECkD61CCslmnYHSqkAXrX//ETv9vMZW4CJ/YepzppC97dQKx4voK/ES61AP+0wJvKu4T2aZwRQPKcdsDdStUFIFiM2i3U0vh3LLuZ16Z4j1s8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501410; 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=AjOYVh2H98yhmNdfjHZLnpMtphmZZ9unAotYYBe5XUNMAN4LPaQUe29R/z9n0DI0TxRnxs1nlWVNMPfC68pcrCLPK6bi8ets470JF069SELmY+0JlKtAk23lIH8RWNFD885Y8oY7CDtgvPf8wN6LQ3mh0wsh1iaeJd67GlnWwmw= 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 1785501410328870.314589276678; Fri, 31 Jul 2026 05:36:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmTI-0007xJ-TN; Fri, 31 Jul 2026 08:36: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 1wpmTF-0007wq-1j for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:36:13 -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 1wpmTD-00010j-9h for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:36:12 -0400 Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-47f84023916so962922f8f.3 for ; Fri, 31 Jul 2026 05:36:10 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fd4562a38sm4171561f8f.21.2026.07.31.05.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:36:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501370; x=1786106170; 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=gTfH0el442v/Z3Gjsx2uknm/tsFGuOqRAjkkenfzV246AnjDcX4SLcAWIqoUz484Dm Bv9/TuA+1f53NxygzpF1SKSd4da9DAQKZJztxkikJoeNmoApcHwRvuTjeSLq1Q4n93jQ Oah/KBXLie17QPygryxqurGNYnq/VVnmc+jmJ8+1MhVnynTD+0TTrh+2MDfjiS2EXqGY Jk9noRPeipcwk7o8bFujjOzop5vGIqKlOChzq8SA9SjtVowxSu9+zf0JjbJFVmuBDGhw oItK1kQuUiGE6AGslg66z4+04nom2IrVqrq5q7pWSWyJ4Ye0meCYiCwj2MnQIwe3HuZ6 XXLg== X-Gm-Message-State: AOJu0YyOm+ir2ObxNwRTVfrtpq9y1cnM6z7RIor0pE+mLg0oKS2Q+x19 oFNHBrVCT/d23HUHIwe1zUChPPJc3x2NKTv8/NiTwi/eT0qdCRRC/JTYA4ObfVSN X-Gm-Gg: AR+sD13kDpEgK5zvbzLK5xYmeE2n+wnzKptnYs/d5Ocfb0M9IEmrQ7amSQRHuT0yT9F 3DYHcNeLCh1wiAyUCdmBVu7LmO6f7KfNXeFpfQui7eBWFlEa2HYy02hdhfm/TmDNq7dGEixTSjE YzqFo1ES4UEcUHXfzSd+vF8A4S0ORCcKcRoJtpAM0hy0N1g09FBlk7E6u8XuidLfHg0EgMZPfJv X6y+9/7Aw7Vh8BTibbTK38shkTwQnEvscpKMTVPLNBXAWaEuP+dhOp+OG+b+zgVCGjR5XJ8Pzl9 PkQrTGomWZs7m5+ZNCAtjzFfelltlgK37v26PayMlljSqPxXke7NELdYx9ml101DTGNePX7RdtP u0JWOguAJ+gmpnRWYY6C9rszZyiAd/DjRtVyjroACM8r03omyxhEjA8V2FXJS85P/O+XdUrVVfF CTDvUunFdcsvBIbs+MzkmFXltyu5Fbsw4XXCAVW/N3ROLgFhNt4vctnh2tsPcZsRyikc3dzUjrz SW856Thogz0rgr8c8dqnnnIiPZreUljdUns X-Received: by 2002:a05:6000:4615:b0:47f:9283:1fbe with SMTP id ffacd0b85a97d-47fd2a431a3mr4030538f8f.0.1785501369803; Fri, 31 Jul 2026 05:36:09 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:11 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-12-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=6006; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=IIGp7JMpwq/OH+NFukTrNiRzNgl7XKdaJGt6qK4dT9k=; b=KsqRg4Wd87HOhX5jS9kCuXTg2q38kkpbUQlkGrY2GE0qgR7KluENrgWss8NKjX8G/48cRUR2s NwdaKV1zPhGAAdrPdBWlojgjDdJrSHXM15ASOEhUaN/bpDd90Mq4rn2 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: 1785501411814158500 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=1785501444; cv=none; d=zohomail.com; s=zohoarc; b=Nx1R16o7kXlczsC1LJfmz0XUckfI3npS0DZqUqiZKOVyAIiTIFnJWK87bZmvEZwMnZvwD2/LnPGewylLAOR+c1ts8RNUvai9pfVhxTRXYA7Tk7BKJh0G45/z6eoH9AjVM4Sd0p39yRtNL3O4XewZtsEa3pyJ2vQ7b4pmx/UIflw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501444; 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=SaZC1cOxgZJU/k/mGTboz1OJK2cBdIvYp2zJU+PV7Cs=; b=QxGuXKH6dlY4UBFtjDmUIRDPij3yyzXUfXOKssBbKeeQZSmZUXdcRqkrOVk02tbKdexkPmso76GNiOB3r0TMFCUf8ZcVHSYEm5uYj2xXUInRLk7CFb33D+XpfgYx+X6lCubFvXLXotuuNi25IzMCyb4ePcqH3ByZN5ST4DyEEBA= 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 1785501444621141.45949925844639; Fri, 31 Jul 2026 05:37:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmUG-0008PU-LL; Fri, 31 Jul 2026 08:37: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 1wpmUF-0008P7-Af for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:37:15 -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 1wpmUC-00015m-SQ for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:37:15 -0400 Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-47ddf7b09aaso965385f8f.3 for ; Fri, 31 Jul 2026 05:37:12 -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-47fd458b05fsm4513056f8f.28.2026.07.31.05.37.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:37:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501431; x=1786106231; 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=SaZC1cOxgZJU/k/mGTboz1OJK2cBdIvYp2zJU+PV7Cs=; b=pQBrIOmdXJDcXBimSSZYVrduiTD4SJ8lkvr5JltGwp+cOVixRltkNfPeuxENINEgEF LcrdQ0IauL3ZQi005cOacr1AOi3g/zpflkbq8md5ZoP9NWp3cJAHk8baRAr1aSKJdWED 9+ATVg4XkRsBuMZalHwZ00d8hAGxutYyfFm2XhUD0YpVomYpIfYXQelUN6dQT03g/BEs j99i1GTOLVGwOgiZvzhPiRklMbxRrVKnQCbhlums5of0OOrcb03yrOvjxzc1gF5qBtSh PZWVj66z4G7CcbDLR4ixH3pSy89ZgDwI70ch6o5kSdoyMJqwx5NJAG6s3gsKWc+cUhFT 5w7Q== X-Gm-Message-State: AOJu0Yx1YjQ29OuFTFnJir2kgaNMDEk+lrnG2/pXgDjQoRVI1ML1fGFk J4Ddd8JS/hV4rRN/1DmjutNQZsvQEpSk3Kbr5g9LbfocrI9hSBqbYEG1I8oikz8e X-Gm-Gg: AR+sD12ZjdVMGR7vMpajOrMi50uUqcxVRxCu3XKEpdXTy9ydSPiIDdsZO/+oYACTXgi ZpZdsWATvKTOnp2Gis3wENXAFy4/qRhqTfFCJZeuZPuv47BbT7Mb7jINl98U0K++4CgYk+W/bAY XeAJslHQTMxdhWUPANyaFe5BcOZWzT/SOjC/zuy/BbDFU4HsMFb4BcOl848pRGKoothUXNeisCJ i7kDOD/E2j/593Tm7u+Zh/1kgEIt779+wK5KacnNZmy1SDWcivN9sMq++Vnqrv2y06ZsfRKKs9+ eOCskysAWhBGomzxvVoEl3YEhU4jEphlcab3I8m+QJ+swRiFqFv3qixLxkh7tGrATIa1+TKS1Nx tFsSKPV69i03Igp8JbmVAP1XoKdXpwCoibGaWg3REVBajsnECyPxcu/g6JTMPlw6F1Cw9xx5gIz TYIJnGxP+LjzstY/Edba5PNHfDaWD9BUxQ+T7nY5QRugy6OVc6QoDhNftnxw4Xy/e0Di88v7exQ atia2MKFFCLCwupuMVJgOwkaWWSaH3+VdmE X-Received: by 2002:a05:6000:4011:b0:47f:86d5:d1d7 with SMTP id ffacd0b85a97d-47fd2ab9128mr4174789f8f.6.1785501431029; Fri, 31 Jul 2026 05:37:11 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:12 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-13-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=14814; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=8TJY/flswX+pacJAJohPVkRNRAiHgkLgviQcHgmd5dU=; b=mjeoA0RsH1B1Srl+S+WRAWSddJUPr4Q2zR6Vls7f7TS+6KLq6grgL71HClQOwU9PbCxdQAxSA SG9p2kgSX/8BD8d0PyYRdFnUcO7L0Pn6IArXinE2PB2VEz6RO1f9zAs 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: 1785501445517158500 Populate AT24C FRU EEPROMs with real data from physical device. Signed-off-by: Emmanuel Blot Reviewed-by: C=C3=A9dric Le Goater --- 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..251dab141f 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=1785501534; cv=none; d=zohomail.com; s=zohoarc; b=mbkvLoPQ57EBFOwu3BuzDe18VnTskdSTCt6YsB18YD8/Z8J/6iG3taPNwKSctzh9aN7O+wdg5/eVpH42FTW0qVgGA7MqLfNH4CvyQb4LwnjgA6qruOclnqy9XQ7OvdkyO3LpiKDw6fBoxSBHEuhHPdJ4qm7lRIKQfFAriqQNT4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501534; 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=eO3wJ74AHnJeK6a0CHiyLHVlJLhidbFEKOe3Zkue27T6GNVFkyal6KCigvJy0tfUOCbInynG5it2cHVtdkdV+P9yEXu3XwWcEg+llSLdccvAo8WlXJ4oQQyYiwbAAD9qZe3u2phT3s7rsET9JwtetFtzLc1DUBIL/iDZ+9gcW5s= 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 17855015343331018.8202370013516; Fri, 31 Jul 2026 05:38:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmVF-0000Rl-2q; Fri, 31 Jul 2026 08:38:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpmVD-0000QW-HD for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:38: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 1wpmVC-00018H-5M for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:38:15 -0400 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-47f9ab7ee38so550929f8f.2 for ; Fri, 31 Jul 2026 05:38: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-47fd41e296csm4474934f8f.12.2026.07.31.05.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:38:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501492; x=1786106292; 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=GdNJgdEMcjY2bC1aIKNDpBlmbpT8+tK3dBM8wG2LWf/QGpJhXJQTY5YHLbHNGcWW+T 0eGnEQWHRvBEICHA/S4hbiY0QkHaTuCGs72h1IO4DYEglqhGzfdfJkxch4sLOvXkI/1v BEVlrYONcycyIhifSoiwzuATayjcxNG2tztSifRRgZ57utJxyGop0V0nGDzniDzRxP0p fWUaQ62DRjokMV+BHB6eKhoUNxwgkoRlKvexJrld+13NPeF5FReWRBgQIQUAbwzMqzZm zg9QcpsSI0IbPVvu0WGWLdMZqC2Ey8wFzMoQY1zL4+NTbQjNKYzcF6sPEaWWm81hKR+n Lx8Q== X-Gm-Message-State: AOJu0Yx/GfO+r3OmIfBEzxP8JTRoHHHKgdRhvVks67iIw8MVVThXFDz1 x6HB4eBdK7lSNinjeT4DMisMkIjt3BGhECn5NPxiJr5iX3vLvV8riWIgm8XkHrjN X-Gm-Gg: AR+sD11KLH3k+6YvdOpjyxv+M74rcrmFEAY2wE7vXhxNXkvFXCBEx4bwR2El/ADAFWS S0o6YVOX+IX8WaKi55JkhoLENBUkqzCh2qChwdaA3NeE75bjiCkkI2QkABGGqgt88tcHVDjnE8Z KII9QLOG3MV11tSQVUcTy4Xa79QDJQRv0KwoNVrxvdnldqZNnZaoNK9+6rYfrq2t5MH0WFEe/9G iEyHES+udsU2sQ7GiqwAZGDj+3Qu5u0+OKs0zI/Py1985/gKetlbLL6YpndVinSPJKvqcTQca9p 57DXTC2Wbv6dc1y2cr5WLuJzlapytr3OiKnhXOevX0ZPJ5aRYiNqR7QwVE4R4vAS2ybmttpEESA rB4ZDbPgkRwAgXeakR4tQmr/Q1hm1lh1RNp4zPVdnHv4aWDivrN4UpwNqT5HdC96yDVtkjcdmC8 OJJLF+sSdVbxsRqY0aV/hv/KEhdwRT1ivee+SzWQU2VV2qJvAQ6W8h3t7nTI7bqd2pd5WgtQRH6 H2Ll9gPIFiLMp7mcERroQGwMS3TpW7Jaai/ X-Received: by 2002:a5d:5f48:0:b0:47f:9822:d99b with SMTP id ffacd0b85a97d-47fd2a426f8mr4362739f8f.0.1785501492502; Fri, 31 Jul 2026 05:38:12 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:13 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-14-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=948; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=yr6ARhHsRJdWelmON/tAwpVgyc94u96MVCdEOI7hMno=; b=+vP28J89xkAkyyQIPR39YLuI2lDmZqn8xSBG6w8WrD32a+VWYSs397H+VlsUQBjDilpeF8hRB EMdQUT4TIcqDtCp9Dg/7Xt/xBmvTD/zs61OvIcs/xaLARYiT4x8aVW4 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: 1785501535913158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501572; cv=none; d=zohomail.com; s=zohoarc; b=goiIrrktrdfjyqK/IZfVicVa/M98xyxl68PlevlxP6oAYQAE/61J7uP1bDzfaBDa7WGzbJNG2tcD8BKKm4PvpaJVjjiESg5ngfc8mHRPa2gIGj1GAZ/Fn18ABpTbY9IpK7sXPsBr5DUx8A7rsHnnMPFypVU40FB/Vr5KENkISs0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501572; 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=YVuuZptHM34AfyCA5xPFwSLicgGZLv8d1+eakqtzeZPcZNbw088pY+2P7ylBD3OB9e3mtVh4Qll6w9b37KnsynCphOX9gQSfsBklRsGzzrba7We2VRvA4tkWw/9s4kJPCD8Q/Km9g0EJxaV5EBlPVU1uIpZb8i5sQVnAYcYsetA= 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 1785501572164512.3365557048776; Fri, 31 Jul 2026 05:39:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmWI-0001HG-N3; Fri, 31 Jul 2026 08:39: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 1wpmWD-0001Gi-Vs for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:39:18 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmWC-0001CU-JB for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:39:17 -0400 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-47fd4ee0b01so270407f8f.2 for ; Fri, 31 Jul 2026 05:39:16 -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-47fd41d1756sm4392990f8f.4.2026.07.31.05.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:39:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501555; x=1786106355; 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=fJp9xwm7AePGphqlX1Z4tyf+aslLETVaoXG1QDP7jYYYlfgzOsIEMztH017XdpfvAX xdbkiLEFcihA3CExGg5gpBwLX+nnSPFGvY7HSNK3H3VES0kmCJgeodH0ceONqyHlAGwZ aVxMCq7V6dd57smIc35qBd6/93biXze0yre+FtRTybEN5OssD7kF/ibkTW6MsmaM4Ke0 hhEUcxCIz5vitatvUzxMaCQWtUcdSr+gJrfBNHuyCnk5R/gg8xFuQzaf40ORHB1Lynlq Un4i+6/IRnoDVfwVjmODLolzjntH9to8irFxpLaaEw6RAXKK/M4OISF30UjRpqojvVtG De9g== X-Gm-Message-State: AOJu0Yy8p7hg3J8HzZ+0Lz4mQwjSQWdOj7jhZvmTlq4klYR9NTe4R1iX CEtrIG7gY6UjgYcVglFF4QlQMeZgYBsCvfMBL+R7RFigE4uGu9T9y7wAPxRqTqwq X-Gm-Gg: AR+sD11Scw2UPkSUgSUtXOwzSEaNRlmpebPCgQA/uhLlady8vstskLVTK11vKD6rc3w 1XeX6aikkAkdlVsj0DPtkEReeJB6BdVgRUFdGRZ0hn8Se22vL0mDr22hbtl/bXE/jA1tec6KWxH JfT6nx5p8AfAd+xDnlYZX8ZZ3a3zrUHSrjfLhTu1B8dn9igdB+9VBK92Q0+FKvYU2YqIb5rfWbV QOpCOAax0J7fqw4g1lpXkXJM4eZPEP6GjU5IuzeUXojccNT9An1c9VSzkb/WA4lLeg7F4cLUB9o augcAYLRGNpFfcd12Assq1wiml8sCSuivlzMphP7soY+NPZtBZvis86+LN0ODMjFyunPgH/iduc Wx72LL4ToUiof+Yv1MHsMCYLpwc8B4EDuuXD0jB0rCRA3NBVi/MTzkGC7BiU41KgWXi0vFmWpMo X/InfsYKMd0SYzig+vs+67GXsBU7UHApivUNUjfcmDlBaYPN+eA/zndjOFTqmANmDYSZfN/TX7r gpe4flkcvq4rdg6htmvmO2ADJRFDRDyfhpwNvPs3TRxM/Q= X-Received: by 2002:a05:6000:2983:20b0:47f:91e3:3cc9 with SMTP id ffacd0b85a97d-47fd2b4d7edmr3474816f8f.39.1785501554967; Fri, 31 Jul 2026 05:39:14 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:14 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-15-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=2648; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=3Z2LgNf5NONtKdqbZ6IR/+v7877ewZwsl3F8BgLX3xg=; b=+6EGiMAiJiKOZgQXC2/o8zVfWfockVOhBAh/ANeR5rmBrmI5HeHIRHxY9S4xchwipkuvm6Qer 7NIm7ZrVwqzBRtBaQselErhYZAkDh3fGQ7tmJYqqL9uaU1vUpGI+AAp 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.47; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-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: 1785501573948158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501631; cv=none; d=zohomail.com; s=zohoarc; b=XuV/0Jf0MSj8J7po7I+obH9dQqu+LIaDsMeq1ESGcrBwxqO3U1MCWRjUOKaJ1TH6JW0eOntiupBUgToVwQAOctRBHzAmMl1xSEOlBsFHs2dVzo11p5Ghd1UVpOJ4JtUJQSDR3Va0sxwH5bSzLwLq5h7mkQ1R8LMshSpn5bblths= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501631; 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=f96DqfHn0YVrt4ivBlJKMr85ARMl2qgxmIJIIpXIkturjNhI8DIcCJEc83PCU1A+EjJ/ZKWuSzfWEXQGWuKkJg3wq2x/FO3HqEWg61pasdOc/Uc9jxydt3J2oP/VM2kSwPQtWjm8P0/ySIgvTgcpI+8UwYxUJzVMcICEUQO1kvk= 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 1785501631061770.1978551577965; Fri, 31 Jul 2026 05:40:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmXE-0001qU-GZ; Fri, 31 Jul 2026 08:40:21 -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 1wpmXD-0001qE-AI for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:40:19 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmXB-0001Ra-M2 for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:40:18 -0400 Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-47f703a9e5dso465408f8f.0 for ; Fri, 31 Jul 2026 05:40:17 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fd456a5a4sm4503816f8f.20.2026.07.31.05.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:40:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501616; x=1786106416; 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=IcTiLfud4gpU/q7TPOjElpm75G12/e6f45dsiJD7G6uepS0ttv4c2d6daLSrgofbtq 5DO6XPJw2yhWzcEG39BFS4nsZTu1w9mtEKl0KvlZPXf9Iqrn/pHvMLI2YaUeVEHQKce/ baNCr1/P0isTFDwxkqSVZg4TtgsiDxW6KrnFUgh+0AGieKwObfKCvKmuFXA+tEH5ojMe RafiSfefDsWuCn81nLuIgR9ZEHs17RVu9APAQJ6CNvODLxc4bwNLemmw5/7kQ91q0Tg8 VrPVB5fkI3/aH1FARNC5J8luEfgTV/ZFfuYGyLFgbqsM0ePIPGJsbUorfWTycO3qonSQ 5KQg== X-Gm-Message-State: AOJu0YxC3SGH7kIn7vPiiGUZuXmYo0YpifvVePMLgZ+VwzcTtplxsn+O kGwJDapu/pq7Er+inRoA/RRlf7bwuqFQmqnKrgxs2oXHRig2vJfe50BnIqTvjuDk X-Gm-Gg: AR+sD11ognrnJ9XNShHNnTnnyqokIfBoRFEfDFUmOxefAW6kEcFg9yKe+mbOCPoMsGR E6F8DxSxBe4VUPeQp/JJkaCenai/pDYQcrbLzXM/BZ9+cOb9Q87QiRjnVSY7GDTexHGW4PoSKLY ulmzklw1VozB0s2pzqWB5oPxdLFViBsJ6TYVDNTHulYI0E4Ipr/flspw2GmRtcXT0kwc2Zb1YUN /9tQKF1yWzHcrQqqpg0PID84oVb+ekLCnW5g5IIq38kaIPnrPq+LekeN63J0DsHXZojRwBx802+ k1KIDmJTFXc3pQFW/efpfH5kGazbPXHp9CMoALMYtrqICod3OAK1tzV9j/30Z54L0pIizVfs/ot DWd3tY6aLTHBRQCJZRmfLeWhQzQjBpbHdEWp0K6pANkypMpvebYCwdxzqtLdvc2hVMDVv02XfUv YSzcQaVnUKK0yIE4Ro0PH8cAvCnsdX1z5a7POtCClqYP35N6etNGuFKzDJ4k8XnPBJLuWuSgZVa uoJC0lPP544+9hj9XVuUyUllmAqraCJxwuu X-Received: by 2002:adf:e006:0:20b0:47f:959f:f6a6 with SMTP id ffacd0b85a97d-47fd2b57ae2mr3448277f8f.54.1785501616176; Fri, 31 Jul 2026 05:40:16 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:15 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-16-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=1664; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=cY6O6mrVrai7NMYpMfMfQOtbJnyb/EZq8fgGv1TgVEA=; b=/dijBUnPE3iklNOoj7/qnWicCyiq0R+kAYriSGiWeH4hp4nDibVTzAMRCRdmBdACRnFdQMtUw myB8jxdCBluA4ENAeAHO1b/J7tYPxNg1k7aYe8wXMTbQA16iGckigqo X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.43; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f43.google.com X-Spam_score_int: -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: 1785501632724158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501709; cv=none; d=zohomail.com; s=zohoarc; b=YRTlweEvRUBesdDOVZ0EC9zmkoaAGpivH+ij8JMkVqFSMrazDcoUz06gjY+gn+tA4UwJf+RuvSR/jycUdzc7BydSjujlFcNEsIje8Q7usz0lEK8QBCskpasCTRE/9bohrGOHO1icC8lWt7aVeYkNZKROEFomiJJ6GP1M2aVjvCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501709; 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=IGecKbExV4OlEw6xxGOyTIDpFp+r9pY7fL19c1wSP23GFlu1lP0vv5cjG/GWQ8PTHsa9+La9M6OLZOrUfiZHPU4VpGz044VeUQBNRR+CbroGdML1S+7E5fNbvQAj5BR5Da4gTeWnH+MmV8iVj5LcovmKZh4x+uf1QBtKUvB4+Ew= 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 1785501708934794.057413744935; Fri, 31 Jul 2026 05:41:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmYL-0002G8-Vx; Fri, 31 Jul 2026 08:41:30 -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 1wpmYF-0002Ch-Mm for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:41:25 -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 1wpmYB-0001bU-UG for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:41:22 -0400 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-4799b3f7c83so719553f8f.2 for ; Fri, 31 Jul 2026 05:41: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 ffacd0b85a97d-47fd458bb4esm4890379f8f.30.2026.07.31.05.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:41:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501678; x=1786106478; 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=GCBL8BQoSsgURm5FTqB3ApfPM2DLBdz3d/yXeJfraMWY1zGVAreESlTsowOf+0/nS/ 2Mclu6x+7bw+c1Us+uHFoT+PIfPA8AkGCUIjG3jcUVOd7IlzRBX1nFywpI61jBnpRt2T 14XI6FefvI78G+OmnRIo53MbT2bJov6cJnkGw3z/jsKr9+e2z2w4tKUSKSUKwjK3kHnA xfSZUeXQdtuaOQyp1E5vzBMDV0BYgsrNo6Cepn1AE/sys/S+HL6WgNzvF44qA1HHgKoY Flx4a+Z6MeTlS/xyIbXN/0una4OvOUBqT6CU721sJpJ3Us4FL93wqKF1KeAoGX5MLUlH 4EBQ== X-Gm-Message-State: AOJu0YzlqwyrETKSMRKk07WOZi0MoJ3lLRD2BgU1uEK8gpfCJpVYFFbs Bg+hAXQ2IxwgYMvlOAIAzPAxdGX/DNpPstVVsDnGQbSJz+Ynz9Zn8QC1Msfc4P1x X-Gm-Gg: AR+sD11Xh3HK+fgNRhU1xeeeFZcxEBwv0/I/Ulc+sBPUQ/+k6DEoU9LMJ6bupirh+83 mWVJqiw22LnsJxHb8dn/SGtjGc4/i3L47+uI/p4JTWSr//YNsXRI2J2Smb/06tcL4Y7Rpq1Anjw GijKRAA37i4CfJAJf3ByZIgeZAjAWna1LMxxgJ8mMxmo0sK9OiE9Bn7szUjqsUHvNxb9vItU5vS h74Wtrsk28LXMwscRA/tr9x7RaWp2xmZ0YUGWsvHw00+bKSahAnx4eRYoFv1BluVs0Tufpe47e+ D46WAHvUxv6oShDOoTxZBpCEWS2ulgluk8gDkE4FJugkjj4tvmGLCSjGOcNcwxBYfngpyTYHiAg Wqt85qcsLq1gNTLHnR6OcS5plPqiiFdroFj2BhcmfagZOHHzbD+7rr6/HaJwgksah32DgH4WjG5 YRAldxrFzONSydJCt1RSHUI9K0Y0MadhhCiu9ygTYLIFkp2Dirx12ybNsVuwnZcx1+Qca3kysGk F1qLCvi41a1rtqeGg3fi1Q4OJjcb3fI8hXJ X-Received: by 2002:a05:6000:4289:b0:47f:9839:a79a with SMTP id ffacd0b85a97d-47fd2abab8dmr4431755f8f.10.1785501677626; Fri, 31 Jul 2026 05:41:17 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:16 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-17-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=1100; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=Z+1yI9ZlM43E+k0NqAp1ImIMvg64cZpfA63qBC1lq6E=; b=MbsEmbQIJ8LmTRubmq1OG/na21OSmmK6gSY19UtB3Wl3hNAsdBDV7pI4pMFVcEwBOeZVr7AKF mcS+P6DkxGUBvNoDmNuh0F1xGYwgcRs3SoJvVj96FmjBH+zAdvmHMW/ 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: 1785501711340158500 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 Reviewed-by: C=C3=A9dric Le Goater --- 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=1785501784; cv=none; d=zohomail.com; s=zohoarc; b=P14anNnaPYwuw2KX4xxZHeQ10+mV17EZ1W9rr37BCqcLyDOOEhe4GpK4XeGTJryG+oEwS+aebtjsAOWuHFgKF2RVtC5XEYGLZSr3PAxl9T+VIPkKkegoqiyzfoWTH+SNvPpA8UQpHGjbCOHWyV6+QDAD8kVzss1HBtZSyFayNkk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501784; 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=d/fGzQQXHabBfOTeHCMOlTazjJbbqv+UcGp2ZlU/qCY=; b=g21Ua5jRqY4e/bvBAyPOCxUdxVXm0IroXoaPOW+4BLYbMedcsapRDcVK2eZEH1uGkB5d/PMyn/RkYF7qXA/xdHKfKl8YSKhdv3T+0H6Sfaqt7miDTse61Idl9JSbUCy5Q4Irbu+o2a3KuuyVzxfRtMGYG9uHkYJlvteJmB7o9Ro= 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 1785501784451453.62928139652854; Fri, 31 Jul 2026 05:43:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmZU-0002hz-SJ; Fri, 31 Jul 2026 08:42:40 -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 1wpmZG-0002f9-Kd for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:42:27 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmZB-0001kE-Bc for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:42:26 -0400 Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4799b3f7c83so720380f8f.2 for ; Fri, 31 Jul 2026 05:42:20 -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-47fd41e2484sm4615278f8f.11.2026.07.31.05.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:42:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501740; x=1786106540; 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=d/fGzQQXHabBfOTeHCMOlTazjJbbqv+UcGp2ZlU/qCY=; b=VNWPiIaGyJ1iu+okzXmB5nKtUn4FXysqAbz3NwDPyTisY7gEvnh3b2zXiyBz/4YCjq 5kv9Yx902GeNsbM593AL+AsHQ4G6b3Yk+n021cuBLAUD3lPfDZgGxcJLZlW3JYJ+sM13 8RN+VmJMObf4m4llCNvFcSHSfEeX6NG+CSPgBddHP+nTtCPf8h+94f85bdxz1pUYswMX DhemAT4i3kHd1dcWkorFJpMpFZovO8eB3G/BEceoR4Af4V5jG36Kxb7cRAmotnPafuP3 E1FfeFR4d+dzc/MQo5hC3A4zzHPVkBCiNnCfAk62ioIAIml8XINRxlb76Wg3RPl8i71G Y2Bg== X-Gm-Message-State: AOJu0Yy+06jVvSMRnKqxK1naFofu1QNo1C/YCbkaMo0f8C34BV/Q7RKi 8t3efjB5+gr23TISUPMHFHiBm6huOigNjnG4WksSNqHvBCnG7kI7l4Ad5CA58Pz7 X-Gm-Gg: AR+sD10HYAbxkAuuq2zZGRw2Kmw4i3BMhpxLw4xPBBoWx80AH+DlOYJQdimiYEk9hIn GOtizAlwdKVVV9zf80qzpiqSmgI4RnbCmqjFaxz1Id2jZwVvQ0nlja6487o6XJx+QOvHGqEl/L+ pF0Uvb7Nf9Vdp74a0laQARiMK60FvW0fey4yu2Z3DKppTHJZuWm4xY7UWPZhREsOfsMXwrqBRZa HOaRU+5utTSACFBGgwRgE6ezRdqLpwBkTBU6lwkWaqr6XcBTZA++MkXkf0j4jpMcLNU2qUPl/gU jMJRtAmpMX3Cjp3qZ7A05t1OS1ABNnr9y2pXrRc3dMxDiT5kHf5RjtYsqPegtXVs9OiMoXuucOK 5b+Ki6Pj4Ae3txOeGPK8kAwH9Z22H6Lzvuyo5575d3MH66emESIipzOy6ywfaR3v/qF/o+PajdV 7SLBGo3autMQhF9yNkOYKERVZfE0f9dQCl834fYKHTpUDxSgz0OVP2Hxd5REZmY6fJj9kux2ZGw ijpf3pa8bmmdqd1tUcCUL4Y+AGyLO3N5j2A X-Received: by 2002:a05:6000:40cf:b0:47f:93b9:b76c with SMTP id ffacd0b85a97d-47fd2b6f8c3mr4286175f8f.56.1785501739514; Fri, 31 Jul 2026 05:42:19 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:17 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-18-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494708; l=25776; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=0fTzP5F9PKtWYO/ZmDouxCuNhKNgSuqV2y3Vc3eRPuA=; b=Nclamxo/VIy1p6e5TsOE85ZxInA8N69roSeeolApv4i6JEoAIAX2dHdC4XFvv4EVoqLRi0D7I WqgUOqZoWDDCENVV/Z5YYSzOqlTGOwJgKRGXdokMok1pzYUyGuXB2wb X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.43; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f43.google.com X-Spam_score_int: -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: 1785501785272158500 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 | 586 ++++++++++++++++++++++++++++++= ++++ 1 file changed, 586 insertions(+) diff --git a/tests/functional/qemu_test/locator.py b/tests/functional/qemu_= test/locator.py new file mode 100644 index 0000000000..bc8ba111a4 --- /dev/null +++ b/tests/functional/qemu_test/locator.py @@ -0,0 +1,586 @@ +# 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 + seen_sigils: set[str] =3D set() + 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 in seen_sigils: + raise LocatorError( + f"duplicate '{sig}' selector in hop '{token}'") + seen_sigils.add(sig) + if value =3D=3D "": + raise LocatorError( + f"empty '{sig}' selector in hop '{token}'") + 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=1785501831; cv=none; d=zohomail.com; s=zohoarc; b=EJsbNnGvd9nowFBhYgon2l5cCB0l/QXPP+JapHIMKU36Ap9i4g984to6XRynVD30VSjeYWsZRhTdbHrREEJ4wcnZbe8lGKFTw8hbb4s8ax28BoTn+1HKD0u9iFqCyZe0WP2EKcCBPLmVZYAOOjdHkFd3aFzrq2eGwg6+nEys304= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501831; 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=l2SVqIwGhCh0aGG62l0hZRpsX29ER4xON3j7toIj5yE=; b=fypDStENvk5yj939f1jVcr4uzT7mSKTc8IPZ1t37o/YjAObxUxV954OZv0G4hewKnxz4IWhquMqApWDMQnMJZwbpdwppRp/PsGyYAS8/IkiPJ/ewMRJ1LvdDe6XNsL38+6zlRQP+YoMdUKN3KxUz2NUXyKZyj+pGHqSDXw+IzqQ= 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 1785501831044373.4107645919885; Fri, 31 Jul 2026 05:43:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmaP-0003NH-LG; Fri, 31 Jul 2026 08:43:38 -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 1wpmaF-0003MV-1r for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:43:27 -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 1wpmaB-0001qN-SR for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:43:25 -0400 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-471eeac43bfso987129f8f.3 for ; Fri, 31 Jul 2026 05:43:22 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fd4562667sm4789106f8f.24.2026.07.31.05.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:43:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501801; x=1786106601; 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=l2SVqIwGhCh0aGG62l0hZRpsX29ER4xON3j7toIj5yE=; b=IPPxow9IxJgusitdGmr0Xr1c3NbanfKwCycI8BoTWjqumq52pc/KG2TI6TXPTIMF3j +owfl/5PHqYg3psHgbfyiaBPv/OEKVc3ideCHewaQFDA6TppKC1mBLvobggw8CxgA1Vu TdAI9Nh8P0Sjz5w1QOSG3sb/F95W6fM22hx9F/4AYbhx8iG8Iv/N9dmB+KUaWMVn2wPt hEedoEDg/OK2IC0wjPOFY3KlThktoqgV4aFdpKq/Y1Vbq4ZsbcOYaxF/uKyBbuW3pA4y gSN7qmOI5x0ZsCJETXZyCnqd0nnaedCYRONkXimZl2L4gWkfDX7riPgEOruTlKHw2QJI gW/Q== X-Gm-Message-State: AOJu0YxnkgQaQD3AcJWCbwi0fNAriHE18WcNWCi3dE7BtVfjy1YpTmxr sZkI/HsLj5scDMUwXBClMIlC7gCurUKqE3hcpon1O/H7DOt3RPbWtUWukjfIqE6h X-Gm-Gg: AR+sD12cRuQmDj1jnZIRfAj7dAIKyNaOoNagDktkG536xbI7kbhii1VBsBpNU3C+zIB EYDqRwHOshu/vcgEsZEmRk2V+EAdcg5cP/MMG5Ops7v8lLciTA+1slcSzeME9DP44dI65wKa6w0 775fT8GLWeZhzL0+aNC/VjrXUxark7vbm3gEH5lTlssJVEHg+P/f4H7r4X7PDeplm4gQQnj2FWs GMHAhL0pYsTO6et6RpLaXKa7m3/RY9OtDvfguz1sagpl0aiR+vcaOA8tPUZmkqGAv2VjcO9gZP9 zxCxs1fGhTDbM3hc12LTgVJZXCeqd0G8mpaJ1mEzr0ItSkjiwEs0jT9DfYiDSaK5tTp0EKjhQrg oknstxd2ZUNbTW6msvMZLxTJO2fNJTftGY1oBLy8EefnpG0BhR9J6xgxdUucR1gdEoN7LoHSdF/ DopORBmxgGYi5WQAH7DnwJNlbq0eZ4VmJ/2j4tIqEvuQz1dOLD3S8ZhvRioLWj8WEmPYENF7UIS QWBXKhzpxlbQiYntsyc2DVFMfNuvue6+BkA X-Received: by 2002:a05:6000:98c:b0:47e:81aa:3822 with SMTP id ffacd0b85a97d-47fd2b55d4bmr4499175f8f.42.1785501801126; Fri, 31 Jul 2026 05:43:21 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:18 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-19-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494709; l=6877; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=8djowPyyHWeRrKEsZJKnuEQSt7974+p7xfk0OhdHwns=; b=U2tx5gorde8hrfpMa4EKyeWT8dHMHkEDQz2x4gGHn3gwx2aMnKTuUPPm8La5W8YWm6U0lJO7k O7JAJ1uhgJRAFwLihUuWmsoikTM6Y0r/dK/m/NzV+jFx3diBmiYfIaA 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: 1785501831775158500 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 | 120 ++++++++++++++++++++++++= ++++ 2 files changed, 121 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..3807a49361 --- /dev/null +++ b/tests/functional/arm/test_device_locator.py @@ -0,0 +1,120 @@ +#!/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') + # A repeated or empty device selector is malformed, not last-wins. + for bad in (f'{ctrl}~i2c[5]~@0x48@0x4e', + f'{ctrl}~i2c[5]~#0#1', + f'{ctrl}~i2c[5]~tmp75=3Da=3Db', + f'{ctrl}~i2c[5]~tmp75=3D'): + self.assertRaises(LocatorError, self.locator.resolve, bad) + + 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=1785501870; cv=none; d=zohomail.com; s=zohoarc; b=UrA3TEbQCTnfU8XcckXBQDQAmaIbn49JTu57MnOWFS9bPgO5yoiQTFrUbdWCgqJRzTCSdrwajUKloOSsj+kK6emsfhamlB9zoYSN76LQxouNXF9TQVWUJF09kp74dXKJHbhIl5Vc31neOgPyGH+qeX81WL1IVFtmpg9eDEhJ4Yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501870; 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=bMcc0WJpNFxS9mbYEBVKQjUNmTFf1lJbU7RBC5SCHwkhMfcLBDeRk+wey3EpHlPLbG5W+yxCBcwnrwHIKH+oULVv+gIL/rUmUwBkKUTXVQBJJCZIsqmhSBpKFkYMCc1ebFQKMGLznX6jZbu3YI7NUeEf2FxjMo2Xd5fMgbjbt7c= 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 1785501870524876.8422719991173; Fri, 31 Jul 2026 05:44:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmbC-0004Dr-9W; Fri, 31 Jul 2026 08:44: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 1wpmbB-0004D9-7D for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:44:25 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmb9-0001rz-RE for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:44:24 -0400 Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-47f904e80eeso849758f8f.1 for ; Fri, 31 Jul 2026 05:44: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 ffacd0b85a97d-47fd456220esm4643136f8f.18.2026.07.31.05.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:44:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501862; x=1786106662; 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=SUa4mOm+mT069XvAwwqxc6RYfyNqB54uXrSyCKrpSgJPjZlzrdEh8m8K+6m4r6Q6S/ Ei1u+tDlhMXU2/H2xBd6TFobx8Q/H3/+iInQRnvlzsNkGsOWBASgpXXV2yrb6GmEt7wz ECGQrCU9l3Q4ePoUOMtaPxa9IVdAUIF/eP4K7ylHTBQhbmiN96X5zGcJaTXbf/HHtAXm BCeH/AOsBzGAwTXormhDx1Ri1jrcti3nbIDH0w+aDNEqy7oCm1eaZMtCyIbH19u1uHtC Hsn4PxHX8dkbls4ykcStKpoOSWNBaVGHL34lF2RTBE44CZI5PDcJKxo7WLyrATnqKiFE 2iew== X-Gm-Message-State: AOJu0Yw5Sa2FqgTCJV2I9VdzDKBEG54948p1Y4HeugXV9Q1kvjmOmOWW sdytkqmeGlCwACDs4w3hm+ZJAT0Gex16nxN30EH+pKksKTC4nlXSpwdLhF1AwQd8 X-Gm-Gg: AR+sD106mjvl+5mp5QCMV9RIQl6YdYyHtnfCvVCUx+RLT9EswZaoxEsgylLCm4senfD pggxoutf+SzqUVsU6VOjrNJ8/jszYvSL5Djuwsdv684/US+WLYeMWUTL/SFMiwlufEMV+bQIy7o Fc4CsR+20MrrjFJKHPRT52+zq5ja513NY55Wwq/boYj6I3uCafRn2Rq1Nd+yIQfVTlhNc9qwxuQ iNiVWmAiMiIatGxrROKJNm5KJw+Wp0vE3BALmiKOntxLTQcJ61NG9UbU4XtVskAmYKuIVSIxSaa Xn1OCcI27J6fzAr7eJVF1WB556yXNsrg2b97BdlK1vekRnE4e9MZmZgZy2u8la42TCiiCQdJhBE fCSiINgUHmuXtUIaaHc004LP4b6S86fNPHhw0fGvkPY/XNA547IlcRPELFeLyor8J+e41QjaxKf 9r8wmSa1gjU03LjNMdv75YJ5/j8g329vwHj822TLOnjke380HNH6cLFAAKpe5kfozG2iPL4v720 EjQdaG2K1X58A12PYjWtjxtrmS70Ek/4nXJ X-Received: by 2002:a05:6000:4b02:b0:47f:86af:8fe7 with SMTP id ffacd0b85a97d-47fd2add55amr4786062f8f.22.1785501862411; Fri, 31 Jul 2026 05:44:22 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:19 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-20-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494709; l=1618; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=OWHYGLs9Qe48IkzshR4rzRcrC9b6ZFXaLE+JZF/S+fM=; b=J5M9HbJ1gKhvbWdXj54EEgDwLw2aIicbtMhLVNudouK6B3C9meC6hSnQaSapht6DcOAv3aYKR O0C2qT9fGoWCYJ0kyCQ4vEq9qA9pai0f2DDx18FlQ/ToBnh+PvCPaM1 X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.41; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f41.google.com X-Spam_score_int: -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: 1785501871819158500 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=1785501961; cv=none; d=zohomail.com; s=zohoarc; b=P4BEmigMmv95kinGXmxwfqjU/9WiaOog4T7L3sHfGkCxs6bz6IoFOwn2hvrt+MEO/alsEDZrrnBF3XbakAtjXUiGq5uCuHcEqXB+efx4dSBQdDKY4W2eSGUutTW0kpdY/GeuPaDPThczt9mH7qkJYp+Ox/Ek6FCrOrJbrllYeLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785501961; 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=Ogi5JQCmYnCEebDzjS+Et7/L3kWGPf4NFaCsWxlvNal4u+1t1Plt3pY1txlfYcxsy0bsX6yPVJHGoEcYLiwA+wiH4BlIH2r7FXfEX85t1Z4KRDYjniHtMHIPSIWNUt21s2imlUkquP1tbRhVGrZQZzinV0VvIVpWDjmqw1W/2tE= 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 1785501961173929.0460495351638; Fri, 31 Jul 2026 05:46:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmcK-0004rY-9y; Fri, 31 Jul 2026 08:45:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpmcE-0004qI-FZ for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:45:32 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmcB-0002Cj-TJ for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:45:30 -0400 Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-47f71156e1aso515824f8f.3 for ; Fri, 31 Jul 2026 05:45:25 -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-47fd42d91bfsm4952323f8f.15.2026.07.31.05.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:45:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501924; x=1786106724; 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=HgC1WlPUa5bMwKRCaL8hLqveIMohwOXru6oxbRVgt1fue/KdnJ4c/Tnm7Hm968AVFc fyDxpbXM5BB/H9Ihezr3FMyRTXbXAnbsr144b1oYapfRMETyWtE3EHAiFVkoNgjjK88U ynsCtkyFfRZvzjWY27y3x4J0a3BziZSf6buc9D/KzcSrRepJmBB7+fwK5vnaXwDcrHeR 6VnVxnUMCdRO1Ss/9qxbYxSTNblew9JrmoubzpngtKE+X3ECKVPCsJur1Udrj8+yDTDo o6eL++sm12DKlUyoMtUgJynjYqH05bvtMLgt/oXNrRdWD4e/S096xs6RV1Anu9ng9aBw ARnQ== X-Gm-Message-State: AOJu0Ywt2dUM1PgF2OHOaypo3tdsmljkCZcai0U8Rfyhr+MJlfPfgeWZ evroHwE0jP/mPdeU7t/PyLl1B66BcriM/1WduLrOMB/ZzmxMx31oUFPgq3yBjOaz X-Gm-Gg: AR+sD13qLmMgLcDP8yroTcajHEusJLJy8ch8TYxcBy/lMUuhQbl42/T0G0YHVda9a7V 61t60dF7PeVY3YI6Wmlg8yVMQPZOUEZuKGWaLLKKLJh/5tU5ws0rTCQbUYjMwXVmpYNX0sFbDUa pHDg7UTUD+zg3zM07mbxgWiA6WSoQaN0DEgCEZ+NZ7oC/3PVATsW4viVWjg0ydDHrZN+MPoZcph cFPWSAfdW90LOllTTGW67pfV1FSRQIwrvlylEbuN5B4zn8crySgpMsCyFsiy+jdIdZmZWE4Hngv vGCj6cxOQuxt4wfWsiY/6RS1UzRxxgk0nzRalR85voZGb7GZjbWJPAv/eoWa3q9KWeqHufcAs2Z SkO/7aW3ry50TEIahbQDK0qQ/hbaLA0onVquBB7Z4P9O4lYtx7g/H/bwLoXfebWzCSg7iXFkzIq FVbT0PNsh7o6yPqhAF/FcWG16GooAGk9xs3+PUrt6FM0H0aQU8LVOpviPRmZ8HIE+n1FEfp3O5i +uR9OO+PZxfOOKnMHSy2KzlGB5bRgB9hOaU X-Received: by 2002:a05:6000:41cd:b0:47f:8a1c:54d8 with SMTP id ffacd0b85a97d-47fd2ababccmr4085104f8f.3.1785501924107; Fri, 31 Jul 2026 05:45:24 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:20 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-21-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494709; l=4763; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=3rFxFx4Yry9jkNAk1yr11//RJi6X7ARRmYJTQcfmW/U=; b=D5IQqh8RhdAGaKpLwMt8UNrXLUOWNcI1cbLKa6RUUOT3c0/Y70mdi2LTb9S2FG9842NdK3166 YFnjRoOUC1cCfFfCitAQjruLtQqlf22IEafOToNnp1xO7uM7AOikCMp X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.43; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f43.google.com X-Spam_score_int: -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: 1785501962690158500 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=1785502030; cv=none; d=zohomail.com; s=zohoarc; b=fYd6RWgvNjnA2MHEUjkepWVJDpsl0KpEiHPttK47FsLRMWvozP9zx52fqWceAaL1vOo3KuUJf2GgJHP9S+ev7N12ruwimO2e7KJEH4m/Pf0fNBCIc8FCQxWYNXyuVNAJnPlj9sIRNPCmxiLBcdarJ242LoQnU+DTRqpgWGxIc7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785502030; 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=BBv6wQVajLCprWlWi69773YRgT0Tjs21Qqr3Afw3QnjzxLQdv1msKvWjvL0jNiWYEhlbtFUIr4ZOtLD2cIaPerbzm7KgKiU+KUH3z+soSLn2IfRwyZfrW8daJOr7rIoZPWtJyI0BZOAliCsAsMUH8pWjfPs/TjpTq47ygWZseHE= 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 1785502030360748.0988252457214; Fri, 31 Jul 2026 05:47:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmdU-0005WM-Rf; Fri, 31 Jul 2026 08:46: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 1wpmdD-0005VA-AD for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:46:33 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmdB-0002Oj-BC for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:46:30 -0400 Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4728c12ba97so561496f8f.0 for ; Fri, 31 Jul 2026 05:46: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 ffacd0b85a97d-47fd42d91bfsm4960391f8f.15.2026.07.31.05.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:46:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785501986; x=1786106786; 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=bmSsFCdpfCZL0WjhsGwk3lcXUb8tmr9HP90wZ4Kwo3VxjI7VXRhk2QcigwNxZUtWhj hOV7aKvhQAtfaQBqNpj9Sx3+sJ818YRjQB9WOxlOI+BDH7uDotrQtysEiKmq96OzbHMS l/YZPihAHAzhCmzHa/bgs3adyTbwG3wIdHP077xlIEX62Ts2px9TAYKPFBVXLClBAjR/ 3sJntuiG8p6K60GRk7cFPU+mHWNKQhxM86zfINVny9ZyOgiKJbxEjeP+syt4RczYKuCa 13cLYzb8bk4CnNxrSF3B+wtRiTGHHImtcnqcVrLnUNVMqQSNtvZhykN/YE8hXtibaMSA cAEA== X-Gm-Message-State: AOJu0YysRhj3Ft2GeJe7h+oGI90rpl+PWnMWJq4gXgOTdc2UTEeLrU8K mA06h+iheGnqQHGi0vQ7Db8doNa27FnqKL7w1xTdZTfM2XJFtszvDuTwwvUk7x/7 X-Gm-Gg: AR+sD11Rx7FoOshsxnFdWpR5UP1F2XXtWTnPKAWy9NZeOmjfSG0Vp598mieHKQ/tY1Y EbQCxeP2kHS95d17IrYr17gvQyxJs9eD+YegUl7tRx9ZwtPDW3KDLGIA2PL/usejWYwElqsPpB9 8Z6u4P8phDNdbIqqmnZSVLSP8+1Qk66e9nsuFiNEbGkV9LfsKp2dWuOznCwLP000EKQkCiYP1y5 ut1d0AhSacsrgbg4MEFg0PvxqIxm+Fj7xyl1ABIjH05kEFbZeQi7oVfApri6vG/NjjkTwHmPlui CFn7KGKeU9QTN0awgn/fGujFFiFUdlsZWZo17nXZtVKuY2tPkqUPH51z9qaArETtbI/7dWzHp3F Il67y67z3nTOkolhv8KFx4Pia+77RG6AfpTgHxpiWNO4EPCrZGiizr0seQgG502FKOInRULiH/m 2qoIYVAXCC+KETKXPG4OEbR5CPo1x0n678Jvir0FSoO2O+Wkm8xdPJH2alqzFpWOxxufYH56vOV JpFnsM1HDdjktXU9Q+Swo+ksXc9PpMmKbUj X-Received: by 2002:a05:6000:1843:b0:47f:cf99:b0bc with SMTP id ffacd0b85a97d-47fd2b32c4emr4426667f8f.38.1785501986017; Fri, 31 Jul 2026 05:46:26 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:21 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-22-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494709; l=3329; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=ltFXNfKtRdSz7pZKawpvHBeNBUB93gRly05M45TjzOE=; b=tHrrYgRR9I6PJxh5nDzHjisSEtq5C2w6lrm67jECcv5f1a9fyXZzlJeTukmMdq1nicwM/sEO2 u8otAP8J9xlCwEoORAqad8zdqUf8UKgTHUmkThwy8WuRMkN7CpDtKlt X-Developer-Key: i=emmanuel.blot@free.fr; a=ed25519; pk=0qFrZ21FAAN8OfVsSoVcCFTk/NMYOWzxJz4paSAVm0g= Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=209.85.221.43; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-f43.google.com X-Spam_score_int: -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: 1785502032886158500 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=1785502072; cv=none; d=zohomail.com; s=zohoarc; b=N8y5K9DNSFyoReytbLVvKAca3LmvK3Z1LlVdbWQhNpyOX3Y0L4FxXj+r4zH/nRJhJp7nUEOyXeVwfKM/v4VlKnEvDqj+t03pm+ISWRXRGMYFKfLDoZgz4KmiO+ysEGKTFkbrFtfxPTPnR4eFZq4HPuvzJs3Iin5LQHuQo5tAsF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785502072; 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=JT65aHTDKNPn+Wn34JyOJFKpQptXOKfPo0+Nkdq7s9UHpLflA/u8RmrCC0100gk+xw7wPvswsuFk1/X2vapI5Mo5AM6jTGlNibDbGRn4uq3zRGHwkstFzb7r6SjOtvhf2G2Z4kFp3n9V7INe7hGgoiE6f5+wV2dhBsFvgj/qfJ8= 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 178550207199865.45036246891368; Fri, 31 Jul 2026 05:47:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmeD-0005vg-DR; Fri, 31 Jul 2026 08:47: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 1wpmeB-0005v9-3Q for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:47:31 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpme9-0002Qv-Ey for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:47:30 -0400 Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-47f904e80eeso852677f8f.1 for ; Fri, 31 Jul 2026 05:47: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 ffacd0b85a97d-47fd41cfdc6sm4551569f8f.8.2026.07.31.05.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:47:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785502048; x=1786106848; 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=I9+pWcVHnGazWqxweaJxM4EfQWWAUTB0FsVHnhADVQ1CsiRcSAX0b+LaokAJks9Cpp R6vatFUYGYZmDGj6InbFqJUzK6oVddl3oLybNIhVhI9zFDLzF5MDLfxBYQ4CqTpkvmPI M7n+OKmQsORVQFrvrz8bn6+ly/yroryiI3Czv4ll9sBJVi/fRxfFq0NJ+oGxtjUENQhq UE9IwoJaJF+s4DVIzK0G1SQ+i2L8+JTb69wayECKbWJZOH3wJ+AdMKfPdOMIMraxPE0C sE+D1K46h8ZEL90XZmnlzwO1gZFNh6ZnvExcMhX5+p8l5Rc+bPMM6o98BZ6cNyrXJeHO G9cQ== X-Gm-Message-State: AOJu0Yxm3Colva4ufwqUKI9qp4lw1WBZhwKfmd+PPifRAIWFvMVAjG5E FyCHCQMQr/+ndZSEXtpnZRlHrwIflNG0SVE/XYOm/EdBIj5K0xrSOtyGd7LS1LQD X-Gm-Gg: AR+sD11f19fXAKxNvRXbKXoZqe0Awe3GY7KP8+pQ/k+F97VaGVjA+mhSXm2ojKH1SK3 0kwMm9VPKHsVEZmLVlDlHgQUUfZjigcewSwIBlFf8468F8rUTbVG+HP5YjUfg/bEsnH/Wbce/09 5m7w6wwtc7p09MaOi3Vc0tiLY8wpn3Fvh+7g1Jfj720eEqYssf20TG+6KTN5gVEq5/dMhAU0qTr Vi9OYJYjo4ZGWVygt2DhKgnDgJ+JlXLE5OTr3EWkQrL0ZJzY149BKpfHA25C7mE0ayML/ajlzOr YHWksj4eydkN0DNdJIJS49IKVI9CCMNh9wOex+R05gMVXw67GZIqGTprEHwc8i9BVSNgZpSS0gl UsEJVAxw2C/gkj9Oea0oRNtlLLgT1iGwwvlMrbvfh/ONv3BIzkzLlVzpXoe3tD/xtLf8LB4gP2p POUN+FLV/Gr6Fd6mIbvP8mAm5hB0g99FecFsYLaeCRVqDoQGjiN5Lg/lYB/hnAyNJyLWHr0JUaD CqfjrSEOUYW4NDUPDCmGmoX6fSk3yIVWXGN X-Received: by 2002:a05:6000:26c6:b0:47f:8602:6887 with SMTP id ffacd0b85a97d-47fd2abbd22mr4396387f8f.11.1785502047747; Fri, 31 Jul 2026 05:47:27 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:22 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-23-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494709; l=4869; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=x+swaeJ/f66FZ473PfGW+ic8eASLYIskyDGJo0YAj4k=; b=0b2Wssm2cNo4eQUPjiEQSBC0k5BbJ9x4kQv3WSzBE/mJQe+0GcFP1mMIpeDix6eXvFcAATC70 lDw7wWWBhD8ANZ2V/ToIS1O13tC6tk+VoRvRTbqlpvZ2wX1RFGp038K 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.45; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-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: 1785502072901158500 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=1785502151; cv=none; d=zohomail.com; s=zohoarc; b=ILc6FhncRukVAMAmZnxQgqBvKKW3VoCtqYg7soYvMTyIXa2VHO0mZonTGMC6ijRGnov9Lsf2wKbXiGjZiW+F1MDqt8fEoFUnAPHb7PGdG9/3Tii8uS2Ayhhd8cYqLfB6O9tvCK2mO3St/j4q/VM9j33QeSnl3DaLAbwk9+mNpPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785502151; 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=nLw7bYW7wcOT5kobmi/swvto8x1Z4AkqROJ8EIvi738V7Fnop8DrF0s8AJ5hvCq0T7ggWodgNMaGdQZbY8yyhBn6+FHHK1QA/XT1Nfc8dASQeZgn1iuClyUhxPeZ5xiPghnrahxT6H33qCSYconcjFIqGLy/S33nRbi9mTwv5Lo= 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 1785502151930292.01381823876227; Fri, 31 Jul 2026 05:49:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmfK-0006Mr-MN; Fri, 31 Jul 2026 08:48:42 -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 1wpmf9-0006Ll-US for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:48:31 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wpmf8-0002cu-Ig for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:48:31 -0400 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-47f7872abb6so682047f8f.3 for ; Fri, 31 Jul 2026 05:48:30 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fd458b73asm3927899f8f.29.2026.07.31.05.48.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:48:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785502109; x=1786106909; 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=gM+3qe6Ms14RdpOhBdknHj3ynlSqMCwKZ1FDjm38yyqhA7uQMRt8D8/7KL4ETZ6UTU 0YUZrc9hpZ+hU9rO2ACu3BF2KO2SUgIKPRr/lKzR3gyxXqKIoRq72bu2z0DVhJXq2aFo 0PEao/smqJoKxU1Ub5Kruur9+PyxhLUuPUglIBWtuAxftUSFuK08fqbbYjbCb5mqM7yY 6zCAh6W++VpwDFl1sN0r3O83wu6xcP98vJ103GLDikctXfNj64qfWoI3iovlATxcieJj aM0MsAen1hDyDJANAm16mkbWeK5mpliL07pZIoS94gKrzC6J6oaYCnfN12i9Sgagwf0y zU0A== X-Gm-Message-State: AOJu0Yy3VELOAIiJhPK8z1tEFzrS1NaBPIVPFkFHKRmfGUC+O/MmRbrN awbURQUb1lwiBMFHLPFAIEtJKkvhpIxOO2NlCqjTvCbkZ0Nw6JO6xquCwJNEXVqb X-Gm-Gg: AR+sD10q2rqNYl006ToT1IdR5R0L6nhtITjkvZ1EFWfUoea+3qAlTFTakHHWFXg5tEV wVgbEsYql9CCqyBdbO+K8lI78i60zhi66AgnmwD3cgvRTNYgYCZyfdii3sWoo2PI3tnX6akhlHF r5jbcHlWPDFeFeM9mBe22q04Wx9KxHF4eqrOTC9ihE4Y+BWUMVbqTzRXFHEGsufI2I3bfxCxsqy u3wLygVFMkUDqD09ekfbm4dG/nKr4SHhcEbNRUQlMaPgze3zbVcDroYfqWfEVC3aSCYsm5Kv3pY XhNJFTvQbjJ1YO9L1sdIreIpzhUp6zehUKum2AFxU6gDAGhMU0P8J//iEaY8HTGuY3Gim44j4mY toQPbkI95ooyPkElKrTGbvwpIVV5lza1FawvPF92BEsm1/t0zOZ2glFIFps0pZidjz6Cnw4iZoR Tcyhr8Px1G9AP9kEELQiyASuAhiN7PczXp2m3ohLHTLswmrnjXiMBlQ/Bm4Mr0Bqk2DFQJUHtkH WdxIQiYb1Fw/TnMIaBembAK3s4ciSuIZQj5 X-Received: by 2002:a05:6000:2504:b0:47f:7c50:2222 with SMTP id ffacd0b85a97d-47fd2adcf89mr4133005f8f.24.1785502109144; Fri, 31 Jul 2026 05:48:29 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:23 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-24-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494709; l=1675; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=EtxfxNQ4ajDXh5xrjgZPSfhgjy+Z8hKW5J2/81txDi0=; b=3uhiNc8DNYIaTMNhkdWS2vMAaIVje9oq6moOgrhv1yblmCtAGe9N9xL9Z4PgdQ255jEsxXcKF eLi8DJ4nLEpD7CbTyJtxBjK9pB7v92+6DhmmDiGR1LhER6IJDIk5N9A 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.47; envelope-from=eblot.ml@gmail.com; helo=mail-wr1-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: 1785502153607158500 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=1785502197; cv=none; d=zohomail.com; s=zohoarc; b=HChmJpfkfgvyWGQpI7bgs9xmZOHWDujc1LIkgKEeZpugyaOvPu46LoWHzoh6q8i8WOUPdzEdswesTwm90VdYJLwALYJse4EVAxEfkUc7NAD5SRMkhcJmbNcQi7VnDFF13+d/YaPoekkdkR7TYlzJscoRk9SorxdZizj/XtKlqSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785502197; 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=AKwelh7sOAulcm53mlfoCqjQVl9ENLArqLmsaqhCOk+eSpZqFd543O+u2j5/EIbzzpJB8LS9lBVUUg9gAbM7tgrVQ2Ht2LwTqdJ9l9UoSCOIdnPLASOkwBFlsNasDi+sluOzQLj9ibIs9yPkxKsb9r5EePorMrNfiggdVjZX4HA= 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 1785502197482986.8390621551282; Fri, 31 Jul 2026 05:49:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpmgC-0007AZ-QI; Fri, 31 Jul 2026 08:49:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpmgA-00079j-JS for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:49:34 -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 1wpmg9-0002hp-6L for qemu-devel@nongnu.org; Fri, 31 Jul 2026 08:49:34 -0400 Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-47f6609c657so478530f8f.2 for ; Fri, 31 Jul 2026 05:49:32 -0700 (PDT) Received: from localhost (89-93-216-19.hfc.dyn.abo.bbox.fr. [89.93.216.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fd4562a38sm4287639f8f.21.2026.07.31.05.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:49:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785502172; x=1786106972; 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=aH68PdNJkUn0A9APOYRfMvCrLwcBbz9YkMRTCK6yJsISkfcVdTUS0VvmoyQLazlaOX Z83IJLtoxa5vWyrOXuoMwgTiIYNBUZ7hS3dCYYQV2M1gE5V2Kl3j8Ac06m1akZEpPNT3 ZDTbloMfIMme9eCu4se2os3tzKZp950poSYvHGLAZQnCspixClEQg+AaD9hnpiJehLm6 kMTeCMb9Vs0oIJRJlc+gR1SgDlc3AFTIq4bTIn/UCPsMri4GcN4wfzs10lO5/DpAGUyT EB6fOpTpFv/a3e6rUozKMUWE5RRvT47lswXnzhpKSLA4I3IHg9F8UWnHPJNcCYC/DnFO 6R6g== X-Gm-Message-State: AOJu0YwUNlnxj3i0JyaRmQm/e9BlAjaORhnGzc/TzZKHKJzAXDiQOQMT IzfmQmeGamRylTUj1fO/bgfYL86jJIwHvJfIkszXBSGggjPQGkRzhBu+TaiTKnFd X-Gm-Gg: AR+sD12cbK2x3t6THBd9t9u+OXmnH6degdrz/U2+z8DCK3K2DxpLq0ATGEJd/CyRUW5 r9btz0uNIjDDlzGu6iWfPenkM+Tr5vWqCMhXI/337d7RJAO99M3QeUm6s9ZWrz9PhSv/5cNeSi/ zm0MGu5V1Z4TmIR1OKDaP5dyrUIwqXOJYmkaIC55DgrdSUtRsPFeAVDN+wPuTYzJE9Kr1vQxzaf 1hDaddXQ/Gzu9s79LYi/myQLNhIxLqmKhLvM+vWjeYE5A4YViruLtge+wZ6bm78Z9oxyt/9IGVJ 7m16geoK/ubnx/VoMxb5vkRtrnIvPoyTYDZg6hE96yldfPADaW98SyLoDBD0/CwZp9dk6iMtZ9K 09/1DzzkKpwKCwlQ5t7yctDGmutgfgIJz0Pvg/2JQcoICn9JTRrZkx5lWGZ2q4sy69S/pFaWaCO QnOQmjXLqNTwTDKCSfpwiSVk2Ep4WM52mdY+HV9lLZsOgtaFS1EGqUvYKtBw9JqYrP7Pn4/0GZb cZ3uQQLQ3wf8KNZpUUZOODU82QAn5qNA39c X-Received: by 2002:a05:6000:41f2:b0:47f:81fe:12f8 with SMTP id ffacd0b85a97d-47fd2ababd7mr4509615f8f.1.1785502171339; Fri, 31 Jul 2026 05:49:31 -0700 (PDT) Date: Fri, 31 Jul 2026 12:45:24 +0200 Subject: [PATCH v2 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: <20260731-sanmiguel-bmc-locator-v2-25-1266926ba769@free.fr> References: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@free.fr> In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-0-1266926ba769@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 , 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=1785494709; l=2183; i=emmanuel.blot@free.fr; s=20260602; h=from:subject:message-id; bh=8aTFJBX4+2Zfb9dvqeKFk8XY5h03hnbOmzH0dpRmEzQ=; b=sxASZf/orReLgvIfnA0D0nVO733hUkUx7XzpQ1f1JTllPMuobgPTDxSRDpwp9zwTOzjoZvrAx /pnDcsHJZs6BdXFaKvfkL2A+QTQqYTP30I90MEIZ2xxT0bwsNfOou5E 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: 1785502199837158500 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