* RTC fixes (Artem)

* icount fixes (Artem)
 * rr fixes (Pavel, myself)
 * hotplug cleanup (Igor)
 * SCSI fixes (myself)
 * 4.20-rc1 KVM header update (myself)
 * coalesced PIO support (Peng Hao)
 * HVF fixes (Roman B.)
 * Hyper-V refactoring (Roman K.)
 * Support for Hyper-V IPI (Vitaly)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJbycRuAAoJEL/70l94x66DGL4H/00Gu/+0dNlpxt6hYVaJ30jX
 vFCsZoglBJ060M8m0C9roTF7zdIgI/X0oxJKWNaxqCDD0GSL5oM1AfG0DCsEBq6X
 ApHYfBOh6mMWuB2qzV9QkK0b2u7+g9J8pQQYfZlU+QNtmUUmbzBxV4h7oqOoedJZ
 nTJrkYzBg88bLDXUAuFrnMhaktqzPvyhdD36vUX5Kc9Hk9R3krtEenc/XKfEJg+o
 n1DX9QeAWgi3MdhkhXSaNSnAu2k2+/qJDmOPk1r63ft5ZfaUKOaVecU06ioiEmrc
 KJd6EYeRvh2eIpbOCGSEVDrieGVBOPvqYg0ryWroxSveoPqJZh5ys9MdIjD+8zg=
 =4XhC
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* RTC fixes (Artem)
* icount fixes (Artem)
* rr fixes (Pavel, myself)
* hotplug cleanup (Igor)
* SCSI fixes (myself)
* 4.20-rc1 KVM header update (myself)
* coalesced PIO support (Peng Hao)
* HVF fixes (Roman B.)
* Hyper-V refactoring (Roman K.)
* Support for Hyper-V IPI (Vitaly)

# gpg: Signature made Fri 19 Oct 2018 12:47:58 BST
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (47 commits)
  replay: pass raw icount value to replay_save_clock
  target/i386: kvm: just return after migrate_add_blocker failed
  hyperv_testdev: add SynIC message and event testmodes
  hyperv: process POST_MESSAGE hypercall
  hyperv: add support for KVM_HYPERV_EVENTFD
  hyperv: process SIGNAL_EVENT hypercall
  hyperv: add synic event flag signaling
  hyperv: add synic message delivery
  hyperv: make overlay pages for SynIC
  hyperv: only add SynIC in compatible configurations
  hyperv: qom-ify SynIC
  hyperv:synic: split capability testing and setting
  i386: add hyperv-stub for CONFIG_HYPERV=n
  default-configs: collect CONFIG_HYPERV* in hyperv.mak
  hyperv: factor out arch-independent API into hw/hyperv
  hyperv: make hyperv_vp_index inline
  hyperv: split hyperv-proto.h into x86 and arch-independent parts
  hyperv: rename kvm_hv_sint_route_set_sint
  hyperv: make HvSintRoute reference-counted
  hyperv: address HvSintRoute by X86CPU pointer
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-10-19 19:01:07 +01:00
commit b312532fd0
58 changed files with 1876 additions and 688 deletions

View file

