From nobody Sun Aug 14 18:50:29 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M5RLY6vh1z4Yl2j; Sun, 14 Aug 2022 18:50:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M5RLY6NnJz3DxQ; Sun, 14 Aug 2022 18:50:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660503029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wZoJNmQLoNcYzSwGpPsbpt+QA2K1G3zhFCJXbJtTuTg=; b=u/UGhIJZuWCFN+IJ5VO4560ipVW3UQAeughzcLOvYY71ZHrudYOPxHb26WULvzF9C2xmXc 7QmGaKasUwdQY/QvrRy4Mqe6gftp3XuH4LAyfDTXyR/7pN/sNhcqQE1iLHWUon8qiZoHh1 5a53NWYwj3LqntNyNY3Ht88olKkWIqwImHvS2a+oh1NRWVo40TxzajuI4KDfUaBJEnceG1 SD/L9yrM5BTKIU5yDOU+UTiDodGLNQ3Dak0ainCS37OktY1KSqJKOSpYzoGzaSFIjlpmMS l0tHtfY1remtwbPqKqhnphw1um7NRclK0KBaGFF5QUr21dREdPAURIv+hzPXFQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M5RLY5S1Nz11QH; Sun, 14 Aug 2022 18:50:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27EIoTG6096342; Sun, 14 Aug 2022 18:50:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27EIoTkF096341; Sun, 14 Aug 2022 18:50:29 GMT (envelope-from git) Date: Sun, 14 Aug 2022 18:50:29 GMT Message-Id: <202208141850.27EIoTkF096341@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 762dcf106412 - main - goldfish_rtc: Fix handling a local time RTC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 762dcf10641251c55dda2e6950fef8bb698027ad Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660503029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wZoJNmQLoNcYzSwGpPsbpt+QA2K1G3zhFCJXbJtTuTg=; b=VHH0SrjoJkcyL12ul1tb7vLWhGv/WHs/YnGq0fCW09LkQjojbyMT4zGKVvD7KjDGapktrF 4ehC7aZDdx6nKRS2+CdVz969TWxE4YKtMVZJQN7LOXkgrfUbPlWyj5dS3m/aBY5//dB5vn 1y+TiedJYYKsuj+UtymEl9CjGimVQhRaomXwMZc1/am5wW9rAjJZr3nWzYoTXI+rNzizdY FX9s/3bh/oZzqQGSvKdYG2NnDEsWgfIVab0Ozt3CYN8/jlKCTd8T5TtM9cPJQSQ5A9Gzay bR7L/gY3/vWofSnyi3AT5i7PGAigzeKPTPiY2zzvyYDuXQc0bHrPnGt+/KruHg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660503029; a=rsa-sha256; cv=none; b=U7IWcVNiGhoC9FhBip+Yb1w3uUtlYpD90PEzpfkZIAxWxuCoMDXmCtU1WYB2Exv/n9t9L/ ylmAxSmfWrCkvOBFucsoiCWFoD/vMk9ocbncPU8inmbgnoGbIBr74kXsBnHsTL17+w8ThS soLF9Z955B7gORsSc+IYvj0h9m9+blKC2ETwfsRnrfWdn05hpVFu5+l8FrNOfqqMMKieWA +FAhnFiBEQJgjEZqL6lElayLHIu7u3UJNT1qi0OhBTOIddoggN4aB/bdUQ4zc9RqMkTOTW PFjkCqafCbBXRH0HQAEZretfa+OmG9EVscn/OSNFYcXXFdGEcIIcw9XO9XPz/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=762dcf10641251c55dda2e6950fef8bb698027ad commit 762dcf10641251c55dda2e6950fef8bb698027ad Author: Jessica Clarke AuthorDate: 2022-08-14 18:50:22 +0000 Commit: Jessica Clarke CommitDate: 2022-08-14 18:50:22 +0000 goldfish_rtc: Fix handling a local time RTC The default QEMU config is to have the RTC in UTC. However, if run with -rtc base=localtime (and wall_cmos_clock is set to match), the driver fails to account for adjkerntz due to the use of CLOCKF_SETTIME_NO_ADJ. Copy the same code used by other CLOCKF_SETTIME_NO_ADJ-using drivers to fix this, namely manually subtracting utc_offset(). Fixes: d63a631e7244 ("Add Goldfish RTC device driver for RISC-V") MFC after: 1 week --- sys/dev/goldfish/goldfish_rtc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/goldfish/goldfish_rtc.c b/sys/dev/goldfish/goldfish_rtc.c index 6cd209ff5872..31b671cd4b3e 100644 --- a/sys/dev/goldfish/goldfish_rtc.c +++ b/sys/dev/goldfish/goldfish_rtc.c @@ -151,6 +151,11 @@ goldfish_rtc_settime(device_t dev, struct timespec *ts) sc = device_get_softc(dev); + /* + * We request a timespec with no resolution-adjustment. That also + * disables utc adjustment, so apply that ourselves. + */ + ts->tv_sec -= utc_offset(); nsec = (uint64_t)ts->tv_sec * 1000000000 + ts->tv_nsec; mtx_lock(&sc->mtx);