From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796394455; b=JRYOfsF2t5tu+2sCAxCUooQ4xJapfKg6iVhZS3Ehwt1vN+u4cCLjkMfV+6SMeLNzIOiR EDyvnb0f5gwbElBqm8quSc1jZD3KBAykqNXYjdT06C20ZfP4wqsJ5SidwEntTn3iutGL0 rQgVRiJi36kBVYlT8iOjZQITHxaQw0PV0TjRzxwN5qZLpMua/vXNvxnvjx1YZGU3J+r9h tJoA+C4Bo7hQI1QH+FfQE6d6Py2PaZftTLb2UXqs7WdGpvWVrnw50lCGYgsg+UqC2pUR9 JzPJ1ZeuUnzdroSoCrXUw9nud3pAXOb7ahbKePaFPJ/5VeG3j2QjBjfGhpI+LAaSAHg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394455; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=2pmQBq4uBXI2jc097ETAJMWZQbjnApioXYBJCq5MdRo=; b=1S+i17VwOtNBkTJnp3KSaRgAf3CLxtmSCH+vsrmZ58SPDM0LsQ2OS2HSYDquY5CTmOJq XMyUtp2K3i8YfVxVgbE7oYtV3CxDsL07/uOihkTPR8LU/+g1TDBfha0gQhDXPnpQh8gyp a5rHDexDt6HTUvLmGC4TiWa5WYZV1ii8+UP+vY9GPHvGa1s6ZXNN4bBlBBaQAoW2q2mjv CYV2A/K3hav2eYaeJmh3ECmJ9CY/lL0sUziMBev7QV1SIOaY1D/10qxgXcg6iz2nEuLYa 0mZEVSrT+Q3tKkXTeB62OvvDJsHZ9yvT/EFezQAC6oI/uyn6sHDYu1Hp6B0GPm+Hv4A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aHUxaiDI; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C0E8606A322; Fri, 4 Dec 2026 14:27:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aHUxaiDI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5288E1F0092C; Fri, 4 Dec 2026 14:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796394455; bh=2pmQBq4uBXI2jc097ETAJMWZQbjnApioXYBJCq5MdRo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=aHUxaiDICMfqOvvNYUTHSZNcykXPEFxkaTMZmQ2fWaCbs+ul8lwk3et3cEEnBqxaJ IEESNovj37O7adBaERqKl0u/PFW82/rv9yqOd8I3exPhf+ary5DPUCyG24ecQDDp5e ZNV5udj/mzN39Gk6CsobHM7vM8qWYK/6AOrftPdeF86WK6uDNNEpd9U3eVvxg2Tfwz ZbEYg2wuNSC5+mvxmTDxOnrxzOLuJChg0Ntq+JyCO0ukztEOmNc7sDabhks8joce+c 6j/w7apOm/LFdgJ/xy0wWH15b5MMl/4QWJk7WdU95tAaX6RpXpAhZ8Ojkhokyeql6w wV0BWdCid4Geg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 09/14] treewide: disable other rtc's in t2 macs Reply-To: sashiko-reviews@lists.linux.dev To: "Atharva Tiwari" Cc: "Aditya Garg" , "Bjorn Helgaas" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , x86@kernel.org, "H. Peter Anvin" , "Rafael J. Wysocki" , "Len Brown" , "Linus Walleij" , "Bartosz Golaszewski" , "Sven Peter" , "Janne Grunau" , "Neal Gompa" , "Guenter Roeck" , "Jonathan Cameron" , "David Lechner" , =?utf-8?b?TnVubyBTw6E=?= , "Andy Shevchenko" , "Lee Jones" , "Pavel Machek" , "Griffin Kroah-Hartman" , "Hans de Goede" , =?utf-8?b?SWxwbyBKw6RydmluZW4=?= , "Sebastian Reichel" , "Alexandre Belloni" , "Wim Van Sebroeck" , "Jarkko Sakkinen" , "Mimi Zohar" , "Roberto Sassu" , "Dmitry Kasatkin" , "Eric Snowberg" , "Paul Moore" , "James Morris" , "Serge E. Hallyn" , linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-leds@vger.kernel.org, mfd@lists.linux.dev, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org In-Reply-To: <20261204131619.5059-10-atharvatiwarilinuxdev@gmail.com> References: <20261204131619.5059-1-atharvatiwarilinuxdev@gmail.com> <20261204131619.5059-10-atharvatiwarilinuxdev@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:27:32 +0000 X-Mailing-List: linux-rtc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [High] x86/rtc: read_persistent_clock64() still reads broken CMOS RTC on T2 Macs - [Medium] rtc: compile-time IS_ENABLED() disables T2 Mac RTCs if macsmc-rtc fails - [Low] ACPI: TAD: acpi_tad_probe() clears ACPI_TAD_RT without ACPI_TAD_RT_IN_MS - [Low] treewide: duplicated leaf-driver Kconfig guard across x86, ACPI, and RTC - [Low] treewide: commit message reverses NTP-to-RTC synchronization direction -- commit 4cff46337e95a353ab01666127ac4401097aabbb Author: Atharva Tiwari treewide: disable other rtc's in t2 macs This commit disables the CMOS RTC, the ACPI TAD real-time clock capability, and legacy x86 persistent clock updates on Apple T2 Macs when CONFIG_MACSMC_ACPI and CONFIG_RTC_DRV_MACSMC are enabled. > Apple also uses RTC to update NTP instead of wallclock so we > do that also. [Severity: Low] Does this sentence have the synchronization direction reversed? Returning -ENODEV from update_persistent_clock64() causes sync_hw_clock() in kernel/time/ntp.c to fall back to update_rtc(), so NTP updates the RTC class device instead of the legacy x86 wallclock, rather than the RTC updating NTP. > diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c > index 314b062a15de9..90f24e6cebfda 100644 > --- a/arch/x86/kernel/rtc.c > +++ b/arch/x86/kernel/rtc.c [ ... ] > @@ -101,6 +102,10 @@ EXPORT_SYMBOL(rtc_cmos_write); > =20 > int update_persistent_clock64(struct timespec64 now) > { > + if (IS_ENABLED(CONFIG_MACSMC_ACPI) && > + IS_ENABLED(CONFIG_RTC_DRV_MACSMC) && has_apple_t2_chip) > + return -ENODEV; > + > return x86_platform.set_wallclock(&now); > } [Severity: High] Should read_persistent_clock64() also bypass the CMOS RTC on T2 Macs? Right now it still calls x86_platform.get_wallclock(ts), which invokes mach_get_cmos_time() on the broken CMOS clock that NTP will no longer update. On boot, if that read returns any valid non-zero timestamp, timekeeping_init() initializes wall time from it and sets persistent_clock_exists =3D true. That makes timekeeping_rtc_skipsuspend() return true, so rtc_suspend() skips snapshotting macsmc-rtc. On S3 resume, timekeeping_resume() then either injects a bogus CMOS delta and skips rtc_resume(), or leaves rtc_resume() to compute sleep time against zeroed old_rtc and old_system snapshots. If CMOS UIP is stuck, mc146818_get_time() also busy-waits for 1000 ms on boot, suspend, and resume. Returning early from read_persistent_clock64() with ts->tv_sec and ts->tv_nsec zeroed under the same T2 guard keeps persistent_clock_exists false so boot and suspend/resume use macsmc-rtc. > diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c > index 45459a4cafae3..a137164511f7b 100644 > --- a/drivers/acpi/acpi_tad.c > +++ b/drivers/acpi/acpi_tad.c [ ... ] > @@ -845,6 +846,10 @@ static int acpi_tad_probe(struct platform_device *pd= ev) > return -ENODEV; > } > =20 > + if (IS_ENABLED(CONFIG_MACSMC_ACPI) && > + IS_ENABLED(CONFIG_RTC_DRV_MACSMC) && has_apple_t2_chip) > + caps &=3D ~ACPI_TAD_RT; > + > if (!acpi_has_method(handle, "_PRW")) { > dev_info(dev, "Missing _PRW\n"); > caps &=3D ~(ACPI_TAD_AC_WAKE | ACPI_TAD_DC_WAKE); [Severity: Low] Should this also clear ACPI_TAD_RT_IN_MS? Leaving it set in dd->capabilities lets caps_show() report millisecond real-time accuracy in sysfs even though ACPI_TAD_RT has been disabled, unlike the ACPI_TAD_AC_WAKE / ACPI_TAD_DC_WAKE handling just below. > diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c > index 209aa4ec732c8..9a6cecc192955 100644 > --- a/drivers/rtc/rtc-cmos.c > +++ b/drivers/rtc/rtc-cmos.c [ ... ] > @@ -968,6 +969,10 @@ cmos_do_probe(struct device *dev, struct resource *p= orts, int rtc_irq) > .priv =3D &cmos_rtc, > }; > =20 > + if (IS_ENABLED(CONFIG_MACSMC_ACPI) && > + IS_ENABLED(CONFIG_RTC_DRV_MACSMC) && has_apple_t2_chip) > + return -ENODEV; > + > /* there can be only one ... */ > if (cmos_rtc.dev) > return -EBUSY; [Severity: Medium] Can gating these checks on compile-time IS_ENABLED() leave a T2 Mac with no working RTC when CONFIG_MACSMC_ACPI=3Dm and CONFIG_RTC_DRV_MACSMC=3Dm? drivers/hwmon/applesmc.c still matches all T2 Macs via applesmc_whitelist[] with no exclusion against macsmc-acpi, and reserves the same SMC I/O ports (0x300..0x31f). If applesmc loads first, apple_smc_acpi_probe() fails with -EBUSY in devm_request_region(), so macsmc-rtc is never instantiated. Because cmos_do_probe(), acpi_tad_probe(), and update_persistent_clock64() already returned early, the system ends up with no /dev/rtc* device (and no cmos_nvram or acpi_cmos_wake_setup()), and sync_hw_clock() fails with -ENODEV. Either the broken T2 RTCs should be quirked directly while resolving the applesmc port conflict, or the fallback should not be disabled based solely on tristate Kconfig symbols. [Severity: Low] This isn't a bug, but repeating the leaf-driver Kconfig check across arch/x86, ACPI, and RTC couples generic drivers to downstream symbol names. Moving it to a static inline helper in include/linux/platform_data/x86/apple.h (and splitting the changes per subsystem) would keep the checks consistent and easier to review. The commit message would also benefit from explaining how the CMOS RTC and ACPI TAD fail on T2 Macs, and why disabling all of rtc-cmos (including cmos_nvram and acpi_cmos_wake_setup()) is safe there. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204131619.5059= -1-atharvatiwarilinuxdev@gmail.com?part=3D9