From nobody Fri Oct 24 11:47:46 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519013281598920.5632994814913; Sun, 18 Feb 2018 20:08:01 -0800 (PST) Received: from localhost ([::1]:47455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1enckA-0001X5-Re for importer@patchew.org; Sun, 18 Feb 2018 23:07:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1encgR-0007Wn-35 for qemu-devel@nongnu.org; Sun, 18 Feb 2018 23:04:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1encgQ-0000S8-DU for qemu-devel@nongnu.org; Sun, 18 Feb 2018 23:04:07 -0500 Received: from mail-it0-x234.google.com ([2607:f8b0:4001:c0b::234]:55519) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1encgQ-0000Ro-9f for qemu-devel@nongnu.org; Sun, 18 Feb 2018 23:04:06 -0500 Received: by mail-it0-x234.google.com with SMTP id b66so7678761itd.5 for ; Sun, 18 Feb 2018 20:04:06 -0800 (PST) Received: from localhost.localdomain ([184.250.204.84]) by smtp.gmail.com with ESMTPSA id a13sm19158075itj.13.2018.02.18.20.04.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Feb 2018 20:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ObOGUZWnw2cfW2O1UuGpwZjvtfluZC6VZMA4Vj0zd/A=; b=ae43qAB1CYUfrdee4zn9rdW8T3XhESPO4kSxym9gSn2ATT5PwWHiUFTAG7jILiEq89 tEY4dlaojqHlb7Ulv8O2+e+00THu+2q0yiweEpsvbylp2zY09CmqksW/ZmtGm6xJei0v wACJJVM65AEENKtW32+RU3E3wjNyQWMCL+lbSBa4eRJS5rdFelPUpVaKI/bZmxsqKuPS Tik3LoSIZGkUdK/nXgUPd4Wj1faqSHlnn50QS3BbVf+PwQbUv6kR/kPdt1LbrmupqTEB WjOB1H/2j7Jla+Dv7UvIjgewELwE3hoWhRDeXVC+rFvj/s35XKFTV+SBZx6dG2VD7PHT cRJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ObOGUZWnw2cfW2O1UuGpwZjvtfluZC6VZMA4Vj0zd/A=; b=pNeNWDdZhejxGmMgAP0kqYBFcXH16KWBRxQisHkM6z5a7z7l80rMp5pxQtNG4CFPVa CsaZaYSD9J+jrKZ/WeKcUcIxbr94HcbFLKVWmTDAiovk8egd1RD/uUvePabwh4/muJxS 7DlnENGUSkjXbc8hq/PyOdv+DvywHAdmIcXvmgjD0v4JdQ50Lq0AdPj66paxEIQqnt10 jKRcx81yTfLNkOBejufe5dfBuL2ky4tHTI7Wp/awCwiUswYpnGA4zNCq94JMLwY4O87I r8C8ATRpXiS+F7HyYJJR4l4v+eBdmvnqaMTtqOQL2i3ADIfFkX95r7MwAKJXMvExu5uO crNQ== X-Gm-Message-State: APf1xPAJMPcoGTKt39r7NY8+1RkaqGOTASZ7hikHNam2Pz9FifnNHHIa 1dnkS0gz6peTRYT+v7JaOqI= X-Google-Smtp-Source: AH8x2252x6OfzGgCAvPuuenTgOFJUXAWE+2yoqHVsQqxXJIJsQTQWGv2X9WW42iDXYWAhCt0ZS9Kxw== X-Received: by 10.36.158.198 with SMTP id p189mr18281285itd.74.1519013045552; Sun, 18 Feb 2018 20:04:05 -0800 (PST) From: Michael Davidsaver To: Paul Brook , Peter Maydell , Antoine Mathys Date: Sun, 18 Feb 2018 20:03:38 -0800 Message-Id: <20180219040342.12686-2-mdavidsaver@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180219040342.12686-1-mdavidsaver@gmail.com> References: <20180219040342.12686-1-mdavidsaver@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::234 Subject: [Qemu-devel] [PATCH 1/5] timer: ds1338 add magic reset for test code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Davidsaver , qemu-devel@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When running w/ QTest, allow the tester to reliably zero time offsets. Allows tests to read the current time, and set time, independent of test order. Signed-off-by: Michael Davidsaver --- hw/timer/ds1338.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/timer/ds1338.c b/hw/timer/ds1338.c index 3849b74a68..41c2d7dac6 100644 --- a/hw/timer/ds1338.c +++ b/hw/timer/ds1338.c @@ -14,6 +14,7 @@ #include "qemu-common.h" #include "hw/i2c/i2c.h" #include "qemu/bcd.h" +#include "sysemu/qtest.h" =20 /* Size of NVRAM including both the user-accessible area and the * secondary register area. @@ -132,6 +133,14 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data) DS1338State *s =3D DS1338(i2c); =20 if (s->addr_byte) { + if (data =3D=3D 0xff && qtest_enabled()) { + /* magic, out of bounds, address to allow test code + * to reset offset + */ + s->offset =3D 0; + s->wday_offset =3D 0; + return 0; + } s->ptr =3D data & (NVRAM_SIZE - 1); s->addr_byte =3D false; return 0; --=20 2.11.0