All of lore.kernel.org
 help / color / mirror / Atom feed
From: andre.przywara@arm.com (Andre Przywara)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 06/20] arm/arm64: KVM: move kvm_register_device_ops() into vGIC probing
Date: Fri,  9 Jan 2015 11:54:24 +0000	[thread overview]
Message-ID: <1420804478-17354-7-git-send-email-andre.przywara@arm.com> (raw)
In-Reply-To: <1420804478-17354-1-git-send-email-andre.przywara@arm.com>

Currently we unconditionally register the GICv2 emulation device
during the host's KVM initialization. Since with GICv3 support we
may end up with only v2 or only v3 or both supported, we move the
registration into the GIC probing function, where we will later know
which combination is valid.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
---
Changelog v5...v6:
 (add Acked-by)

Changelog v4...v5:
 (none)

Changelog v3...v4:
 (add Acked-by)

 include/linux/kvm_host.h |    1 +
 virt/kvm/arm/vgic-v2.c   |    2 ++
 virt/kvm/arm/vgic-v3.c   |    1 +
 virt/kvm/arm/vgic.c      |    5 ++---
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 26f1060..703eeed 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1042,6 +1042,7 @@ void kvm_unregister_device_ops(u32 type);
 
 extern struct kvm_device_ops kvm_mpic_ops;
 extern struct kvm_device_ops kvm_xics_ops;
+extern struct kvm_device_ops kvm_arm_vgic_v2_ops;
 
 #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
 
diff --git a/virt/kvm/arm/vgic-v2.c b/virt/kvm/arm/vgic-v2.c
index 2935405..e1cd3cb 100644
--- a/virt/kvm/arm/vgic-v2.c
+++ b/virt/kvm/arm/vgic-v2.c
@@ -229,6 +229,8 @@ int vgic_v2_probe(struct device_node *vgic_node,
 		goto out_unmap;
 	}
 
+	kvm_register_device_ops(&kvm_arm_vgic_v2_ops, KVM_DEV_TYPE_ARM_VGIC_V2);
+
 	vgic->vcpu_base = vcpu_res.start;
 
 	kvm_info("%s@%llx IRQ%d\n", vgic_node->name,
diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c
index 1c2c8ee..d14c75f 100644
--- a/virt/kvm/arm/vgic-v3.c
+++ b/virt/kvm/arm/vgic-v3.c
@@ -230,6 +230,7 @@ int vgic_v3_probe(struct device_node *vgic_node,
 		ret = -ENXIO;
 		goto out;
 	}
+	kvm_register_device_ops(&kvm_arm_vgic_v2_ops, KVM_DEV_TYPE_ARM_VGIC_V2);
 
 	vgic->vcpu_base = vcpu_res.start;
 	vgic->vctrl_base = NULL;
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 205df80..038d287 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -2559,7 +2559,7 @@ static int vgic_create(struct kvm_device *dev, u32 type)
 	return kvm_vgic_create(dev->kvm, type);
 }
 
