All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: peter.maydell@linaro.org, agraf@suse.de, cdall@linaro.org
Subject: [Qemu-devel] [PATCH v2 3/4] hw/arm/virt: allow pmu instantiation with userspace irqchip
Date: Wed, 19 Jul 2017 09:39:56 -0400	[thread overview]
Message-ID: <1500471597-2517-4-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1500471597-2517-1-git-send-email-drjones@redhat.com>

Move the in-kernel-irqchip test to only guard the set-irq
stage, not the init stage of the PMU.  Also add the PMU to
the KVM device irq line synchronization to enable its use.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 hw/arm/virt.c      | 3 ++-
 target/arm/kvm.c   | 6 +++++-
 target/arm/kvm64.c | 3 +--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 7157a028adce..a215330444da 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -496,7 +496,8 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
             return;
         }
         if (kvm_enabled()) {
-            if (!kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ))) {
+            if (kvm_irqchip_in_kernel() &&
+                !kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ))) {
                 return;
             }
             if (!kvm_arm_pmu_init(cpu)) {
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 7c17f0d629d7..211a7bf7befd 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -567,7 +567,11 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
             switched_level &= ~KVM_ARM_DEV_EL1_PTIMER;
         }
 
-        /* XXX PMU IRQ is missing */
+        if (switched_level & KVM_ARM_DEV_PMU) {
+            qemu_set_irq(cpu->pmu_interrupt,
+                         !!(run->s.regs.device_irq_level & KVM_ARM_DEV_PMU));
+            switched_level &= ~KVM_ARM_DEV_PMU;
+        }
 
         if (switched_level) {
             qemu_log_mask(LOG_UNIMP, "%s: unhandled in-kernel device IRQ %x\n",
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index e26638a6fac1..ec7d85314acc 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -506,8 +506,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
     if (!arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
         cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_EL1_32BIT;
     }
-    if (!kvm_irqchip_in_kernel() ||
-        !kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PMU_V3)) {
+    if (!kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PMU_V3)) {
             cpu->has_pmu = false;
     }
     if (cpu->has_pmu) {
-- 
1.8.3.1

  parent reply	other threads:[~2017-07-19 13:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 13:39 [Qemu-devel] [PATCH v2 0/4] ARM: KVM: Enable in-kernel PMU with user space gic Andrew Jones
2017-07-19 13:39 ` [Qemu-devel] [PATCH v2 1/4] hw/arm/virt: add pmu interrupt state Andrew Jones
2017-07-21 11:16   ` Christoffer Dall
2017-07-21 11:35     ` Andrew Jones
2017-07-21 12:01       ` Christoffer Dall
2017-07-19 13:39 ` [Qemu-devel] [PATCH v2 2/4] target/arm/kvm: pmu: split init and set-irq stages Andrew Jones
2017-07-21 11:25   ` Christoffer Dall
2017-07-19 13:39 ` Andrew Jones [this message]
2017-07-21 11:28   ` [Qemu-devel] [PATCH v2 3/4] hw/arm/virt: allow pmu instantiation with userspace irqchip Christoffer Dall
2017-07-19 13:39 ` [Qemu-devel] [PATCH v2 4/4] target/arm/kvm: pmu: improve error handling Andrew Jones
2017-07-21 11:29   ` Christoffer Dall
2017-09-04 14:17   ` Peter Maydell
2017-09-05 14:44     ` Andrew Jones
2017-07-19 15:14 ` [Qemu-devel] [PATCH v2 0/4] ARM: KVM: Enable in-kernel PMU with user space gic no-reply
2017-08-08 13:23 ` Andrew Jones
2017-08-17 10:41   ` 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=1500471597-2517-4-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=agraf@suse.de \
    --cc=cdall@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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.