hw/acpi/viot: build array of PCI host bridges before generating VIOT ACPI table
commite5f73c8397dddef8fc4b2fca76ffc153070a5db1
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Wed, 25 May 2022 17:32:29 +0000 (25 18:32 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 9 Jun 2022 23:32:49 +0000 (9 19:32 -0400)
tree5cb97dfecd4a6923cfbfd82894aab9b63ea0a042
parent1b805ab560d3c020377680742ae2a49c7eb417d0
hw/acpi/viot: build array of PCI host bridges before generating VIOT ACPI table

Perform the generation of the VIOT ACPI table in 2 separate passes: the first pass
enumerates all of the PCI host bridges and adds the min_bus and max_bus information
to an array.

Once this is done the VIOT table header is generated using the size of the array
to calculate the node count, which means it is no longer necessary to use a
sub-array to hold the PCI host bridge range information along with viommu_off.

Finally the PCI host bridge array is iterated again to add the required entries
to the final VIOT ACPI table.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220525173232.31429-4-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/acpi/viot.c