diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-06-05 20:09:44 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-06-17 09:47:39 +0200 |
commit | 109238a8d97cd8e85ca614109724a0b1222b21f5 (patch) | |
tree | 919bcb79c26b2e35d5944955388d22d1d15c49f0 | |
parent | 0c4da54883336e43af13ad3b3c33dac646cfa9fb (diff) | |
download | qemu-109238a8d97cd8e85ca614109724a0b1222b21f5.zip qemu-109238a8d97cd8e85ca614109724a0b1222b21f5.tar.gz qemu-109238a8d97cd8e85ca614109724a0b1222b21f5.tar.bz2 |
target/i386: SEV: do not assume machine->cgs is SEV
There can be other confidential computing classes that are not derived
from sev-common. Avoid aborting when encountering them.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | target/i386/sev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/target/i386/sev.c b/target/i386/sev.c index c40562d..30b83f1 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1712,7 +1712,9 @@ void sev_es_set_reset_vector(CPUState *cpu) { X86CPU *x86; CPUX86State *env; - SevCommonState *sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs); + ConfidentialGuestSupport *cgs = MACHINE(qdev_get_machine())->cgs; + SevCommonState *sev_common = SEV_COMMON( + object_dynamic_cast(OBJECT(cgs), TYPE_SEV_COMMON)); /* Only update if we have valid reset information */ if (!sev_common || !sev_common->reset_data_valid) { |