From: "Andreas Färber" <afaerber@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Christoffer Dall <cdall@cs.columbia.edu>,
kvm@vger.kernel.org, Gleb Natapov <gleb@redhat.com>,
patches@linaro.org, Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, Blue Swirl <blauwirbel@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v6 3/9] ARM: KVM: Add support for KVM on ARM architecture
Date: Sat, 23 Feb 2013 16:14:23 +0100 [thread overview]
Message-ID: <5128DCCF.9060105@suse.de> (raw)
In-Reply-To: <1361559865-22168-4-git-send-email-peter.maydell@linaro.org>
Am 22.02.2013 20:04, schrieb Peter Maydell:
> From: Christoffer Dall <cdall@cs.columbia.edu>
>
> Add basic support for KVM on ARM architecture.
>
> Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
> [PMM: Minor tweaks and code cleanup, switch to ONE_REG]
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/arm_pic.c | 26 ++++
> target-arm/Makefile.objs | 1 +
> target-arm/cpu.h | 1 +
> target-arm/helper.c | 2 +-
> target-arm/kvm.c | 336 ++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 365 insertions(+), 1 deletion(-)
> create mode 100644 target-arm/kvm.c
>
> diff --git a/hw/arm_pic.c b/hw/arm_pic.c
> index ffb4d41..45ccb9f 100644
> --- a/hw/arm_pic.c
> +++ b/hw/arm_pic.c
> @@ -9,6 +9,7 @@
>
> #include "hw.h"
> #include "arm-misc.h"
> +#include "sysemu/kvm.h"
>
> /* Input 0 is IRQ and input 1 is FIQ. */
> static void arm_pic_cpu_handler(void *opaque, int irq, int level)
> @@ -34,7 +35,32 @@ static void arm_pic_cpu_handler(void *opaque, int irq, int level)
> }
> }
>
> +static void kvm_arm_pic_cpu_handler(void *opaque, int irq, int level)
> +{
> +#ifdef CONFIG_KVM
> + ARMCPU *armcpu = opaque;
> + CPUState *cpu = CPU(armcpu);
I notice this is the only place you use "armcpu", elsewhere "cpu" is
used for ARMCPU and "cs" for CPUState.
Andreas
> + int kvm_irq = KVM_ARM_IRQ_TYPE_CPU << KVM_ARM_IRQ_TYPE_SHIFT;
> +
> + switch (irq) {
> + case ARM_PIC_CPU_IRQ:
> + kvm_irq |= KVM_ARM_IRQ_CPU_IRQ;
> + break;
> + case ARM_PIC_CPU_FIQ:
> + kvm_irq |= KVM_ARM_IRQ_CPU_FIQ;
> + break;
> + default:
> + hw_error("kvm_arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
> + }
> + kvm_irq |= cpu->cpu_index << KVM_ARM_IRQ_VCPU_SHIFT;
> + kvm_set_irq(kvm_state, kvm_irq, level ? 1 : 0);
> +#endif
> +}
> +
> qemu_irq *arm_pic_init_cpu(ARMCPU *cpu)
> {
> + if (kvm_enabled()) {
> + return qemu_allocate_irqs(kvm_arm_pic_cpu_handler, cpu, 2);
> + }
> return qemu_allocate_irqs(arm_pic_cpu_handler, cpu, 2);
> }
> diff --git a/target-arm/Makefile.objs b/target-arm/Makefile.objs
> index b6f1a9e..d89b57c 100644
> --- a/target-arm/Makefile.objs
> +++ b/target-arm/Makefile.objs
> @@ -1,4 +1,5 @@
> obj-y += arm-semi.o
> obj-$(CONFIG_SOFTMMU) += machine.o
> +obj-$(CONFIG_KVM) += kvm.o
> obj-y += translate.o op_helper.o helper.o cpu.o
> obj-y += neon_helper.o iwmmxt_helper.o
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index 2902ba5..c02e458 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -237,6 +237,7 @@ void arm_translate_init(void);
> void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu);
> int cpu_arm_exec(CPUARMState *s);
> void do_interrupt(CPUARMState *);
> +int bank_number(CPUARMState *env, int mode);
Any chance to make this ARMCPU *cpu when exposing it globally?
> void switch_mode(CPUARMState *, int);
> uint32_t do_arm_semihosting(CPUARMState *env);
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index e63da57..0380cb1 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -1617,7 +1617,7 @@ uint32_t HELPER(get_r13_banked)(CPUARMState *env, uint32_t mode)
> #else
>
> /* Map CPU modes onto saved register banks. */
> -static inline int bank_number(CPUARMState *env, int mode)
> +int bank_number(CPUARMState *env, int mode)
> {
> switch (mode) {
> case ARM_CPU_MODE_USR:
> diff --git a/target-arm/kvm.c b/target-arm/kvm.c
> new file mode 100644
> index 0000000..13ebfd7
> --- /dev/null
> +++ b/target-arm/kvm.c
> @@ -0,0 +1,336 @@
> +/*
> + * ARM implementation of KVM hooks
> + *
> + * Copyright Christoffer Dall 2009-2010
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + */
> +
> +#include <stdio.h>
> +#include <sys/types.h>
> +#include <sys/ioctl.h>
> +#include <sys/mman.h>
> +
> +#include <linux/kvm.h>
> +
> +#include "qemu-common.h"
> +#include "qemu/timer.h"
> +#include "sysemu/sysemu.h"
> +#include "sysemu/kvm.h"
> +#include "cpu.h"
> +#include "hw/arm-misc.h"
> +
> +const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
static const?
> + KVM_CAP_LAST_INFO
> +};
[snip]
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-02-23 15:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-22 19:04 [PATCH v6 0/9] QEMU: Support KVM on ARM Peter Maydell
2013-02-22 19:04 ` [PATCH v6 1/9] oslib-posix: Align to permit transparent hugepages on ARM Linux Peter Maydell
2013-02-22 19:04 ` [PATCH v6 2/9] linux-headers: resync from mainline to add ARM KVM headers Peter Maydell
2013-02-22 19:04 ` [PATCH v6 3/9] ARM: KVM: Add support for KVM on ARM architecture Peter Maydell
2013-02-23 15:14 ` Andreas Färber [this message]
2013-02-26 14:50 ` Peter Maydell
2013-02-22 19:04 ` [PATCH v6 4/9] ARM KVM: save and load VFP registers from kernel Peter Maydell
2013-02-22 19:04 ` [PATCH v6 5/9] hw/arm_gic: Add presave/postload hooks Peter Maydell
2013-02-22 19:04 ` [PATCH v6 6/9] target-arm: Use MemoryListener to identify GIC base address for KVM Peter Maydell
2013-02-22 19:04 ` [PATCH v6 7/9] hw/kvm/arm_gic: Implement support for KVM in-kernel ARM GIC Peter Maydell
2013-02-23 15:29 ` [Qemu-devel] " Andreas Färber
2013-02-24 16:20 ` Peter Maydell
2013-02-22 19:04 ` [PATCH v6 8/9] configure: Enable KVM on ARM Peter Maydell
2013-02-22 19:04 ` [PATCH v6 9/9] MAINTAINERS: add entry for ARM KVM guest cores Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5128DCCF.9060105@suse.de \
--to=afaerber@suse.de \
--cc=blauwirbel@gmail.com \
--cc=cdall@cs.columbia.edu \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=mtosatti@redhat.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.