NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60672: TOD clock enabled check is too strict on NetBSD 11



>Number:         60672
>Category:       kern
>Synopsis:       TOD clock enabled check is too strict on NetBSD 11
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 31 08:00:00 +0000 2026
>Originator:     Andrius V
>Release:        NetBSD 11.0
>Organization:
>Environment:
>Description:
On my amd64 KX-7000 system, I noticed the 
"WARNING: no TOD clock present"
warning during boot. After code analysis and testing, it looks like a
NetBSD 11 specific check causes the RTC clock not to be considered present, skipping its registration:

https://nxr.netbsd.org/xref/src/sys/arch/x86/isa/clock.c?r=1.42#335

As the comment states, this check was added for QEMU/microVM to identify
when the RTC is disabled. However, the assumption that bits 0-6 are
read-only and always zero is not always correct anymore.

For example, the Intel I/O Controller Hub 8 datasheet states that bits 0-5 can be used for the "Date Alarm"
(section 7.6.2.4, RTC_REGD--Register D (Flag Register)).

AMD datasheets document similar use of this register.

I am not sure whether the KX-7000 uses the same meaning (no datasheet is
known to me), but considering that recent Zhaoxin CPUs appear to
follow Intel specifications more closely, this seems plausible.

I am not entirely sure what the best fix would be. Possibly checking
for a value of 0xFF specifically would be more correct, since
comment mentions that all bits are set to 1 when the RTC is disabled?
>How-To-Repeat:
Boot the system, observe the warning in the boot log:
"WARNING: no TOD clock present"
>Fix:
Replace the check with(?):

if (mc146818_read(NULL, MC_REGD) == 0xFF)
        return;




Home | Main Index | Thread Index | Old Index