diff options
author | Haibo Xu <haibo1.xu@intel.com> | 2023-07-25 16:41:38 +0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2023-08-09 12:15:25 +0530 |
commit | 031f9efafc08d68b1b672e83ee73f6ea5c69c2ef (patch) | |
tree | 682d4f167d6a663d0d54dd8d153f79c26fb02a64 /arch/riscv/kvm/vcpu.c | |
parent | cbc0daa67c62bcfeb45cccfc821216549566fb40 (diff) | |
download | lwn-031f9efafc08d68b1b672e83ee73f6ea5c69c2ef.tar.gz lwn-031f9efafc08d68b1b672e83ee73f6ea5c69c2ef.zip |
KVM: riscv: Add KVM_GET_REG_LIST API support
KVM_GET_REG_LIST API will return all registers that are available to
KVM_GET/SET_ONE_REG APIs. It's very useful to identify some platform
regression issue during VM migration.
Since this API was already supported on arm64, it is straightforward
to enable it on riscv with similar code structure.
Signed-off-by: Haibo Xu <haibo1.xu@intel.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'arch/riscv/kvm/vcpu.c')
-rw-r--r-- | arch/riscv/kvm/vcpu.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index 452d6548e951..82229db1ce73 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -254,6 +254,24 @@ long kvm_arch_vcpu_ioctl(struct file *filp, r = kvm_riscv_vcpu_get_reg(vcpu, ®); break; } + case KVM_GET_REG_LIST: { + struct kvm_reg_list __user *user_list = argp; + struct kvm_reg_list reg_list; + unsigned int n; + + r = -EFAULT; + if (copy_from_user(®_list, user_list, sizeof(reg_list))) + break; + n = reg_list.n; + reg_list.n = kvm_riscv_vcpu_num_regs(vcpu); + if (copy_to_user(user_list, ®_list, sizeof(reg_list))) + break; + r = -E2BIG; + if (n < reg_list.n) + break; + r = kvm_riscv_vcpu_copy_reg_indices(vcpu, user_list->reg); + break; + } default: break; } |