[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 07/19] target/riscv: read marchid/mimpid in kvm_riscv_init_mac
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH v3 07/19] target/riscv: read marchid/mimpid in kvm_riscv_init_machine_ids() |
Date: |
Thu, 22 Jun 2023 10:56:48 -0300 |
Allow 'marchid' and 'mimpid' to also be initialized in
kvm_riscv_init_machine_ids().
After this change, the handling of mvendorid/marchid/mimpid for the
'host' CPU type will be equal to what we already have for TCG named
CPUs, i.e. the user is not able to set these values to a different val
than the one that is already preset.
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/kvm.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c
index 37f0f70794..cd2974c663 100644
--- a/target/riscv/kvm.c
+++ b/target/riscv/kvm.c
@@ -378,6 +378,22 @@ static void kvm_riscv_init_machine_ids(RISCVCPU *cpu,
KVMScratchCPU *kvmcpu)
if (ret != 0) {
error_report("Unable to retrieve mvendorid from host, error %d", ret);
}
+
+ reg.id = kvm_riscv_reg_id(env, KVM_REG_RISCV_CONFIG,
+ KVM_REG_RISCV_CONFIG_REG(marchid));
+ reg.addr = (uint64_t)&cpu->cfg.marchid;
+ ret = ioctl(kvmcpu->cpufd, KVM_GET_ONE_REG, ®);
+ if (ret != 0) {
+ error_report("Unable to retrieve marchid from host, error %d", ret);
+ }
+
+ reg.id = kvm_riscv_reg_id(env, KVM_REG_RISCV_CONFIG,
+ KVM_REG_RISCV_CONFIG_REG(mimpid));
+ reg.addr = (uint64_t)&cpu->cfg.mimpid;
+ ret = ioctl(kvmcpu->cpufd, KVM_GET_ONE_REG, ®);
+ if (ret != 0) {
+ error_report("Unable to retrieve mimpid from host, error %d", ret);
+ }
}
void kvm_riscv_init_user_properties(Object *cpu_obj)
--
2.41.0
- [PATCH v3 00/19] target/riscv, KVM: fixes and enhancements, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 01/19] target/riscv: skip features setup for KVM CPUs, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 02/19] hw/riscv/virt.c: skip 'mmu-type' FDT if satp mode not set, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 03/19] target/riscv/cpu.c: restrict 'mvendorid' value, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 08/19] target/riscv: handle mvendorid/marchid/mimpid for KVM CPUs, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 09/19] linux-headers: Update to v6.4-rc1, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 11/19] target/riscv/cpu: add misa_ext_info_arr[], Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 05/19] target/riscv/cpu.c: restrict 'marchid' value, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 07/19] target/riscv: read marchid/mimpid in kvm_riscv_init_machine_ids(),
Daniel Henrique Barboza <=
- [PATCH v3 06/19] target/riscv: use KVM scratch CPUs to init KVM properties, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 13/19] target/riscv/kvm.c: update KVM MISA bits, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 04/19] target/riscv/cpu.c: restrict 'mimpid' value, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 12/19] target/riscv: add KVM specific MISA properties, Daniel Henrique Barboza, 2023/06/22
- [PATCH v3 10/19] target/riscv/kvm.c: init 'misa_ext_mask' with scratch CPU, Daniel Henrique Barboza, 2023/06/22