From: Marc Zyngier <marc.zyngier@arm.com>
To: Pavel Fedin <p.fedin@samsung.com>, kvm@vger.kernel.org
Cc: Christoffer Dall <christoffer.dall@linaro.org>,
Andre Przywara <andre.przywara@arm.com>
Subject: Re: [PATCH 3/3] KVM: arm: Enable vGICv2 software emulation
Date: Mon, 29 Jun 2015 13:17:28 +0100 [thread overview]
Message-ID: <55913758.4020805@arm.com> (raw)
In-Reply-To: <cc5767063bf07b484d0655280e007472c9ce599c.1435567226.git.p.fedin@samsung.com>
On 29/06/15 10:53, Pavel Fedin wrote:
> The emulation code is automatically enabled when one of vGIC resources
> is missing from the device tree
Hold on a second. In your cover letter, your saying "RPi-2". The RPi-2
doesn't have a GIC at all, so I'd really like to know *how* you end-up
in the GICv2 probe function?
Thanks,
M.
>
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
> ---
> virt/kvm/arm/vgic-v2.c | 29 ++++++++++++++---------------
> virt/kvm/arm/vgic.c | 10 ++++++----
> 2 files changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/virt/kvm/arm/vgic-v2.c b/virt/kvm/arm/vgic-v2.c
> index f9b9c7c..b371a59 100644
> --- a/virt/kvm/arm/vgic-v2.c
> +++ b/virt/kvm/arm/vgic-v2.c
> @@ -180,22 +180,27 @@ int vgic_v2_probe(struct device_node *vgic_node,
> const struct vgic_ops **ops,
> const struct vgic_params **params)
> {
> - int ret;
> + int ret = 0;
> struct resource vctrl_res;
> struct resource vcpu_res;
> struct vgic_params *vgic = &vgic_v2_params;
>
> + vgic->nr_lr = VGIC_V2_MAX_LRS;
> +
> vgic->maint_irq = irq_of_parse_and_map(vgic_node, 0);
> if (!vgic->maint_irq) {
> kvm_err("error getting vgic maintenance irq from DT\n");
> - ret = -ENXIO;
> - goto out;
> + goto sw_emul;
> }
>
> - ret = of_address_to_resource(vgic_node, 2, &vctrl_res);
> - if (ret) {
> + if (of_address_to_resource(vgic_node, 2, &vctrl_res)) {
> kvm_err("Cannot obtain GICH resource\n");
> - goto out;
> + goto sw_emul;
> + }
> +
> + if (of_address_to_resource(vgic_node, 3, &vcpu_res)) {
> + kvm_err("Cannot obtain GICV resource\n");
> + goto sw_emul;
> }
>
> vgic->vctrl_base = of_iomap(vgic_node, 2);
> @@ -216,12 +221,6 @@ int vgic_v2_probe(struct device_node *vgic_node,
> goto out_unmap;
> }
>
> - if (of_address_to_resource(vgic_node, 3, &vcpu_res)) {
> - kvm_err("Cannot obtain GICV resource\n");
> - ret = -ENXIO;
> - goto out_unmap;
> - }
> -
> if (!PAGE_ALIGNED(vcpu_res.start)) {
> kvm_err("GICV physical address 0x%llx not page aligned\n",
> (unsigned long long)vcpu_res.start);
> @@ -237,13 +236,13 @@ int vgic_v2_probe(struct device_node *vgic_node,
> goto out_unmap;
> }
>
> - vgic->can_emulate_gicv2 = true;
> - 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,
> vctrl_res.start, vgic->maint_irq);
> +sw_emul:
> + vgic->can_emulate_gicv2 = true;
> + kvm_register_device_ops(&kvm_arm_vgic_v2_ops, KVM_DEV_TYPE_ARM_VGIC_V2);
>
> vgic->type = VGIC_V2;
> vgic->max_gic_vcpus = VGIC_V2_MAX_CPUS;
> diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
> index aec6063..66e0cae 100644
> --- a/virt/kvm/arm/vgic.c
> +++ b/virt/kvm/arm/vgic.c
> @@ -2196,11 +2196,13 @@ int kvm_vgic_hyp_init(void)
> if (ret)
> return ret;
>
> - ret = request_percpu_irq(vgic->maint_irq, vgic_maintenance_handler,
> + if (vgic->maint_irq) {
> + ret = request_percpu_irq(vgic->maint_irq, vgic_maintenance_handler,
> "vgic", kvm_get_running_vcpus());
> - if (ret) {
> - kvm_err("Cannot register interrupt %d\n", vgic->maint_irq);
> - return ret;
> + if (ret) {
> + kvm_err("Cannot register interrupt %d\n", vgic->maint_irq);
> + return ret;
> + }
> }
>
> ret = __register_cpu_notifier(&vgic_cpu_nb);
>
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2015-06-29 12:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-29 9:53 [PATCH 0/3] KVM: arm: Implement software vGICv2 emulation Pavel Fedin
2015-06-29 9:53 ` [PATCH 1/3] KVM: arm: Add basic infrastructure for software vGIC emulation Pavel Fedin
2015-06-29 9:53 ` [PATCH 2/3] KVM: arm: Introduce software emulation of vGICv2 CPU interface Pavel Fedin
2015-06-29 9:53 ` [PATCH 3/3] KVM: arm: Enable vGICv2 software emulation Pavel Fedin
2015-06-29 12:17 ` Marc Zyngier [this message]
2015-06-29 12:37 ` Pavel Fedin
2015-06-29 12:48 ` Marc Zyngier
2015-06-29 12:13 ` [PATCH 0/3] KVM: arm: Implement software vGICv2 emulation Marc Zyngier
2015-06-29 12:52 ` Christoffer Dall
2015-06-29 14:11 ` Andre Przywara
2015-06-29 14:15 ` Christoffer Dall
2015-06-29 15:29 ` Marc Zyngier
2015-06-30 8:16 ` Pavel Fedin
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=55913758.4020805@arm.com \
--to=marc.zyngier@arm.com \
--cc=andre.przywara@arm.com \
--cc=christoffer.dall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=p.fedin@samsung.com \
/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.