Skip to contentSkip to conversation

hw/arm/virt-acpi-build: use PCIE_MMCFG_BUS to retrieve end_bus_number

PATCH Applied Wei Yang 4 participants 4 messages Mar 12, 2019 – Mar 14, 2019

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 hw/arm/virt-acpi-build: use PCIE_MMCFG_BUS to retrieve end_bus_number

This is more proper to use PCIE_MMCFG_BUS to retrieve end_bus_number.

---
 hw/arm/virt-acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/virt-acpi-build.c +2 -2
index d7e2e4885b..57679a89bf 100644
@@ -560,8 +560,8 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     /* Only a single allocation so no need to play with segments */
     mcfg->allocation[0].pci_segment = cpu_to_le16(0);
     mcfg->allocation[0].start_bus_number = 0;
-    mcfg->allocation[0].end_bus_number = (memmap[ecam_id].size
-                                          / PCIE_MMCFG_SIZE_MIN) - 1;
+    mcfg->allocation[0].end_bus_number =
+        PCIE_MMCFG_BUS(memmap[ecam_id].size - 1);
 
     build_header(linker, table_data, (void *)(table_data->data + mcfg_start),
                  "MCFG", table_data->len - mcfg_start, 1, NULL, NULL);
Signature · 1 line
2.19.1
Reviewed-by on v1 1/1
#1 lore raw

Hi

Quoted 3 lines · Wei Yang

This is more proper to use PCIE_MMCFG_BUS to retrieve end_bus_number.

Thanks

Eric

Quoted 20 lines
---
 hw/arm/virt-acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/virt-acpi-build.c +2 -2
index d7e2e4885b..57679a89bf 100644
@@ -560,8 +560,8 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     /* Only a single allocation so no need to play with segments */
     mcfg->allocation[0].pci_segment = cpu_to_le16(0);
     mcfg->allocation[0].start_bus_number = 0;
-    mcfg->allocation[0].end_bus_number = (memmap[ecam_id].size
-                                          / PCIE_MMCFG_SIZE_MIN) - 1;
+    mcfg->allocation[0].end_bus_number =
+        PCIE_MMCFG_BUS(memmap[ecam_id].size - 1);
 
     build_header(linker, table_data, (void *)(table_data->data + mcfg_start),
                  "MCFG", table_data->len - mcfg_start, 1, NULL, NULL);
Reviewed-by on v1 1/1
#2 lore raw
In reply to Wei Yang
Quoted 3 lines · On Tue, 12 Mar 2019 15:49:53 +0800 Wei Yang <[email protected]>…

This is more proper to use PCIE_MMCFG_BUS to retrieve end_bus_number.

Quoted 19 lines
---
 hw/arm/virt-acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/virt-acpi-build.c +2 -2
index d7e2e4885b..57679a89bf 100644
@@ -560,8 +560,8 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     /* Only a single allocation so no need to play with segments */
     mcfg->allocation[0].pci_segment = cpu_to_le16(0);
     mcfg->allocation[0].start_bus_number = 0;
-    mcfg->allocation[0].end_bus_number = (memmap[ecam_id].size
-                                          / PCIE_MMCFG_SIZE_MIN) - 1;
+    mcfg->allocation[0].end_bus_number =
+        PCIE_MMCFG_BUS(memmap[ecam_id].size - 1);
 
     build_header(linker, table_data, (void *)(table_data->data + mcfg_start),
                  "MCFG", table_data->len - mcfg_start, 1, NULL, NULL);
#3 lore raw
In reply to Wei Yang
Quoted 24 lines · Wei Yang

This is more proper to use PCIE_MMCFG_BUS to retrieve end_bus_number.

---
 hw/arm/virt-acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/virt-acpi-build.c +2 -3
index d7e2e4885b..57679a89bf 100644
@@ -560,8 +560,8 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     /* Only a single allocation so no need to play with segments */
     mcfg->allocation[0].pci_segment = cpu_to_le16(0);
     mcfg->allocation[0].start_bus_number = 0;
-    mcfg->allocation[0].end_bus_number = (memmap[ecam_id].size
-                                          / PCIE_MMCFG_SIZE_MIN) - 1;
+    mcfg->allocation[0].end_bus_number =
+        PCIE_MMCFG_BUS(memmap[ecam_id].size - 1);
 
     build_header(linker, table_data, (void *)(table_data->data + mcfg_start),
                  "MCFG", table_data->len - mcfg_start, 1, NULL, NULL);
--
Quoted 1 line

2.19.1

Applied to target-arm.next, thanks.

-- PMM