hw/acpi: Make storage of node id uint32_t to reduce fragility
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 16 Sep 2024 17:42:37 +0000 (18:42 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 4 Nov 2024 21:03:24 +0000 (16:03 -0500)
>From review of generic port introduction.

The value is handled as a uint32_t so store it in that type.
The value cannot in reality exceed MAX_NODES which is currently
128 but if the types are matched there is no need to rely on that
restriction.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20240916174237.1843213-1-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/acpi/aml-build.c
hw/acpi/pci.c
include/hw/acpi/aml-build.h

index 7a06ffec5a752b31519d61be3785d85d51375a36..6a7662617706c818978541ce1f0915b2e7f37e7a 100644 (file)
@@ -1972,7 +1972,7 @@ static void build_append_srat_acpi_device_handle(GArray *table_data,
  * 5.2.16.6 Generic Initiator Affinity Structure
  *    With PCI Device Handle.
  */
-void build_srat_pci_generic_initiator(GArray *table_data, int node,
+void build_srat_pci_generic_initiator(GArray *table_data, uint32_t node,
                                       uint16_t segment, uint8_t bus,
                                       uint8_t devfn)
 {
index d7a0e91f011e07c853cf544910170ac5376c46f5..a4835ce56313008c48adbb94c32b0482fe628cb7 100644 (file)
@@ -72,7 +72,7 @@ typedef struct AcpiGenericInitiator {
 
     /* public */
     char *pci_dev;
-    uint16_t node;
+    uint32_t node;
 } AcpiGenericInitiator;
 
 typedef struct AcpiGenericInitiatorClass {
index 47a4692a7d87cb67d0ebb7781743484e134cef7f..4fd5da49e7e653d0ef721f1ffa523eea1d5a509a 100644 (file)
@@ -486,7 +486,7 @@ Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_offset,
 void build_srat_memory(GArray *table_data, uint64_t base,
                        uint64_t len, int node, MemoryAffinityFlags flags);
 
-void build_srat_pci_generic_initiator(GArray *table_data, int node,
+void build_srat_pci_generic_initiator(GArray *table_data, uint32_t node,
                                       uint16_t segment, uint8_t bus,
                                       uint8_t devfn);