Re: [RFC PATCH v3 5/6] kvm/ppc/mpic: in-kernel MPIC emulation

Gleb Natapov
2013-04-03T15:55:27Z

On Tue, Apr 02, 2013 at 08:57:52PM -0500, Scott Wood wrote:
> Hook the MPIC code up to the KVM interfaces, add locking, etc.
>
> TODO: irqfd support, split up into multiple patches, KVM_IRQ_LINE
> support
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
[skip]

> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index 20ce2d2..d8f44ef 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -927,6 +927,15 @@ struct kvm_device_attr {
> __u64 addr; /* userspace address of attr data */
> };
>
> +#define KVM_DEV_TYPE_FSL_MPIC_20 1
> +#define KVM_DEV_TYPE_FSL_MPIC_42 2
> +
> +#define KVM_DEV_MPIC_GRP_MISC 1
> +#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */
> +
> +#define KVM_DEV_MPIC_GRP_REGISTER 2 /* 32-bit */
> +#define KVM_DEV_MPIC_GRP_IRQ_ACTIVE 3 /* 32-bit */
Why not put them in arch specific header?

> +
> /* ioctl for vm fd */
> #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index ed033c0..e325f5d 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2164,6 +2164,15 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
> bool test = cd->flags & KVM_CREATE_DEVICE_TEST;
>
> switch (cd->type) {
> +#ifdef CONFIG_KVM_MPIC
> + case KVM_DEV_TYPE_FSL_MPIC_20:
> + case KVM_DEV_TYPE_FSL_MPIC_42: {
> + if (test)
> + return 0;
> +
> + return kvm_create_mpic(kvm, cd->type);
> + }
> +#endif
> default:
> return -ENODEV;
> }
> --
> 1.7.9.5
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Gleb.