Re: RFC/patch portability: split kvm_vm_ioctl

Avi Kivity
2007-10-13T07:47:05Z

Carsten Otte wrote:
> This patch splits kvm_vm_ioctl into archtecture independent parts, and
> x86 specific parts which go to kvm_arch_vcpu_ioctl in x86.c.
>
> Common ioctls for all architectures are:
> KVM_CREATE_VCPU, KVM_GET_DIRTY_LOG
>
> I'd really like to see more commonalities, but all others did not fit
> our needs. I would love to keep KVM_GET_DIRTY_LOG common, so that the
> ingenious migration code does not need to care too much about different
> architectures.
>
> x86 specific ioctls are:
> KVM_SET_MEMORY_REGION, KVM_SET_USER_MEMORY_REGION,
> KVM_GET/SET_NR_MMU_PAGES, KVM_SET_MEMORY_ALIAS, KVM_CREATE_IRQCHIP,
> KVM_CREATE_IRQ_LINE, KVM_GET/SET_IRQCHIP
>

We need to distinguish between x86 specific (only x86 has this) and s390
special (everyone has it except s390). In the latter case it should
still be in common code to avoid duplication, with a guard to disable
compilation on s390.

KVM_SET_MEMORY_REGION is in theory applicable to non-s390 but I'd like
to deprecate it, so there's no point in implementing it on non-x86. The
rest are s390 special rather than x86 specific.

As related previously, KVM_SET_USER_MEMORY_REGION should work for s390
(with an extra check for the guest phsyical start address).

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.