[RFC PATCH v1 17/17] hw/core/machine-qmp-cmds: shut down a CoVE guest on reset
Baolong Duan <[email protected]> Fri, 31 Jul 2026 11:50:11 +0800
| Newsgroups | org.nongnu.qemu-riscv,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
A TEE VM cannot be reset: the TSM destroys it and the host cannot recreate it with the same measurement, so treat system_reset as a shutdown request. Changing the meaning of a QMP command like this is not acceptable as is. QEMU already has a generic mechanism for guests that cannot be rebuilt, qemu_system_reset_request() checks cpus_are_resettable() together with confidential_guest_can_rebuild_state(), and using it would require CoVE to provide a ConfidentialGuestSupport object. This patch is included to document the limitation and to ask whether that is the direction to take. Signed-off-by: Baolong Duan <[email protected]> --- hw/core/machine-qmp-cmds.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index e62cb4ec88..74a9274ab3 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -12,6 +12,7 @@ #include "hw/core/boards.h" #include "hw/intc/intc.h" #include "hw/mem/memory-device.h" +#include "hw/riscv/cove.h" #include "qapi/error.h" #include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-accelerator.h" @@ -302,6 +303,15 @@ UuidInfo *qmp_query_uuid(Error **errp) void qmp_system_reset(Error **errp) { + /* + * Resetting a CoVE guest destroys the TVM, which cannot be recreated + * from the host, so shut the guest down instead. + */ + if (riscv_cove_vm_active()) { + qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET); + return; + } + qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET); } -- 2.34.1