]> xenbits.xensource.com Git - xen.git/commit
x86/rtc: provide mediated access to RTC for PVH dom0
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 8 Jun 2020 16:13:53 +0000 (18:13 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 8 Jun 2020 17:40:05 +0000 (18:40 +0100)
commit835d8d69d96aa7feb52ef7b3dd8ecf43f0807578
tree7fb58684746d6fcda3642acc8de76174240bb9f4
parent63b4c9bfb788ebfd35d0172f7e8e2e41ef948f70
x86/rtc: provide mediated access to RTC for PVH dom0

Mediated access to the RTC was provided for PVHv1 dom0 using the PV
code paths (guest_io_{write/read}), but those accesses where never
implemented for PVHv2 dom0. This patch provides such mediated accesses
to the RTC for PVH dom0, just like it's provided for a classic PV
dom0.

Pull out some of the RTC logic from guest_io_{read/write} into
specific helpers that can be used by both PV and HVM guests. The
setup of the handlers for PVH is done in rtc_init, which is already
used to initialize the fully emulated RTC.

Without this a Linux PVH dom0 will read garbage when trying to access
the RTC, and one vCPU will be constantly looping in
rtc_timer_do_work.

Note that such issue doesn't happen on domUs because the ACPI
NO_CMOS_RTC flag is set in FADT, which prevents the OS from accessing
the RTC. Also the X86_EMU_RTC flag is not set for PVH dom0, as the
accesses are not emulated but rather forwarded to the physical
hardware.

No functional change expected for classic PV dom0.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Paul Durrant <paul@xen.org>
xen/arch/x86/hvm/rtc.c
xen/arch/x86/pv/emul-priv-op.c
xen/arch/x86/time.c
xen/include/asm-x86/mc146818rtc.h