ANDROID: gunyah: Add new VM status to handle reset failure

Add new VM status GUNYAH_RM_VM_STATUS_RESET_FAILED to indicate that VM
reset is failed.

Bug: 430214928
Change-Id: If9664bf64a6a14c577fb2b29e1ad0775c0e9d140
Signed-off-by: Cong Zhang <quic_congzhan@quicinc.com>
This commit is contained in:
Cong Zhang
2025-06-27 16:45:42 +08:00
committed by Treehugger Robot
parent e740e8d9ea
commit 2bd1f36314
4 changed files with 21 additions and 2 deletions

View File

@@ -8,6 +8,7 @@
#include <linux/gunyah.h>
#include <linux/notifier.h>
#include <linux/types.h>
#include <linux/android_kabi.h>
#define GUNYAH_VMID_INVAL U16_MAX
#define GUNYAH_MEM_HANDLE_INVAL U32_MAX
@@ -48,8 +49,10 @@ enum gunyah_rm_vm_status {
GUNYAH_RM_VM_STATUS_EXITED = 9,
GUNYAH_RM_VM_STATUS_RESETTING = 10,
GUNYAH_RM_VM_STATUS_RESET = 11,
GUNYAH_RM_VM_STATUS_RESET_FAILED = 12,
/* clang-format on */
};
ANDROID_KABI_ENUMERATOR_IGNORE(gunyah_rm_vm_status, GUNYAH_RM_VM_STATUS_RESET_FAILED);
struct gunyah_rm_vm_status_payload {
__le16 vmid;

View File

@@ -583,11 +583,19 @@ static int gunyah_vm_rm_notification_status(struct gunyah_vm *ghvm, void *data)
return NOTIFY_OK;
/* All other state transitions are synchronous to a corresponding RM call */
if (payload->vm_status == GUNYAH_RM_VM_STATUS_RESET) {
switch (payload->vm_status) {
case GUNYAH_RM_VM_STATUS_RESET_FAILED:
dev_warn(ghvm->parent, "VM: %u RESET failed with status %u\n",
ghvm->vmid, payload->vm_status);
fallthrough;
case GUNYAH_RM_VM_STATUS_RESET:
down_write(&ghvm->status_lock);
ghvm->vm_status = payload->vm_status;
up_write(&ghvm->status_lock);
wake_up(&ghvm->vm_status_wait);
break;
default:
break;
}
return NOTIFY_DONE;
@@ -1147,7 +1155,8 @@ static void _gunyah_vm_put(struct kref *kref)
/* clang-format off */
if (!ret)
wait_event(ghvm->vm_status_wait,
ghvm->vm_status == GUNYAH_RM_VM_STATUS_RESET);
(ghvm->vm_status == GUNYAH_RM_VM_STATUS_RESET) ||
(ghvm->vm_status == GUNYAH_RM_VM_STATUS_RESET_FAILED));
else
dev_err(ghvm->parent, "Failed to reset the vm: %d\n", ret);

View File

@@ -357070,6 +357070,10 @@ enumeration {
name: "GUNYAH_RM_VM_STATUS_RESET"
value: 11
}
enumerator {
name: "GUNYAH_RM_VM_STATUS_RESET_FAILED"
value: 12
}
}
}
enumeration {

View File

@@ -10,3 +10,6 @@ type 'struct sched_dl_entity' changed
type 'struct f2fs_sb_info' changed
member 'union { unsigned int reserved_pin_section; unsigned char __kabi_ignored0; }' was added
type 'enum gunyah_rm_vm_status' changed
enumerator 'GUNYAH_RM_VM_STATUS_RESET_FAILED' (12) was added