
* Update to QEMU v9.0.0 --------- Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Signed-off-by: Ido Plat <ido.plat@ibm.com> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Signed-off-by: Gregory Price <gregory.price@memverge.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Lorenz Brun <lorenz@brun.one> Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> Signed-off-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Sven Schnelle <svens@stackframe.org> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Avihai Horon <avihaih@nvidia.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Joonas Kankaala <joonas.a.kankaala@gmail.com> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Glenn Miles <milesg@linux.ibm.com> Signed-off-by: Oleg Sviridov <oleg.sviridov@red-soft.ru> Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Signed-off-by: Yajun Wu <yajunw@nvidia.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com> Signed-off-by: Lei Wang <lei4.wang@intel.com> Signed-off-by: Wei Wang <wei.w.wang@intel.com> Signed-off-by: Martin Hundebøll <martin@geanix.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Wafer <wafer@jaguarmicro.com> Signed-off-by: Yuxue Liu <yuxue.liu@jaguarmicro.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com> Signed-off-by: Zack Buhman <zack@buhman.org> Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Yuquan Wang wangyuquan1236@phytium.com.cn Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Signed-off-by: Cindy Lu <lulu@redhat.com> Co-authored-by: Peter Maydell <peter.maydell@linaro.org> Co-authored-by: Fabiano Rosas <farosas@suse.de> Co-authored-by: Peter Xu <peterx@redhat.com> Co-authored-by: Thomas Huth <thuth@redhat.com> Co-authored-by: Cédric Le Goater <clg@redhat.com> Co-authored-by: Zheyu Ma <zheyuma97@gmail.com> Co-authored-by: Ido Plat <ido.plat@ibm.com> Co-authored-by: Ilya Leoshkevich <iii@linux.ibm.com> Co-authored-by: Markus Armbruster <armbru@redhat.com> Co-authored-by: Marc-André Lureau <marcandre.lureau@redhat.com> Co-authored-by: Paolo Bonzini <pbonzini@redhat.com> Co-authored-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Co-authored-by: David Hildenbrand <david@redhat.com> Co-authored-by: Kevin Wolf <kwolf@redhat.com> Co-authored-by: Stefan Reiter <s.reiter@proxmox.com> Co-authored-by: Fiona Ebner <f.ebner@proxmox.com> Co-authored-by: Gregory Price <gregory.price@memverge.com> Co-authored-by: Lorenz Brun <lorenz@brun.one> Co-authored-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> Co-authored-by: Philippe Mathieu-Daudé <philmd@linaro.org> Co-authored-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Co-authored-by: BALATON Zoltan <balaton@eik.bme.hu> Co-authored-by: Igor Mammedov <imammedo@redhat.com> Co-authored-by: Akihiko Odaki <akihiko.odaki@daynix.com> Co-authored-by: Richard Henderson <richard.henderson@linaro.org> Co-authored-by: Sven Schnelle <svens@stackframe.org> Co-authored-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Co-authored-by: Helge Deller <deller@kernel.org> Co-authored-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Co-authored-by: Benjamin Gray <bgray@linux.ibm.com> Co-authored-by: Nicholas Piggin <npiggin@gmail.com> Co-authored-by: Avihai Horon <avihaih@nvidia.com> Co-authored-by: Michael Tokarev <mjt@tls.msk.ru> Co-authored-by: Joonas Kankaala <joonas.a.kankaala@gmail.com> Co-authored-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Co-authored-by: Stefan Weil <sw@weilnetz.de> Co-authored-by: Dayu Liu <liu.dayu@zte.com.cn> Co-authored-by: Zhao Liu <zhao1.liu@intel.com> Co-authored-by: Glenn Miles <milesg@linux.vnet.ibm.com> Co-authored-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Co-authored-by: Yajun Wu <yajunw@nvidia.com> Co-authored-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Co-authored-by: Pierre-Clément Tosi <ptosi@google.com> Co-authored-by: Wei Wang <wei.w.wang@intel.com> Co-authored-by: Martin Hundebøll <martin@geanix.com> Co-authored-by: Michael S. Tsirkin <mst@redhat.com> Co-authored-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Co-authored-by: Wafer <wafer@jaguarmicro.com> Co-authored-by: lyx634449800 <yuxue.liu@jaguarmicro.com> Co-authored-by: Gerd Hoffmann <kraxel@redhat.com> Co-authored-by: Nguyen Dinh Phi <phind.uet@gmail.com> Co-authored-by: Zack Buhman <zack@buhman.org> Co-authored-by: Keith Packard <keithp@keithp.com> Co-authored-by: Yuquan Wang <wangyuquan1236@phytium.com.cn> Co-authored-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Co-authored-by: Cindy Lu <lulu@redhat.com>
216 lines
6.8 KiB
C
216 lines
6.8 KiB
C
#ifndef REPLAY_INTERNAL_H
|
|
#define REPLAY_INTERNAL_H
|
|
|
|
/*
|
|
* replay-internal.h
|
|
*
|
|
* Copyright (c) 2010-2015 Institute for System Programming
|
|
* of the Russian Academy of Sciences.
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*
|
|
*/
|
|
|
|
/* Asynchronous events IDs */
|
|
|
|
typedef enum ReplayAsyncEventKind {
|
|
REPLAY_ASYNC_EVENT_BH,
|
|
REPLAY_ASYNC_EVENT_BH_ONESHOT,
|
|
REPLAY_ASYNC_EVENT_INPUT,
|
|
REPLAY_ASYNC_EVENT_INPUT_SYNC,
|
|
REPLAY_ASYNC_EVENT_CHAR_READ,
|
|
REPLAY_ASYNC_EVENT_BLOCK,
|
|
REPLAY_ASYNC_EVENT_NET,
|
|
REPLAY_ASYNC_COUNT
|
|
} ReplayAsyncEventKind;
|
|
|
|
/*
|
|
* Any changes to order/number of events will need to bump
|
|
* REPLAY_VERSION to prevent confusion with old logs. Also don't
|
|
* forget to update replay_event_name() to make your debugging life
|
|
* easier.
|
|
*/
|
|
enum ReplayEvents {
|
|
/* for instruction event */
|
|
EVENT_INSTRUCTION,
|
|
/* for software interrupt */
|
|
EVENT_INTERRUPT,
|
|
/* for emulated exceptions */
|
|
EVENT_EXCEPTION,
|
|
/* for async events */
|
|
EVENT_ASYNC,
|
|
EVENT_ASYNC_LAST = EVENT_ASYNC + REPLAY_ASYNC_COUNT - 1,
|
|
/* for shutdown requests, range allows recovery of ShutdownCause */
|
|
EVENT_SHUTDOWN,
|
|
EVENT_SHUTDOWN_LAST = EVENT_SHUTDOWN + SHUTDOWN_CAUSE__MAX,
|
|
/* for character device write event */
|
|
EVENT_CHAR_WRITE,
|
|
/* for character device read all event */
|
|
EVENT_CHAR_READ_ALL,
|
|
EVENT_CHAR_READ_ALL_ERROR,
|
|
/* for audio out event */
|
|
EVENT_AUDIO_OUT,
|
|
/* for audio in event */
|
|
EVENT_AUDIO_IN,
|
|
/* for random number generator */
|
|
EVENT_RANDOM,
|
|
/* for clock read/writes */
|
|
/* some of greater codes are reserved for clocks */
|
|
EVENT_CLOCK,
|
|
EVENT_CLOCK_LAST = EVENT_CLOCK + REPLAY_CLOCK_COUNT - 1,
|
|
/* for checkpoint event */
|
|
/* some of greater codes are reserved for checkpoints */
|
|
EVENT_CHECKPOINT,
|
|
EVENT_CHECKPOINT_LAST = EVENT_CHECKPOINT + CHECKPOINT_COUNT - 1,
|
|
/* end of log event */
|
|
EVENT_END,
|
|
EVENT_COUNT
|
|
};
|
|
|
|
/**
|
|
* typedef ReplayState - global tracking Replay state
|
|
*
|
|
* This structure tracks where we are in the current ReplayState
|
|
* including the logged events from the recorded replay stream. Some
|
|
* of the data is also stored/restored from VMStateDescription when VM
|
|
* save/restore events take place.
|
|
*
|
|
* @cached_clock: Cached clocks values
|
|
* @current_icount: number of processed instructions
|
|
* @instruction_count: number of instructions until next event
|
|
* @current_event: current event index
|
|
* @data_kind: current event
|
|
* @has_unread_data: true if event not yet processed
|
|
* @file_offset: offset into replay log at replay snapshot
|
|
* @block_request_id: current serialised block request id
|
|
* @read_event_id: current async read event id
|
|
*/
|
|
typedef struct ReplayState {
|
|
int64_t cached_clock[REPLAY_CLOCK_COUNT];
|
|
uint64_t current_icount;
|
|
int instruction_count;
|
|
unsigned int current_event;
|
|
unsigned int data_kind;
|
|
bool has_unread_data;
|
|
uint64_t file_offset;
|
|
uint64_t block_request_id;
|
|
uint64_t read_event_id;
|
|
} ReplayState;
|
|
extern ReplayState replay_state;
|
|
|
|
/* File for replay writing */
|
|
extern FILE *replay_file;
|
|
/* Instruction count of the replay breakpoint */
|
|
extern uint64_t replay_break_icount;
|
|
/* Timer for the replay breakpoint callback */
|
|
extern QEMUTimer *replay_break_timer;
|
|
|
|
void replay_put_byte(uint8_t byte);
|
|
void replay_put_event(uint8_t event);
|
|
void replay_put_word(uint16_t word);
|
|
void replay_put_dword(uint32_t dword);
|
|
void replay_put_qword(int64_t qword);
|
|
void replay_put_array(const uint8_t *buf, size_t size);
|
|
|
|
uint8_t replay_get_byte(void);
|
|
uint16_t replay_get_word(void);
|
|
uint32_t replay_get_dword(void);
|
|
int64_t replay_get_qword(void);
|
|
void replay_get_array(uint8_t *buf, size_t *size);
|
|
void replay_get_array_alloc(uint8_t **buf, size_t *size);
|
|
|
|
/* Mutex functions for protecting replay log file and ensuring
|
|
* synchronisation between vCPU and main-loop threads. */
|
|
|
|
void replay_mutex_init(void);
|
|
bool replay_mutex_locked(void);
|
|
|
|
/*! Checks error status of the file. */
|
|
void replay_check_error(void);
|
|
|
|
/*! Finishes processing of the replayed event and fetches
|
|
the next event from the log. */
|
|
void replay_finish_event(void);
|
|
/*! Reads data type from the file and stores it in the
|
|
data_kind variable. */
|
|
void replay_fetch_data_kind(void);
|
|
|
|
/*! Advance replay_state.current_icount to the specified value. */
|
|
void replay_advance_current_icount(uint64_t current_icount);
|
|
/*! Saves queued events (like instructions and sound). */
|
|
void replay_save_instructions(void);
|
|
|
|
/*! Skips async events until some sync event will be found.
|
|
\return true, if event was found */
|
|
bool replay_next_event_is(int event);
|
|
|
|
/*! Reads next clock value from the file.
|
|
If clock kind read from the file is different from the parameter,
|
|
the value is not used. */
|
|
void replay_read_next_clock(ReplayClockKind kind);
|
|
|
|
/* Asynchronous events queue */
|
|
|
|
/*! Initializes events' processing internals */
|
|
void replay_init_events(void);
|
|
/*! Clears internal data structures for events handling */
|
|
void replay_finish_events(void);
|
|
/*! Returns true if there are any unsaved events in the queue */
|
|
bool replay_has_events(void);
|
|
/*! Saves events from queue into the file */
|
|
void replay_save_events(void);
|
|
/*! Read events from the file into the input queue */
|
|
void replay_read_events(void);
|
|
/*! Adds specified async event to the queue */
|
|
void replay_add_event(ReplayAsyncEventKind event_kind, void *opaque,
|
|
void *opaque2, uint64_t id);
|
|
|
|
/* Input events */
|
|
|
|
/*! Saves input event to the log */
|
|
void replay_save_input_event(InputEvent *evt);
|
|
/*! Reads input event from the log */
|
|
InputEvent *replay_read_input_event(void);
|
|
/*! Adds input event to the queue */
|
|
void replay_add_input_event(struct InputEvent *event);
|
|
/*! Adds input sync event to the queue */
|
|
void replay_add_input_sync_event(void);
|
|
|
|
/* Character devices */
|
|
|
|
/*! Called to run char device read event. */
|
|
void replay_event_char_read_run(void *opaque);
|
|
/*! Writes char read event to the file. */
|
|
void replay_event_char_read_save(void *opaque);
|
|
/*! Reads char event read from the file. */
|
|
void *replay_event_char_read_load(void);
|
|
|
|
/* Network devices */
|
|
|
|
/*! Called to run network event. */
|
|
void replay_event_net_run(void *opaque);
|
|
/*! Writes network event to the file. */
|
|
void replay_event_net_save(void *opaque);
|
|
/*! Reads network from the file. */
|
|
void *replay_event_net_load(void);
|
|
|
|
/* Diagnostics */
|
|
|
|
/**
|
|
* replay_sync_error(): report sync error and exit
|
|
*
|
|
* When we reach an error condition we want to report it centrally so
|
|
* we can also dump some useful information into the logs.
|
|
*/
|
|
G_NORETURN void replay_sync_error(const char *error);
|
|
|
|
/* VMState-related functions */
|
|
|
|
/* Registers replay VMState.
|
|
Should be called before virtual devices initialization
|
|
to make cached timers available for post_load functions. */
|
|
void replay_vmstate_register(void);
|
|
|
|
#endif
|