@ -2,6 +2,7 @@
#define QEMU_TIMER_H
#include "qemu-common.h"
#include "qemu/bitops.h"
#include "qemu/notify.h"
#include "qemu/host-utils.h"
@ -42,14 +43,6 @@
* In icount mode, this clock counts nanoseconds while the virtual
* machine is running. It is used to increase @QEMU_CLOCK_VIRTUAL
* while the CPUs are sleeping and thus not executing instructions.
*
* @QEMU_CLOCK_VIRTUAL_EXT: virtual clock for external subsystems
*
* The virtual clock only runs during the emulation. It stops
* when the virtual machine is stopped. The timers for this clock
* do not recorded in rr mode, therefore this clock could be used
* for the subsystems that operate outside the guest core.
*
*/
typedef enum {
@ -57,10 +50,27 @@ typedef enum {
QEMU_CLOCK_VIRTUAL = 1,
QEMU_CLOCK_HOST = 2,
QEMU_CLOCK_VIRTUAL_RT = 3,
QEMU_CLOCK_VIRTUAL_EXT = 4,
QEMU_CLOCK_MAX
} QEMUClockType;
/**
* QEMU Timer attributes:
*
* An individual timer may be given one or multiple attributes when initialized.
* Each attribute corresponds to one bit. Attributes modify the processing
* of timers when they fire.
*
* The following attributes are available:
*
* QEMU_TIMER_ATTR_EXTERNAL: drives external subsystem
*
* Timers with this attribute do not recorded in rr mode, therefore it could be
* used for the subsystems that operate outside the guest core. Applicable only
* with virtual clock type.
*/
#define QEMU_TIMER_ATTR_EXTERNAL BIT(0)
typedef struct QEMUTimerList QEMUTimerList;
struct QEMUTimerListGroup {
@ -76,6 +86,7 @@ struct QEMUTimer {
QEMUTimerCB *cb;
void *opaque;
QEMUTimer *next;
int attributes;
int scale;
};
@ -427,22 +438,27 @@ int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup *tlg);
*/
/**
* timer_init_tl:
* timer_init_full:
* @ts: the timer to be initialised
* @timer_list: the timer list to attach the timer to
* @timer_list_group: (optional) the timer list group to attach the timer to
* @type: the clock type to use
* @scale: the scale value for the timer
* @attributes: 0, or one or more OR'ed QEMU_TIMER_ATTR_<id> values
* @cb: the callback to be called when the timer expires
* @opaque: the opaque pointer to be passed to the callback
*
* Initialise a new timer and associate it with @timer_list.
* Initialise a timer with the given scale and attributes,
* and associate it with timer list for given clock @type in @timer_list_group
* (or default timer list group, if NULL).
* The caller is responsible for allocating the memory.
*
* You need not call an explicit deinit call. Simply make
* sure it is not on a list with timer_del.
*/
void timer_init_tl(QEMUTimer *ts,
QEMUTimerList *timer_list, int scale,
QEMUTimerCB *cb, void *opaque);
void timer_init_full(QEMUTimer *ts,
QEMUTimerListGroup *timer_list_group, QEMUClockType type,
int scale, int attributes,
QEMUTimerCB *cb, void *opaque);
/**
* timer_init:
@ -454,14 +470,12 @@ void timer_init_tl(QEMUTimer *ts,
*
* Initialize a timer with the given scale on the default timer list
* associated with the clock.
*
* You need not call an explicit deinit call. Simply make
* sure it is not on a list with timer_del.
* See timer_init_full for details.
*/
static inline void timer_init(QEMUTimer *ts, QEMUClockType type, int scale,
QEMUTimerCB *cb, void *opaque)
{
timer_init_tl(ts, main_loop_tlg.tl[type], scale, cb, opaque);
timer_init_full(ts, NULL, type, scale, 0, cb, opaque);
}
/**
@ -473,9 +487,7 @@ static inline void timer_init(QEMUTimer *ts, QEMUClockType type, int scale,
*
* Initialize a timer with nanosecond scale on the default timer list
* associated with the clock.
*
* You need not call an explicit deinit call. Simply make
* sure it is not on a list with timer_del.
* See timer_init_full for details.
*/
static inline void timer_init_ns(QEMUTimer *ts, QEMUClockType type,
QEMUTimerCB *cb, void *opaque)
@ -492,9 +504,7 @@ static inline void timer_init_ns(QEMUTimer *ts, QEMUClockType type,
*
* Initialize a timer with microsecond scale on the default timer list
* associated with the clock.
*
* You need not call an explicit deinit call. Simply make
* sure it is not on a list with timer_del.
* See timer_init_full for details.
*/
static inline void timer_init_us(QEMUTimer *ts, QEMUClockType type,
QEMUTimerCB *cb, void *opaque)
@ -511,9 +521,7 @@ static inline void timer_init_us(QEMUTimer *ts, QEMUClockType type,
*
* Initialize a timer with millisecond scale on the default timer list
* associated with the clock.
*
* You need not call an explicit deinit call. Simply make
* sure it is not on a list with timer_del.
* See timer_init_full for details.
*/
static inline void timer_init_ms(QEMUTimer *ts, QEMUClockType type,
QEMUTimerCB *cb, void *opaque)
@ -522,27 +530,37 @@ static inline void timer_init_ms(QEMUTimer *ts, QEMUClockType type,
}
/**
* timer_new_tl:
* @timer_list: the timer list to attach the timer to
* timer_new_full:
* @timer_list_group: (optional) the timer list group to attach the timer to
* @type: the clock type to use
* @scale: the scale value for the timer
* @attributes: 0, or one or more OR'ed QEMU_TIMER_ATTR_<id> values
* @cb: the callback to be called when the timer expires
* @opaque: the opaque pointer to be passed to the callback
*
* Create a new timer and associate it with @timer_list.
* Create a new timer with the given scale and attributes,
* and associate it with timer list for given clock @type in @timer_list_group
* (or default timer list group, if NULL).
* The memory is allocated by the function.
*
* This is not the preferred interface unless you know you
* are going to call timer_free. Use timer_init instead.
* are going to call timer_free. Use timer_init or timer_init_full instead.
*
* The default timer list has one special feature: in icount mode,
* %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is
* not true of other timer lists, which are typically associated
* with an AioContext---each of them runs its timer callbacks in its own
* AioContext thread.
*
* Returns: a pointer to the timer
*/
static inline QEMUTimer *timer_new_tl(QEMUTimerList *timer_list,
int scale,
QEMUTimerCB *cb,
void *opaque)
static inline QEMUTimer *timer_new_full(QEMUTimerListGroup *timer_list_group,
QEMUClockType type,
int scale, int attributes,
QEMUTimerCB *cb, void *opaque)
{
QEMUTimer *ts = g_malloc0(sizeof(QEMUTimer));
timer_init_tl(ts, timer_list, scale, cb, opaque);
timer_init_full(ts, timer_list_group, type, scale, attributes, cb, opaque);
return ts;
}
@ -553,21 +571,16 @@ static inline QEMUTimer *timer_new_tl(QEMUTimerList *timer_list,
* @cb: the callback to be called when the timer expires
* @opaque: the opaque pointer to be passed to the callback
*
* Create a new timer and associate it with the default
* timer list for the clock type @type.
*
* The default timer list has one special feature: in icount mode,
* %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is
* not true of other timer lists, which are typically associated
* with an AioContext---each of them runs its timer callbacks in its own
* AioContext thread.
* Create a new timer with the given scale,
* and associate it with the default timer list for the clock type @type.
* See timer_new_full for details.
*
* Returns: a pointer to the timer
*/
static inline QEMUTimer *timer_new(QEMUClockType type, int scale,
QEMUTimerCB *cb, void *opaque)
{
return timer_new_tl(main_loop_tlg.tl[type], scale, cb, opaque);
return timer_new_full(NULL, type, scale, 0, cb, opaque);
}
/**
@ -578,12 +591,7 @@ static inline QEMUTimer *timer_new(QEMUClockType type, int scale,
*
* Create a new timer with nanosecond scale on the default timer list
* associated with the clock.
*
* The default timer list has one special feature: in icount mode,
* %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is
* not true of other timer lists, which are typically associated
* with an AioContext---each of them runs its timer callbacks in its own
* AioContext thread.
* See timer_new_full for details.
*
* Returns: a pointer to the newly created timer
*/
@ -599,14 +607,9 @@ static inline QEMUTimer *timer_new_ns(QEMUClockType type, QEMUTimerCB *cb,
* @cb: the callback to call when the timer expires
* @opaque: the opaque pointer to pass to the callback
*
* The default timer list has one special feature: in icount mode,
* %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is
* not true of other timer lists, which are typically associated
* with an AioContext---each of them runs its timer callbacks in its own
* AioContext thread.
*
* Create a new timer with microsecond scale on the default timer list
* associated with the clock.
* See timer_new_full for details.
*
* Returns: a pointer to the newly created timer
*/
@ -622,14 +625,9 @@ static inline QEMUTimer *timer_new_us(QEMUClockType type, QEMUTimerCB *cb,
* @cb: the callback to call when the timer expires
* @opaque: the opaque pointer to pass to the callback
*
* The default timer list has one special feature: in icount mode,
* %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is
* not true of other timer lists, which are typically associated
* with an AioContext---each of them runs its timer callbacks in its own
* AioContext thread.
*
* Create a new timer with millisecond scale on the default timer list
* associated with the clock.
* See timer_new_full for details.
*
* Returns: a pointer to the newly created timer
*/