hv_vm/hv_exc: Add cpu_id to exception & mmiotrace structs

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-09-15 23:22:42 +09:00
parent a13a23d5fa
commit 56b54a6641
6 changed files with 10 additions and 3 deletions

View file

@ -15,6 +15,7 @@ from . import xnutools, shell
__all__ = ["HV"]
class MMIOTraceFlags(Register32):
CPU = 23, 16
WIDTH = 4, 0
WRITE = 5
MULTI = 6

View file

@ -67,6 +67,7 @@ class EXC_RET(IntEnum):
STEP = 4
ExcInfo = Struct(
"cpu_id" / Int64ul,
"spsr" / RegAdapter(SPSR),
"elr" / Int64ul,
"esr" / RegAdapter(ESR),

View file

@ -9,9 +9,10 @@
typedef bool(hv_hook_t)(u64 addr, u64 *val, bool write, int width);
#define MMIO_EVT_WIDTH GENMASK(4, 0)
#define MMIO_EVT_WRITE BIT(5)
#define MMIO_EVT_CPU GENMASK(23, 16)
#define MMIO_EVT_MULTI BIT(6)
#define MMIO_EVT_WRITE BIT(5)
#define MMIO_EVT_WIDTH GENMASK(4, 0)
struct hv_evt_mmiotrace {
u32 flags;

View file

@ -4,6 +4,7 @@
#include "assert.h"
#include "cpu_regs.h"
#include "exception.h"
#include "smp.h"
#include "string.h"
#include "uart.h"
#include "uartproxy.h"
@ -33,6 +34,7 @@ void hv_exc_proxy(u64 *regs, uartproxy_boot_reason_t reason, uartproxy_exc_code_
hv_wdt_breadcrumb('P');
struct uartproxy_exc_info exc_info = {
.cpu_id = smp_id(),
.spsr = hv_get_spsr(),
.elr = hv_get_elr(),
.esr = hv_get_esr(),

View file

@ -7,6 +7,7 @@
#include "cpu_regs.h"
#include "iodev.h"
#include "malloc.h"
#include "smp.h"
#include "string.h"
#include "types.h"
#include "uartproxy.h"
@ -616,7 +617,7 @@ static bool emulate_store(u64 *regs, u32 insn, u64 *val, u64 *width)
static void emit_mmiotrace(u64 pc, u64 addr, u64 *data, u64 width, u64 flags, bool sync)
{
struct hv_evt_mmiotrace evt = {
.flags = flags,
.flags = flags | FIELD_PREP(MMIO_EVT_CPU, smp_id()),
.pc = pc,
.addr = addr,
};

View file

@ -33,6 +33,7 @@ typedef enum _uartproxy_event_type_t {
} uartproxy_event_type_t;
struct uartproxy_exc_info {
u64 cpu_id;
u64 spsr;
u64 elr;
u64 esr;