aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-08-06 09:59:05 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-08-06 09:59:05 +0100
commite3a4129abdccfc2fcc2fb9305339af41b07e8215 (patch)
tree847d4ee60ce56b1a056538582972f6ca13b0e1d7
parentf7502360397d291be04bc040e9f96c92ff2d8030 (diff)
parent1c707d6990eaf3db0c9dc4557bba5458977e9f8d (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pc, virtio: fixes A couple of last minute fixes. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Fri 03 Aug 2018 09:35:54 BST # gpg: using RSA key 281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: tests/acpi: update tables after memory hotplug changes pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size tests/acpi-test: update ACPI tables test blobs hw/acpi-build: Add a check for memory-less NUMA nodes vhost: check region type before casting Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/i386/acpi-build.c28
-rw-r--r--hw/virtio/vhost.c4
-rw-r--r--tests/acpi-test-data/pc/SRAT.dimmpxmbin472 -> 472 bytes
-rw-r--r--tests/acpi-test-data/pc/SRAT.memhpbin264 -> 264 bytes
-rw-r--r--tests/acpi-test-data/pc/SRAT.numamembin224 -> 224 bytes
-rw-r--r--tests/acpi-test-data/q35/SRAT.dimmpxmbin472 -> 472 bytes
-rw-r--r--tests/acpi-test-data/q35/SRAT.memhpbin264 -> 264 bytes
-rw-r--r--tests/acpi-test-data/q35/SRAT.numamembin224 -> 224 bytes
8 files changed, 19 insertions, 13 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 9e8350c55d..e1ee8ae9e0 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2269,7 +2269,16 @@ static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
numamem = acpi_data_push(table_data, sizeof *numamem);
if (!info) {
- build_srat_memory(numamem, cur, end - cur, default_node,
+ /*
+ * Entry is required for Windows to enable memory hotplug in OS
+ * and for Linux to enable SWIOTLB when booted with less than
+ * 4G of RAM. Windows works better if the entry sets proximity
+ * to the highest NUMA node in the machine at the end of the
+ * reserved space.
+ * Memory devices may override proximity set by this entry,
+ * providing _PXM method if necessary.
+ */
+ build_srat_memory(numamem, end - 1, 1, default_node,
MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
break;
}
@@ -2392,9 +2401,12 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
mem_len = next_base - pcms->below_4g_mem_size;
next_base = mem_base + mem_len;
}
- numamem = acpi_data_push(table_data, sizeof *numamem);
- build_srat_memory(numamem, mem_base, mem_len, i - 1,
- MEM_AFFINITY_ENABLED);
+
+ if (mem_len > 0) {
+ numamem = acpi_data_push(table_data, sizeof *numamem);
+ build_srat_memory(numamem, mem_base, mem_len, i - 1,
+ MEM_AFFINITY_ENABLED);
+ }
}
slots = (table_data->len - numa_start) / sizeof *numamem;
for (; slots < pcms->numa_nodes + 2; slots++) {
@@ -2402,14 +2414,6 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
}
- /*
- * Entry is required for Windows to enable memory hotplug in OS
- * and for Linux to enable SWIOTLB when booted with less than
- * 4G of RAM. Windows works better if the entry sets proximity
- * to the highest NUMA node in the machine.
- * Memory devices may override proximity set by this entry,
- * providing _PXM method if necessary.
- */
if (hotplugabble_address_space_size) {
build_srat_hotpluggable_memory(table_data, machine->device_memory->base,
hotplugabble_address_space_size,
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index b129cb9ddd..d4cb5894a8 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -663,12 +663,14 @@ static void vhost_iommu_region_add(MemoryListener *listener,
struct vhost_iommu *iommu;
Int128 end;
int iommu_idx;
- IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+ IOMMUMemoryRegion *iommu_mr;
if (!memory_region_is_iommu(section->mr)) {
return;
}
+ iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+
iommu = g_malloc0(sizeof(*iommu));
end = int128_add(int128_make64(section->offset_within_region),
section->size);
diff --git a/tests/acpi-test-data/pc/SRAT.dimmpxm b/tests/acpi-test-data/pc/SRAT.dimmpxm
index 3b10a607d5..5aa6f693ef 100644
--- a/tests/acpi-test-data/pc/SRAT.dimmpxm
+++ b/tests/acpi-test-data/pc/SRAT.dimmpxm
Binary files differ
diff --git a/tests/acpi-test-data/pc/SRAT.memhp b/tests/acpi-test-data/pc/SRAT.memhp
index e508b4ae3c..5de8a100a4 100644
--- a/tests/acpi-test-data/pc/SRAT.memhp
+++ b/tests/acpi-test-data/pc/SRAT.memhp
Binary files differ
diff --git a/tests/acpi-test-data/pc/SRAT.numamem b/tests/acpi-test-data/pc/SRAT.numamem
index dbc595d9cb..119922f497 100644
--- a/tests/acpi-test-data/pc/SRAT.numamem
+++ b/tests/acpi-test-data/pc/SRAT.numamem
Binary files differ
diff --git a/tests/acpi-test-data/q35/SRAT.dimmpxm b/tests/acpi-test-data/q35/SRAT.dimmpxm
index 3b10a607d5..5aa6f693ef 100644
--- a/tests/acpi-test-data/q35/SRAT.dimmpxm
+++ b/tests/acpi-test-data/q35/SRAT.dimmpxm
Binary files differ
diff --git a/tests/acpi-test-data/q35/SRAT.memhp b/tests/acpi-test-data/q35/SRAT.memhp
index e508b4ae3c..5de8a100a4 100644
--- a/tests/acpi-test-data/q35/SRAT.memhp
+++ b/tests/acpi-test-data/q35/SRAT.memhp
Binary files differ
diff --git a/tests/acpi-test-data/q35/SRAT.numamem b/tests/acpi-test-data/q35/SRAT.numamem
index dbc595d9cb..119922f497 100644
--- a/tests/acpi-test-data/q35/SRAT.numamem
+++ b/tests/acpi-test-data/q35/SRAT.numamem
Binary files differ