hw/vfio/platform: irqfd setup sequence update
authorEric Auger <eric.auger@linaro.org>
Mon, 5 Oct 2015 18:30:12 +0000 (12:30 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 5 Oct 2015 18:30:12 +0000 (12:30 -0600)
commit58892b447f0ffcd0967bc6f1bcb40df288ebeebc
tree2607a56a41cd816c75f9070310567fb31a3f0603
parentc0b520dfb8890294a9f8879f4759172900585995
hw/vfio/platform: irqfd setup sequence update

With current implementation, eventfd VFIO signaling is first set up and
then irqfd is setup, if supported and allowed.

This start sequence causes several issues with IRQ forwarding setup
which, if supported, is transparently attempted on irqfd setup:
IRQ forwarding setup is likely to fail if the IRQ is detected as under
injection into the guest (active at irqchip level or VFIO masked).

This currently always happens because the current sequence explicitly
VFIO-masks the IRQ before setting irqfd.

Even if that masking were removed, we couldn't prevent the case where
the IRQ is under injection into the guest.

So the simpler solution is to remove this 2-step startup and directly
attempt irqfd setup. This is what this patch does.

Also in case the eventfd setup fails, there is no reason to go farther:
let's abort.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
hw/vfio/platform.c