mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'pull-riscv-to-apply-20220927' of https://github.com/alistair23/qemu into staging
Second RISC-V PR for QEMU 7.2
* Fixup typos and register addresses for Ibex SPI
* Cleanup the RISC-V virt machine documentation
* Remove the sideleg and sedeleg CSR macros
* Fix the CSR check for cycle{h}, instret{h}, time{h}, hpmcounter3-31{h}
* Remove fixed numbering from GDB xml feature files
* Allow setting the resetvec for the OpenTitan machine
* Check the correct exception cause in vector GDB stub
* Fix inheritance of SiFiveEState
* Improvements to the RISC-V debugger spec
* Simplify some vector code
# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEE9sSsRtSTSGjTuM6PIeENKd+XcFQFAmMymHIACgkQIeENKd+X
# cFQPxwf8DhYeJ+Ctsi9/fFTIHLAE3ciZ15Hf/BJGc5maeVGupYG64+9Cs0fGX4bY
# CBlmE5xqn8hanEQXTQxmbC3AoNyykRV+arUrdawlUrJR5hQy/PNVq4yTxFPHcEjJ
# bOsQxkMvMzZiWbJfG8SZObXfFZ+6HjWd2qjbCUwyVAa5mWDHsuPy22/RDcaR9KSV
# Sb217kNIY3a2WkDUrY84zqOfks3NDFA1GuCge7EcQGV9iPxH06KO3ANpGvCE/31i
# FnfA9qUu7ts+ls2lSj+2ARsZUzMciZuC3ggTRYIKbyf0QNTK6fILuzlMPPvf0ORZ
# vbq8rSTDPrWzmrLskba1jADbWPtiXA==
# =b3zl
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 27 Sep 2022 02:30:10 EDT
# gpg: using RSA key F6C4AC46D4934868D3B8CE8F21E10D29DF977054
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: F6C4 AC46 D493 4868 D3B8 CE8F 21E1 0D29 DF97 7054
* tag 'pull-riscv-to-apply-20220927' of https://github.com/alistair23/qemu: (22 commits)
target/riscv: rvv-1.0: vf[w]redsum distinguish between ordered/unordered
target/riscv: rvv-1.0: Simplify vfwredsum code
target/riscv: debug: Add initial support of type 6 trigger
target/riscv: debug: Check VU/VS modes for type 2 trigger
target/riscv: debug: Create common trigger actions function
target/riscv: debug: Introduce tinfo CSR
target/riscv: debug: Restrict the range of tselect value can be written
target/riscv: debug: Introduce tdata1, tdata2, and tdata3 CSRs
target/riscv: debug: Introduce build_tdata1() to build tdata1 register content
target/riscv: debug: Determine the trigger type from tdata1.type
hw/riscv/sifive_e: Fix inheritance of SiFiveEState
target/riscv: Check the correct exception cause in vector GDB stub
hw/riscv: opentitan: Expose the resetvec as a SoC property
hw/riscv: opentitan: Fixup resetvec
target/riscv: Set the CPU resetvec directly
target/riscv: remove fixed numbering from GDB xml feature files
target/riscv: remove fflags, frm, and fcsr from riscv-*-fpu.xml
target/riscv: fix csr check for cycle{h}, instret{h}, time{h}, hpmcounter3-31{h}
target/riscv: Remove sideleg and sedeleg
docs/system: clean up code escape for riscv virt platform
...
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
@@ -1304,8 +1304,6 @@ static const char *csr_name(int csrno)
|
||||
case 0x0043: return "utval";
|
||||
case 0x0044: return "uip";
|
||||
case 0x0100: return "sstatus";
|
||||
case 0x0102: return "sedeleg";
|
||||
case 0x0103: return "sideleg";
|
||||
case 0x0104: return "sie";
|
||||
case 0x0105: return "stvec";
|
||||
case 0x0106: return "scounteren";
|
||||
|
||||
@@ -168,14 +168,19 @@ Enabling TPM
|
||||
|
||||
A TPM device can be connected to the virt board by following the steps below.
|
||||
|
||||
First launch the TPM emulator
|
||||
First launch the TPM emulator:
|
||||
|
||||
swtpm socket --tpm2 -t -d --tpmstate dir=/tmp/tpm \
|
||||
.. code-block:: bash
|
||||
|
||||
$ swtpm socket --tpm2 -t -d --tpmstate dir=/tmp/tpm \
|
||||
--ctrl type=unixio,path=swtpm-sock
|
||||
|
||||
Then launch QEMU with:
|
||||
Then launch QEMU with some additional arguments to link a TPM device to the backend:
|
||||
|
||||
...
|
||||
.. code-block:: bash
|
||||
|
||||
$ qemu-system-riscv64 \
|
||||
... other args .... \
|
||||
-chardev socket,id=chrtpm,path=swtpm-sock \
|
||||
-tpmdev emulator,id=tpm0,chardev=chrtpm \
|
||||
-device tpm-tis-device,tpmdev=tpm0
|
||||
|
||||
@@ -5,13 +5,9 @@
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- Register numbers are hard-coded in order to maintain backward
|
||||
compatibility with older versions of tools that didn't use xml
|
||||
register descriptions. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.riscv.cpu">
|
||||
<reg name="zero" bitsize="32" type="int" regnum="0"/>
|
||||
<reg name="zero" bitsize="32" type="int"/>
|
||||
<reg name="ra" bitsize="32" type="code_ptr"/>
|
||||
<reg name="sp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="gp" bitsize="32" type="data_ptr"/>
|
||||
|
||||
@@ -5,13 +5,9 @@
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- Register numbers are hard-coded in order to maintain backward
|
||||
compatibility with older versions of tools that didn't use xml
|
||||
register descriptions. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.riscv.fpu">
|
||||
<reg name="ft0" bitsize="32" type="ieee_single" regnum="33"/>
|
||||
<reg name="ft0" bitsize="32" type="ieee_single"/>
|
||||
<reg name="ft1" bitsize="32" type="ieee_single"/>
|
||||
<reg name="ft2" bitsize="32" type="ieee_single"/>
|
||||
<reg name="ft3" bitsize="32" type="ieee_single"/>
|
||||
@@ -43,8 +39,4 @@
|
||||
<reg name="ft9" bitsize="32" type="ieee_single"/>
|
||||
<reg name="ft10" bitsize="32" type="ieee_single"/>
|
||||
<reg name="ft11" bitsize="32" type="ieee_single"/>
|
||||
|
||||
<reg name="fflags" bitsize="32" type="int" regnum="66"/>
|
||||
<reg name="frm" bitsize="32" type="int" regnum="67"/>
|
||||
<reg name="fcsr" bitsize="32" type="int" regnum="68"/>
|
||||
</feature>
|
||||
|
||||
@@ -5,13 +5,9 @@
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- Register numbers are hard-coded in order to maintain backward
|
||||
compatibility with older versions of tools that didn't use xml
|
||||
register descriptions. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.riscv.cpu">
|
||||
<reg name="zero" bitsize="64" type="int" regnum="0"/>
|
||||
<reg name="zero" bitsize="64" type="int"/>
|
||||
<reg name="ra" bitsize="64" type="code_ptr"/>
|
||||
<reg name="sp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="gp" bitsize="64" type="data_ptr"/>
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- Register numbers are hard-coded in order to maintain backward
|
||||
compatibility with older versions of tools that didn't use xml
|
||||
register descriptions. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.riscv.fpu">
|
||||
|
||||
@@ -17,7 +13,7 @@
|
||||
<field name="double" type="ieee_double"/>
|
||||
</union>
|
||||
|
||||
<reg name="ft0" bitsize="64" type="riscv_double" regnum="33"/>
|
||||
<reg name="ft0" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft1" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft2" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft3" bitsize="64" type="riscv_double"/>
|
||||
@@ -49,8 +45,4 @@
|
||||
<reg name="ft9" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft10" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft11" bitsize="64" type="riscv_double"/>
|
||||
|
||||
<reg name="fflags" bitsize="32" type="int" regnum="66"/>
|
||||
<reg name="frm" bitsize="32" type="int" regnum="67"/>
|
||||
<reg name="fcsr" bitsize="32" type="int" regnum="68"/>
|
||||
</feature>
|
||||
|
||||
@@ -142,7 +142,7 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||
&error_abort);
|
||||
object_property_set_int(OBJECT(&s->cpus), "num-harts", ms->smp.cpus,
|
||||
&error_abort);
|
||||
object_property_set_int(OBJECT(&s->cpus), "resetvec", 0x20000490,
|
||||
object_property_set_int(OBJECT(&s->cpus), "resetvec", s->resetvec,
|
||||
&error_abort);
|
||||
sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_fatal);
|
||||
|
||||
@@ -297,10 +297,16 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||
memmap[IBEX_DEV_PERI].base, memmap[IBEX_DEV_PERI].size);
|
||||
}
|
||||
|
||||
static Property lowrisc_ibex_soc_props[] = {
|
||||
DEFINE_PROP_UINT32("resetvec", LowRISCIbexSoCState, resetvec, 0x20000400),
|
||||
DEFINE_PROP_END_OF_LIST()
|
||||
};
|
||||
|
||||
static void lowrisc_ibex_soc_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
device_class_set_props(dc, lowrisc_ibex_soc_props);
|
||||
dc->realize = lowrisc_ibex_soc_realize;
|
||||
/* Reason: Uses serial_hds in realize function, thus can't be used twice */
|
||||
dc->user_creatable = false;
|
||||
|
||||
@@ -93,7 +93,7 @@ REG32(ERROR_STATUS, 0x30)
|
||||
FIELD(ERROR_STATUS, CMDINVAL, 3, 1)
|
||||
FIELD(ERROR_STATUS, CSIDINVAL, 4, 1)
|
||||
FIELD(ERROR_STATUS, ACCESSINVAL, 5, 1)
|
||||
REG32(EVENT_ENABLE, 0x30)
|
||||
REG32(EVENT_ENABLE, 0x34)
|
||||
FIELD(EVENT_ENABLE, RXFULL, 0, 1)
|
||||
FIELD(EVENT_ENABLE, TXEMPTY, 1, 1)
|
||||
FIELD(EVENT_ENABLE, RXWM, 2, 1)
|
||||
@@ -172,7 +172,7 @@ static void ibex_spi_host_irq(IbexSPIHostState *s)
|
||||
& R_INTR_STATE_SPI_EVENT_MASK;
|
||||
int err_irq = 0, event_irq = 0;
|
||||
|
||||
/* Error IRQ enabled and Error IRQ Cleared*/
|
||||
/* Error IRQ enabled and Error IRQ Cleared */
|
||||
if (error_en && !err_pending) {
|
||||
/* Event enabled, Interrupt Test Error */
|
||||
if (s->regs[IBEX_SPI_HOST_INTR_TEST] & R_INTR_TEST_ERROR_MASK) {
|
||||
@@ -434,7 +434,7 @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
|
||||
case IBEX_SPI_HOST_TXDATA:
|
||||
/*
|
||||
* This is a hardware `feature` where
|
||||
* the first word written TXDATA after init is omitted entirely
|
||||
* the first word written to TXDATA after init is omitted entirely
|
||||
*/
|
||||
if (s->init_status) {
|
||||
s->init_status = false;
|
||||
@@ -487,7 +487,7 @@ static void ibex_spi_host_write(void *opaque, hwaddr addr,
|
||||
break;
|
||||
case IBEX_SPI_HOST_ERROR_STATUS:
|
||||
/*
|
||||
* Indicates that any errors that have occurred.
|
||||
* Indicates any errors that have occurred.
|
||||
* When an error occurs, the corresponding bit must be cleared
|
||||
* here before issuing any further commands
|
||||
*/
|
||||
|
||||
@@ -46,6 +46,8 @@ struct LowRISCIbexSoCState {
|
||||
IbexTimerState timer;
|
||||
IbexSPIHostState spi_host[OPENTITAN_NUM_SPI_HOSTS];
|
||||
|
||||
uint32_t resetvec;
|
||||
|
||||
MemoryRegion flash_mem;
|
||||
MemoryRegion rom;
|
||||
MemoryRegion flash_alias;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "hw/riscv/riscv_hart.h"
|
||||
#include "hw/riscv/sifive_cpu.h"
|
||||
#include "hw/gpio/sifive_gpio.h"
|
||||
#include "hw/boards.h"
|
||||
|
||||
#define TYPE_RISCV_E_SOC "riscv.sifive.e.soc"
|
||||
#define RISCV_E_SOC(obj) \
|
||||
@@ -41,7 +42,7 @@ typedef struct SiFiveESoCState {
|
||||
|
||||
typedef struct SiFiveEState {
|
||||
/*< private >*/
|
||||
SysBusDevice parent_obj;
|
||||
MachineState parent_obj;
|
||||
|
||||
/*< public >*/
|
||||
SiFiveESoCState soc;
|
||||
|
||||
+3
-10
@@ -228,13 +228,6 @@ static void set_vext_version(CPURISCVState *env, int vext_ver)
|
||||
env->vext_ver = vext_ver;
|
||||
}
|
||||
|
||||
static void set_resetvec(CPURISCVState *env, target_ulong resetvec)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
env->resetvec = resetvec;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void riscv_any_cpu_init(Object *obj)
|
||||
{
|
||||
CPURISCVState *env = &RISCV_CPU(obj)->env;
|
||||
@@ -336,7 +329,6 @@ static void rv32_imafcu_nommu_cpu_init(Object *obj)
|
||||
|
||||
set_misa(env, MXL_RV32, RVI | RVM | RVA | RVF | RVC | RVU);
|
||||
set_priv_version(env, PRIV_VERSION_1_10_0);
|
||||
set_resetvec(env, DEFAULT_RSTVEC);
|
||||
cpu->cfg.mmu = false;
|
||||
}
|
||||
#endif
|
||||
@@ -676,7 +668,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
|
||||
riscv_set_feature(env, RISCV_FEATURE_DEBUG);
|
||||
}
|
||||
|
||||
set_resetvec(env, cpu->cfg.resetvec);
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
if (cpu->cfg.ext_sstc) {
|
||||
@@ -1079,7 +1070,9 @@ static Property riscv_cpu_properties[] = {
|
||||
DEFINE_PROP_UINT64("marchid", RISCVCPU, cfg.marchid, RISCV_CPU_MARCHID),
|
||||
DEFINE_PROP_UINT64("mimpid", RISCVCPU, cfg.mimpid, RISCV_CPU_MIMPID),
|
||||
|
||||
DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC),
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
DEFINE_PROP_UINT64("resetvec", RISCVCPU, env.resetvec, DEFAULT_RSTVEC),
|
||||
#endif
|
||||
|
||||
DEFINE_PROP_BOOL("short-isa-string", RISCVCPU, cfg.short_isa_string, false),
|
||||
|
||||
|
||||
+6
-3
@@ -190,7 +190,7 @@ struct CPUArchState {
|
||||
/* This contains QEMU specific information about the virt state. */
|
||||
target_ulong virt;
|
||||
target_ulong geilen;
|
||||
target_ulong resetvec;
|
||||
uint64_t resetvec;
|
||||
|
||||
target_ulong mhartid;
|
||||
/*
|
||||
@@ -324,7 +324,11 @@ struct CPUArchState {
|
||||
|
||||
/* trigger module */
|
||||
target_ulong trigger_cur;
|
||||
type2_trigger_t type2_trig[TRIGGER_TYPE2_NUM];
|
||||
target_ulong tdata1[RV_MAX_TRIGGERS];
|
||||
target_ulong tdata2[RV_MAX_TRIGGERS];
|
||||
target_ulong tdata3[RV_MAX_TRIGGERS];
|
||||
struct CPUBreakpoint *cpu_breakpoint[RV_MAX_TRIGGERS];
|
||||
struct CPUWatchpoint *cpu_watchpoint[RV_MAX_TRIGGERS];
|
||||
|
||||
/* machine specific rdtime callback */
|
||||
uint64_t (*rdtime_fn)(void *);
|
||||
@@ -474,7 +478,6 @@ struct RISCVCPUConfig {
|
||||
bool pmp;
|
||||
bool epmp;
|
||||
bool debug;
|
||||
uint64_t resetvec;
|
||||
|
||||
bool short_isa_string;
|
||||
};
|
||||
|
||||
@@ -190,8 +190,6 @@
|
||||
|
||||
/* Supervisor Trap Setup */
|
||||
#define CSR_SSTATUS 0x100
|
||||
#define CSR_SEDELEG 0x102
|
||||
#define CSR_SIDELEG 0x103
|
||||
#define CSR_SIE 0x104
|
||||
#define CSR_STVEC 0x105
|
||||
#define CSR_SCOUNTEREN 0x106
|
||||
@@ -321,6 +319,7 @@
|
||||
#define CSR_TDATA1 0x7a1
|
||||
#define CSR_TDATA2 0x7a2
|
||||
#define CSR_TDATA3 0x7a3
|
||||
#define CSR_TINFO 0x7a4
|
||||
|
||||
/* Debug Mode Registers */
|
||||
#define CSR_DCSR 0x7b0
|
||||
|
||||
+18
-5
@@ -98,17 +98,22 @@ static RISCVException ctr(CPURISCVState *env, int csrno)
|
||||
|
||||
skip_ext_pmu_check:
|
||||
|
||||
if (((env->priv == PRV_S) && (!get_field(env->mcounteren, ctr_mask))) ||
|
||||
((env->priv == PRV_U) && (!get_field(env->scounteren, ctr_mask)))) {
|
||||
if (env->priv < PRV_M && !get_field(env->mcounteren, ctr_mask)) {
|
||||
return RISCV_EXCP_ILLEGAL_INST;
|
||||
}
|
||||
|
||||
if (riscv_cpu_virt_enabled(env)) {
|
||||
if (!get_field(env->hcounteren, ctr_mask) &&
|
||||
get_field(env->mcounteren, ctr_mask)) {
|
||||
if (!get_field(env->hcounteren, ctr_mask) ||
|
||||
(env->priv == PRV_U && !get_field(env->scounteren, ctr_mask))) {
|
||||
return RISCV_EXCP_VIRT_INSTRUCTION_FAULT;
|
||||
}
|
||||
}
|
||||
|
||||
if (riscv_has_ext(env, RVS) && env->priv == PRV_U &&
|
||||
!get_field(env->scounteren, ctr_mask)) {
|
||||
return RISCV_EXCP_ILLEGAL_INST;
|
||||
}
|
||||
|
||||
#endif
|
||||
return RISCV_EXCP_NONE;
|
||||
}
|
||||
@@ -3065,7 +3070,7 @@ static RISCVException read_tdata(CPURISCVState *env, int csrno,
|
||||
target_ulong *val)
|
||||
{
|
||||
/* return 0 in tdata1 to end the trigger enumeration */
|
||||
if (env->trigger_cur >= TRIGGER_NUM && csrno == CSR_TDATA1) {
|
||||
if (env->trigger_cur >= RV_MAX_TRIGGERS && csrno == CSR_TDATA1) {
|
||||
*val = 0;
|
||||
return RISCV_EXCP_NONE;
|
||||
}
|
||||
@@ -3089,6 +3094,13 @@ static RISCVException write_tdata(CPURISCVState *env, int csrno,
|
||||
return RISCV_EXCP_NONE;
|
||||
}
|
||||
|
||||
static RISCVException read_tinfo(CPURISCVState *env, int csrno,
|
||||
target_ulong *val)
|
||||
{
|
||||
*val = tinfo_csr_read(env);
|
||||
return RISCV_EXCP_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions to access Pointer Masking feature registers
|
||||
* We have to check if current priv lvl could modify
|
||||
@@ -3893,6 +3905,7 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
|
||||
[CSR_TDATA1] = { "tdata1", debug, read_tdata, write_tdata },
|
||||
[CSR_TDATA2] = { "tdata2", debug, read_tdata, write_tdata },
|
||||
[CSR_TDATA3] = { "tdata3", debug, read_tdata, write_tdata },
|
||||
[CSR_TINFO] = { "tinfo", debug, read_tinfo, write_ignore },
|
||||
|
||||
/* User Pointer Masking */
|
||||
[CSR_UMTE] = { "umte", pointer_masking, read_umte, write_umte },
|
||||
|
||||
+391
-103
File diff suppressed because it is too large
Load Diff
+38
-15
@@ -22,13 +22,7 @@
|
||||
#ifndef RISCV_DEBUG_H
|
||||
#define RISCV_DEBUG_H
|
||||
|
||||
/* trigger indexes implemented */
|
||||
enum {
|
||||
TRIGGER_TYPE2_IDX_0 = 0,
|
||||
TRIGGER_TYPE2_IDX_1,
|
||||
TRIGGER_TYPE2_NUM,
|
||||
TRIGGER_NUM = TRIGGER_TYPE2_NUM
|
||||
};
|
||||
#define RV_MAX_TRIGGERS 2
|
||||
|
||||
/* register index of tdata CSRs */
|
||||
enum {
|
||||
@@ -46,24 +40,33 @@ typedef enum {
|
||||
TRIGGER_TYPE_EXCP = 5, /* exception trigger */
|
||||
TRIGGER_TYPE_AD_MATCH6 = 6, /* new address/data match trigger */
|
||||
TRIGGER_TYPE_EXT_SRC = 7, /* external source trigger */
|
||||
TRIGGER_TYPE_UNAVAIL = 15 /* trigger exists, but unavailable */
|
||||
TRIGGER_TYPE_UNAVAIL = 15, /* trigger exists, but unavailable */
|
||||
TRIGGER_TYPE_NUM
|
||||
} trigger_type_t;
|
||||
|
||||
typedef struct {
|
||||
target_ulong mcontrol;
|
||||
target_ulong maddress;
|
||||
struct CPUBreakpoint *bp;
|
||||
struct CPUWatchpoint *wp;
|
||||
} type2_trigger_t;
|
||||
/* actions */
|
||||
typedef enum {
|
||||
DBG_ACTION_NONE = -1, /* sentinel value */
|
||||
DBG_ACTION_BP = 0,
|
||||
DBG_ACTION_DBG_MODE,
|
||||
DBG_ACTION_TRACE0,
|
||||
DBG_ACTION_TRACE1,
|
||||
DBG_ACTION_TRACE2,
|
||||
DBG_ACTION_TRACE3,
|
||||
DBG_ACTION_EXT_DBG0 = 8,
|
||||
DBG_ACTION_EXT_DBG1
|
||||
} trigger_action_t;
|
||||
|
||||
/* tdata field masks */
|
||||
/* tdata1 field masks */
|
||||
|
||||
#define RV32_TYPE(t) ((uint32_t)(t) << 28)
|
||||
#define RV32_TYPE_MASK (0xf << 28)
|
||||
#define RV32_DMODE BIT(27)
|
||||
#define RV32_DATA_MASK 0x7ffffff
|
||||
#define RV64_TYPE(t) ((uint64_t)(t) << 60)
|
||||
#define RV64_TYPE_MASK (0xfULL << 60)
|
||||
#define RV64_DMODE BIT_ULL(59)
|
||||
#define RV64_DATA_MASK 0x7ffffffffffffff
|
||||
|
||||
/* mcontrol field masks */
|
||||
|
||||
@@ -82,6 +85,24 @@ typedef struct {
|
||||
#define TYPE2_HIT BIT(20)
|
||||
#define TYPE2_SIZEHI (0x3 << 21) /* RV64 only */
|
||||
|
||||
/* mcontrol6 field masks */
|
||||
|
||||
#define TYPE6_LOAD BIT(0)
|
||||
#define TYPE6_STORE BIT(1)
|
||||
#define TYPE6_EXEC BIT(2)
|
||||
#define TYPE6_U BIT(3)
|
||||
#define TYPE6_S BIT(4)
|
||||
#define TYPE6_M BIT(6)
|
||||
#define TYPE6_MATCH (0xf << 7)
|
||||
#define TYPE6_CHAIN BIT(11)
|
||||
#define TYPE6_ACTION (0xf << 12)
|
||||
#define TYPE6_SIZE (0xf << 16)
|
||||
#define TYPE6_TIMING BIT(20)
|
||||
#define TYPE6_SELECT BIT(21)
|
||||
#define TYPE6_HIT BIT(22)
|
||||
#define TYPE6_VU BIT(23)
|
||||
#define TYPE6_VS BIT(24)
|
||||
|
||||
/* access size */
|
||||
enum {
|
||||
SIZE_ANY = 0,
|
||||
@@ -105,6 +126,8 @@ void tselect_csr_write(CPURISCVState *env, target_ulong val);
|
||||
target_ulong tdata_csr_read(CPURISCVState *env, int tdata_index);
|
||||
void tdata_csr_write(CPURISCVState *env, int tdata_index, target_ulong val);
|
||||
|
||||
target_ulong tinfo_csr_read(CPURISCVState *env);
|
||||
|
||||
void riscv_cpu_debug_excp_handler(CPUState *cs);
|
||||
bool riscv_cpu_debug_check_breakpoint(CPUState *cs);
|
||||
bool riscv_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp);
|
||||
|
||||
+4
-32
@@ -114,20 +114,6 @@ static int riscv_gdb_get_fpu(CPURISCVState *env, GByteArray *buf, int n)
|
||||
if (env->misa_ext & RVF) {
|
||||
return gdb_get_reg32(buf, env->fpr[n]);
|
||||
}
|
||||
/* there is hole between ft11 and fflags in fpu.xml */
|
||||
} else if (n < 36 && n > 32) {
|
||||
target_ulong val = 0;
|
||||
int result;
|
||||
/*
|
||||
* CSR_FFLAGS is at index 1 in csr_register, and gdb says it is FP
|
||||
* register 33, so we recalculate the map index.
|
||||
* This also works for CSR_FRM and CSR_FCSR.
|
||||
*/
|
||||
result = riscv_csrrw_debug(env, n - 32, &val,
|
||||
0, 0);
|
||||
if (result == RISCV_EXCP_NONE) {
|
||||
return gdb_get_regl(buf, val);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -137,20 +123,6 @@ static int riscv_gdb_set_fpu(CPURISCVState *env, uint8_t *mem_buf, int n)
|
||||
if (n < 32) {
|
||||
env->fpr[n] = ldq_p(mem_buf); /* always 64-bit */
|
||||
return sizeof(uint64_t);
|
||||
/* there is hole between ft11 and fflags in fpu.xml */
|
||||
} else if (n < 36 && n > 32) {
|
||||
target_ulong val = ldtul_p(mem_buf);
|
||||
int result;
|
||||
/*
|
||||
* CSR_FFLAGS is at index 1 in csr_register, and gdb says it is FP
|
||||
* register 33, so we recalculate the map index.
|
||||
* This also works for CSR_FRM and CSR_FCSR.
|
||||
*/
|
||||
result = riscv_csrrw_debug(env, n - 32, NULL,
|
||||
val, -1);
|
||||
if (result == RISCV_EXCP_NONE) {
|
||||
return sizeof(target_ulong);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -211,7 +183,7 @@ static int riscv_gdb_get_vector(CPURISCVState *env, GByteArray *buf, int n)
|
||||
target_ulong val = 0;
|
||||
int result = riscv_csrrw_debug(env, csrno, &val, 0, 0);
|
||||
|
||||
if (result == 0) {
|
||||
if (result == RISCV_EXCP_NONE) {
|
||||
return gdb_get_regl(buf, val);
|
||||
}
|
||||
|
||||
@@ -238,7 +210,7 @@ static int riscv_gdb_set_vector(CPURISCVState *env, uint8_t *mem_buf, int n)
|
||||
target_ulong val = ldtul_p(mem_buf);
|
||||
int result = riscv_csrrw_debug(env, csrno, NULL, val, -1);
|
||||
|
||||
if (result == 0) {
|
||||
if (result == RISCV_EXCP_NONE) {
|
||||
return sizeof(target_ulong);
|
||||
}
|
||||
|
||||
@@ -404,10 +376,10 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs)
|
||||
CPURISCVState *env = &cpu->env;
|
||||
if (env->misa_ext & RVD) {
|
||||
gdb_register_coprocessor(cs, riscv_gdb_get_fpu, riscv_gdb_set_fpu,
|
||||
36, "riscv-64bit-fpu.xml", 0);
|
||||
32, "riscv-64bit-fpu.xml", 0);
|
||||
} else if (env->misa_ext & RVF) {
|
||||
gdb_register_coprocessor(cs, riscv_gdb_get_fpu, riscv_gdb_set_fpu,
|
||||
36, "riscv-32bit-fpu.xml", 0);
|
||||
32, "riscv-32bit-fpu.xml", 0);
|
||||
}
|
||||
if (env->misa_ext & RVV) {
|
||||
gdb_register_coprocessor(cs, riscv_gdb_get_vector, riscv_gdb_set_vector,
|
||||
|
||||
+10
-5
@@ -1009,9 +1009,12 @@ DEF_HELPER_6(vwredsum_vs_b, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vwredsum_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vwredsum_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
|
||||
DEF_HELPER_6(vfredsum_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredsum_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredsum_vs_d, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredusum_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredusum_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredusum_vs_d, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredosum_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredosum_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredosum_vs_d, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredmax_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredmax_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredmax_vs_d, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
@@ -1019,8 +1022,10 @@ DEF_HELPER_6(vfredmin_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredmin_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfredmin_vs_d, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
|
||||
DEF_HELPER_6(vfwredsum_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfwredsum_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfwredusum_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfwredusum_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfwredosum_vs_h, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vfwredosum_vs_w, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
|
||||
DEF_HELPER_6(vmand_mm, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
DEF_HELPER_6(vmnand_mm, void, ptr, ptr, ptr, ptr, env, i32)
|
||||
|
||||
@@ -664,11 +664,13 @@ vredmax_vs 000111 . ..... ..... 010 ..... 1010111 @r_vm
|
||||
vwredsumu_vs 110000 . ..... ..... 000 ..... 1010111 @r_vm
|
||||
vwredsum_vs 110001 . ..... ..... 000 ..... 1010111 @r_vm
|
||||
# Vector ordered and unordered reduction sum
|
||||
vfredsum_vs 0000-1 . ..... ..... 001 ..... 1010111 @r_vm
|
||||
vfredusum_vs 000001 . ..... ..... 001 ..... 1010111 @r_vm
|
||||
vfredosum_vs 000011 . ..... ..... 001 ..... 1010111 @r_vm
|
||||
vfredmin_vs 000101 . ..... ..... 001 ..... 1010111 @r_vm
|
||||
vfredmax_vs 000111 . ..... ..... 001 ..... 1010111 @r_vm
|
||||
# Vector widening ordered and unordered float reduction sum
|
||||
vfwredsum_vs 1100-1 . ..... ..... 001 ..... 1010111 @r_vm
|
||||
vfwredusum_vs 110001 . ..... ..... 001 ..... 1010111 @r_vm
|
||||
vfwredosum_vs 110011 . ..... ..... 001 ..... 1010111 @r_vm
|
||||
vmand_mm 011001 - ..... ..... 010 ..... 1010111 @r
|
||||
vmnand_mm 011101 - ..... ..... 010 ..... 1010111 @r
|
||||
vmandn_mm 011000 - ..... ..... 010 ..... 1010111 @r
|
||||
|
||||
@@ -3136,7 +3136,8 @@ static bool freduction_check(DisasContext *s, arg_rmrr *a)
|
||||
require_zve64f(s);
|
||||
}
|
||||
|
||||
GEN_OPFVV_TRANS(vfredsum_vs, freduction_check)
|
||||
GEN_OPFVV_TRANS(vfredusum_vs, freduction_check)
|
||||
GEN_OPFVV_TRANS(vfredosum_vs, freduction_check)
|
||||
GEN_OPFVV_TRANS(vfredmax_vs, freduction_check)
|
||||
GEN_OPFVV_TRANS(vfredmin_vs, freduction_check)
|
||||
|
||||
@@ -3148,7 +3149,8 @@ static bool freduction_widen_check(DisasContext *s, arg_rmrr *a)
|
||||
(s->sew != MO_8);
|
||||
}
|
||||
|
||||
GEN_OPFVV_WIDEN_TRANS(vfwredsum_vs, freduction_widen_check)
|
||||
GEN_OPFVV_WIDEN_TRANS(vfwredusum_vs, freduction_widen_check)
|
||||
GEN_OPFVV_WIDEN_TRANS(vfwredosum_vs, freduction_widen_check)
|
||||
|
||||
/*
|
||||
*** Vector Mask Operations
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user