From: Jan Kiszka <jan.kiszka@siemens.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: patches@linaro.org, qemu-devel@nongnu.org, kvm@vger.kernel.org,
kvmarm@lists.cs.columbia.edu
Subject: Re: [RFC v2 2/6] ARM: KVM: Add support for KVM on ARM architecture
Date: Thu, 18 Oct 2012 19:41:19 +0200 [thread overview]
Message-ID: <50803F3F.1010609@siemens.com> (raw)
In-Reply-To: <1349881659-8403-3-git-send-email-peter.maydell@linaro.org>
On 2012-10-10 17:07, Peter Maydell wrote:
> 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>
> ---
> hw/arm_pic.c | 28 ++++
> target-arm/Makefile.objs | 1 +
> target-arm/cpu.h | 1 +
> target-arm/helper.c | 2 +-
> target-arm/kvm.c | 328 ++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 359 insertions(+), 1 deletion(-)
> create mode 100644 target-arm/kvm.c
>
> diff --git a/hw/arm_pic.c b/hw/arm_pic.c
> index ffb4d41..72272dc 100644
> --- a/hw/arm_pic.c
> +++ b/hw/arm_pic.c
> @@ -9,6 +9,7 @@
>
> #include "hw.h"
> #include "arm-misc.h"
> +#include "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,34 @@ static void arm_pic_cpu_handler(void *opaque, int irq, int level)
> }
> }
>
> +#ifdef CONFIG_KVM
> +static void kvm_arm_pic_cpu_handler(void *opaque, int irq, int level)
> +{
> + ARMCPU *cpu = opaque;
> + CPUARMState *env = &cpu->env;
> + 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 |= env->cpu_index << KVM_ARM_IRQ_VCPU_SHIFT;
> + kvm_set_irq(kvm_state, kvm_irq, level ? 1 : 0);
> +}
> +#endif
Minor: If you do
function()
{
#ifdef CONFIG_KVM
...
#endif
}
> +
> qemu_irq *arm_pic_init_cpu(ARMCPU *cpu)
> {
> +#ifdef CONFIG_KVM
> + if (kvm_enabled()) {
> + return qemu_allocate_irqs(kvm_arm_pic_cpu_handler, cpu, 2);
> + }
> +#endif
...you can avoid the ifdef'ery here.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: patches@linaro.org, qemu-devel@nongnu.org, kvm@vger.kernel.org,
kvmarm@lists.cs.columbia.edu
Subject: Re: [Qemu-devel] [RFC v2 2/6] ARM: KVM: Add support for KVM on ARM architecture
Date: Thu, 18 Oct 2012 19:41:19 +0200 [thread overview]
Message-ID: <50803F3F.1010609@siemens.com> (raw)
In-Reply-To: <1349881659-8403-3-git-send-email-peter.maydell@linaro.org>
On 2012-10-10 17:07, Peter Maydell wrote:
> 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>
> ---
> hw/arm_pic.c | 28 ++++
> target-arm/Makefile.objs | 1 +
> target-arm/cpu.h | 1 +
> target-arm/helper.c | 2 +-
> target-arm/kvm.c | 328 ++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 359 insertions(+), 1 deletion(-)
> create mode 100644 target-arm/kvm.c
>
> diff --git a/hw/arm_pic.c b/hw/arm_pic.c
> index ffb4d41..72272dc 100644
> --- a/hw/arm_pic.c
> +++ b/hw/arm_pic.c
> @@ -9,6 +9,7 @@
>
> #include "hw.h"
> #include "arm-misc.h"
> +#include "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,34 @@ static void arm_pic_cpu_handler(void *opaque, int irq, int level)
> }
> }
>
> +#ifdef CONFIG_KVM
> +static void kvm_arm_pic_cpu_handler(void *opaque, int irq, int level)
> +{
> + ARMCPU *cpu = opaque;
> + CPUARMState *env = &cpu->env;
> + 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 |= env->cpu_index << KVM_ARM_IRQ_VCPU_SHIFT;
> + kvm_set_irq(kvm_state, kvm_irq, level ? 1 : 0);
> +}
> +#endif
Minor: If you do
function()
{
#ifdef CONFIG_KVM
...
#endif
}
> +
> qemu_irq *arm_pic_init_cpu(ARMCPU *cpu)
> {
> +#ifdef CONFIG_KVM
> + if (kvm_enabled()) {
> + return qemu_allocate_irqs(kvm_arm_pic_cpu_handler, cpu, 2);
> + }
> +#endif
...you can avoid the ifdef'ery here.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-10-18 17:41 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 15:07 [RFC v2 0/6] QEMU: Support KVM on ARM Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] " Peter Maydell
2012-10-10 15:07 ` [RFC v2 1/6] linux-headers: Add ARM KVM headers (not for upstream) Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] " Peter Maydell
2012-10-10 15:07 ` [RFC v2 2/6] ARM: KVM: Add support for KVM on ARM architecture Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] " Peter Maydell
2012-10-13 9:09 ` Blue Swirl
2012-10-13 9:09 ` Blue Swirl
2012-10-13 19:19 ` Peter Maydell
2012-10-13 19:19 ` Peter Maydell
2012-10-18 12:37 ` Peter Maydell
2012-10-18 12:37 ` Peter Maydell
2012-10-18 17:41 ` Jan Kiszka [this message]
2012-10-18 17:41 ` Jan Kiszka
2012-10-18 17:53 ` Peter Maydell
2012-10-18 17:53 ` [Qemu-devel] " Peter Maydell
2012-10-10 15:07 ` [RFC v2 3/6] hw/arm_gic: Add presave/postload hooks Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] " Peter Maydell
2012-10-10 17:29 ` Andreas Färber
2012-10-10 17:29 ` Andreas Färber
2012-10-10 15:07 ` [RFC v2 4/6] hw/kvm/arm_gic: Implement support for KVM in-kernel ARM GIC Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] " Peter Maydell
2012-10-10 17:23 ` Andreas Färber
2012-10-10 17:23 ` Andreas Färber
2012-10-10 17:35 ` Peter Maydell
2012-10-10 17:35 ` Peter Maydell
2012-10-10 15:07 ` [RFC v2 5/6] ARM KVM: save and load VFP registers from kernel Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] " Peter Maydell
2012-10-10 15:07 ` [RFC v2 6/6] configure: Enable KVM on ARM Peter Maydell
2012-10-10 15:07 ` [Qemu-devel] " 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=50803F3F.1010609@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=patches@linaro.org \
--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.