aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/hpet.c
Commit message (Collapse)AuthorAgeFilesLines
* x86/HPET: basic cleanupAndrew Cooper2013-10-081-9/+9
| | | | | | | | | * Strip trailing whitespace * Remove redundant definitions * Update stale documentation links * Move hpet_address into __initdata Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
* x86/hpet: warn about and clear reserved set config register bitsJan Beulich2012-03-281-1/+2
| | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/hpet: use asm/hpet.h in HVM emulation codeJan Beulich2012-03-271-57/+34
| | | | | | | | | | | Also replace some plain numbers by using suitable defines (to make clear what they are standing for). Generated code is identical (apart from line number changes and functions possibly getting ordered differently). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: split struct domainJan Beulich2011-04-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is accomplished by converting a couple of embedded arrays (in one case a structure containing an array) into separately allocated pointers, and (just as for struct arch_vcpu in a prior patch) overlaying some PV-only fields with HVM-only ones. One particularly noteworthy change in the opposite direction is that of PITState - this field so far lived in the HVM-only portion, but is being used by PV guests too, and hence needed to be moved out of struct hvm_domain. The change to XENMEM_set_memory_map (and hence libxl__build_pre() and the movement of the E820 related pieces to struct pv_domain) are subject to a positive response to a query sent to xen-devel regarding the need for this to happen for HVM guests (see http://lists.xensource.com/archives/html/xen-devel/2011-03/msg01848.html). The protection of arch.hvm_domain.irq.dpci accesses by is_hvm_domain() is subject to confirmation that the field is used for HVM guests only (see http://lists.xensource.com/archives/html/xen-devel/2011-03/msg02004.html). In the absence of any reply to these queries, and given the early state of 4.2 development, I think it should be acceptable to take the risk of having to later undo/redo some of this. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* hvm save: Introduce hvm_load_entry_zeroextend().Keir Fraser2010-12-151-1/+1
| | | | | | | | | | In certain cases this will allow us to load old HVM save images where an HVM saved chunk has subsequently been extended with new fields. Rather than fail to load the chunk, we can pad the extended structure with zeroes, if the caller knows how to handle that. Signed-off-by: Keir Fraser <keir@xen.org> Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
* Miscellaneous data placement adjustmentsKeir Fraser2009-10-281-1/+1
| | | | | | | Make various data items const or __read_mostly where possible/reasonable. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* x86 hvm: Use 'x' as parameter name for macros converting betweenKeir Fraser2009-07-081-5/+5
| | | | | | | {vcpu,domain} and {vlapic,vpic,vrtc,hpet}. Completely avoids accidental aliasing. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86,hvm: Allow delivery of timer interrupts to VCPUs != 0Keir Fraser2009-07-071-1/+1
| | | | | | | This patch is needed for kexec/kdump since VCPU#0 is halted. Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86,hvm: cleanup hpet.c vcpu handling same as i8254.c/rtc.cKeir Fraser2009-07-071-15/+21
| | | | | | | | | - introduce macros: domain_vhpet, vcpu_vhpet, vhpet_domain, vhpet_vcpu - remove *vcpu field from struct HPETState - modify guest_time_hpet() takes *vhpet instead of *vcpu as 1st - argument Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
* x86, hvm: Allow 100us periodic virtual timersKeir Fraser2008-10-221-3/+3
| | | | | | | Adjust vpt and hpet minimum period (for timers) from 900us to 100us to be able to pass Windows 2008 compatibility tests. Signed-off-by: Peter Johnston <peter.johnston@citrix.com>
* Port HPET device model to vpt timer subsystemKeir Fraser2008-10-221-143/+186
| | | | | | | | | | | | | | | | | | | | | The current hpet implementation runs a one-shot xen timer for each hpet timer whenever the main counter is enabled regardless of whether or not the individual hpet timers are enabled. When the timer fires, if it is enabled the interrupt is routed to the guest. If the hpet timer is periodic, a new one-shot timer is set, for NOW()+period. There are a number of problems with this the most significant is guest time drift. Windows does not read the hardware clock to verify time, it depends on timer interrupts firing at the expected interval. The existing implementation queues a new one-shot timer each time it fires and does not allow for a difference between NOW() and the time the timer was expected to fire, causing drift. Also there is no allowance for lost ticks. This modification changes HPET to use the Virtual Platform Timer (VPT) and, for periodic timers, to use periodic timers. The VPT ensures an interrupt is delivered to the guest for each period that elapses, plus, its use of xen periodic timers ensures no drift. Signed-off-by: Peter Johnston <peter.johnston@citrix.com>
* hvm: Build guest timers on monotonic system time.Keir Fraser2008-05-241-8/+8
| | | | | | | | | | Move hvm platform timers from underlying physical CPU TSC to Xen system time and ensure domain-wide monotonicity. TSC on many systems may skew between processors leading to 'time going backwards' messages from some guests. Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86 hvm: Xen interface and implementation for virtual S3Keir Fraser2008-05-201-0/+5
| | | | | | | Signed-off-by: Tian Kevin <kevin.tian@intel.com> Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Ke Liping <liping.ke@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86, hvm: I/O emulation handlers return X86EMUL_* return codes.Keir Fraser2008-04-151-6/+15
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86 hvm: Allow HPET to be configured as a per-domain config option.Keir Fraser2008-02-111-1/+2
| | | | | | | | | | A new platform variable 'hpet' is added, which defaults to 0 for new guests (that is, hpet disabled). Default is off (no hpet) because hpet is currently less accurate in keeping time than PIT (because no timer_mode adjustments). Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* hvm: hpet: Tidy up hpet_to_ns_limit calculation.Keir Fraser2008-01-111-1/+1
| | | | | Suggested by Haitao Shan @ Intel. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* hvm: hpet: Clamp period to sane values to prevent excessive looping inKeir Fraser2008-01-091-6/+18
| | | | | hpet_timer_fn(), or excessive numbers of set_timer() callbacks. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* hvm: hpet: Fix overflow when converting to nanoseconds.Keir Fraser2008-01-081-2/+6
| | | | | | | | | | | | Currently in hpet_tick_to_ns, the approach is multiplying first, which easily causes overflow when tick is quite large. The patch cannot handle arbitratry large ticks duo to the precision requirement and 64bit's value range. But by optimize the equation, a larger ticks than current code can be supported. Also an overflow check is added before the calculation. From: Haitao Shan <haitao.shan@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* hvm: hpet: Fix per-timer enable/disable.Keir Fraser2008-01-081-12/+6
| | | | | | | | | | The enable/disable per timer interrupt bit is wrongly used as per timer enable/disable. According to spec, comparator value should constantly increasing when HPET is globally enabled, no matter whether the timer interrupt is enabled or not. From: Haitao Shan <haitao.shan@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* hvm: Fix 2 type mismatches in vlapic.h and hpet.c for 32-bit build XenKeir Fraser2007-11-281-1/+1
| | | | | | | | | | | | For 32-bit build of Xen: 1) the first mismatch (in hpet_read(), length is 4) makes guest think the HPET DM is buggy (we return 0 for HPET_CFG.COUNTER_CLK_PERIOD to guest), so guest wouldn't use HPET at all. 2) the second one: if tmict is 62500000 and timer_divisor is 16 (Fedoar7's installer uses the values at some time), 10 * 62500000 * 16 = 0x2540BE400 -- it's too big to be held in uint32_t. Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>=20
* hvm: Do not crash guest if it does an unaligned access to an HPETKeir Fraser2007-11-211-2/+6
| | | | | | | register. Some CrashMe test apaprently does this and we don't want that to crash the domain it runs in. From: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
* hvm: Do not include full hvm_hw_hpet in 'struct domain'. It is veryKeir Fraser2007-10-031-6/+78
| | | | | | large due to the number of (unused) reserved registers. This unnecessarily blots the size of the domain structure. Signed-off-by: Keir Fraser <keir@xensource.com>
* hvm: Add locking to platform timers.Keir Fraser2007-06-151-2/+39
| | | | | Handy for correctness. Signed-off-by: Keir Fraser <keir@xensource.com>
* hvm: Reintroduce hpet_migrate_timers(), as it is not covered by vptKeir Fraser2007-06-151-0/+3
| | | | | logic, but fix so that only VCPU0 migrates the timers. Signed-off-by: Keir Fraser <keir@xensource.com>
* hvm: Lower HPET frequency to 1/32 of the TSC.kfraser@localhost.localdomain2007-03-191-9/+15
| | | | | | | | | | | | | | | | | | | The frequency of HPET device model is defined to be the same as TSC's, but this doesn't work well with calibrate_tsc_hpet() in Linux kernel 2.6.16-33, causing some IA32 Linux HVM guests to failt o boot. Calibrate_tsc_hpet() tries to figure out how many HPET ticks a TSC cycle equals; it magnifies the result by scale of 2^32, trying to get a more accurate result since it assumes the frequency of HPET in real world is usually less than 1/100 of TSC, so the result of "(2^32 * hpet_freq) / tsc_freq" may exceed 32bits, then a "divide error (overflow)" would occur! The result doesn't overflow every time because hpet_freq/tsc_freq may less than 1.0 due to the little inaccuracy in the implementation of HVM timer virtualization. Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
* [HVM] Save/restore: dynamically calculate the size of the save bufferTim Deegan2007-02-071-1/+1
| | | | Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
* [HVM] Save/restore: misc tidyingTim Deegan2007-02-051-0/+3
| | | | | | | | - Don't save PIT's last-load-time or CPU's vmx-assist bits - Reorder save as cpu, PICs, irqs, timers - Save the correct value in the HPET's counter. Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
* [HVM] Save/restore: save HPET registersTim Deegan2007-01-311-6/+36
| | | | Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
* [HVM] Save/restore cleanups 03: IRQTim Deegan2007-01-201-3/+2
| | | | | IRQ, PIC, IOAPIC and LAPIC Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
* [HVM] Fix slow wallclock in x64 Vista. This is due to confusing akfraser@localhost.localdomain2007-01-181-6/+18
| | | | | | | timeout in the past vs. a timeout in the future when looking at a 32-bit HPET comparator. Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* [HVM] Remove unneeded vcpu_kick() from HPET device model.kfraser@localhost.localdomain2007-01-101-2/+0
| | | | Signed-off-by: Keir Fraser <keir@xensource.com>
* [HVM] Minor HPET fixes/ and cleanups.kaf24@localhost.localdomain2006-12-301-8/+10
| | | | | | | In particular, the definition of HPET_TN_SIZE_CAP is wrong. From: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Keir Fraser <keir@xensource.com>
* [HVM] Fix HPET timer to support 8-byte accesses, erroneous updateskaf24@localhost.localdomain2006-12-291-284/+150
| | | | | to read-only bits, etc. Signed-off-by: Keir Fraser <keir@xensource.com>
* [HVM] Route ISA IRQ 0 to IOAPIC GSI 2, just like 99% of native systems.kaf24@localhost.localdomain2006-12-261-48/+5
| | | | | | | This is a built-in assumption of HPET 'legacy' IRQ routing, which is why we have changed to this routing strategy now. Signed-off-by: Keir Fraser <keir@xensource.com>
* [HVM] Emulates HPET in hypervisor and extend ACPI tables.kfraser@localhost.localdomain2006-12-211-0/+584
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Eddie Dong <eddie.dong@intel.com> Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>