[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC v3 3/9] target/loongarch: Supplement vcpu env initial when vc
From: |
Tianrui Zhao |
Subject: |
[PATCH RFC v3 3/9] target/loongarch: Supplement vcpu env initial when vcpu reset |
Date: |
Sat, 6 May 2023 10:24:16 +0800 |
Supplement vcpu env initial when vcpu reset, including
init vcpu CSR_CPUID,CSR_TID to cpu->cpu_index. The two
regs will be used in kvm_get/set_csr_ioctl.
Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
---
target/loongarch/cpu.c | 2 ++
target/loongarch/cpu.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index 97e6579f6a..d15b4b2844 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -486,10 +486,12 @@ static void loongarch_cpu_reset_hold(Object *obj)
env->CSR_ESTAT = env->CSR_ESTAT & (~MAKE_64BIT_MASK(0, 2));
env->CSR_RVACFG = FIELD_DP64(env->CSR_RVACFG, CSR_RVACFG, RBITS, 0);
+ env->CSR_CPUID = cs->cpu_index;
env->CSR_TCFG = FIELD_DP64(env->CSR_TCFG, CSR_TCFG, EN, 0);
env->CSR_LLBCTL = FIELD_DP64(env->CSR_LLBCTL, CSR_LLBCTL, KLO, 0);
env->CSR_TLBRERA = FIELD_DP64(env->CSR_TLBRERA, CSR_TLBRERA, ISTLBR, 0);
env->CSR_MERRCTL = FIELD_DP64(env->CSR_MERRCTL, CSR_MERRCTL, ISMERR, 0);
+ env->CSR_TID = cs->cpu_index;
env->CSR_PRCFG3 = FIELD_DP64(env->CSR_PRCFG3, CSR_PRCFG3, TLB_TYPE, 2);
env->CSR_PRCFG3 = FIELD_DP64(env->CSR_PRCFG3, CSR_PRCFG3, MTLB_ENTRY, 63);
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index e11c875188..1d9a4009b9 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -288,6 +288,7 @@ typedef struct CPUArchState {
uint64_t CSR_PWCH;
uint64_t CSR_STLBPS;
uint64_t CSR_RVACFG;
+ uint64_t CSR_CPUID;
uint64_t CSR_PRCFG1;
uint64_t CSR_PRCFG2;
uint64_t CSR_PRCFG3;
--
2.31.1
- [PATCH RFC v3 0/9] Add loongarch kvm accel support, Tianrui Zhao, 2023/05/05
- [PATCH RFC v3 2/9] target/loongarch: Define some kvm_arch interfaces, Tianrui Zhao, 2023/05/05
- [PATCH RFC v3 1/9] linux-headers: Add KVM headers for loongarch, Tianrui Zhao, 2023/05/05
- [PATCH RFC v3 9/9] target/loongarch: Add loongarch kvm into meson build, Tianrui Zhao, 2023/05/05
- [PATCH RFC v3 5/9] target/loongarch: Implement kvm_arch_init function, Tianrui Zhao, 2023/05/05
- [PATCH RFC v3 6/9] target/loongarch: Implement kvm_arch_init_vcpu, Tianrui Zhao, 2023/05/05
- [PATCH RFC v3 4/9] target/loongarch: Implement kvm get/set registers, Tianrui Zhao, 2023/05/05
- [PATCH RFC v3 3/9] target/loongarch: Supplement vcpu env initial when vcpu reset,
Tianrui Zhao <=
- [PATCH RFC v3 8/9] target/loongarch: Implement set vcpu intr for kvm, Tianrui Zhao, 2023/05/05
- [PATCH RFC v3 7/9] target/loongarch: Implement kvm_arch_handle_exit, Tianrui Zhao, 2023/05/05