4 * Copyright (c) 2016-2017 Sagar Karandikar, sagark@eecs.berkeley.edu
5 * Copyright (c) 2017-2018 SiFive, Inc.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2 or later, as published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "hw/core/cpu.h"
24 #include "hw/registerfields.h"
25 #include "hw/qdev-properties.h"
26 #include "exec/cpu-defs.h"
27 #include "qemu/cpu-float.h"
28 #include "qom/object.h"
29 #include "qemu/int128.h"
32 #include "qapi/qapi-types-common.h"
35 typedef struct CPUArchState CPURISCVState
;
37 #define CPU_RESOLVING_TYPE TYPE_RISCV_CPU
39 #if defined(TARGET_RISCV32)
40 # define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE32
41 #elif defined(TARGET_RISCV64)
42 # define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE64
45 #define TCG_GUEST_DEFAULT_MO 0
48 * RISC-V-specific extra insn start words:
49 * 1: Original instruction opcode
51 #define TARGET_INSN_START_EXTRA_WORDS 1
53 #define RV(x) ((target_ulong)1 << (x - 'A'))
56 * Update misa_bits[], misa_ext_info_arr[] and misa_ext_cfgs[]
57 * when adding new MISA bits here.
60 #define RVE RV('E') /* E and I are mutually exclusive */
73 extern const uint32_t misa_bits
[];
74 const char *riscv_get_misa_ext_name(uint32_t bit
);
75 const char *riscv_get_misa_ext_description(uint32_t bit
);
77 #define CPU_CFG_OFFSET(_prop) offsetof(struct RISCVCPUConfig, _prop)
79 /* Privileged specification version */
81 PRIV_VERSION_1_10_0
= 0,
85 PRIV_VERSION_LATEST
= PRIV_VERSION_1_12_0
,
88 #define VEXT_VERSION_1_00_0 0x00010000
94 TRANSLATE_G_STAGE_FAIL
97 /* Extension context status */
99 EXT_STATUS_DISABLED
= 0,
105 #define MMU_USER_IDX 3
107 #define MAX_RISCV_PMPS (16)
109 #if !defined(CONFIG_USER_ONLY)
114 #define RV_VLEN_MAX 1024
115 #define RV_MAX_MHPMEVENTS 32
116 #define RV_MAX_MHPMCOUNTERS 32
118 FIELD(VTYPE
, VLMUL
, 0, 3)
119 FIELD(VTYPE
, VSEW
, 3, 3)
120 FIELD(VTYPE
, VTA
, 6, 1)
121 FIELD(VTYPE
, VMA
, 7, 1)
122 FIELD(VTYPE
, VEDIV
, 8, 2)
123 FIELD(VTYPE
, RESERVED
, 10, sizeof(target_ulong
) * 8 - 11)
125 typedef struct PMUCTRState
{
126 /* Current value of a counter */
127 target_ulong mhpmcounter_val
;
128 /* Current value of a counter in RV32 */
129 target_ulong mhpmcounterh_val
;
130 /* Snapshot values of counter */
131 target_ulong mhpmcounter_prev
;
132 /* Snapshort value of a counter in RV32 */
133 target_ulong mhpmcounterh_prev
;
135 /* Value beyond UINT32_MAX/UINT64_MAX before overflow interrupt trigger */
136 target_ulong irq_overflow_left
;
139 struct CPUArchState
{
140 target_ulong gpr
[32];
141 target_ulong gprh
[32]; /* 64 top bits of the 128-bit registers */
143 /* vector coprocessor state. */
144 uint64_t vreg
[32 * RV_VLEN_MAX
/ 64] QEMU_ALIGNED(16);
153 target_ulong load_res
;
154 target_ulong load_val
;
156 /* Floating-Point state */
157 uint64_t fpr
[32]; /* assume both F and D extensions */
159 float_status fp_status
;
161 target_ulong badaddr
;
164 target_ulong guest_phys_fault_addr
;
166 target_ulong priv_ver
;
167 target_ulong bext_ver
;
168 target_ulong vext_ver
;
170 /* RISCVMXL, but uint32_t for vmstate migration */
171 uint32_t misa_mxl
; /* current mxl */
172 uint32_t misa_mxl_max
; /* max mxl for this cpu */
173 uint32_t misa_ext
; /* current extensions */
174 uint32_t misa_ext_mask
; /* max ext for this cpu */
175 uint32_t xl
; /* current xlen */
177 /* 128-bit helpers upper part return value */
182 #ifdef CONFIG_USER_ONLY
186 #ifndef CONFIG_USER_ONLY
188 /* This contains QEMU specific information about the virt state. */
193 target_ulong mhartid
;
195 * For RV32 this is 32-bit mstatus and 32-bit mstatush.
196 * For RV64 this is a 64-bit mstatus.
202 * MIP contains the software writable version of SEIP ORed with the
203 * external interrupt value. The MIP register is always up-to-date.
204 * To keep track of the current source, we also save booleans of the values
216 * When mideleg[i]=0 and mvien[i]=1, sie[i] is no more
217 * alias of mie[i] and needs to be maintained separately.
222 * When hideleg[i]=0 and hvien[i]=1, vsie[i] is no more
223 * alias of sie[i] (mie[i]) and needs to be maintained separately.
227 target_ulong satp
; /* since: priv-1.10.0 */
229 target_ulong medeleg
;
238 target_ulong mtval
; /* since: priv-1.10.0 */
240 /* Machine and Supervisor interrupt priorities */
245 target_ulong miselect
;
246 target_ulong siselect
;
250 /* Hypervisor CSRs */
251 target_ulong hstatus
;
252 target_ulong hedeleg
;
254 target_ulong hcounteren
;
264 * Bits VSSIP, VSTIP and VSEIP in hvip are maintained in mip. Other bits
265 * from 0:12 are reserved. Bits 13:63 are not aliased and must be separately
270 /* Hypervisor controlled virtual interrupt priorities */
274 /* Upper 64-bits of 128-bit CSRs */
280 * For RV32 this is 32-bit vsstatus and 32-bit vsstatush.
281 * For RV64 this is a 64-bit vsstatus.
285 target_ulong vsscratch
;
287 target_ulong vscause
;
291 /* AIA VS-mode CSRs */
292 target_ulong vsiselect
;
298 target_ulong stvec_hs
;
299 target_ulong sscratch_hs
;
300 target_ulong sepc_hs
;
301 target_ulong scause_hs
;
302 target_ulong stval_hs
;
303 target_ulong satp_hs
;
307 * Signals whether the current exception occurred with two-stage address
308 * translation active.
310 bool two_stage_lookup
;
312 * Signals whether the current exception occurred while doing two-stage
313 * address translation for the VS-stage page table walk.
315 bool two_stage_indirect_lookup
;
317 target_ulong scounteren
;
318 target_ulong mcounteren
;
320 target_ulong mcountinhibit
;
322 /* PMU counter state */
323 PMUCTRState pmu_ctrs
[RV_MAX_MHPMCOUNTERS
];
325 /* PMU event selector configured values. First three are unused */
326 target_ulong mhpmevent_val
[RV_MAX_MHPMEVENTS
];
328 /* PMU event selector configured values for RV32 */
329 target_ulong mhpmeventh_val
[RV_MAX_MHPMEVENTS
];
331 target_ulong sscratch
;
332 target_ulong mscratch
;
339 /* physical memory protection */
340 pmp_table_t pmp_state
;
341 target_ulong mseccfg
;
344 target_ulong trigger_cur
;
345 target_ulong tdata1
[RV_MAX_TRIGGERS
];
346 target_ulong tdata2
[RV_MAX_TRIGGERS
];
347 target_ulong tdata3
[RV_MAX_TRIGGERS
];
348 struct CPUBreakpoint
*cpu_breakpoint
[RV_MAX_TRIGGERS
];
349 struct CPUWatchpoint
*cpu_watchpoint
[RV_MAX_TRIGGERS
];
350 QEMUTimer
*itrigger_timer
[RV_MAX_TRIGGERS
];
352 bool itrigger_enabled
;
354 /* machine specific rdtime callback */
355 uint64_t (*rdtime_fn
)(void *);
358 /* machine specific AIA ireg read-modify-write callback */
359 #define AIA_MAKE_IREG(__isel, __priv, __virt, __vgein, __xlen) \
360 ((((__xlen) & 0xff) << 24) | \
361 (((__vgein) & 0x3f) << 20) | \
362 (((__virt) & 0x1) << 18) | \
363 (((__priv) & 0x3) << 16) | \
365 #define AIA_IREG_ISEL(__ireg) ((__ireg) & 0xffff)
366 #define AIA_IREG_PRIV(__ireg) (((__ireg) >> 16) & 0x3)
367 #define AIA_IREG_VIRT(__ireg) (((__ireg) >> 18) & 0x1)
368 #define AIA_IREG_VGEIN(__ireg) (((__ireg) >> 20) & 0x3f)
369 #define AIA_IREG_XLEN(__ireg) (((__ireg) >> 24) & 0xff)
370 int (*aia_ireg_rmw_fn
[4])(void *arg
, target_ulong reg
,
371 target_ulong
*val
, target_ulong new_val
, target_ulong write_mask
);
372 void *aia_ireg_rmw_fn_arg
[4];
374 /* True if in debugger mode. */
378 * CSRs for PointerMasking extension
381 target_ulong mpmmask
;
382 target_ulong mpmbase
;
383 target_ulong spmmask
;
384 target_ulong spmbase
;
385 target_ulong upmmask
;
386 target_ulong upmbase
;
388 /* CSRs for execution environment configuration */
390 uint64_t mstateen
[SMSTATEEN_MAX_COUNT
];
391 uint64_t hstateen
[SMSTATEEN_MAX_COUNT
];
392 uint64_t sstateen
[SMSTATEEN_MAX_COUNT
];
393 target_ulong senvcfg
;
396 target_ulong cur_pmmask
;
397 target_ulong cur_pmbase
;
399 /* Fields from here on are preserved across CPU reset. */
400 QEMUTimer
*stimer
; /* Internal timer for S-mode interrupt */
401 QEMUTimer
*vstimer
; /* Internal timer for VS-mode interrupt */
409 bool kvm_timer_dirty
;
410 uint64_t kvm_timer_time
;
411 uint64_t kvm_timer_compare
;
412 uint64_t kvm_timer_state
;
413 uint64_t kvm_timer_frequency
;
414 #endif /* CONFIG_KVM */
419 * @env: #CPURISCVState
431 /* Configuration Settings */
434 QEMUTimer
*pmu_timer
;
435 /* A bitmask of Available programmable counters */
436 uint32_t pmu_avail_ctrs
;
437 /* Mapping of events to counters */
438 GHashTable
*pmu_event_ctr_map
;
443 * @parent_realize: The parent class' realize handler.
444 * @parent_phases: The parent class' reset phase handlers.
448 struct RISCVCPUClass
{
449 CPUClass parent_class
;
451 DeviceRealize parent_realize
;
452 ResettablePhases parent_phases
;
455 static inline int riscv_has_ext(CPURISCVState
*env
, target_ulong ext
)
457 return (env
->misa_ext
& ext
) != 0;
460 #include "cpu_user.h"
462 extern const char * const riscv_int_regnames
[];
463 extern const char * const riscv_int_regnamesh
[];
464 extern const char * const riscv_fpr_regnames
[];
466 const char *riscv_cpu_get_trap_name(target_ulong cause
, bool async
);
467 void riscv_cpu_do_interrupt(CPUState
*cpu
);
468 int riscv_cpu_write_elf64_note(WriteCoreDumpFunction f
, CPUState
*cs
,
469 int cpuid
, DumpState
*s
);
470 int riscv_cpu_write_elf32_note(WriteCoreDumpFunction f
, CPUState
*cs
,
471 int cpuid
, DumpState
*s
);
472 int riscv_cpu_gdb_read_register(CPUState
*cpu
, GByteArray
*buf
, int reg
);
473 int riscv_cpu_gdb_write_register(CPUState
*cpu
, uint8_t *buf
, int reg
);
474 int riscv_cpu_hviprio_index2irq(int index
, int *out_irq
, int *out_rdzero
);
475 uint8_t riscv_cpu_default_priority(int irq
);
476 uint64_t riscv_cpu_all_pending(CPURISCVState
*env
);
477 int riscv_cpu_mirq_pending(CPURISCVState
*env
);
478 int riscv_cpu_sirq_pending(CPURISCVState
*env
);
479 int riscv_cpu_vsirq_pending(CPURISCVState
*env
);
480 bool riscv_cpu_fp_enabled(CPURISCVState
*env
);
481 target_ulong
riscv_cpu_get_geilen(CPURISCVState
*env
);
482 void riscv_cpu_set_geilen(CPURISCVState
*env
, target_ulong geilen
);
483 bool riscv_cpu_vector_enabled(CPURISCVState
*env
);
484 void riscv_cpu_set_virt_enabled(CPURISCVState
*env
, bool enable
);
485 int riscv_cpu_mmu_index(CPURISCVState
*env
, bool ifetch
);
486 G_NORETURN
void riscv_cpu_do_unaligned_access(CPUState
*cs
, vaddr addr
,
487 MMUAccessType access_type
,
488 int mmu_idx
, uintptr_t retaddr
);
489 bool riscv_cpu_tlb_fill(CPUState
*cs
, vaddr address
, int size
,
490 MMUAccessType access_type
, int mmu_idx
,
491 bool probe
, uintptr_t retaddr
);
492 char *riscv_isa_string(RISCVCPU
*cpu
);
494 #define cpu_mmu_index riscv_cpu_mmu_index
496 #ifndef CONFIG_USER_ONLY
497 void riscv_cpu_do_transaction_failed(CPUState
*cs
, hwaddr physaddr
,
498 vaddr addr
, unsigned size
,
499 MMUAccessType access_type
,
500 int mmu_idx
, MemTxAttrs attrs
,
501 MemTxResult response
, uintptr_t retaddr
);
502 hwaddr
riscv_cpu_get_phys_page_debug(CPUState
*cpu
, vaddr addr
);
503 bool riscv_cpu_exec_interrupt(CPUState
*cs
, int interrupt_request
);
504 void riscv_cpu_swap_hypervisor_regs(CPURISCVState
*env
);
505 int riscv_cpu_claim_interrupts(RISCVCPU
*cpu
, uint64_t interrupts
);
506 uint64_t riscv_cpu_update_mip(CPURISCVState
*env
, uint64_t mask
,
508 void riscv_cpu_interrupt(CPURISCVState
*env
);
509 #define BOOL_TO_MASK(x) (-!!(x)) /* helper for riscv_cpu_update_mip value */
510 void riscv_cpu_set_rdtime_fn(CPURISCVState
*env
, uint64_t (*fn
)(void *),
512 void riscv_cpu_set_aia_ireg_rmw_fn(CPURISCVState
*env
, uint32_t priv
,
513 int (*rmw_fn
)(void *arg
,
516 target_ulong new_val
,
517 target_ulong write_mask
),
520 RISCVException
smstateen_acc_ok(CPURISCVState
*env
, int index
, uint64_t bit
);
522 void riscv_cpu_set_mode(CPURISCVState
*env
, target_ulong newpriv
);
524 void riscv_translate_init(void);
525 G_NORETURN
void riscv_raise_exception(CPURISCVState
*env
,
526 uint32_t exception
, uintptr_t pc
);
528 target_ulong
riscv_cpu_get_fflags(CPURISCVState
*env
);
529 void riscv_cpu_set_fflags(CPURISCVState
*env
, target_ulong
);
531 #include "exec/cpu-all.h"
533 FIELD(TB_FLAGS
, MEM_IDX
, 0, 3)
534 FIELD(TB_FLAGS
, FS
, 3, 2)
536 FIELD(TB_FLAGS
, VS
, 5, 2)
537 FIELD(TB_FLAGS
, LMUL
, 7, 3)
538 FIELD(TB_FLAGS
, SEW
, 10, 3)
539 FIELD(TB_FLAGS
, VL_EQ_VLMAX
, 13, 1)
540 FIELD(TB_FLAGS
, VILL
, 14, 1)
541 FIELD(TB_FLAGS
, VSTART_EQ_ZERO
, 15, 1)
542 /* The combination of MXL/SXL/UXL that applies to the current cpu mode. */
543 FIELD(TB_FLAGS
, XL
, 16, 2)
544 /* If PointerMasking should be applied */
545 FIELD(TB_FLAGS
, PM_MASK_ENABLED
, 18, 1)
546 FIELD(TB_FLAGS
, PM_BASE_ENABLED
, 19, 1)
547 FIELD(TB_FLAGS
, VTA
, 20, 1)
548 FIELD(TB_FLAGS
, VMA
, 21, 1)
549 /* Native debug itrigger */
550 FIELD(TB_FLAGS
, ITRIGGER
, 22, 1)
551 /* Virtual mode enabled */
552 FIELD(TB_FLAGS
, VIRT_ENABLED
, 23, 1)
553 FIELD(TB_FLAGS
, PRIV
, 24, 2)
554 FIELD(TB_FLAGS
, AXL
, 26, 2)
556 #ifdef TARGET_RISCV32
557 #define riscv_cpu_mxl(env) ((void)(env), MXL_RV32)
559 static inline RISCVMXL
riscv_cpu_mxl(CPURISCVState
*env
)
561 return env
->misa_mxl
;
564 #define riscv_cpu_mxl_bits(env) (1UL << (4 + riscv_cpu_mxl(env)))
566 static inline const RISCVCPUConfig
*riscv_cpu_cfg(CPURISCVState
*env
)
568 return &env_archcpu(env
)->cfg
;
571 #if !defined(CONFIG_USER_ONLY)
572 static inline int cpu_address_mode(CPURISCVState
*env
)
574 int mode
= env
->priv
;
576 if (mode
== PRV_M
&& get_field(env
->mstatus
, MSTATUS_MPRV
)) {
577 mode
= get_field(env
->mstatus
, MSTATUS_MPP
);
582 static inline RISCVMXL
cpu_get_xl(CPURISCVState
*env
, target_ulong mode
)
584 RISCVMXL xl
= env
->misa_mxl
;
586 * When emulating a 32-bit-only cpu, use RV32.
587 * When emulating a 64-bit cpu, and MXL has been reduced to RV32,
588 * MSTATUSH doesn't have UXL/SXL, therefore XLEN cannot be widened
589 * back to RV64 for lower privs.
591 if (xl
!= MXL_RV32
) {
596 xl
= get_field(env
->mstatus
, MSTATUS64_UXL
);
599 xl
= get_field(env
->mstatus
, MSTATUS64_SXL
);
607 #if defined(TARGET_RISCV32)
608 #define cpu_recompute_xl(env) ((void)(env), MXL_RV32)
610 static inline RISCVMXL
cpu_recompute_xl(CPURISCVState
*env
)
612 #if !defined(CONFIG_USER_ONLY)
613 return cpu_get_xl(env
, env
->priv
);
615 return env
->misa_mxl
;
620 #if defined(TARGET_RISCV32)
621 #define cpu_address_xl(env) ((void)(env), MXL_RV32)
623 static inline RISCVMXL
cpu_address_xl(CPURISCVState
*env
)
625 #ifdef CONFIG_USER_ONLY
628 int mode
= cpu_address_mode(env
);
630 return cpu_get_xl(env
, mode
);
635 static inline int riscv_cpu_xlen(CPURISCVState
*env
)
637 return 16 << env
->xl
;
640 #ifdef TARGET_RISCV32
641 #define riscv_cpu_sxl(env) ((void)(env), MXL_RV32)
643 static inline RISCVMXL
riscv_cpu_sxl(CPURISCVState
*env
)
645 #ifdef CONFIG_USER_ONLY
646 return env
->misa_mxl
;
648 return get_field(env
->mstatus
, MSTATUS64_SXL
);
654 * Encode LMUL to lmul as follows:
665 * then, we can calculate VLMAX = vlen >> (vsew + 3 - lmul)
666 * e.g. vlen = 256 bits, SEW = 16, LMUL = 1/8
667 * => VLMAX = vlen >> (1 + 3 - (-3))
671 static inline uint32_t vext_get_vlmax(RISCVCPU
*cpu
, target_ulong vtype
)
673 uint8_t sew
= FIELD_EX64(vtype
, VTYPE
, VSEW
);
674 int8_t lmul
= sextract32(FIELD_EX64(vtype
, VTYPE
, VLMUL
), 0, 3);
675 return cpu
->cfg
.vlen
>> (sew
+ 3 - lmul
);
678 void cpu_get_tb_cpu_state(CPURISCVState
*env
, vaddr
*pc
,
679 uint64_t *cs_base
, uint32_t *pflags
);
681 void riscv_cpu_update_mask(CPURISCVState
*env
);
683 RISCVException
riscv_csrrw(CPURISCVState
*env
, int csrno
,
684 target_ulong
*ret_value
,
685 target_ulong new_value
, target_ulong write_mask
);
686 RISCVException
riscv_csrrw_debug(CPURISCVState
*env
, int csrno
,
687 target_ulong
*ret_value
,
688 target_ulong new_value
,
689 target_ulong write_mask
);
691 static inline void riscv_csr_write(CPURISCVState
*env
, int csrno
,
694 riscv_csrrw(env
, csrno
, NULL
, val
, MAKE_64BIT_MASK(0, TARGET_LONG_BITS
));
697 static inline target_ulong
riscv_csr_read(CPURISCVState
*env
, int csrno
)
699 target_ulong val
= 0;
700 riscv_csrrw(env
, csrno
, &val
, 0, 0);
704 typedef RISCVException (*riscv_csr_predicate_fn
)(CPURISCVState
*env
,
706 typedef RISCVException (*riscv_csr_read_fn
)(CPURISCVState
*env
, int csrno
,
707 target_ulong
*ret_value
);
708 typedef RISCVException (*riscv_csr_write_fn
)(CPURISCVState
*env
, int csrno
,
709 target_ulong new_value
);
710 typedef RISCVException (*riscv_csr_op_fn
)(CPURISCVState
*env
, int csrno
,
711 target_ulong
*ret_value
,
712 target_ulong new_value
,
713 target_ulong write_mask
);
715 RISCVException
riscv_csrrw_i128(CPURISCVState
*env
, int csrno
,
717 Int128 new_value
, Int128 write_mask
);
719 typedef RISCVException (*riscv_csr_read128_fn
)(CPURISCVState
*env
, int csrno
,
721 typedef RISCVException (*riscv_csr_write128_fn
)(CPURISCVState
*env
, int csrno
,
726 riscv_csr_predicate_fn predicate
;
727 riscv_csr_read_fn read
;
728 riscv_csr_write_fn write
;
730 riscv_csr_read128_fn read128
;
731 riscv_csr_write128_fn write128
;
732 /* The default priv spec version should be PRIV_VERSION_1_10_0 (i.e 0) */
733 uint32_t min_priv_ver
;
734 } riscv_csr_operations
;
736 /* CSR function table constants */
738 CSR_TABLE_SIZE
= 0x1000
742 * The event id are encoded based on the encoding specified in the
743 * SBI specification v0.3
746 enum riscv_pmu_event_idx
{
747 RISCV_PMU_EVENT_HW_CPU_CYCLES
= 0x01,
748 RISCV_PMU_EVENT_HW_INSTRUCTIONS
= 0x02,
749 RISCV_PMU_EVENT_CACHE_DTLB_READ_MISS
= 0x10019,
750 RISCV_PMU_EVENT_CACHE_DTLB_WRITE_MISS
= 0x1001B,
751 RISCV_PMU_EVENT_CACHE_ITLB_PREFETCH_MISS
= 0x10021,
754 /* used by tcg/tcg-cpu.c*/
755 void isa_ext_update_enabled(RISCVCPU
*cpu
, uint32_t ext_offset
, bool en
);
756 bool isa_ext_is_enabled(RISCVCPU
*cpu
, uint32_t ext_offset
);
757 void riscv_cpu_set_misa(CPURISCVState
*env
, RISCVMXL mxl
, uint32_t ext
);
759 typedef struct RISCVCPUMultiExtConfig
{
763 } RISCVCPUMultiExtConfig
;
765 extern const RISCVCPUMultiExtConfig riscv_cpu_extensions
[];
766 extern const RISCVCPUMultiExtConfig riscv_cpu_vendor_exts
[];
767 extern const RISCVCPUMultiExtConfig riscv_cpu_experimental_exts
[];
768 extern const RISCVCPUMultiExtConfig riscv_cpu_deprecated_exts
[];
769 extern Property riscv_cpu_options
[];
771 typedef struct isa_ext_data
{
774 int ext_enable_offset
;
776 extern const RISCVIsaExtData isa_edata_arr
[];
777 char *riscv_cpu_get_name(RISCVCPU
*cpu
);
779 void riscv_cpu_finalize_features(RISCVCPU
*cpu
, Error
**errp
);
780 void riscv_add_satp_mode_properties(Object
*obj
);
781 bool riscv_cpu_accelerator_compatible(RISCVCPU
*cpu
);
783 /* CSR function table */
784 extern riscv_csr_operations csr_ops
[CSR_TABLE_SIZE
];
786 extern const bool valid_vm_1_10_32
[], valid_vm_1_10_64
[];
788 void riscv_get_csr_ops(int csrno
, riscv_csr_operations
*ops
);
789 void riscv_set_csr_ops(int csrno
, riscv_csr_operations
*ops
);
791 void riscv_cpu_register_gdb_regs_for_features(CPUState
*cs
);
793 uint8_t satp_mode_max_from_map(uint32_t map
);
794 const char *satp_mode_str(uint8_t satp_mode
, bool is_32_bit
);
796 #endif /* RISCV_CPU_H */