Skip to content

Commit

Permalink
hw/mips/gt64xxx_pci: Fix PCI IRQ levels to be preserved during migration
Browse files Browse the repository at this point in the history
Based on commit e735b55:

  piix_pci: eliminate PIIX3State::pci_irq_levels

  PIIX3State::pci_irq_levels are redundant which is already tracked by
  PCIBus layer. So eliminate them.

The IRQ levels in the PCIBus layer are already preserved during
migration. By reusing them and rather than having a redundant implementation
the bug is avoided in the first place.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220217101924.15347-2-shentey@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
  • Loading branch information
shentok authored and philmd committed Mar 8, 2022
1 parent 5e0c126 commit c291635
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions hw/mips/gt64xxx_pci.c
Expand Up @@ -1006,14 +1006,11 @@ static int gt64120_pci_map_irq(PCIDevice *pci_dev, int irq_num)
}
}

static int pci_irq_levels[4];

static void gt64120_pci_set_irq(void *opaque, int irq_num, int level)
{
int i, pic_irq, pic_level;
qemu_irq *pic = opaque;

pci_irq_levels[irq_num] = level;
PCIBus *bus = pci_get_bus(piix4_dev);

/* now we change the pic irq level according to the piix irq mappings */
/* XXX: optimize */
Expand All @@ -1023,7 +1020,7 @@ static void gt64120_pci_set_irq(void *opaque, int irq_num, int level)
pic_level = 0;
for (i = 0; i < 4; i++) {
if (pic_irq == piix4_dev->config[PIIX_PIRQCA + i]) {
pic_level |= pci_irq_levels[i];
pic_level |= pci_bus_get_irq_level(bus, i);
}
}
qemu_set_irq(pic[pic_irq], pic_level);
Expand Down

0 comments on commit c291635

Please sign in to comment.