hw/arm/virt: Consolidate GIC finalize logic
commita3495d11c4970c6cac05da516439a4f74ff6db01
authorAlexander Graf <agraf@csgraf.de>
Fri, 23 Dec 2022 09:01:06 +0000 (23 10:01 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 3 Feb 2023 12:59:22 +0000 (3 12:59 +0000)
tree47f6bd11d3d12b3e4937d1004ccbcef22c9b9efa
parenta2260983c65539010310b7105da284026cfceba4
hw/arm/virt: Consolidate GIC finalize logic

Up to now, the finalize_gic_version() code open coded what is essentially
a support bitmap match between host/emulation environment and desired
target GIC type.

This open coding leads to undesirable side effects. For example, a VM with
KVM and -smp 10 will automatically choose GICv3 while the same command
line with TCG will stay on GICv2 and fail the launch.

This patch combines the TCG and KVM matching code paths by making
everything a 2 pass process. First, we determine which GIC versions the
current environment is able to support, then we go through a single
state machine to determine which target GIC mode that means for us.

After this patch, the only user noticable changes should be consolidated
error messages as well as TCG -M virt supporting -smp > 8 automatically.

Signed-off-by: Alexander Graf <agraf@csgraf.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Message-id: 20221223090107.98888-2-agraf@csgraf.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/virt.c
include/hw/arm/virt.h