xen/dm: Introduce xendevicemodel_set_irq_level DM op
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Fri, 29 Jan 2021 01:48:46 +0000 (03:48 +0200)
committerJulien Grall <jgrall@amazon.com>
Fri, 29 Jan 2021 16:55:23 +0000 (16:55 +0000)
commit5d752df85f2c8faf87736cba05113435c7e9a9f1
treebb9fedb1a543afae32a837cefc35842276a8fe69
parent61eda016ca94d9dcacab10bd686374e2efc87416
xen/dm: Introduce xendevicemodel_set_irq_level DM op

This patch adds ability to the device emulator to notify otherend
(some entity running in the guest) using a SPI and implements Arm
specific bits for it. Proposed interface allows emulator to set
the logical level of a one of a domain's IRQ lines.

We can't reuse the existing DM op (xen_dm_op_set_isa_irq_level)
to inject an interrupt as the "isa_irq" field is only 8-bit and
able to cover IRQ 0 - 255, whereas we need a wider range (0 - 1020).

Please note, for egde-triggered interrupt (which is used for
the virtio-mmio emulation) we only trigger the interrupt on Arm
if the level is asserted (rising edge) and do nothing if the level
is deasserted (falling edge), so the call could be named "trigger_irq"
(without the level parameter). But, in order to model the line closely
(to be able to support level-triggered interrupt) we need to know whether
the line is low or high, so the proposed interface has been chosen.
However, it is worth mentioning that in case of the level-triggered
interrupt, we should keep injecting the interrupt to the guest until
the line is deasserted (this is not covered by current patch).

Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
[On Arm only]
Tested-by: Wei Chen <Wei.Chen@arm.com>
tools/include/xendevicemodel.h
tools/libs/devicemodel/core.c
tools/libs/devicemodel/libxendevicemodel.map
xen/arch/arm/dm.c
xen/include/public/hvm/dm_op.h