aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/time.c
Commit message (Collapse)AuthorAgeFilesLines
* x86/time: remove Cyclone as a platform timerMatt Wilson2013-08-271-68/+3
| | | | | | | | | The Cyclone time source was part of IBM's Summit chipset, which was only used for 32-bit only ccNUMA and IA-64 machines. Neither of these are supported by Xen anymore. Signed-off-by: Matt Wilson <msw@amazon.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
* x86/time: fix check for negative time in __update_vcpu_system_time()Tim Deegan2013-08-151-1/+2
| | | | | | Clang points out that u64 stime variable is always >= 0. Signed-off-by: Tim Deegan <tim@xen.org>
* x86/time: Update wallclock in shared info when altering domain time offsetAndrew Cooper2013-07-181-0/+1
| | | | | | | | | | domain_set_time_offset() udpates d->time_offset_seconds, but does not correct the wallclock in the shared info, meaning that it is incorrect until the next XENPF_settime hypercall from dom0 which resynchronises the wallclock for all domains. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: don't pass negative time to gtime_to_gtsc() (try 2)Jan Beulich2013-07-021-9/+6
| | | | | | | | | | | | | | | This mostly reverts commit eb60be3d ("x86: don't pass negative time to gtime_to_gtsc()") and instead corrects __update_vcpu_system_time()'s handling of this_cpu(cpu_time).stime_local_stamp dating back before the start of a HVM guest (which would otherwise lead to a negative value getting passed to gtime_to_gtsc(), causing scale_delta() to produce meaningless output). Flushing the value to zero was wrong, and printing a message for something that can validly happen wasn't very useful either. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* Revert "x86: debugging code for platform timer wrap problem"Jan Beulich2013-05-311-49/+9
| | | | | | This reverts commit bd9be94eb2280e8e662e75f1e5fea7c12eb2589c. Signed-off-by: Jan Beulich <jbeulich@suse.com>
* x86: don't pass negative time to gtime_to_gtsc()Jan Beulich2013-04-111-0/+9
| | | | | | | | | | | | scale_delta(), which is being called by that function, doesn't cope with that. Also print a warning message, so hopefully we can eventually figure why occasionally a negative value results from the calculation in the first place. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86: debugging code for platform timer wrap problemJan Beulich2013-04-091-9/+49
| | | | | | | | This is intentionally adding code not well formatted (so it stands out) and expected to be reverted as soon as the problem with the timer wraps has been spotted. Signed-off-by: Jan Beulich <jbeulich@suse.com>
* x86: honor ACPI indicating absence of CMOS RTCJan Beulich2013-02-221-0/+3
| | | | | | | On such systems we can boot through EFI only. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-211-1/+1
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* x86: explicit suffix in inline assembler (for clang).Tim Deegan2013-02-141-1/+1
| | | | | | | This fixes the clang build, and has no effect on gcc's output. Signed-off-by: Tim Deegan <tim@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* xen: Fix some over-long source lines.Keir Fraser2013-01-301-1/+3
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* x86: mark certain items staticJan Beulich2012-12-071-1/+1
| | | | | | | ..., and at once constify the data items among them. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* x86/time: fix scale_delta() inline assemblyJan Beulich2012-11-261-2/+3
| | | | | | | | | | | | | | | The way it was coded, it clobbered %rdx without telling the compiler. This generally didn't cause any problems except when there are two back to back invocations (as in plt_overflow()), as in that case the compiler may validly assume that it can re-use for the second instance the value loaded into %rdx before the first one. Once at it, also properly relax the second operand of "mul" (there's no need for it to be in %rdx, or a register at all), and switch away from using explicit register names in the instruction operands. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* printk: prefer %#x et at over 0x%xJan Beulich2012-09-211-3/+3
| | | | | | | | | Performance is not an issue with printk(), so let the function do minimally more work and instead save a byte per affected format specifier. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* xen: Remove x86_32 build target.Keir Fraser2012-09-121-16/+0
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* x86/hpet: disable before reboot or kexecJan Beulich2012-03-271-1/+1
| | | | | | | | | | | | | | Linux up to now is not smart enough to properly clear the HPET when it boots, which is particularly a problem when a kdump attempt from running under Xen is being made. Linux itself added code to work around this to its shutdown paths quite some time ago, so let's do something similar in Xen: Save the configuration register settings during boot, and restore them during shutdown. This should cover the majority of cases where the secondary kernel might not come up because timer interrupts don't work. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* RTC: Add UIP(update in progress) check logicYang Zhang2012-03-071-0/+7
| | | | | | | | The UIP(update in progress) is set when RTC is in updating. And the update cycle begins 244us later after UIP is set. Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Committed-by: Keir Fraser <keir@xen.org>
* replace bogus gdprintk() uses with {,d}printk()Jan Beulich2012-02-161-2/+2
| | | | | | | | | | | When the subject domain is not the current one (e.g. during domctl or HVM save/restore handling), use of gdprintk() is questionable at best, as it won't give the intended information on what domain is affected. Use plain printk() or dprintk() instead, but keep things (mostly) as guest messages by using XENLOG_G_*. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* eliminate cpu_set()Jan Beulich2011-11-081-1/+1
| | | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
* eliminate cpu_test_xyz()Jan Beulich2011-11-081-1/+1
| | | | | | Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
* eliminate direct assignments of CPU masksJan Beulich2011-10-211-8/+8
| | | | | | | | | | | | | | | | Use cpumask_copy() instead of direct variable assignments for copying CPU masks. While direct assignments are not a problem when both sides are variables actually defined as cpumask_t (except for possibly copying *much* more than would actually need to be copied), they must not happen when the original variable is of type cpumask_var_t (which may have lass space allocated to it than a full cpumask_t). Eliminate as many of such assignments as possible (in several cases it's even possible to collapse two operations [copy then clear one bit] into one [cpumask_andnot()]), and thus set the way for reducing the allocation size in alloc_cpumask_var(). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* eliminate cpumask accessors referencing NR_CPUSJan Beulich2011-10-211-5/+5
| | | | | | | ... in favor of using the new, nr_cpumask_bits-based ones. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* convert more literal uses of cpumask_t to pointersJan Beulich2011-09-181-1/+1
| | | | | | | This is particularly relevant as the number of CPUs to be supported increases (as recently happened for the default thereof). Signed-off-by: Jan Beulich <jbeulich@suse.com>
* x86/time: verify_tsc_reliability() can be run as a generic initcall.Keir Fraser2011-09-171-1/+4
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* xen: Move tsc reliability check until after CPUs have bootedGeorge Dunlap2011-09-171-2/+10
| | | | | | | | | | | | | AMD CPUs by default enable X86_FEATURE_TSC_RELIABLE, and depend upon a later check to disable this feature if TSC drift is detected. Unfortunately, this check is done in time.c:init_xen_time(), which is done before any secondary CPUs are brought up, and is thus guaranteed to succed. This patch moves the check into its own function, and calls it after cpus are brought up. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
* x86-64: EFI runtime codeJan Beulich2011-06-281-0/+8
| | | | | | | | | | | | | | | | | | | This allows Dom0 access to all suitable EFI runtime services. The actual calls into EFI are done in "physical" mode, as entering virtual mode has been determined to be incompatible with kexec (EFI's SetVirtualAddressMap() can be called only once, and hence the secondary kernel can't establish its mappings). ("Physical" mode here being quoted because this is a mode with paging enabled [otherwise 64-bit mode wouldn't work] but all mappings being 1:1.) Open issue (not preventing this from being committed imo): Page (and perhaps other) faults occuring while calling runtime functions in the context of a hypercall don't get handled correctly (they don't even seem to reach do_page_fault()). I'm intending to investigate this further. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* x86/tsc: Remove incorrect assertion from cstate_restore_tsc()...Keir Fraser2011-05-161-2/+0
| | | | | | ..fix and move to write_tsc(). Signed-off-by: Keir Fraser <keir@xen.org>
* x86: a little bit of cleanup to time.cJan Beulich2011-05-011-18/+22
| | | | Signed-off-by: Jan Beulich <jbeulich@novell.com>
* A little bit of SMP boot code cleanupJan Beulich2011-05-011-1/+1
| | | | Signed-off-by: Jan Beulich <jbeulich@novell.com>
* x86: don't write_tsc() non-zero values on CPUs updating only the lower 32 bitsKeir Fraser2011-04-151-1/+66
| | | | | | | | | | This means suppressing the uses in time_calibration_tsc_rendezvous(), cstate_restore_tsc(), and synchronize_tsc_slave(), and fixes a boot hang of Linux Dom0 when loading processor.ko on such systems that have support for C states above C1. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xen.org>
* x86/HPET: cleanupJan Beulich2011-03-121-17/+26
| | | | | | | | | | | | - separate init and resume code paths (so that the [larger] init parts can go init .init.* sections) - drop the separate legacy_hpet_event object, as we can easily re-use the first slot of hpet_events[] for that purpose (the whole array is otherwise unused when the legacy code is being used) - use section placement attributes where reasonable Signed-off-by: Jan Beulich <jbeulich@novell.com> Acked-by: Wei Gang <gang.wei@intel.com>
* move various bits into .init.* sectionsJan Beulich2011-03-091-1/+1
| | | | | | | | | | This also includes the removal of some entirely unused functions. The patch builds upon the makefile adjustments done in the earlier sent patch titled "move more kernel decompression bits to .init.* sections". Signed-off-by: Jan Beulich <jbeulich@novell.com>
* Use bool_t for various boolean variablesKeir Fraser2010-12-241-1/+0
| | | | | | | | | | | ... decreasing cache footprint. As a prerequisite this requires making cmdline_parse() a little more flexible. Also remove a few variables altogether, and adjust sections annotations for several others. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xen.org>
* x86: Define a new function gtsc_to_gtime()Keir Fraser2010-12-151-3/+12
| | | | | | | | Define it to do the transform from guest tsc to guest time. Fix the typo in gtime_to_gtsc() definition. Signed-off-by: Wei Gang <gang.wei@intel.com>
* x86: time: tsc_set_info() must skip the idle domain.Keir Fraser2010-12-091-1/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* x86: Simplify tsc_set_info() slightly -- no domain has id DOMID_INVALID.Keir Fraser2010-12-091-1/+2
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* x86: Add -Wredundant-decls to Xen build flags.Keir Fraser2010-12-021-1/+0
| | | | | | Fix up the fallout. Signed-off-by: Keir Fraser <keir@xen.org>
* X86: Prefer TSC-deadline timer in XenKeir Fraser2010-10-291-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new TSC Deadline Timer offers system software a low overhead per-logical-thread deadline timer in TSC units. The timer is implemented via a new architectural 64-bit register, IA32_TSC_DEADLINE_MSR. Reads and writes of this MSR occur in program order, but are non-serializing. The support for this feature is indicated by CPUID.01H:ECX.TSC_Deadline[bit 24] =3D 1 as documented in the Intel Architecture Software Developer's Manual. The LOCAL APIC on new processors has a mode where its underlying hardware timer can now be accessed via the non-serializing IA32_TSC_DEADLINE_MSR in TSC tick units. If this mode is present, prefer it over the traditional LAPIC timer mode. KERN_DEBUG dmesg will print "TSC deadline timer enabled" when TDT is used. Bootparam "tdt=off" is available to revert to LAPIC timer mode. This patch is based on original work by Len Brown for Linux kernel. cc: Len Brown <len.brown@intel.com> Signed-off-by: Wei Gang <gang.wei@intel.com> Signed-off-by: Keir Fraser <keir@xen.org>
* mce: Provide ERST interfaceKeir Fraser2010-08-221-0/+5
| | | | | | | This patch is used to provide ERST write/read/clear operation interface to Xen MCE. Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
* timers: Simplify implementation logic.Keir Fraser2010-08-181-1/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86, pm: provide core/package cstate residenciesKeir Fraser2010-07-121-0/+7
| | | | | | | | | According to Intel 64 and IA32 Architectures SDM 3B Appendix B, Intel Nehalem/Westmere processors provide h/w MSR to report the core/package cstate residencies. Extend sysctl_get_pmstat interface to pass the core/package cstate residencies. Signed-off-by: Wei Gang <gang.wei@intel.com>
* cpuidle: reduce redundant cost in cstate_restore_tsc for nonstop tscKeir Fraser2010-06-171-2/+5
| | | | Signed-off-by: Wei Gang <gang.wei@intel.com>
* x86: Warn on CPU hot-add to tsc-reliable systemKeir Fraser2010-05-281-1/+20
| | | | | | ...and provide a boot option to indicate TSCs may be skewed. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: TSC handling cleanups (version 2)Keir Fraser2010-05-221-8/+22
| | | | | | | | | | | | | | | "I am removing the tsc_scaled variable that is never actually used because when tsc needs to be scaled vtsc is 1. I am also making this more explicit in tsc_set_info. I am also removing hvm_domain.gtsc_khz that is a duplicate of d->arch.tsc_khz. I am using scale_delta(delta, &d->arch.ns_to_vtsc) to scale the tsc value before returning it to the guest like in the pv case. I added a feature flag to specify that the pvclock algorithm is safe to be used in an HVM guest so that the guest can now use it without hanging." Version 2 fixes a bug which breaks PV domU time. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* Revert 21339:804304d4e05d "x86: TSC handling cleanups"Keir Fraser2010-05-211-23/+8
| | | | | | It very much breaks PV domU boot. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: Remove special-case paths for start-of-day SMP bringup.Keir Fraser2010-05-171-53/+3
| | | | | | | | | | | | | All CPUs are now brought up in __cpu_up(), in the correct order for cpu-bringup notifiers. Notably ganged TSC calibration is removed. This was another start-of-day-specific aspect of bringup. If we really need calibration, I think we can come up with an efficient method for APs to calibrate themselves against PIT during their bringup (even asynchronously, if required for efficiency). Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Remove many uses of cpu_possible_map and iterators over NR_CPUS.Keir Fraser2010-05-141-3/+4
| | | | | | | The significant remaining culprits for x86 are credit2, hpet, and percpu-area subsystems. To be dealt with in a separate patch. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: Detect and handle unexpected platform-timer counter wrap.Keir Fraser2010-05-111-7/+29
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: TSC handling cleanupsKeir Fraser2010-05-111-8/+23
| | | | | | | | | | | | | "I am removing the tsc_scaled variable that is never actually used because when tsc needs to be scaled vtsc is 1. I am also making this more explicit in tsc_set_info. I am also removing hvm_domain.gtsc_khz that is a duplicate of d->arch.tsc_khz. I am using scale_delta(delta, &d->arch.ns_to_vtsc) to scale the tsc value before returning it to the guest like in the pv case. I added a feature flag to specify that the pvclock algorithm is safe to be used in an HVM guest so that the guest can now use it without hanging." Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* Some time-handling fixes.Keir Fraser2010-02-081-12/+28
| | | | | | | | Fixes my domU boot hangs (when using vtsc) due to vtsc_offset less then local cpu's stime_local_stamp, leading to bogus vcpu_time_info.tsc_timestamp. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>