
* 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>
225 lines
8.2 KiB
C
225 lines
8.2 KiB
C
/*
|
|
* TCG CPU-specific operations
|
|
*
|
|
* Copyright 2021 SUSE LLC
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef TCG_CPU_OPS_H
|
|
#define TCG_CPU_OPS_H
|
|
|
|
#include "hw/core/cpu.h"
|
|
|
|
struct TCGCPUOps {
|
|
/**
|
|
* @initialize: Initialize TCG state
|
|
*
|
|
* Called when the first CPU is realized.
|
|
*/
|
|
void (*initialize)(void);
|
|
/**
|
|
* @synchronize_from_tb: Synchronize state from a TCG #TranslationBlock
|
|
*
|
|
* This is called when we abandon execution of a TB before starting it,
|
|
* and must set all parts of the CPU state which the previous TB in the
|
|
* chain may not have updated.
|
|
* By default, when this is NULL, a call is made to @set_pc(tb->pc).
|
|
*
|
|
* If more state needs to be restored, the target must implement a
|
|
* function to restore all the state, and register it here.
|
|
*/
|
|
void (*synchronize_from_tb)(CPUState *cpu, const TranslationBlock *tb);
|
|
/**
|
|
* @restore_state_to_opc: Synchronize state from INDEX_op_start_insn
|
|
*
|
|
* This is called when we unwind state in the middle of a TB,
|
|
* usually before raising an exception. Set all part of the CPU
|
|
* state which are tracked insn-by-insn in the target-specific
|
|
* arguments to start_insn, passed as @data.
|
|
*/
|
|
void (*restore_state_to_opc)(CPUState *cpu, const TranslationBlock *tb,
|
|
const uint64_t *data);
|
|
|
|
/** @cpu_exec_enter: Callback for cpu_exec preparation */
|
|
void (*cpu_exec_enter)(CPUState *cpu);
|
|
/** @cpu_exec_exit: Callback for cpu_exec cleanup */
|
|
void (*cpu_exec_exit)(CPUState *cpu);
|
|
/** @debug_excp_handler: Callback for handling debug exceptions */
|
|
void (*debug_excp_handler)(CPUState *cpu);
|
|
|
|
#ifdef NEED_CPU_H
|
|
#ifdef CONFIG_USER_ONLY
|
|
/**
|
|
* @fake_user_interrupt: Callback for 'fake exception' handling.
|
|
*
|
|
* Simulate 'fake exception' which will be handled outside the
|
|
* cpu execution loop (hack for x86 user mode).
|
|
*/
|
|
void (*fake_user_interrupt)(CPUState *cpu);
|
|
|
|
/**
|
|
* record_sigsegv:
|
|
* @cpu: cpu context
|
|
* @addr: faulting guest address
|
|
* @access_type: access was read/write/execute
|
|
* @maperr: true for invalid page, false for permission fault
|
|
* @ra: host pc for unwinding
|
|
*
|
|
* We are about to raise SIGSEGV with si_code set for @maperr,
|
|
* and si_addr set for @addr. Record anything further needed
|
|
* for the signal ucontext_t.
|
|
*
|
|
* If the emulated kernel does not provide anything to the signal
|
|
* handler with anything besides the user context registers, and
|
|
* the siginfo_t, then this hook need do nothing and may be omitted.
|
|
* Otherwise, record the data and return; the caller will raise
|
|
* the signal, unwind the cpu state, and return to the main loop.
|
|
*
|
|
* If it is simpler to re-use the sysemu tlb_fill code, @ra is provided
|
|
* so that a "normal" cpu exception can be raised. In this case,
|
|
* the signal must be raised by the architecture cpu_loop.
|
|
*/
|
|
void (*record_sigsegv)(CPUState *cpu, vaddr addr,
|
|
MMUAccessType access_type,
|
|
bool maperr, uintptr_t ra);
|
|
/**
|
|
* record_sigbus:
|
|
* @cpu: cpu context
|
|
* @addr: misaligned guest address
|
|
* @access_type: access was read/write/execute
|
|
* @ra: host pc for unwinding
|
|
*
|
|
* We are about to raise SIGBUS with si_code BUS_ADRALN,
|
|
* and si_addr set for @addr. Record anything further needed
|
|
* for the signal ucontext_t.
|
|
*
|
|
* If the emulated kernel does not provide the signal handler with
|
|
* anything besides the user context registers, and the siginfo_t,
|
|
* then this hook need do nothing and may be omitted.
|
|
* Otherwise, record the data and return; the caller will raise
|
|
* the signal, unwind the cpu state, and return to the main loop.
|
|
*
|
|
* If it is simpler to re-use the sysemu do_unaligned_access code,
|
|
* @ra is provided so that a "normal" cpu exception can be raised.
|
|
* In this case, the signal must be raised by the architecture cpu_loop.
|
|
*/
|
|
void (*record_sigbus)(CPUState *cpu, vaddr addr,
|
|
MMUAccessType access_type, uintptr_t ra);
|
|
#else
|
|
/** @do_interrupt: Callback for interrupt handling. */
|
|
void (*do_interrupt)(CPUState *cpu);
|
|
/** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
|
|
bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
|
|
/** @cpu_exec_halt: Callback for handling halt in cpu_exec */
|
|
void (*cpu_exec_halt)(CPUState *cpu);
|
|
/**
|
|
* @tlb_fill: Handle a softmmu tlb miss
|
|
*
|
|
* If the access is valid, call tlb_set_page and return true;
|
|
* if the access is invalid and probe is true, return false;
|
|
* otherwise raise an exception and do not return.
|
|
*/
|
|
bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
|
|
MMUAccessType access_type, int mmu_idx,
|
|
bool probe, uintptr_t retaddr);
|
|
/**
|
|
* @do_transaction_failed: Callback for handling failed memory transactions
|
|
* (ie bus faults or external aborts; not MMU faults)
|
|
*/
|
|
void (*do_transaction_failed)(CPUState *cpu, hwaddr physaddr, vaddr addr,
|
|
unsigned size, MMUAccessType access_type,
|
|
int mmu_idx, MemTxAttrs attrs,
|
|
MemTxResult response, uintptr_t retaddr);
|
|
/**
|
|
* @do_unaligned_access: Callback for unaligned access handling
|
|
* The callback must exit via raising an exception.
|
|
*/
|
|
G_NORETURN void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
|
|
MMUAccessType access_type,
|
|
int mmu_idx, uintptr_t retaddr);
|
|
|
|
/**
|
|
* @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
|
|
*/
|
|
vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
|
|
|
|
/**
|
|
* @debug_check_watchpoint: return true if the architectural
|
|
* watchpoint whose address has matched should really fire, used by ARM
|
|
* and RISC-V
|
|
*/
|
|
bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
|
|
|
|
/**
|
|
* @debug_check_breakpoint: return true if the architectural
|
|
* breakpoint whose PC has matched should really fire.
|
|
*/
|
|
bool (*debug_check_breakpoint)(CPUState *cpu);
|
|
|
|
/**
|
|
* @io_recompile_replay_branch: Callback for cpu_io_recompile.
|
|
*
|
|
* The cpu has been stopped, and cpu_restore_state_from_tb has been
|
|
* called. If the faulting instruction is in a delay slot, and the
|
|
* target architecture requires re-execution of the branch, then
|
|
* adjust the cpu state as required and return true.
|
|
*/
|
|
bool (*io_recompile_replay_branch)(CPUState *cpu,
|
|
const TranslationBlock *tb);
|
|
/**
|
|
* @need_replay_interrupt: Return %true if @interrupt_request
|
|
* needs to be recorded for replay purposes.
|
|
*/
|
|
bool (*need_replay_interrupt)(int interrupt_request);
|
|
#endif /* !CONFIG_USER_ONLY */
|
|
#endif /* NEED_CPU_H */
|
|
|
|
};
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
static inline void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
|
|
MemTxAttrs atr, int fl, uintptr_t ra)
|
|
{
|
|
}
|
|
|
|
static inline int cpu_watchpoint_address_matches(CPUState *cpu,
|
|
vaddr addr, vaddr len)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#else
|
|
|
|
/**
|
|
* cpu_check_watchpoint:
|
|
* @cpu: cpu context
|
|
* @addr: guest virtual address
|
|
* @len: access length
|
|
* @attrs: memory access attributes
|
|
* @flags: watchpoint access type
|
|
* @ra: unwind return address
|
|
*
|
|
* Check for a watchpoint hit in [addr, addr+len) of the type
|
|
* specified by @flags. Exit via exception with a hit.
|
|
*/
|
|
void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
|
|
MemTxAttrs attrs, int flags, uintptr_t ra);
|
|
|
|
/**
|
|
* cpu_watchpoint_address_matches:
|
|
* @cpu: cpu context
|
|
* @addr: guest virtual address
|
|
* @len: access length
|
|
*
|
|
* Return the watchpoint flags that apply to [addr, addr+len).
|
|
* If no watchpoint is registered for the range, the result is 0.
|
|
*/
|
|
int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len);
|
|
|
|
#endif
|
|
|
|
#endif /* TCG_CPU_OPS_H */
|