From nobody Mon Feb 9 11:33:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498927809616134.08586400190825; Sat, 1 Jul 2017 09:50:09 -0700 (PDT) Received: from localhost ([::1]:55372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRLax-0001iU-0h for importer@patchew.org; Sat, 01 Jul 2017 12:50:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRLYN-00084b-C8 for qemu-devel@nongnu.org; Sat, 01 Jul 2017 12:47:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dRLYM-0000Sc-F1 for qemu-devel@nongnu.org; Sat, 01 Jul 2017 12:47:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dRLYI-0000PC-Mj; Sat, 01 Jul 2017 12:47:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85D9A80462; Sat, 1 Jul 2017 16:47:21 +0000 (UTC) Received: from cav-thunderx1s-cn88xx-03.khw.lab.eng.bos.redhat.com (cav-thunderx1s-cn88xx-03.khw.lab.eng.bos.redhat.com [10.16.185.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5195863C3; Sat, 1 Jul 2017 16:47:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 85D9A80462 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=drjones@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 85D9A80462 From: Andrew Jones To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Sat, 1 Jul 2017 12:47:17 -0400 Message-Id: <1498927637-14496-4-git-send-email-drjones@redhat.com> In-Reply-To: <1498927637-14496-1-git-send-email-drjones@redhat.com> References: <1498927637-14496-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 01 Jul 2017 16:47:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/3] hw/arm/virt: allow pmu instantiation with userspace irqchip X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, agraf@suse.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move the in-kernel-irqchip test to only guard the creation, not the init'ing of the PMU. Also add the PMU to the KVM device irq line synchronization to enable its use. Signed-off-by: Andrew Jones --- hw/arm/virt.c | 2 +- target/arm/kvm.c | 6 +++++- target/arm/kvm64.c | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0cb8b479232d..53592fd0f30c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -495,7 +495,7 @@ static void fdt_add_pmu_nodes(const VirtMachineState *v= ms) if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) { return; } - if (kvm_enabled() && + if (kvm_irqchip_in_kernel() && !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ))) { return; } 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 &=3D ~KVM_ARM_DEV_EL1_PTIMER; } =20 - /* 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 &=3D ~KVM_ARM_DEV_PMU; + } =20 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 d94e0a04f015..54e58e407812 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] |=3D 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 =3D false; } if (cpu->has_pmu) { --=20 1.8.3.1