mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Add flags field to VCPUOP_set_singlsehot_timer.
Flag 'future' causes Xen to check if the timeout is in the past and return -ETIME if so. From: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
04866d25fd
commit
505ef3ea86
3 files changed
+12
-1
No files matched your search
@@ -1008,6 +1008,7 @@ static void stop_hz_timer(void)
|
||||
}
|
||||
|
||||
singleshot.timeout_abs_ns = jiffies_to_st(j);
|
||||
singleshot.flags = 0;
|
||||
rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot);
|
||||
#ifdef XEN_COMPAT_030004
|
||||
if (rc) {
|
||||
|
||||
@@ -623,6 +623,10 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
|
||||
if ( copy_from_guest(&set, arg, 1) )
|
||||
return -EFAULT;
|
||||
|
||||
if ( (set.flags & VCPU_SSHOTTMR_future) &&
|
||||
(set.timeout_abs_ns < NOW()) )
|
||||
return -ETIME;
|
||||
|
||||
if ( v->singleshot_timer.cpu != smp_processor_id() )
|
||||
{
|
||||
stop_timer(&v->singleshot_timer);
|
||||
|
||||
@@ -150,11 +150,17 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_set_periodic_timer_t);
|
||||
#define VCPUOP_set_singleshot_timer 8 /* arg == vcpu_set_singleshot_timer_t */
|
||||
#define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */
|
||||
struct vcpu_set_singleshot_timer {
|
||||
uint64_t timeout_abs_ns;
|
||||
uint64_t timeout_abs_ns; /* Absolute system time value in nanoseconds. */
|
||||
uint32_t flags; /* VCPU_SSHOTTMR_??? */
|
||||
};
|
||||
typedef struct vcpu_set_singleshot_timer vcpu_set_singleshot_timer_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(vcpu_set_singleshot_timer_t);
|
||||
|
||||
/* Flags to VCPUOP_set_singleshot_timer. */
|
||||
/* Require the timeout to be in the future (return -ETIME if it's passed). */
|
||||
#define _VCPU_SSHOTTMR_future (0)
|
||||
#define VCPU_SSHOTTMR_future (1U << _VCPU_SSHOTTMR_future)
|
||||
|
||||
#endif /* __XEN_PUBLIC_VCPU_H__ */
|
||||
|
||||
/*
|
||||
|
||||