Re: [PATCH]: kvm-s390: add KVM_S390_GET/SET_SREGS2 call for additional hw regs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>  arch/s390/include/asm/kvm.h |    9 +++++++++
>>  arch/s390/kvm/kvm-s390.c    |   24 ++++++++++++++++++++++++
>>  include/linux/kvm.h         |    4 ++++
>>  3 files changed, 37 insertions(+)
> 
> The lack of documentation is not.

Ok, will do.
> 
> 
>> @@ -673,6 +674,29 @@ long kvm_arch_vcpu_ioctl(struct file *fi
>>  	case KVM_S390_INITIAL_RESET:
>>  		r = kvm_arch_vcpu_ioctl_initial_reset(vcpu);
>>  		break;
>> +	case KVM_S390_GET_SREGS2: {
>> +		struct kvm_s390_sregs2 sregs2;
>> +
>> +		sregs2.prefix = vcpu->arch.sie_block->prefix;
>> +		sregs2.gbea = vcpu->arch.sie_block->gbea;
>> +		sregs2.cputm = vcpu->arch.sie_block->cputm;
>> +		sregs2.ckc = vcpu->arch.sie_block->ckc;
>> +		sregs2.todpr = vcpu->arch.sie_block->todpr;
>> +		r = copy_to_user(argp, &sregs2, sizeof(sregs2));
> 
> Need to return -EFAULT, not the number of remaining bytes to copy.

Will fix.

>> +	case KVM_S390_SET_SREGS2: {
>> +		struct kvm_s390_sregs2 sregs2;
>> +
>> +		vcpu->arch.sie_block->prefix = sregs2.prefix;
>> +		vcpu->arch.sie_block->gbea = sregs2.gbea;
>> +		vcpu->arch.sie_block->cputm = sregs2.cputm;
>> +		vcpu->arch.sie_block->ckc = sregs2.ckc;
>> +		vcpu->arch.sie_block->todpr = sregs2.todpr;
> 
> Copying uninitialized data.
> 
>> +		r = copy_from_user(&sregs2, argp, sizeof(sregs2));
> 
> Then initializing it.

Hmm, a brown paper bag bug. Since life migration does not yet work
I only tested the get case (via dump). Sorry about that.

> 
>> +	        vcpu->arch.sie_block->ihcpu     = 0xffff;
> 
> What's this?

tlb flush. Necessary after setting the prefix register.

Thanks

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux