@@ -30,7 +30,7 @@ struct kvm_vcpu_sbi_extension {
void kvm_riscv_vcpu_sbi_forward(struct kvm_vcpu *vcpu, struct kvm_run *run);
void kvm_riscv_vcpu_sbi_system_reset(struct kvm_vcpu *vcpu,
struct kvm_run *run,
- u32 type, u64 flags);
+ u32 type, bool have_reason, u64 reason);
const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext(unsigned long extid);
#endif /* __RISCV_KVM_VCPU_SBI_H__ */
@@ -83,7 +83,7 @@ void kvm_riscv_vcpu_sbi_forward(struct kvm_vcpu *vcpu, struct kvm_run *run)
void kvm_riscv_vcpu_sbi_system_reset(struct kvm_vcpu *vcpu,
struct kvm_run *run,
- u32 type, u64 flags)
+ u32 type, bool have_reason, u64 reason)
{
unsigned long i;
struct kvm_vcpu *tmp;
@@ -94,7 +94,8 @@ void kvm_riscv_vcpu_sbi_system_reset(struct kvm_vcpu *vcpu,
memset(&run->system_event, 0, sizeof(run->system_event));
run->system_event.type = type;
- run->system_event.flags = flags;
+ run->system_event.ndata = have_reason;
+ run->system_event.data[0] = reason;
run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
}
@@ -148,14 +148,14 @@ static int kvm_sbi_ext_srst_handler(struct kvm_vcpu *vcpu,
case SBI_SRST_RESET_TYPE_SHUTDOWN:
kvm_riscv_vcpu_sbi_system_reset(vcpu, run,
KVM_SYSTEM_EVENT_SHUTDOWN,
- reason);
+ true, reason);
*exit = true;
break;
case SBI_SRST_RESET_TYPE_COLD_REBOOT:
case SBI_SRST_RESET_TYPE_WARM_REBOOT:
kvm_riscv_vcpu_sbi_system_reset(vcpu, run,
KVM_SYSTEM_EVENT_RESET,
- reason);
+ true, reason);
*exit = true;
break;
default:
@@ -66,7 +66,7 @@ static int kvm_sbi_ext_v01_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
break;
case SBI_EXT_0_1_SHUTDOWN:
kvm_riscv_vcpu_sbi_system_reset(vcpu, run,
- KVM_SYSTEM_EVENT_SHUTDOWN, 0);
+ KVM_SYSTEM_EVENT_SHUTDOWN, false, 0);
*exit = true;
break;
case SBI_EXT_0_1_REMOTE_FENCE_I:
The flags datum for KVM_EXIT_SYSTEM_EVENT exits has been removed because it was defined incorrectly; no padding was introduced between the 32-bit type and the 64-bit flags, resulting in different definitions for 32-bit and 64-bit userspace. The replacement is a pair of fields, ndata and data[], with ndata saying how many items are valid in the data array. In the case of RISC-V that's one for the SRST SBI call (with flags simply moved to data[0]) and zero for the legacy v0.1 call. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +- arch/riscv/kvm/vcpu_sbi.c | 5 +++-- arch/riscv/kvm/vcpu_sbi_replace.c | 4 ++-- arch/riscv/kvm/vcpu_sbi_v01.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-)