From: "Cédric Le Goater" <clg@kaod.org>
To: Emmanuel Blot <emmanuel.blot@free.fr>, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Jamin Lin" <jamin_lin@aspeedtech.com>,
"Kane Chen" <kane_chen@aspeedtech.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
qemu-arm@nongnu.org, "Fabiano Rosas" <farosas@suse.de>,
"Laurent Vivier" <lvivier@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Huth" <th.huth+qemu@posteo.eu>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Emmanuel Blot" <eblot@meta.com>
Subject: Re: [PATCH v2 10/25] tests/qtest: tmp105: cover one-shot and fault-queue write immunity
Date: Tue, 1 Sep 2026 08:59:55 +0200 [thread overview]
Message-ID: <e09fc3a4-17bf-4ccc-a28e-4516350fa956@kaod.org> (raw)
In-Reply-To: <20260731-sanmiguel-bmc-locator-v2-10-1266926ba769@free.fr>
On 7/31/26 12:45, Emmanuel Blot wrote:
> 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 — only
> real conversions do.
>
> Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
> ---
> 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 faults */
> #define TMP105_CONFIG_FQ(f) ((f) << 3) /* raw F1:F0 fault-queue field value */
> +#define TMP105_CONFIG_SD (1 << 0) /* shutdown mode */
> +#define TMP105_CONFIG_OS (1 << 7) /* one-shot conversion */
>
> static int qmp_tmp105_get_temperature(const char *id)
> {
> @@ -200,6 +202,102 @@ static void check_fault_queue(QI2CDevice *i2cdev, const char *id,
> g_assert_true(get_irq(0));
> }
>
> +/*
> + * 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 = (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 = 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 = 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 = (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 = 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 = 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 = (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 = 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);
>
> /* TMP75: register-compatible, but with a 1/2/3/4 fault queue. */
> QOSGraphEdgeOptions tmp75_opts = {
>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
next prev parent reply other threads:[~2026-09-01 7:00 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 10:44 [PATCH v2 00/25] hw/arm: Facebook SanMiguel BMC and TMP75-family sensors Emmanuel Blot via
2026-07-31 10:44 ` Emmanuel Blot via qemu development
2026-07-31 10:45 ` [PATCH v2 01/25] hw/sensor: tmp105: make device state private to the implementation Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-01 6:58 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 02/25] hw/sensor: tmp105: name the parent object field parent_obj Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-01 6:58 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 03/25] hw/sensor: tmp105: implement Resettable reset Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-01 6:58 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 04/25] hw/sensor: tmp105: enforce the configurable fault queue Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-09-01 6:59 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 05/25] hw/sensor: tmp105: describe the temperature property Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-01 6:59 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 06/25] hw/arm: aspeed: guard board-local temperature-sensor aliases Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-09-01 6:59 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 07/25] hw/sensor: tmp105: add TMP75, TMP175 and LM75B variants Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-09-01 6:59 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 08/25] tests/qtest: tmp105: cover the ALERT fault queue Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-01 6:59 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 09/25] tests/qtest: tmp105: cover the TMP75, TMP175 and LM75B variants Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-01 6:59 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 10/25] tests/qtest: tmp105: cover one-shot and fault-queue write immunity Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-01 6:59 ` Cédric Le Goater [this message]
2026-07-31 10:45 ` [PATCH v2 11/25] tests/qtest: tmp105: cover shutdown clearing the ALERT across variants Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-09-01 7:00 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 12/25] hw/arm: sanmiguel: add Facebook SanMiguel BMC machine Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-07-31 10:45 ` [PATCH v2 13/25] hw/arm: sanmiguel: populate EEPROM data Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-09-02 5:50 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 14/25] hw/arm: catalina: use the real TMP75 model Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-09-02 5:50 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 15/25] hw/arm: fuji: use the real TMP75 and LM75B temperature sensors Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-09-02 5:50 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 16/25] tests/functional: aspeed: optionally check the device tree model on boot Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-02 5:50 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 17/25] tests/functional: give the set_machine probe VM the test workdir Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-02 5:51 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 18/25] tests/functional: add a pure-Python device-locator resolver Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-09-03 14:21 ` Adding /machines/labels (was Re: [PATCH v2 18/25] tests/functional: add a pure-Python device-locator resolver) Cédric Le Goater
2026-09-04 8:22 ` Markus Armbruster
2026-09-05 12:45 ` Mark Cave-Ayland
2026-09-05 15:20 ` Cédric Le Goater
2026-07-31 10:45 ` [PATCH v2 19/25] tests/functional: add a device-locator self-check Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-07-31 10:45 ` [PATCH v2 20/25] tests/functional: aspeed: add hwmon sensor read helpers Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-07-31 10:45 ` [PATCH v2 21/25] tests/functional/arm: sanmiguel: add BMC boot test Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-07-31 10:45 ` [PATCH v2 22/25] tests/functional/arm: catalina: test TMP75 Emmanuel Blot via
2026-07-31 10:45 ` Emmanuel Blot via qemu development
2026-07-31 10:45 ` [PATCH v2 23/25] tests/functional/arm: catalina: test PCA9555 IO expander via QOM Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-07-31 10:45 ` [PATCH v2 24/25] hw/arm: catalina: drive pca9554 io expander input pins externally Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-07-31 10:45 ` [PATCH v2 25/25] tests/functional/arm: catalina: test PCA9554 IO expander via QOM Emmanuel Blot via qemu development
2026-07-31 10:45 ` Emmanuel Blot via
2026-08-31 14:42 ` [PING] Re: [PATCH v2 00/25] hw/arm: Facebook SanMiguel BMC and TMP75-family sensors Emmanuel Blot
2026-09-02 6:19 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e09fc3a4-17bf-4ccc-a28e-4516350fa956@kaod.org \
--to=clg@kaod.org \
--cc=andrew@codeconstruct.com.au \
--cc=berrange@redhat.com \
--cc=eblot@meta.com \
--cc=emmanuel.blot@free.fr \
--cc=farosas@suse.de \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=kane_chen@aspeedtech.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@mailo.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=th.huth+qemu@posteo.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.