memory hotplug fixups when building with clang
cover memory hotplug fixups when building with clang
fixes build errors and warnings introduced by
memory hotplug series when building with clang
Igor Mammedov (4):
pc: acpi: do not hardcode preprocessor fixup! pc: initialize memory hotplug address space fixup! pc: add memory hotplug handler to PC_MACHINE fixup! pc: implement pc-dimm device abstraction
hw/i386/Makefile.objs | 2 +- hw/i386/pc.c | 6 +++--- include/hw/mem/pc-dimm.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
PATCH 1/4 pc: acpi: do not hardcode preprocessor
but use one provided by environment, in addition
force C style preprocessing so that 'gcc -E' or
"clang -E" wouldn't ignore .dsl files.
--- hw/i386/Makefile.objs | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/i386/Makefile.objs +1 -1
@@ -18,7 +18,7 @@ iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ ifdef IASL #IASL Present. Generate hex files from .dsl hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.dsl $(SRC_PATH)/scripts/acpi_extract_preprocess.py $(SRC_PATH)/scripts/acpi_extract.py - $(call quiet-command, cpp -P $(QEMU_DGFLAGS) $(QEMU_INCLUDES) $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") + $(call quiet-command, $(CPP) -x c -P $(QEMU_DGFLAGS) $(QEMU_INCLUDES) $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, " ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ," IASL $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract.py $*.lst > $*.off, " ACPI_EXTRACT $(TARGET_DIR)$*.off")
Signature · 1 line
1.7.1
PATCH 2/4 fixup! pc: initialize memory hotplug address space
In reply to Igor Mammedov--- hw/i386/pc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/i386/pc.c +1 -1
@@ -1261,7 +1261,7 @@ FWCfgState *pc_memory_init(MachineState *machine,if ((pcms->hotplug_memory_base + hotplug_mem_size) < hotplug_mem_size) { -error_report ("unsupported amount of maximum memory: %" PRIu64, +error_report ("unsupported amount of maximum memory: " RAM_ADDR_FMT , machine->maxram_size);exit (EXIT_FAILURE ); }
Signature · 1 line
1.7.1
PATCH 3/4 fixup! pc: add memory hotplug handler to PC_MACHINE
In reply to Igor Mammedov--- hw/i386/pc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
hw/i386/pc.c +2 -2
@@ -1564,8 +1564,8 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,PCDIMMDevice *dimm =PC_DIMM (dev);PCDIMMDeviceClass *ddc =PC_DIMM_GET_CLASS (dimm);MemoryRegion *mr = ddc->get_memory_region (dimm); -ram_addr_t addr =object_property_get_int (OBJECT (dimm),PC_DIMM_ADDR_PROP , - &local_err); +uint64_t addr =object_property_get_int (OBJECT (dimm),PC_DIMM_ADDR_PROP , + &local_err);if (local_err) { goto out; }
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 3/4] fixup! pc: add memory hotplug handler to PC_MACHINE
Quoted 1 line · Igor Mammedov
Signed-off-by Igor Mammedov <[email protected]>
Note that properties are all int64.
I think we need a new kind of "RAM offset" property that verifies that the supplied value is a valid
ram offset.
Quoted 21 lines
--- hw/i386/pc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)hw/i386/pc.c +2
-2@@ -1564,8 +1564,8 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,PCDIMMDevice *dimm =PC_DIMM (dev);PCDIMMDeviceClass *ddc =PC_DIMM_GET_CLASS (dimm);MemoryRegion *mr = ddc->get_memory_region (dimm); -ram_addr_t addr =object_property_get_int (OBJECT (dimm),PC_DIMM_ADDR_PROP , - &local_err); +uint64_t addr =object_property_get_int (OBJECT (dimm),PC_DIMM_ADDR_PROP , + &local_err);if (local_err) { goto out; }Signature · 1 line
1.7.1
PATCH 4/4 fixup! pc: implement pc-dimm device abstraction
In reply to Igor Mammedovfix typecheck error in DEFINE_PROP_UINT64 when building with with clang, on OS X ram_addr_t is uintptr_t with size 8 bytes but compiler still refuses to accept type_check() macro as valid.
It's still fixing consequences of how ram_addr_t is defined but it's safer this way than to change ram_addr_t to uint64_t unconditionally last minute.
TODO:
is to fix ram_addr_t on 32-bit host so that it could represent 64-bit guest addresses which is broken now if --disable-xen configure option was used.
--- include/hw/mem/pc-dimm.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/hw/mem/pc-dimm.h +1 -1
@@ -52,7 +52,7 @@ typedef struct PCDIMMDevice {DeviceState parent_obj;/* public */ -ram_addr_t addr; +uint64_t addr;uint32_t node;int32_t slot;HostMemoryBackend *hostmem;
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 4/4] fixup! pc: implement pc-dimm device abstraction
Quoted 23 lines · Igor Mammedov
fix typecheck error in
DEFINE_PROP_UINT64when building with with clang, on OS Xram_addr_tisuintptr_twith size 8 bytes but compiler still refuses to accepttype_check()macro as valid.It's still fixing consequences of how
ram_addr_tis defined but it's safer this way than to changeram_addr_ttouint64_tunconditionally last minute.TODO:
is to fixram_addr_ton 32-bit host so that it could represent 64-bit guest addresses which is broken now if --disable-xen configure option was used.Signed-off-by Igor Mammedov <[email protected]>--- include/hw/mem/pc-dimm.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/hw/mem/pc-dimm.h +0
-0
include/hw/mem/pc-dimm.h typedef struct PCDIMMDevice { · line 58
Quoted 8 lines
include/hw/mem/pc-dimm.h +1
-1@@ -52,7 +52,7 @@ typedef struct PCDIMMDevice {DeviceState parent_obj;/* public */ -ram_addr_t addr; +uint64_t addr;uint32_t node;int32_t slot;HostMemoryBackend *hostmem;
This needs some thought.
HACKING explicitly says:
Guest RAM memory offsets must use ram_addr_t, but only for RAM, it may not cover whole guest address space.
I think we need to validate addresses where they
are used/defined.
Quoted 2 lines
Signature · 1 line
1.7.1
Quoted 8 lines · Igor Mammedov
fixes build errors and warnings introduced by
memory hotplug series when building with clangIgor Mammedov (4):
pc: acpi: do not hardcode preprocessor fixup! pc: initialize memory hotplug address space fixup! pc: add memory hotplug handler toPC_MACHINEfixup! pc: implement pc-dimm device abstraction
I applied patches 1-3.
I think patch 4 can be improved on, let's
merge it on top.
Quoted 4 lines
hw/i386/Makefile.objs | 2 +- hw/i386/pc.c | 6 +++--- include/hw/mem/pc-dimm.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)