-static struct kvm_device_ops kvm_arm_vgic_v2_ops = {
+struct kvm_device_ops kvm_arm_vgic_v2_ops = {
 	.name = "kvm-arm-vgic",
 	.create = vgic_create,
 	.destroy = vgic_destroy,
@@ -2638,8 +2638,7 @@ int kvm_vgic_hyp_init(void)
 
 	on_each_cpu(vgic_init_maintenance_interrupt, NULL, 1);
 
-	return kvm_register_device_ops(&kvm_arm_vgic_v2_ops,
-				       KVM_DEV_TYPE_ARM_VGIC_V2);
+	return 0;
 
 out_free_irq:
 	free_percpu_irq(vgic->maint_irq, kvm_get_running_vcpus());
-- 
1.7.9.5

  parent reply	other threads:[~2015-01-09 11:54 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09 11:54 [PATCH v6 00/20] KVM GICv3 emulation Andre Przywara
2015-01-09 11:54 ` [PATCH v6 01/20] arm/arm64: KVM: rework MPIDR assignment and add accessors Andre Przywara
2015-01-09 11:54 ` [PATCH v6 02/20] arm/arm64: KVM: pass down user space provided GIC type into vGIC code Andre Przywara
2015-01-09 11:54 ` [PATCH v6 03/20] arm/arm64: KVM: refactor vgic_handle_mmio() function Andre Przywara
2015-01-09 11:54 ` [PATCH v6 04/20] arm/arm64: KVM: wrap 64 bit MMIO accesses with two 32 bit ones Andre Przywara
2015-01-09 11:54 ` [PATCH v6 05/20] arm/arm64: KVM: introduce per-VM ops Andre Przywara
2015-01-11 14:58   ` Christoffer Dall
2015-01-09 11:54 ` Andre Przywara [this message]
2015-01-09 11:54 ` [PATCH v6 07/20] arm/arm64: KVM: dont rely on a valid GICH base address Andre Przywara
2015-01-09 11:54 ` [PATCH v6 08/20] arm/arm64: KVM: make the maximum number of vCPUs a per-VM value Andre Przywara
2015-01-11 14:58   ` Christoffer Dall
2015-01-12  9:34     ` Andre Przywara
2015-01-09 11:54 ` [PATCH v6 09/20] arm/arm64: KVM: make the value of ICC_SRE_EL1 a per-VM variable Andre Przywara
2015-01-09 11:54 ` [PATCH v6 10/20] arm/arm64: KVM: refactor MMIO accessors Andre Przywara
2015-01-09 11:54 ` [PATCH v6 11/20] arm/arm64: KVM: refactor/wrap vgic_set/get_attr() Andre Przywara
2015-01-09 11:54 ` [PATCH v6 12/20] arm/arm64: KVM: add vgic.h header file Andre Przywara
2015-01-09 11:54 ` [PATCH v6 13/20] arm/arm64: KVM: split GICv2 specific emulation code from vgic.c Andre Przywara
2015-01-09 11:54 ` [PATCH v6 14/20] arm/arm64: KVM: add opaque private pointer to MMIO data Andre Przywara
2015-01-09 11:54 ` [PATCH v6 15/20] arm/arm64: KVM: add virtual GICv3 distributor emulation Andre Przywara
2015-01-11 15:15   ` Christoffer Dall
2015-01-12  9:57     ` Andre Przywara
2015-01-12 17:08       ` Christoffer Dall
2015-01-09 11:54 ` [PATCH v6 16/20] arm64: GICv3: introduce symbolic names for GICv3 ICC_SGI1R_EL1 fields Andre Przywara
2015-01-09 11:54 ` [PATCH v6 17/20] arm64: KVM: add SGI generation register emulation Andre Przywara
2015-01-09 11:54 ` [PATCH v6 18/20] KVM: introduce kvm_check_device_type() Andre Przywara
2015-01-09 12:33   ` Christoffer Dall
2015-01-09 13:42     ` Andre Przywara
2015-01-11 15:22       ` Christoffer Dall
2015-01-12 12:33         ` Andre Przywara
2015-01-12 17:11           ` Christoffer Dall
2015-01-14 12:33           ` Andre Przywara
2015-01-09 11:54 ` [PATCH v6 19/20] arm/arm64: KVM: enable kernel side of GICv3 emulation Andre Przywara
2015-01-11 15:32   ` Christoffer Dall
2015-01-09 11:54 ` [PATCH v6 20/20] arm/arm64: KVM: allow userland to request a virtual GICv3 Andre Przywara
2015-01-11 15:35   ` Christoffer Dall
2015-01-13 16:25 ` [PATCH v6 00/20] KVM GICv3 emulation Tomasz Nowicki
2015-01-14  0:04   ` Andre Przywara
2015-01-14  8:50     ` Tomasz Nowicki
2015-01-14  8:51       ` Eric Auger
2015-01-14 10:48         ` Andre Przywara

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=1420804478-17354-7-git-send-email-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.