This was lost when making the logic accessible to PVH Dom0.
While doing so make the access to the global function pointer safe
against races (as noticed by Roger): The only current user wants to be
invoked just once (but can tolerate to be invoked multiple times),
zapping the pointer at that point.
Fixes: 835d8d69d96a ("x86/rtc: provide mediated access to RTC for PVH dom0")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Release-acked-by: Paul Durrant <paul@xen.org>
if ( value & (RTC_PIE | RTC_AIE | RTC_UIE ) )
{
cpuidle_disable_deep_cstate();
- pv_rtc_handler = NULL;
+ ACCESS_ONCE(pv_rtc_handler) = NULL;
}
}
switch ( port )
{
+ typeof(pv_rtc_handler) hook;
+
case RTC_PORT(0):
/*
* All PV domains (and PVH dom0) are allowed to write to the latched
case RTC_PORT(1):
if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
break;
+
+ hook = ACCESS_ONCE(pv_rtc_handler);
+ if ( hook )
+ hook(currd->arch.cmos_idx & 0x7f, data);
+
spin_lock_irqsave(&rtc_lock, flags);
outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
outb(data, RTC_PORT(1));