Skip to content

Fix two savevm/loadvm bugs: a pending serial byte, AArch32 Secure cpregs - #5

Open
lacraig2 wants to merge 1 commit into
mainfrom
workspace/savevm-restore-fixes
Open

lacraig2 wants to merge 1 commit into
mainfrom
workspace/savevm-restore-fixes

Conversation

@lacraig2

Copy link
Copy Markdown
Contributor

Two savevm/loadvm bugs, as patches 0013-0014. Both are upstream candidates.

  • hw/char/serial: retry a byte left pending at savevm when the chardev can't be watched at load time
    (for example a socket server with no client yet). Before this fix the transmitter stayed busy forever, and the
    guest console was dead after the restore. A one-shot BH now retries: serial_xmit() either sends the byte,
    installs a watch, or drops the byte at the retry limit.
  • target/arm: save and restore the Secure bank of AArch32 cp registers on TCG CPUs with EL3.
    kvm_to_cpreg_id() forces the NS bit, so the Secure-bank registers (DACR_S, TTBR1_S, ...) were never saved,
    and on load the Non-secure values overwrote them. cpreg_list_id_to_cpreg_id() is the exact inverse of
    cpreg_to_kvm_id(). For AArch64 (KVM) ids it is identical to kvm_to_cpreg_id().
    Note: snapshots taken before this fix stored Non-secure values in the Secure slots. Loading them now writes
    those values into the Secure bank. Such snapshots were already broken for guests running in Secure state.

verify-series: 14/14 apply with strict context to pristine qemu-11.1.0. patchedTree is recorded, and the
import/export round trip is clean.

Ordering: PR #4 and the panda-next stack also use slot 0013 and also change base.json. Whichever lands later
renumbers (export-series does this) and re-records patchedTree.

Two patches (0013-0014), both upstream candidates:

- hw/char/serial: retry a byte left pending at savevm when the chardev
  can't be watched at load time (a socket server with no client yet).
  Before, the transmitter stayed busy forever and the guest console was
  dead after the restore.
- target/arm: savevm/loadvm dropped the Secure bank of AArch32 cp
  registers on TCG CPUs with EL3 (kvm_to_cpreg_id() forces the NS bit),
  so a guest running in Secure state faulted right after a restore.

verify-series: 14/14 apply with strict context to pristine qemu-11.1.0;
patchedTree recorded; the import/export round trip is clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant