* fixes for Alpine and SuSE

* fix crash when hot-plugging nvdimm on older machine types
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJcrMmTAAoJEL/70l94x66DrZYH/jHgRDg+8OucuAdobG5UAaMR
 24doCVFvblyjYvB1+GPw3lsU7B1BOQ7ihPGmAGV5hEhZIequYfM8aC2Fm5ZvHEwv
 rFtMiau5hYcLSkG6iQvNeEsUajZoD5tJJ4X437R5kr4IdvL2DIRrhGFEsAHi/obf
 9ZV5klaT3A87CEO9dIG22Or8e/qRcVUN3LKQ2ZZAv6Ij05g7nf+mwtolKbFUTtG4
 xxog0T05fREQXFmjLWEwl2QyCF11/dVOBeYwwRdppd8a43avBoi24lOc4NKa+KXs
 WWOkWK7EPgXVQ99TVmuoIvt4mJNGChl8ubfPPUK7SykO2iuLqv4CE9PlCJK27IE=
 =FfJt
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* fixes for Alpine and SuSE
* fix crash when hot-plugging nvdimm on older machine types

# gpg: Signature made Tue 09 Apr 2019 17:34:27 BST
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream:
  tests: Make check-block a phony target
  hw/i386/pc: Fix crash when hot-plugging nvdimm on older machine types
  include/qemu/bswap.h: Use __builtin_memcpy() in accessor functions
  roms: Allow passing configure options to the EDK2 build tools
  roms: Rename the EFIROM variable to avoid clashing with iPXE

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-04-09 17:36:00 +01:00
commit 4b9a21c344
4 changed files with 42 additions and 18 deletions

View File

@ -2078,6 +2078,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
const MachineState *ms = MACHINE(hotplug_dev); const MachineState *ms = MACHINE(hotplug_dev);
const bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); const bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
const uint64_t legacy_align = TARGET_PAGE_SIZE; const uint64_t legacy_align = TARGET_PAGE_SIZE;
Error *local_err = NULL;
/* /*
* When -no-acpi is used with Q35 machine type, no ACPI is built, * When -no-acpi is used with Q35 machine type, no ACPI is built,
@ -2090,13 +2091,17 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
return; return;
} }
hotplug_handler_pre_plug(pcms->acpi_dev, dev, errp);
if (is_nvdimm && !ms->nvdimms_state->is_enabled) { if (is_nvdimm && !ms->nvdimms_state->is_enabled) {
error_setg(errp, "nvdimm is not enabled: missing 'nvdimm' in '-M'"); error_setg(errp, "nvdimm is not enabled: missing 'nvdimm' in '-M'");
return; return;
} }
hotplug_handler_pre_plug(pcms->acpi_dev, dev, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
pc_dimm_pre_plug(PC_DIMM(dev), MACHINE(hotplug_dev), pc_dimm_pre_plug(PC_DIMM(dev), MACHINE(hotplug_dev),
pcmc->enforce_aligned_dimm ? NULL : &legacy_align, errp); pcmc->enforce_aligned_dimm ? NULL : &legacy_align, errp);
} }

View File

@ -316,51 +316,57 @@ static inline void stb_p(void *ptr, uint8_t v)
*(uint8_t *)ptr = v; *(uint8_t *)ptr = v;
} }
/* Any compiler worth its salt will turn these memcpy into native unaligned /*
operations. Thus we don't need to play games with packed attributes, or * Any compiler worth its salt will turn these memcpy into native unaligned
inline byte-by-byte stores. */ * operations. Thus we don't need to play games with packed attributes, or
* inline byte-by-byte stores.
* Some compilation environments (eg some fortify-source implementations)
* may intercept memcpy() in a way that defeats the compiler optimization,
* though, so we use __builtin_memcpy() to give ourselves the best chance
* of good performance.
*/
static inline int lduw_he_p(const void *ptr) static inline int lduw_he_p(const void *ptr)
{ {
uint16_t r; uint16_t r;
memcpy(&r, ptr, sizeof(r)); __builtin_memcpy(&r, ptr, sizeof(r));
return r; return r;
} }
static inline int ldsw_he_p(const void *ptr) static inline int ldsw_he_p(const void *ptr)
{ {
int16_t r; int16_t r;
memcpy(&r, ptr, sizeof(r)); __builtin_memcpy(&r, ptr, sizeof(r));
return r; return r;
} }
static inline void stw_he_p(void *ptr, uint16_t v) static inline void stw_he_p(void *ptr, uint16_t v)
{ {
memcpy(ptr, &v, sizeof(v)); __builtin_memcpy(ptr, &v, sizeof(v));
} }
static inline int ldl_he_p(const void *ptr) static inline int ldl_he_p(const void *ptr)
{ {
int32_t r; int32_t r;
memcpy(&r, ptr, sizeof(r)); __builtin_memcpy(&r, ptr, sizeof(r));
return r; return r;
} }
static inline void stl_he_p(void *ptr, uint32_t v) static inline void stl_he_p(void *ptr, uint32_t v)
{ {
memcpy(ptr, &v, sizeof(v)); __builtin_memcpy(ptr, &v, sizeof(v));
} }
static inline uint64_t ldq_he_p(const void *ptr) static inline uint64_t ldq_he_p(const void *ptr)
{ {
uint64_t r; uint64_t r;
memcpy(&r, ptr, sizeof(r)); __builtin_memcpy(&r, ptr, sizeof(r));
return r; return r;
} }
static inline void stq_he_p(void *ptr, uint64_t v) static inline void stq_he_p(void *ptr, uint64_t v)
{ {
memcpy(ptr, &v, sizeof(v)); __builtin_memcpy(ptr, &v, sizeof(v));
} }
static inline int lduw_le_p(const void *ptr) static inline int lduw_le_p(const void *ptr)

