diff mbox

[05/17] kvm: add kvm stub for arch specific stuff

Message ID 1302881578-5357-6-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf April 15, 2011, 3:32 p.m. UTC
We have a generic stub architecture for kvm calls, but some architectures
are different from others. So we do want to be able to have stubs for
architecture specific functionality as well.

This patch adds kvm stubs for all architectures.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 Makefile.target                   |    2 +-
 target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
 target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
 target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
 target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
 target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
 target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
 target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
 target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
 target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
 target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
 target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
 target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
 target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
 14 files changed, 351 insertions(+), 1 deletions(-)
 create mode 100644 target-alpha/kvm-arch-stub.c
 create mode 100644 target-arm/kvm-arch-stub.c
 create mode 100644 target-cris/kvm-arch-stub.c
 create mode 100644 target-i386/kvm-arch-stub.c
 create mode 100644 target-lm32/kvm-arch-stub.c
 create mode 100644 target-m68k/kvm-arch-stub.c
 create mode 100644 target-microblaze/kvm-arch-stub.c
 create mode 100644 target-mips/kvm-arch-stub.c
 create mode 100644 target-ppc/kvm-arch-stub.c
 create mode 100644 target-s390x/kvm-arch-stub.c
 create mode 100644 target-sh4/kvm-arch-stub.c
 create mode 100644 target-sparc/kvm-arch-stub.c
 create mode 100644 target-unicore32/kvm-arch-stub.c

Comments

Aurelien Jarno April 18, 2011, 6:34 p.m. UTC | #1
On Fri, Apr 15, 2011 at 05:32:46PM +0200, Alexander Graf wrote:
> We have a generic stub architecture for kvm calls, but some architectures
> are different from others. So we do want to be able to have stubs for
> architecture specific functionality as well.
> 
> This patch adds kvm stubs for all architectures.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  Makefile.target                   |    2 +-
>  target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>  target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>  target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>  target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>  target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>  target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>  target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
>  target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>  target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>  target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
>  target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>  target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>  target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
>  14 files changed, 351 insertions(+), 1 deletions(-)
>  create mode 100644 target-alpha/kvm-arch-stub.c
>  create mode 100644 target-arm/kvm-arch-stub.c
>  create mode 100644 target-cris/kvm-arch-stub.c
>  create mode 100644 target-i386/kvm-arch-stub.c
>  create mode 100644 target-lm32/kvm-arch-stub.c
>  create mode 100644 target-m68k/kvm-arch-stub.c
>  create mode 100644 target-microblaze/kvm-arch-stub.c
>  create mode 100644 target-mips/kvm-arch-stub.c
>  create mode 100644 target-ppc/kvm-arch-stub.c
>  create mode 100644 target-s390x/kvm-arch-stub.c
>  create mode 100644 target-sh4/kvm-arch-stub.c
>  create mode 100644 target-sparc/kvm-arch-stub.c
>  create mode 100644 target-unicore32/kvm-arch-stub.c

Do we really want to create so much files on architectures we will never
see KVM support? Actually I know very few things about KVM, so it would
be better to have this patch reviewed by someone else. Avi or Anthony
maybe?

