KVM already exposes the SBI STA extension and its shmem address through the one-reg interface, but QEMU does not consume it. As a result, the guest-configured shmem address is not kept in sync between KVM and QEMU, and is lost on migration, breaking STA for the guest after live migration.
This series probes for SBI STA support via get-reg-list, synchronizes the shmem address (shmem_lo/shmem_hi) between KVM and QEMU (skipping the put at reset, since the address is configured by the guest), and saves the address in vmstate so STA keeps working after live migration. Only the STA shmem address is saved for now; other SBI state can be appended to kvm_sbi_state later. Changes in v2: - patch03, only save the sbi sta state if kvm sbi sta supported. - rebase on riscv-to-apply.next. - Link to v1: https://lore.kernel.org/qemu-devel/[email protected]/ Wang Yechao (3): target/riscv/kvm: Detect SBI STA extension support target/riscv/kvm: Sync SBI STA shmem registers with KVM target/riscv: Add SBI STA state to vmstate target/riscv/cpu.h | 6 ++ target/riscv/kvm/kvm-cpu.c | 122 +++++++++++++++++++++++++++++++++++ target/riscv/kvm/kvm_riscv.h | 1 + target/riscv/machine.c | 18 ++++++ 4 files changed, 147 insertions(+) -- 2.27.0