View File

@ -47,7 +47,7 @@ SEABIOS_EXTRAVERSION="-prebuilt.qemu.org"
# We need that to combine multiple images (legacy bios, # We need that to combine multiple images (legacy bios,
# efi ia32, efi x64) into a single rom binary. # efi ia32, efi x64) into a single rom binary.
# #
EFIROM = edk2/BaseTools/Source/C/bin/EfiRom EDK2_EFIROM = edk2/BaseTools/Source/C/bin/EfiRom
default: default:
@echo "nothing is build by default" @echo "nothing is build by default"
@ -102,8 +102,8 @@ pxe-rom-%: build-pxe-roms
efirom: $(patsubst %,efi-rom-%,$(pxerom_variants)) efirom: $(patsubst %,efi-rom-%,$(pxerom_variants))
efi-rom-%: build-pxe-roms build-efi-roms $(EFIROM) efi-rom-%: build-pxe-roms build-efi-roms $(EDK2_EFIROM)
$(EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \ $(EDK2_EFIROM) -f "0x$(VID)" -i "0x$(DID)" -l 0x02 \
-b ipxe/src/bin/$(VID)$(DID).rom \ -b ipxe/src/bin/$(VID)$(DID).rom \
-ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \ -ec ipxe/src/bin-i386-efi/$(VID)$(DID).efidrv \
-ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \ -ec ipxe/src/bin-x86_64-efi/$(VID)$(DID).efidrv \
@ -120,8 +120,21 @@ build-efi-roms: build-pxe-roms
$(patsubst %,bin-i386-efi/%.efidrv,$(pxerom_targets)) \ $(patsubst %,bin-i386-efi/%.efidrv,$(pxerom_targets)) \
$(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets)) $(patsubst %,bin-x86_64-efi/%.efidrv,$(pxerom_targets))
$(EFIROM): # Build scripts can pass compiler/linker flags to the EDK2 build tools
$(MAKE) -C edk2/BaseTools # via the EDK2_BASETOOLS_OPTFLAGS (CPPFLAGS and CFLAGS) and
# EDK2_BASETOOLS_LDFLAGS (LDFLAGS) environment variables.
#
# Example:
#
# make -C roms \
# EDK2_BASETOOLS_OPTFLAGS='...' \
# EDK2_BASETOOLS_LDFLAGS='...' \
# efirom
#
$(EDK2_EFIROM):
$(MAKE) -C edk2/BaseTools \
EXTRA_OPTFLAGS='$(EDK2_BASETOOLS_OPTFLAGS)' \
EXTRA_LDFLAGS='$(EDK2_BASETOOLS_LDFLAGS)'
slof: slof:
$(MAKE) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu $(MAKE) -C SLOF CROSS=$(powerpc64_cross_prefix) qemu

View File

@ -1164,7 +1164,7 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR)
# Consolidated targets # Consolidated targets
.PHONY: check-qapi-schema check-qtest check-unit check check-clean .PHONY: check-block check-qapi-schema check-qtest check-unit check check-clean
check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) check-tests/qapi-schema/doc-good.texi check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) check-tests/qapi-schema/doc-good.texi
check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS)) check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
check-block: $(patsubst %,check-%, $(check-block-y)) check-block: $(patsubst %,check-%, $(check-block-y))