On 22/06/2015 18:05, Denis V. Lunev wrote:
> +void qemu_system_guest_panicked(void)
> +{
> + qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);
> + vm_stop(RUN_STATE_GUEST_PANICKED);
> +}
> +
Please call this in pvpanic.c and target-s390x/kvm.c (replacing the
guest_panicked function in that file there) as well.
> @@ -2540,6 +2573,53 @@ static bool host_supports_vmx(void)
> return ecx & CPUID_EXT_VMX;
> }
>
> +int kvm_arch_handle_hv_crash(CPUState *cs)
> +{
> + X86CPU *cpu = X86_CPU(cs);
> + CPUX86State *env = &cpu->env;
> + struct {
> + struct kvm_msrs info;
> + struct kvm_msr_entry entries[HV_X64_MSR_CRASH_PARAMS + 1];
> + } msr_data;
> + struct kvm_msr_entry *msrs = msr_data.entries;
> + int ret, n, i;
> +
> + if (!has_msr_hv_crash) {
> + return -EINVAL;
> + }
> +
> + for (n = 0; n < HV_X64_MSR_CRASH_PARAMS; n++) {
> + msrs[n].index = HV_X64_MSR_CRASH_P0 + n;
> + }
> +
> + msrs[n++].index = HV_X64_MSR_CRASH_CTL;
> + msr_data.info = (struct kvm_msrs) {
> + .nmsrs = n,
> + };
> +
> + ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MSRS, &msr_data);
> + if (ret < 0) {
> + return ret;
> + }
> +
> + for (i = 0; i < ret; i++) {
> + uint32_t index = msrs[i].index;
> +
> + switch (index) {
> + case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4:
> + env->msr_hv_crash_prm[index - HV_X64_MSR_CRASH_P0] =
> msrs[i].data;
> + break;
> + case HV_X64_MSR_CRASH_CTL:
> + env->msr_hv_crash_ctl = msrs[i].data;
> + break;
> + default:
> + break;
> + }
> + }
> +
> + return 0;
> +}
> +
Is this necessary? The call to cpu_synchronize_all_states in
qemu_savevm_state_complete should be enough. If necessary, you can call
it from qemu_system_guest_panicked instead of special casing the crash
MSRs here.
Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in