diff options
author | Daniel Henrique Barboza | 2020-04-13 22:36:28 +0200 |
---|---|---|
committer | David Gibson | 2020-05-07 03:10:50 +0200 |
commit | 70fc9cb0920fce3c2c0a090e69bf06d39f4b2362 (patch) | |
tree | 1036957b57378f567fe5592f39d2cc4f174b6658 /hw/ppc/spapr_nvdimm.c | |
parent | target/ppc: Add support for Radix partition-scoped translation (diff) | |
download | qemu-70fc9cb0920fce3c2c0a090e69bf06d39f4b2362.tar.gz qemu-70fc9cb0920fce3c2c0a090e69bf06d39f4b2362.tar.xz qemu-70fc9cb0920fce3c2c0a090e69bf06d39f4b2362.zip |
spapr_nvdimm.c: make 'label-size' mandatory
The pseries machine does not support NVDIMM modules without label.
Attempting to do so, even if the overall block size is aligned with
256MB, will seg fault the guest kernel during NVDIMM probe. This
can be avoided by forcing 'label-size' to always be present for
sPAPR NVDIMMs.
The verification was put before the alignment check because the
presence of label-size affects the alignment calculation, so
it's not optimal to warn the user about an alignment error,
then about the lack of label-size, then about a new alignment
error when the user sets a label-size.
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20200413203628.31636-1-danielhb413@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr_nvdimm.c')
-rw-r--r-- | hw/ppc/spapr_nvdimm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c index 25be8082d7..9abcdcc26b 100644 --- a/hw/ppc/spapr_nvdimm.c +++ b/hw/ppc/spapr_nvdimm.c @@ -37,6 +37,12 @@ void spapr_nvdimm_validate_opts(NVDIMMDevice *nvdimm, uint64_t size, QemuUUID uuid; int ret; + if (object_property_get_int(OBJECT(nvdimm), NVDIMM_LABEL_SIZE_PROP, + &error_abort) == 0) { + error_setg(errp, "NVDIMM device requires label-size to be set"); + return; + } + if (size % SPAPR_MINIMUM_SCM_BLOCK_SIZE) { error_setg(errp, "NVDIMM memory size excluding the label area" " must be a multiple of %" PRIu64 "MB", |