summaryrefslogtreecommitdiffstats
path: root/hw/mem
diff options
context:
space:
mode:
authorRichard Henderson2021-11-15 21:56:15 +0100
committerRichard Henderson2021-11-15 21:56:15 +0100
commit757b8dd4e970038538b2e027120ab4594bebdebc (patch)
treeb70c7fa0d161d12a3278e7d7153dca7f0d5d14fb /hw/mem
parentMerge tag 'pull-ppc-20211112' of https://github.com/legoater/qemu into staging (diff)
parentpcie: expire pending delete (diff)
downloadqemu-757b8dd4e970038538b2e027120ab4594bebdebc.tar.gz
qemu-757b8dd4e970038538b2e027120ab4594bebdebc.tar.xz
qemu-757b8dd4e970038538b2e027120ab4594bebdebc.zip
Merge tag 'for_upstream' of git://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
pci,pc,virtio: bugfixes pci power management fixes acpi hotplug fixes misc other fixes Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Mon 15 Nov 2021 05:15:09 PM CET # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] * tag 'for_upstream' of git://git.kernel.org/pub/scm/virt/kvm/mst/qemu: pcie: expire pending delete pcie: fast unplug when slot power is off pcie: factor out pcie_cap_slot_unplug() pcie: add power indicator blink check pcie: implement slot power control for pcie root ports pci: implement power state vdpa: Check for existence of opts.vhostdev vdpa: Replace qemu_open_old by qemu_open at virtio: use virtio accessor to access packed event virtio: use virtio accessor to access packed descriptor flags tests: bios-tables-test update expected blobs hw/i386/acpi-build: Deny control on PCIe Native Hot-plug in _OSC bios-tables-test: Allow changes in DSDT ACPI tables hw/acpi/ich9: Add compat prop to keep HPC bit set for 6.1 machine type pcie: rename 'native-hotplug' to 'x-native-hotplug' hw/mem/pc-dimm: Restrict NUMA-specific code to NUMA machines vhost: Fix last vq queue index of devices with no cvq vhost: Rename last_index to vq_index_end softmmu/qdev-monitor: fix use-after-free in qdev_set_id() net/vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs() Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'hw/mem')
-rw-r--r--hw/mem/pc-dimm.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index a3a2560301..48b913aba6 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -181,7 +181,21 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp)
PCDIMMDevice *dimm = PC_DIMM(dev);
PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
MachineState *ms = MACHINE(qdev_get_machine());
- int nb_numa_nodes = ms->numa_state->num_nodes;
+
+ if (ms->numa_state) {
+ int nb_numa_nodes = ms->numa_state->num_nodes;
+
+ if (((nb_numa_nodes > 0) && (dimm->node >= nb_numa_nodes)) ||
+ (!nb_numa_nodes && dimm->node)) {
+ error_setg(errp, "'DIMM property " PC_DIMM_NODE_PROP " has value %"
+ PRIu32 "' which exceeds the number of numa nodes: %d",
+ dimm->node, nb_numa_nodes ? nb_numa_nodes : 1);
+ return;
+ }
+ } else if (dimm->node > 0) {
+ error_setg(errp, "machine doesn't support NUMA");
+ return;
+ }
if (!dimm->hostmem) {
error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set");
@@ -191,13 +205,6 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp)
object_get_canonical_path_component(OBJECT(dimm->hostmem)));
return;
}
- if (((nb_numa_nodes > 0) && (dimm->node >= nb_numa_nodes)) ||
- (!nb_numa_nodes && dimm->node)) {
- error_setg(errp, "'DIMM property " PC_DIMM_NODE_PROP " has value %"
- PRIu32 "' which exceeds the number of numa nodes: %d",
- dimm->node, nb_numa_nodes ? nb_numa_nodes : 1);
- return;
- }
if (ddc->realize) {
ddc->realize(dimm, errp);