target/arm: Initialize debug capabilities only once
commitad5c6ddea327758daa9f0e6edd916be39dce7dca
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Thu, 20 Apr 2023 09:21:15 +0000 (20 10:21 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 20 Apr 2023 09:21:15 +0000 (20 10:21 +0100)
tree10a86c1266076cbc73620777d1da279dbc1d4262
parent7a98c8377b7466fbcbc488425d6b6bff85437013
target/arm: Initialize debug capabilities only once

kvm_arm_init_debug() used to be called several times on a SMP system as
kvm_arch_init_vcpu() calls it. Move the call to kvm_arch_init() to make
sure it will be called only once; otherwise it will overwrite pointers
to memory allocated with the previous call and leak it.

Fixes: e4482ab7e3 ("target-arm: kvm - add support for HW assisted debug")
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-id: 20230405153644.25300-1-akihiko.odaki@daynix.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/kvm.c
target/arm/kvm64.c
target/arm/kvm_arm.h