lkml.org 
[lkml]   [2018]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RESEND v4 2/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS
From
Date


On 2018/6/11 21:36, James Morse wrote:
> Hi Dongjiu Geng,
>
> On 09/06/18 13:40, Marc Zyngier wrote:
>> On Fri, 08 Jun 2018 20:48:40 +0100, Dongjiu Geng wrote:
>>> For the migrating VMs, user space may need to know the exception
>>> state. For example, in the machine A, KVM make an SError pending,
>>> when migrate to B, KVM also needs to pend an SError.
>>>
>>> This new IOCTL exports user-invisible states related to SError.
>>> Together with appropriate user space changes, user space can get/set
>>> the SError exception state to do migrate/snapshot/suspend.
>
>>> diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
>>> index 04b3256..df4faee 100644
>>> --- a/arch/arm64/include/uapi/asm/kvm.h
>>> +++ b/arch/arm64/include/uapi/asm/kvm.h
>>> @@ -153,6 +154,18 @@ struct kvm_sync_regs {
>>> struct kvm_arch_memory_slot {
>>> };
>>>
>>> +/* for KVM_GET/SET_VCPU_EVENTS */
>>> +struct kvm_vcpu_events {
>>> + struct {
>>> + __u8 serror_pending;
>>> + __u8 serror_has_esr;
>>> + /* Align it to 8 bytes */
>>> + __u8 pad[6];
>>> + __u64 serror_esr;
>>> + } exception;
>>> + __u32 reserved[12];
>>> +};
>
>>> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
>>> index 56a0260..4426915 100644
>>> --- a/arch/arm64/kvm/guest.c
>>> +++ b/arch/arm64/kvm/guest.c
>
>>> +int kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu,
>>> + struct kvm_vcpu_events *events)
>>> +{
>>> + bool serror_pending = events->exception.serror_pending;
>>> + bool has_esr = events->exception.serror_has_esr;
>>> +
>>> + if (serror_pending && has_esr) {
>>> + if (!cpus_have_const_cap(ARM64_HAS_RAS_EXTN))
>>> + return -EINVAL;
>>> +
>>> + kvm_set_sei_esr(vcpu, events->exception.serror_esr);
>>> + } else if (serror_pending) {
>>> + kvm_inject_vabt(vcpu);
>>> + }
>>> +
>>> + return 0;
>>
>> There was an earlier request to check that all the padding is set to
>> zero. I still think this makes sense.
>
> I agree, not just the exception.padding[], but reserved[] too.
Ok, thanks for the reminder again.

>
>
> Thanks,
>
> James
>
> .
>

\
 
 \ /
  Last update: 2018-06-12 16:56    [W:0.050 / U:2.336 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site