[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/11] arm/hvf: Initialise GICv3 state just before first vCPU run
From: |
phil |
Subject: |
[PATCH 02/11] arm/hvf: Initialise GICv3 state just before first vCPU run |
Date: |
Mon, 9 Dec 2024 21:36:20 +0100 |
From: Phil Dennis-Jordan <phil@philjordan.eu>
Initialising the vCPU PFR0_EL1 system register with the GIC flag in
hvf_arch_init_vcpu() does not actually work because the GIC state is
not yet available at that time.
If we set this flag just before running each vCPU for the first time,
the GIC will definitely be fully initialised at that point.
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
target/arm/hvf/hvf.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 0b334c268e..bc431f25cc 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -993,7 +993,6 @@ int hvf_arch_init_vcpu(CPUState *cpu)
CPUARMState *env = &arm_cpu->env;
uint32_t sregs_match_len = ARRAY_SIZE(hvf_sreg_match);
uint32_t sregs_cnt = 0;
- uint64_t pfr;
hv_return_t ret;
int i;
@@ -1042,12 +1041,6 @@ int hvf_arch_init_vcpu(CPUState *cpu)
arm_cpu->mp_affinity);
assert_hvf_ok(ret);
- ret = hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_ID_AA64PFR0_EL1,
&pfr);
- assert_hvf_ok(ret);
- pfr |= env->gicv3state ? (1 << 24) : 0;
- ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_ID_AA64PFR0_EL1, pfr);
- assert_hvf_ok(ret);
-
/* We're limited to underlying hardware caps, override internal versions */
ret = hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_ID_AA64MMFR0_EL1,
&arm_cpu->isar.id_aa64mmfr0);
@@ -1063,6 +1056,16 @@ int hvf_arch_init_vcpu(CPUState *cpu)
void hvf_vcpu_before_first_run(CPUState *cpu)
{
+ uint64_t pfr;
+ hv_return_t ret;
+ ARMCPU *arm_cpu = ARM_CPU(cpu);
+ CPUARMState *env = &arm_cpu->env;
+
+ ret = hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_ID_AA64PFR0_EL1,
&pfr);
+ assert_hvf_ok(ret);
+ pfr |= env->gicv3state ? (1 << 24) : 0;
+ ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_ID_AA64PFR0_EL1, pfr);
+ assert_hvf_ok(ret);
}
void hvf_kick_vcpu_thread(CPUState *cpu)
--
2.39.3 (Apple Git-146)
- [PATCH 00/11] hvf and APIC fixes, improvements, and optimisations, phil, 2024/12/09
- [PATCH 02/11] arm/hvf: Initialise GICv3 state just before first vCPU run,
phil <=
- [PATCH 01/11] hvf: Add facility for initialisation code prior to first vCPU run, phil, 2024/12/09
- [PATCH 04/11] i386/hvf: Pre-fetch emulated instructions, phil, 2024/12/09
- [PATCH 05/11] i386/hvf: Decode APIC access x86 instruction outside BQL, phil, 2024/12/09
- [PATCH 08/11] i386/hvf: Variable type fixup in decoder, phil, 2024/12/09
- [PATCH 07/11] i386/hvf: Enables APIC_ACCESS VM exits by setting APICBASE, phil, 2024/12/09
- [PATCH 09/11] i386/hvf: Print hex pairs for each opcode byte in decode error, phil, 2024/12/09