Skip to content

Commit

Permalink
hw/sparc/sun4m: Realize DMA controller before accessing it
Browse files Browse the repository at this point in the history
We should not wire IRQs on unrealized device.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240213130341.1793-9-philmd@linaro.org>
  • Loading branch information
philmd committed Feb 15, 2024
1 parent 5e37bc4 commit 73a143b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hw/sparc/sun4m.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,11 @@ static void *sparc32_dma_init(hwaddr dma_base,
dma = qdev_new(TYPE_SPARC32_DMA);
espdma = SPARC32_ESPDMA_DEVICE(object_resolve_path_component(
OBJECT(dma), "espdma"));
sysbus_connect_irq(SYS_BUS_DEVICE(espdma), 0, espdma_irq);

esp = SYSBUS_ESP(object_resolve_path_component(OBJECT(espdma), "esp"));

ledma = SPARC32_LEDMA_DEVICE(object_resolve_path_component(
OBJECT(dma), "ledma"));
sysbus_connect_irq(SYS_BUS_DEVICE(ledma), 0, ledma_irq);

lance = SYSBUS_PCNET(object_resolve_path_component(
OBJECT(ledma), "lance"));
Expand All @@ -332,6 +330,11 @@ static void *sparc32_dma_init(hwaddr dma_base,
}

sysbus_realize_and_unref(SYS_BUS_DEVICE(dma), &error_fatal);

sysbus_connect_irq(SYS_BUS_DEVICE(espdma), 0, espdma_irq);

sysbus_connect_irq(SYS_BUS_DEVICE(ledma), 0, ledma_irq);

sysbus_mmio_map(SYS_BUS_DEVICE(dma), 0, dma_base);

sysbus_mmio_map(SYS_BUS_DEVICE(esp), 0, esp_base);
Expand Down

0 comments on commit 73a143b

Please sign in to comment.