> On 3 Sep 2025, at 12.06, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> hvf_arch_init_vcpu(), along with hvf_put_guest_debug_registers()
> and hvf_put_gdbstub_debug_registers(), calls hv_vcpu_set_sys_reg(),
> which must run on a vCPU. Mention they also must.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/system/hvf_int.h | 3 ++-
> target/arm/hvf/hvf.c | 2 ++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h
> index 8fce627b08c..0c335facc3b 100644
> --- a/include/system/hvf_int.h
> +++ b/include/system/hvf_int.h
> @@ -71,11 +71,12 @@ void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line,
> const char *hvf_return_string(hv_return_t ret);
> int hvf_arch_init(void);
> hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range);
> -int hvf_arch_init_vcpu(CPUState *cpu);
> void hvf_arch_vcpu_destroy(CPUState *cpu);
> hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t);
> void hvf_kick_vcpu_thread(CPUState *cpu);
>
> +/* Must be called by the owning thread */
> +int hvf_arch_init_vcpu(CPUState *cpu);
> /* Must be called by the owning thread */
> int hvf_arch_vcpu_exec(CPUState *);
> /* Must be called by the owning thread */
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index 58934953c4a..d87a41bcc53 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -2244,6 +2244,7 @@ void hvf_arch_remove_all_hw_breakpoints(void)
> * consists of all hardware breakpoints and watchpoints inserted so far while
> * debugging the guest.
> */
> +/* Must be called by the owning thread */
Should this be combined with the comment block above it?
> static void hvf_put_gdbstub_debug_registers(CPUState *cpu)
> {
> hv_return_t r = HV_SUCCESS;
> @@ -2282,6 +2283,7 @@ static void hvf_put_gdbstub_debug_registers(CPUState *cpu)
> * Update the vCPU with the guest's view of debug registers. This view is kept
> * in the environment at all times.
> */
> +/* Must be called by the owning thread */
Same here.
> static void hvf_put_guest_debug_registers(CPUState *cpu)
> {
> ARMCPU *arm_cpu = ARM_CPU(cpu);
> --
> 2.51.0
>
With or without the change:
Reviewed-by: Mads Ynddal <mads@ynddal.dk>