|
@@ -58,6 +58,12 @@ void riscv_kvm_aplic_request(void *opaque, int irq, int level)
|
|
|
|
|
|
static bool cap_has_mp_state;
|
|
|
|
|
|
+#define KVM_RISCV_REG_ID_U32(type, idx) (KVM_REG_RISCV | KVM_REG_SIZE_U32 | \
|
|
|
+ type | idx)
|
|
|
+
|
|
|
+#define KVM_RISCV_REG_ID_U64(type, idx) (KVM_REG_RISCV | KVM_REG_SIZE_U64 | \
|
|
|
+ type | idx)
|
|
|
+
|
|
|
static uint64_t kvm_riscv_reg_id_ulong(CPURISCVState *env, uint64_t type,
|
|
|
uint64_t idx)
|
|
|
{
|
|
@@ -76,16 +82,6 @@ static uint64_t kvm_riscv_reg_id_ulong(CPURISCVState *env, uint64_t type,
|
|
|
return id;
|
|
|
}
|
|
|
|
|
|
-static uint64_t kvm_riscv_reg_id_u32(uint64_t type, uint64_t idx)
|
|
|
-{
|
|
|
- return KVM_REG_RISCV | KVM_REG_SIZE_U32 | type | idx;
|
|
|
-}
|
|
|
-
|
|
|
-static uint64_t kvm_riscv_reg_id_u64(uint64_t type, uint64_t idx)
|
|
|
-{
|
|
|
- return KVM_REG_RISCV | KVM_REG_SIZE_U64 | type | idx;
|
|
|
-}
|
|
|
-
|
|
|
static uint64_t kvm_encode_reg_size_id(uint64_t id, size_t size_b)
|
|
|
{
|
|
|
uint64_t size_ctz = __builtin_ctz(size_b);
|
|
@@ -119,12 +115,12 @@ static uint64_t kvm_riscv_vector_reg_id(RISCVCPU *cpu,
|
|
|
kvm_riscv_reg_id_ulong(env, KVM_REG_RISCV_CONFIG, \
|
|
|
KVM_REG_RISCV_CONFIG_REG(name))
|
|
|
|
|
|
-#define RISCV_TIMER_REG(name) kvm_riscv_reg_id_u64(KVM_REG_RISCV_TIMER, \
|
|
|
+#define RISCV_TIMER_REG(name) KVM_RISCV_REG_ID_U64(KVM_REG_RISCV_TIMER, \
|
|
|
KVM_REG_RISCV_TIMER_REG(name))
|
|
|
|
|
|
-#define RISCV_FP_F_REG(idx) kvm_riscv_reg_id_u32(KVM_REG_RISCV_FP_F, idx)
|
|
|
+#define RISCV_FP_F_REG(idx) KVM_RISCV_REG_ID_U32(KVM_REG_RISCV_FP_F, idx)
|
|
|
|
|
|
-#define RISCV_FP_D_REG(idx) kvm_riscv_reg_id_u64(KVM_REG_RISCV_FP_D, idx)
|
|
|
+#define RISCV_FP_D_REG(idx) KVM_RISCV_REG_ID_U64(KVM_REG_RISCV_FP_D, idx)
|
|
|
|
|
|
#define RISCV_VECTOR_CSR_REG(env, name) \
|
|
|
kvm_riscv_reg_id_ulong(env, KVM_REG_RISCV_VECTOR, \
|