> diff --git a/Makefile.target b/Makefile.target
> index d5761b7..69ea140 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -197,7 +197,7 @@ obj-$(CONFIG_VHOST_NET) += vhost.o
>  obj-$(CONFIG_REALLY_VIRTFS) += virtio-9p.o
>  obj-y += rwhandler.o
>  obj-$(CONFIG_KVM) += kvm.o kvm-all.o
> -obj-$(CONFIG_NO_KVM) += kvm-stub.o
> +obj-$(CONFIG_NO_KVM) += kvm-stub.o kvm-arch-stub.o
>  LIBS+=-lz
>  
>  QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
> diff --git a/target-alpha/kvm-arch-stub.c b/target-alpha/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-alpha/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-arm/kvm-arch-stub.c b/target-arm/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-arm/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-cris/kvm-arch-stub.c b/target-cris/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-cris/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-i386/kvm-arch-stub.c b/target-i386/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-i386/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-lm32/kvm-arch-stub.c b/target-lm32/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-lm32/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-m68k/kvm-arch-stub.c b/target-m68k/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-m68k/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-microblaze/kvm-arch-stub.c b/target-microblaze/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-microblaze/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-mips/kvm-arch-stub.c b/target-mips/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-mips/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-ppc/kvm-arch-stub.c b/target-ppc/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-ppc/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-s390x/kvm-arch-stub.c b/target-s390x/kvm-arch-stub.c
> new file mode 100644
> index 0000000..16d2340
> --- /dev/null
> +++ b/target-s390x/kvm-arch-stub.c
> @@ -0,0 +1,38 @@
> +/*
> + * QEMU non-KVM stub implementation (s390x)
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> +void kvm_s390_virtio_irq(CPUState *env, int config_change, uint64_t token)
> +{
> +}
> +
> +void kvm_s390_interrupt(CPUState *env, int type, uint32_t code)
> +{
> +}
> +
> +void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,
> +                                 uint64_t parm64, int vm)
> +{
> +}
> diff --git a/target-sh4/kvm-arch-stub.c b/target-sh4/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-sh4/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-sparc/kvm-arch-stub.c b/target-sparc/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-sparc/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> diff --git a/target-unicore32/kvm-arch-stub.c b/target-unicore32/kvm-arch-stub.c
> new file mode 100644
> index 0000000..b338995
> --- /dev/null
> +++ b/target-unicore32/kvm-arch-stub.c
> @@ -0,0 +1,26 @@
> +/*
> + * QEMU non-KVM stub implementation
> + *
> + * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "sysemu.h"
> +#include "hw/hw.h"
> +#include "exec-all.h"
> +#include "gdbstub.h"
> +#include "kvm.h"
> +
> -- 
> 1.6.0.2
> 
> 
>
Alexander Graf May 3, 2011, 2:17 p.m. UTC | #2
On 18.04.2011, at 20:34, Aurelien Jarno wrote:

> On Fri, Apr 15, 2011 at 05:32:46PM +0200, Alexander Graf wrote:
>> We have a generic stub architecture for kvm calls, but some architectures
>> are different from others. So we do want to be able to have stubs for
>> architecture specific functionality as well.
>> 
>> This patch adds kvm stubs for all architectures.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> Makefile.target                   |    2 +-
>> target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>> target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>> target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>> target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>> target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>> target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>> target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
>> target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>> target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>> target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
>> target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>> target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>> target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
>> 14 files changed, 351 insertions(+), 1 deletions(-)
>> create mode 100644 target-alpha/kvm-arch-stub.c
>> create mode 100644 target-arm/kvm-arch-stub.c
>> create mode 100644 target-cris/kvm-arch-stub.c
>> create mode 100644 target-i386/kvm-arch-stub.c
>> create mode 100644 target-lm32/kvm-arch-stub.c
>> create mode 100644 target-m68k/kvm-arch-stub.c
>> create mode 100644 target-microblaze/kvm-arch-stub.c
>> create mode 100644 target-mips/kvm-arch-stub.c
>> create mode 100644 target-ppc/kvm-arch-stub.c
>> create mode 100644 target-s390x/kvm-arch-stub.c
>> create mode 100644 target-sh4/kvm-arch-stub.c
>> create mode 100644 target-sparc/kvm-arch-stub.c
>> create mode 100644 target-unicore32/kvm-arch-stub.c
> 
> Do we really want to create so much files on architectures we will never
> see KVM support? Actually I know very few things about KVM, so it would
> be better to have this patch reviewed by someone else. Avi or Anthony
> maybe?

Well, the main idea is to be able to have a unified place to put stub functions into. And as it stands with most generalizations, we either make it generic or not :).
Maybe there's some Makefile magic to only compile the stub if the file exists? I certainly don't know of any.


Alex
Jan Kiszka May 3, 2011, 2:57 p.m. UTC | #3
On 2011-05-03 16:17, Alexander Graf wrote:
> 
> On 18.04.2011, at 20:34, Aurelien Jarno wrote:
> 
>> On Fri, Apr 15, 2011 at 05:32:46PM +0200, Alexander Graf wrote:
>>> We have a generic stub architecture for kvm calls, but some architectures
>>> are different from others. So we do want to be able to have stubs for
>>> architecture specific functionality as well.
>>>
>>> This patch adds kvm stubs for all architectures.
>>>
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>> ---
>>> Makefile.target                   |    2 +-
>>> target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>> target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>> target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>> target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>> target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>> target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>> target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
>>> target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>> target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>> target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
>>> target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>> target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>> target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
>>> 14 files changed, 351 insertions(+), 1 deletions(-)
>>> create mode 100644 target-alpha/kvm-arch-stub.c
>>> create mode 100644 target-arm/kvm-arch-stub.c
>>> create mode 100644 target-cris/kvm-arch-stub.c
>>> create mode 100644 target-i386/kvm-arch-stub.c
>>> create mode 100644 target-lm32/kvm-arch-stub.c
>>> create mode 100644 target-m68k/kvm-arch-stub.c
>>> create mode 100644 target-microblaze/kvm-arch-stub.c
>>> create mode 100644 target-mips/kvm-arch-stub.c
>>> create mode 100644 target-ppc/kvm-arch-stub.c
>>> create mode 100644 target-s390x/kvm-arch-stub.c
>>> create mode 100644 target-sh4/kvm-arch-stub.c
>>> create mode 100644 target-sparc/kvm-arch-stub.c
>>> create mode 100644 target-unicore32/kvm-arch-stub.c
>>
>> Do we really want to create so much files on architectures we will never
>> see KVM support? Actually I know very few things about KVM, so it would
>> be better to have this patch reviewed by someone else. Avi or Anthony
>> maybe?
> 
> Well, the main idea is to be able to have a unified place to put stub functions into. And as it stands with most generalizations, we either make it generic or not :).
> Maybe there's some Makefile magic to only compile the stub if the file exists? I certainly don't know of any.

This approach looks wrong.

The point of kvm stubs is to allow generic components to be built
independently of kvm enabled/disabled. But target-specific callbacks
can't be part of generic components anyway. So there is no need for a
stub, those bits will be built per-target anyway.

The examples you provided with this patch underline it:
s390-virtio-bus.c should be built for s390 but nothing else.

Jan
Peter Maydell May 3, 2011, 3:05 p.m. UTC | #4
On 3 May 2011 15:17, Alexander Graf <agraf@suse.de> wrote:
> Maybe there's some Makefile magic to only compile the stub if the file
> exists? I certainly don't know of any.

obj-$(CONFIG_NO_KVM) += kvm-stub.o
ifneq ($(wildcard $(TARGET_PATH)/kvm-arch-stub.c),)
obj-$(CONFIG_NO_KVM) += kvm-arch-stub.o
endif

? (not very heavily tested)

-- PMM
Alexander Graf May 4, 2011, 5:19 a.m. UTC | #5
On 03.05.2011, at 16:57, Jan Kiszka wrote:

> On 2011-05-03 16:17, Alexander Graf wrote:
>> 
>> On 18.04.2011, at 20:34, Aurelien Jarno wrote:
>> 
>>> On Fri, Apr 15, 2011 at 05:32:46PM +0200, Alexander Graf wrote:
>>>> We have a generic stub architecture for kvm calls, but some architectures
>>>> are different from others. So we do want to be able to have stubs for
>>>> architecture specific functionality as well.
>>>> 
>>>> This patch adds kvm stubs for all architectures.
>>>> 
>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>> ---
>>>> Makefile.target                   |    2 +-
>>>> target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>> target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>> target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>> target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>> target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>> target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>> target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
>>>> target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>> target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>> target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
>>>> target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>> target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>> target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
>>>> 14 files changed, 351 insertions(+), 1 deletions(-)
>>>> create mode 100644 target-alpha/kvm-arch-stub.c
>>>> create mode 100644 target-arm/kvm-arch-stub.c
>>>> create mode 100644 target-cris/kvm-arch-stub.c
>>>> create mode 100644 target-i386/kvm-arch-stub.c
>>>> create mode 100644 target-lm32/kvm-arch-stub.c
>>>> create mode 100644 target-m68k/kvm-arch-stub.c
>>>> create mode 100644 target-microblaze/kvm-arch-stub.c
>>>> create mode 100644 target-mips/kvm-arch-stub.c
>>>> create mode 100644 target-ppc/kvm-arch-stub.c
>>>> create mode 100644 target-s390x/kvm-arch-stub.c
>>>> create mode 100644 target-sh4/kvm-arch-stub.c
>>>> create mode 100644 target-sparc/kvm-arch-stub.c
>>>> create mode 100644 target-unicore32/kvm-arch-stub.c
>>> 
>>> Do we really want to create so much files on architectures we will never
>>> see KVM support? Actually I know very few things about KVM, so it would
>>> be better to have this patch reviewed by someone else. Avi or Anthony
>>> maybe?
>> 
>> Well, the main idea is to be able to have a unified place to put stub functions into. And as it stands with most generalizations, we either make it generic or not :).
>> Maybe there's some Makefile magic to only compile the stub if the file exists? I certainly don't know of any.
> 
> This approach looks wrong.
> 
> The point of kvm stubs is to allow generic components to be built
> independently of kvm enabled/disabled. But target-specific callbacks
> can't be part of generic components anyway. So there is no need for a
> stub, those bits will be built per-target anyway.
> 
> The examples you provided with this patch underline it:
> s390-virtio-bus.c should be built for s390 but nothing else.

And it is, yes. The point is to not require #ifdefs in device emulation code :).


Alex
Jan Kiszka May 4, 2011, 8:31 a.m. UTC | #6
On 2011-05-04 07:19, Alexander Graf wrote:
> 
> On 03.05.2011, at 16:57, Jan Kiszka wrote:
> 
>> On 2011-05-03 16:17, Alexander Graf wrote:
>>>
>>> On 18.04.2011, at 20:34, Aurelien Jarno wrote:
>>>
>>>> On Fri, Apr 15, 2011 at 05:32:46PM +0200, Alexander Graf wrote:
>>>>> We have a generic stub architecture for kvm calls, but some architectures
>>>>> are different from others. So we do want to be able to have stubs for
>>>>> architecture specific functionality as well.
>>>>>
>>>>> This patch adds kvm stubs for all architectures.
>>>>>
>>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>> ---
>>>>> Makefile.target                   |    2 +-
>>>>> target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>>> target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>> target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>> target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>> target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>> target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>> target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
>>>>> target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>> target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>> target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
>>>>> target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>> target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>>> target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
>>>>> 14 files changed, 351 insertions(+), 1 deletions(-)
>>>>> create mode 100644 target-alpha/kvm-arch-stub.c
>>>>> create mode 100644 target-arm/kvm-arch-stub.c
>>>>> create mode 100644 target-cris/kvm-arch-stub.c
>>>>> create mode 100644 target-i386/kvm-arch-stub.c
>>>>> create mode 100644 target-lm32/kvm-arch-stub.c
>>>>> create mode 100644 target-m68k/kvm-arch-stub.c
>>>>> create mode 100644 target-microblaze/kvm-arch-stub.c
>>>>> create mode 100644 target-mips/kvm-arch-stub.c
>>>>> create mode 100644 target-ppc/kvm-arch-stub.c
>>>>> create mode 100644 target-s390x/kvm-arch-stub.c
>>>>> create mode 100644 target-sh4/kvm-arch-stub.c
>>>>> create mode 100644 target-sparc/kvm-arch-stub.c
>>>>> create mode 100644 target-unicore32/kvm-arch-stub.c
>>>>
>>>> Do we really want to create so much files on architectures we will never
>>>> see KVM support? Actually I know very few things about KVM, so it would
>>>> be better to have this patch reviewed by someone else. Avi or Anthony
>>>> maybe?
>>>
>>> Well, the main idea is to be able to have a unified place to put stub functions into. And as it stands with most generalizations, we either make it generic or not :).
>>> Maybe there's some Makefile magic to only compile the stub if the file exists? I certainly don't know of any.
>>
>> This approach looks wrong.
>>
>> The point of kvm stubs is to allow generic components to be built
>> independently of kvm enabled/disabled. But target-specific callbacks
>> can't be part of generic components anyway. So there is no need for a
>> stub, those bits will be built per-target anyway.
>>
>> The examples you provided with this patch underline it:
>> s390-virtio-bus.c should be built for s390 but nothing else.
> 
> And it is, yes. The point is to not require #ifdefs in device emulation code :).

But that's not the purpose of the stubs. They shall avoid building
components target specific when just the kvm on/off dependency would
force them to. Moreover, I do not see any need for such in
infrastructure beyond s390 when considering that case valid.

Why not simply define those few functions as static inline in the
already s390-specific header depending on #ifdef CONFIG_KVM?

Jan
Alexander Graf May 4, 2011, 8:40 a.m. UTC | #7
On 04.05.2011, at 10:31, Jan Kiszka wrote:

> On 2011-05-04 07:19, Alexander Graf wrote:
>> 
>> On 03.05.2011, at 16:57, Jan Kiszka wrote:
>> 
>>> On 2011-05-03 16:17, Alexander Graf wrote:
>>>> 
>>>> On 18.04.2011, at 20:34, Aurelien Jarno wrote:
>>>> 
>>>>> On Fri, Apr 15, 2011 at 05:32:46PM +0200, Alexander Graf wrote:
>>>>>> We have a generic stub architecture for kvm calls, but some architectures
>>>>>> are different from others. So we do want to be able to have stubs for
>>>>>> architecture specific functionality as well.
>>>>>> 
>>>>>> This patch adds kvm stubs for all architectures.
>>>>>> 
>>>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>>> ---
>>>>>> Makefile.target                   |    2 +-
>>>>>> target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>>>> target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>> target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>> target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>> target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>> target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>> target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
>>>>>> target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>> target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>> target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
>>>>>> target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>> target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>>>> target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
>>>>>> 14 files changed, 351 insertions(+), 1 deletions(-)
>>>>>> create mode 100644 target-alpha/kvm-arch-stub.c
>>>>>> create mode 100644 target-arm/kvm-arch-stub.c
>>>>>> create mode 100644 target-cris/kvm-arch-stub.c
>>>>>> create mode 100644 target-i386/kvm-arch-stub.c
>>>>>> create mode 100644 target-lm32/kvm-arch-stub.c
>>>>>> create mode 100644 target-m68k/kvm-arch-stub.c
>>>>>> create mode 100644 target-microblaze/kvm-arch-stub.c
>>>>>> create mode 100644 target-mips/kvm-arch-stub.c
>>>>>> create mode 100644 target-ppc/kvm-arch-stub.c
>>>>>> create mode 100644 target-s390x/kvm-arch-stub.c
>>>>>> create mode 100644 target-sh4/kvm-arch-stub.c
>>>>>> create mode 100644 target-sparc/kvm-arch-stub.c
>>>>>> create mode 100644 target-unicore32/kvm-arch-stub.c
>>>>> 
>>>>> Do we really want to create so much files on architectures we will never
>>>>> see KVM support? Actually I know very few things about KVM, so it would
>>>>> be better to have this patch reviewed by someone else. Avi or Anthony
>>>>> maybe?
>>>> 
>>>> Well, the main idea is to be able to have a unified place to put stub functions into. And as it stands with most generalizations, we either make it generic or not :).
>>>> Maybe there's some Makefile magic to only compile the stub if the file exists? I certainly don't know of any.
>>> 
>>> This approach looks wrong.
>>> 
>>> The point of kvm stubs is to allow generic components to be built
>>> independently of kvm enabled/disabled. But target-specific callbacks
>>> can't be part of generic components anyway. So there is no need for a
>>> stub, those bits will be built per-target anyway.
>>> 
>>> The examples you provided with this patch underline it:
>>> s390-virtio-bus.c should be built for s390 but nothing else.
>> 
>> And it is, yes. The point is to not require #ifdefs in device emulation code :).
> 
> But that's not the purpose of the stubs. They shall avoid building
> components target specific when just the kvm on/off dependency would
> force them to. Moreover, I do not see any need for such in
> infrastructure beyond s390 when considering that case valid.
> 
> Why not simply define those few functions as static inline in the
> already s390-specific header depending on #ifdef CONFIG_KVM?

Which already-s390-specific header depending on #ifdef CONFIG_KVM? The current definitions are in cpu.h which is included in code that doesn't include CONFIG*.


Alex
Jan Kiszka May 4, 2011, 8:43 a.m. UTC | #8
On 2011-05-04 10:40, Alexander Graf wrote:
> 
> On 04.05.2011, at 10:31, Jan Kiszka wrote:
> 
>> On 2011-05-04 07:19, Alexander Graf wrote:
>>>
>>> On 03.05.2011, at 16:57, Jan Kiszka wrote:
>>>
>>>> On 2011-05-03 16:17, Alexander Graf wrote:
>>>>>
>>>>> On 18.04.2011, at 20:34, Aurelien Jarno wrote:
>>>>>
>>>>>> On Fri, Apr 15, 2011 at 05:32:46PM +0200, Alexander Graf wrote:
>>>>>>> We have a generic stub architecture for kvm calls, but some architectures
>>>>>>> are different from others. So we do want to be able to have stubs for
>>>>>>> architecture specific functionality as well.
>>>>>>>
>>>>>>> This patch adds kvm stubs for all architectures.
>>>>>>>
>>>>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>>>> ---
>>>>>>> Makefile.target                   |    2 +-
>>>>>>> target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>>>>> target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>>> target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>> target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>> target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>> target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>> target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
>>>>>>> target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>> target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>>> target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
>>>>>>> target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>>> target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>>>>> target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
>>>>>>> 14 files changed, 351 insertions(+), 1 deletions(-)
>>>>>>> create mode 100644 target-alpha/kvm-arch-stub.c
>>>>>>> create mode 100644 target-arm/kvm-arch-stub.c
>>>>>>> create mode 100644 target-cris/kvm-arch-stub.c
>>>>>>> create mode 100644 target-i386/kvm-arch-stub.c
>>>>>>> create mode 100644 target-lm32/kvm-arch-stub.c
>>>>>>> create mode 100644 target-m68k/kvm-arch-stub.c
>>>>>>> create mode 100644 target-microblaze/kvm-arch-stub.c
>>>>>>> create mode 100644 target-mips/kvm-arch-stub.c
>>>>>>> create mode 100644 target-ppc/kvm-arch-stub.c
>>>>>>> create mode 100644 target-s390x/kvm-arch-stub.c
>>>>>>> create mode 100644 target-sh4/kvm-arch-stub.c
>>>>>>> create mode 100644 target-sparc/kvm-arch-stub.c
>>>>>>> create mode 100644 target-unicore32/kvm-arch-stub.c
>>>>>>
>>>>>> Do we really want to create so much files on architectures we will never
>>>>>> see KVM support? Actually I know very few things about KVM, so it would
>>>>>> be better to have this patch reviewed by someone else. Avi or Anthony
>>>>>> maybe?
>>>>>
>>>>> Well, the main idea is to be able to have a unified place to put stub functions into. And as it stands with most generalizations, we either make it generic or not :).
>>>>> Maybe there's some Makefile magic to only compile the stub if the file exists? I certainly don't know of any.
>>>>
>>>> This approach looks wrong.
>>>>
>>>> The point of kvm stubs is to allow generic components to be built
>>>> independently of kvm enabled/disabled. But target-specific callbacks
>>>> can't be part of generic components anyway. So there is no need for a
>>>> stub, those bits will be built per-target anyway.
>>>>
>>>> The examples you provided with this patch underline it:
>>>> s390-virtio-bus.c should be built for s390 but nothing else.
>>>
>>> And it is, yes. The point is to not require #ifdefs in device emulation code :).
>>
>> But that's not the purpose of the stubs. They shall avoid building
>> components target specific when just the kvm on/off dependency would
>> force them to. Moreover, I do not see any need for such in
>> infrastructure beyond s390 when considering that case valid.
>>
>> Why not simply define those few functions as static inline in the
>> already s390-specific header depending on #ifdef CONFIG_KVM?
> 
> Which already-s390-specific header depending on #ifdef CONFIG_KVM? The current definitions are in cpu.h which is included in code that doesn't include CONFIG*.

cpu.h is target-specific, thus must pull in all the configs (e.g. the
prototypes are already under CONFIG_USER_ONLY).

Jan
Alexander Graf May 4, 2011, 8:53 a.m. UTC | #9
On 04.05.2011, at 10:43, Jan Kiszka wrote:

> On 2011-05-04 10:40, Alexander Graf wrote:
>> 
>> On 04.05.2011, at 10:31, Jan Kiszka wrote:
>> 
>>> On 2011-05-04 07:19, Alexander Graf wrote:
>>>> 
>>>> On 03.05.2011, at 16:57, Jan Kiszka wrote:
>>>> 
>>>>> On 2011-05-03 16:17, Alexander Graf wrote:
>>>>>> 
>>>>>> On 18.04.2011, at 20:34, Aurelien Jarno wrote:
>>>>>> 
>>>>>>> On Fri, Apr 15, 2011 at 05:32:46PM +0200, Alexander Graf wrote:
>>>>>>>> We have a generic stub architecture for kvm calls, but some architectures
>>>>>>>> are different from others. So we do want to be able to have stubs for
>>>>>>>> architecture specific functionality as well.
>>>>>>>> 
>>>>>>>> This patch adds kvm stubs for all architectures.
>>>>>>>> 
>>>>>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>>>>> ---
>>>>>>>> Makefile.target                   |    2 +-
>>>>>>>> target-alpha/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>>>>>> target-arm/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>>>> target-cris/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>>> target-i386/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>>> target-lm32/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>>> target-m68k/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>>> target-microblaze/kvm-arch-stub.c |   26 +++++++++++++++++++++++++
>>>>>>>> target-mips/kvm-arch-stub.c       |   26 +++++++++++++++++++++++++
>>>>>>>> target-ppc/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>>>> target-s390x/kvm-arch-stub.c      |   38 +++++++++++++++++++++++++++++++++++++
>>>>>>>> target-sh4/kvm-arch-stub.c        |   26 +++++++++++++++++++++++++
>>>>>>>> target-sparc/kvm-arch-stub.c      |   26 +++++++++++++++++++++++++
>>>>>>>> target-unicore32/kvm-arch-stub.c  |   26 +++++++++++++++++++++++++
>>>>>>>> 14 files changed, 351 insertions(+), 1 deletions(-)
>>>>>>>> create mode 100644 target-alpha/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-arm/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-cris/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-i386/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-lm32/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-m68k/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-microblaze/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-mips/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-ppc/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-s390x/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-sh4/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-sparc/kvm-arch-stub.c
>>>>>>>> create mode 100644 target-unicore32/kvm-arch-stub.c
>>>>>>> 
>>>>>>> Do we really want to create so much files on architectures we will never
>>>>>>> see KVM support? Actually I know very few things about KVM, so it would
>>>>>>> be better to have this patch reviewed by someone else. Avi or Anthony
>>>>>>> maybe?
>>>>>> 
>>>>>> Well, the main idea is to be able to have a unified place to put stub functions into. And as it stands with most generalizations, we either make it generic or not :).
>>>>>> Maybe there's some Makefile magic to only compile the stub if the file exists? I certainly don't know of any.
>>>>> 
>>>>> This approach looks wrong.
>>>>> 
>>>>> The point of kvm stubs is to allow generic components to be built
>>>>> independently of kvm enabled/disabled. But target-specific callbacks
>>>>> can't be part of generic components anyway. So there is no need for a
>>>>> stub, those bits will be built per-target anyway.
>>>>> 
>>>>> The examples you provided with this patch underline it:
>>>>> s390-virtio-bus.c should be built for s390 but nothing else.
>>>> 
>>>> And it is, yes. The point is to not require #ifdefs in device emulation code :).
>>> 
>>> But that's not the purpose of the stubs. They shall avoid building
>>> components target specific when just the kvm on/off dependency would
>>> force them to. Moreover, I do not see any need for such in
>>> infrastructure beyond s390 when considering that case valid.
>>> 
>>> Why not simply define those few functions as static inline in the
>>> already s390-specific header depending on #ifdef CONFIG_KVM?
>> 
>> Which already-s390-specific header depending on #ifdef CONFIG_KVM? The current definitions are in cpu.h which is included in code that doesn't include CONFIG*.
> 
> cpu.h is target-specific, thus must pull in all the configs (e.g. the
> prototypes are already under CONFIG_USER_ONLY).

Hrm - I certainly did have it #ifdef'ed in cpu.h at first. There was a reason I moved it over. Let me see if maybe I can get it working with #ifdefery in cpu.h again.


Alex
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index d5761b7..69ea140 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -197,7 +197,7 @@  obj-$(CONFIG_VHOST_NET) += vhost.o
 obj-$(CONFIG_REALLY_VIRTFS) += virtio-9p.o
 obj-y += rwhandler.o
 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
-obj-$(CONFIG_NO_KVM) += kvm-stub.o
+obj-$(CONFIG_NO_KVM) += kvm-stub.o kvm-arch-stub.o
 LIBS+=-lz
 
 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
diff --git a/target-alpha/kvm-arch-stub.c b/target-alpha/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-alpha/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-arm/kvm-arch-stub.c b/target-arm/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-arm/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-cris/kvm-arch-stub.c b/target-cris/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-cris/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-i386/kvm-arch-stub.c b/target-i386/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-i386/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-lm32/kvm-arch-stub.c b/target-lm32/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-lm32/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-m68k/kvm-arch-stub.c b/target-m68k/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-m68k/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-microblaze/kvm-arch-stub.c b/target-microblaze/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-microblaze/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-mips/kvm-arch-stub.c b/target-mips/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-mips/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-ppc/kvm-arch-stub.c b/target-ppc/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-ppc/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-s390x/kvm-arch-stub.c b/target-s390x/kvm-arch-stub.c
new file mode 100644
index 0000000..16d2340
--- /dev/null
+++ b/target-s390x/kvm-arch-stub.c
@@ -0,0 +1,38 @@ 
+/*
+ * QEMU non-KVM stub implementation (s390x)
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
+void kvm_s390_virtio_irq(CPUState *env, int config_change, uint64_t token)
+{
+}
+
+void kvm_s390_interrupt(CPUState *env, int type, uint32_t code)
+{
+}
+
+void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,
+                                 uint64_t parm64, int vm)
+{
+}
diff --git a/target-sh4/kvm-arch-stub.c b/target-sh4/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-sh4/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-sparc/kvm-arch-stub.c b/target-sparc/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-sparc/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+
diff --git a/target-unicore32/kvm-arch-stub.c b/target-unicore32/kvm-arch-stub.c
new file mode 100644
index 0000000..b338995
--- /dev/null
+++ b/target-unicore32/kvm-arch-stub.c
@@ -0,0 +1,26 @@ 
+/*
+ * QEMU non-KVM stub implementation
+ *
+ * Copyright (c) 2011 Alexander Graf <agraf@suse.de>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "sysemu.h"
+#include "hw/hw.h"
+#include "exec-all.h"
+#include "gdbstub.h"
+#include "kvm.h"
+