Hi Peter,
Thanks for your comments. I will explain SDEI in another mail and please
provide your suggestions for such situation.
Heyi
On 2019/9/30 21:19, Peter Maydell wrote:
On Tue, 24 Sep 2019 at 16:23, Heyi Guo <guoh...@huawei.com> wrote:
Override qemu_irq handler to support trigger SDEI event transparently
after guest binds interrupt to SDEI event. We don't have good way to
get GIC device and to guarantee SDEI device is initialized after GIC,
so we search GIC in system bus when the first SDEI request happens or
in VMSTATE post_load().
Signed-off-by: Heyi Guo <guoh...@huawei.com>
Cc: Peter Maydell <peter.mayd...@linaro.org>
Cc: Dave Martin <dave.mar...@arm.com>
Cc: Marc Zyngier <marc.zyng...@arm.com>
Cc: Mark Rutland <mark.rutl...@arm.com>
Cc: James Morse <james.mo...@arm.com>
+static void override_qemu_irq(QemuSDEState *s, int32_t event, uint32_t intid)
+{
+ qemu_irq irq;
+ QemuSDE *sde;
+ CPUState *cs;
+ int cpu;
+
+ /* SPI */
+ if (intid >= GIC_INTERNAL) {
+ cs = arm_get_cpu_by_id(0);
+ irq = qdev_get_gpio_in(s->gic_dev,
+ gic_int_to_irq(s->num_irq, intid, 0));
+ if (irq) {
+ qemu_irq_intercept_in(&irq, qemu_sdei_irq_handler, 1);
+ }
I'm not sure what this code is trying to do, but
qemu_irq_intercept_in() is a function for internal use
by the qtest testing infrastructure, so it shouldn't be
used in 'real' QEMU code.
+ sde = get_sde_no_check(s, event, cs);
+ sde->irq = irq;
+ put_sde(sde, cs);
+ return;
+ }
@@ -1042,6 +1152,17 @@ void sdei_handle_request(CPUState *cs, struct kvm_run
*run)
return;
}
+ if (!sde_state->gic_dev) {
+ /* Search for ARM GIC device */
+ qbus_walk_children(sysbus_get_default(), dev_walkerfn,
+ NULL, NULL, NULL, sde_state);
+ if (!sde_state->gic_dev) {
+ error_report("Cannot find ARM GIC device!");
+ run->hypercall.args[0] = SDEI_NOT_SUPPORTED;
+ return;
+ }
+ }
Walking through the qbus tree looking for particular devices
isn't really something I'd recommend either.
thanks
-- PMM
_______________________________________________
linux-arm-kernel mailing list
linux-arm-ker...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm