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]

 



On 12/20/2011 11:38 AM, Christian Borntraeger wrote:
> Avi, Marcelo,
>
> let me know if you would prefer to reuse another register load/save ioctls
> that is still unused for s390 (e.g. XCRS).

No, the proposed names are fine.

>
> From: Christian Borntraeger <borntraeger@xxxxxxxxxx>
>
> For guest relocation and virsh dump qemu needs an interface to
> get/set additional registers from kvm. We also need the prefix
> register for all guest memory accesses to the prefix pages.
>
> The prefix register could also be set via the KVM_S390_SIGP_SET_PREFIX
> interrupt ioctl, but I also added the synchronous operation to have
>
> o symmetry: we want to have the same struct for get/set routine
> o the interrupt is only delivered before entering the SIE, we also
>   want to cover the sequence set prefix/store status at prefix
>
> Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>
> ---
>  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.


> @@ -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.

> +		break;
> +	}
> +	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.

> +	        vcpu->arch.sie_block->ihcpu     = 0xffff;

What's this?



-- 
error compiling committee.c: too many arguments to function

--
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