Re: [patch 04/12] [PATCH] kvm-s390-ucontrol: export SIE control block to user

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

 



On 09.12.2011, at 13:49, Carsten Otte wrote:

> This patch exports the s390 SIE hardware control block to userspace
> via the mapping of the vcpu file descriptor. In order to do so,
> a new arch callback named kvm_arch_vcpu_fault  is introduced for all
> architectures. It allows to map architecture specific pages.
> 
> Signed-off-by: Carsten Otte <cotte@xxxxxxxxxx>
> ---
> ---
> Documentation/virtual/kvm/api.txt |    5 +++++
> arch/ia64/kvm/kvm-ia64.c          |    5 +++++
> arch/powerpc/kvm/powerpc.c        |    5 +++++
> arch/s390/kvm/kvm-s390.c          |   13 +++++++++++++
> arch/x86/kvm/x86.c                |    5 +++++
> include/linux/kvm.h               |    1 +
> include/linux/kvm_host.h          |    1 +
> virt/kvm/kvm_main.c               |    2 +-
> 8 files changed, 36 insertions(+), 1 deletion(-)
> 
> --- a/Documentation/virtual/kvm/api.txt
> +++ b/Documentation/virtual/kvm/api.txt
> @@ -218,6 +218,11 @@ allocation of vcpu ids.  For example, if
> single-threaded guest vcpus, it should make all vcpu ids be a multiple
> of the number of vcpus per vcore.
> 
> +For virtual cpus that have been created with S390 user controlled virtual
> +machines, the resulting vcpu fd can be memory mapped at page offset
> +KVM_S390_SIE_PAGE_OFFSET in order to obtain a memory map of the virtual
> +cpu's hardware control block.
> +
> 4.8 KVM_GET_DIRTY_LOG (vm ioctl)
> 
> Capability: basic
> --- a/arch/ia64/kvm/kvm-ia64.c
> +++ b/arch/ia64/kvm/kvm-ia64.c
> @@ -1566,6 +1566,11 @@ out:
> 	return r;
> }
> 
> +int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
> +{
> +	return VM_FAULT_SIGBUS;
> +}
> +
> int kvm_arch_prepare_memory_region(struct kvm *kvm,
> 		struct kvm_memory_slot *memslot,
> 		struct kvm_memory_slot old,
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -659,6 +659,11 @@ out:
> 	return r;
> }
> 
> +int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
> +{
> +	return VM_FAULT_SIGBUS;
> +}
> +
> static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
> {
> 	u32 inst_lis = 0x3c000000;
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -769,6 +769,19 @@ long kvm_arch_vcpu_ioctl(struct file *fi
> 	return r;
> }
> 
> +int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
> +{
> +#ifdef CONFIG_KVM_UCONTROL

Do we ever want to allow non-s390 to circumvent the GPL? This should also have s390 in its name.

> +	if ((vmf->pgoff == KVM_S390_SIE_PAGE_OFFSET)
> +		 && (kvm_is_ucontrol(vcpu->kvm))) {
> +		vmf->page = virt_to_page(vcpu->arch.sie_block);
> +		get_page(vmf->page);
> +		return 0;
> +	}
> +#endif
> +	return VM_FAULT_SIGBUS;
> +}
> +
> /* Section: memory related */
> int kvm_arch_prepare_memory_region(struct kvm *kvm,
> 				   struct kvm_memory_slot *memslot,
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2790,6 +2790,11 @@ out:
> 	return r;
> }
> 
> +int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
> +{
> +	return VM_FAULT_SIGBUS;
> +}
> +
> static int kvm_vm_ioctl_set_tss_addr(struct kvm *kvm, unsigned long addr)
> {
> 	int ret;
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -439,6 +439,7 @@ struct kvm_ppc_pvinfo {
> 
> #define KVM_VM_REGULAR  0
> #define KVM_VM_UCONTROL	1

Same as this. It's an s390 specific hack, so it should be identified as such.


Alex

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