qemu/qemu/dcaadc26fda20e920e05828f488fe5b10f00a3de
target/loongarch: Check CPU msgint feature with cpu_has_msgint()
There are two ways to check the CPU msgint feature. One is to call
cpu_has_msgint(); the other is to check CPULoongArchState::msgint, which
has type OnOffAuto. A problem arises if msgint is set to ON_OFF_AUTO_AUTO
in KVM mode: QEMU checks the host feature and sets its actual value in
cpucfg1, which is read by cpu_has_msgint(). However, the msgint field
remains ON_OFF_AUTO_AUTO.
Therefore, in KVM mode cpu_has_msgint() is more accurate than checking
the OnOffAuto-typed msgint field.
A problem occurs when booting a VM with the max CPU type on an LA464 host
that does not support msgint. cpu_has_msgint() returns false, but the
msgint field remains ON_OFF_AUTO_AUTO, so the expression
cpu->msgint != ON_OFF_AUTO_OFF evaluates to true.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Xianglai Li <lixianglai@loongson.cn>
2 files changed