mirror of https://github.com/xemu-project/xemu.git
hw/mem/memory-device: Remove legacy_align from memory_device_pre_plug()
'legacy_align' is always NULL, remove it, simplifying memory_device_pre_plug(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20240617071118.60464-16-philmd@linaro.org>
This commit is contained in:
parent
d4fdb05b0e
commit
0e0bf77d28
|
@ -1395,8 +1395,7 @@ static void pc_hv_balloon_pre_plug(HotplugHandler *hotplug_dev,
|
||||||
{
|
{
|
||||||
/* The vmbus handler has no hotplug handler; we should never end up here. */
|
/* The vmbus handler has no hotplug handler; we should never end up here. */
|
||||||
g_assert(!dev->hotplugged);
|
g_assert(!dev->hotplugged);
|
||||||
memory_device_pre_plug(MEMORY_DEVICE(dev), MACHINE(hotplug_dev), NULL,
|
memory_device_pre_plug(MEMORY_DEVICE(dev), MACHINE(hotplug_dev), errp);
|
||||||
errp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pc_hv_balloon_plug(HotplugHandler *hotplug_dev,
|
static void pc_hv_balloon_plug(HotplugHandler *hotplug_dev,
|
||||||
|
|
|
@ -345,7 +345,7 @@ uint64_t get_plugged_memory_size(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
|
void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
|
||||||
const uint64_t *legacy_align, Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(md);
|
const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(md);
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
@ -388,14 +388,10 @@ void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (legacy_align) {
|
if (mdc->get_min_alignment) {
|
||||||
align = *legacy_align;
|
align = mdc->get_min_alignment(md);
|
||||||
} else {
|
|
||||||
if (mdc->get_min_alignment) {
|
|
||||||
align = mdc->get_min_alignment(md);
|
|
||||||
}
|
|
||||||
align = MAX(align, memory_region_get_alignment(mr));
|
|
||||||
}
|
}
|
||||||
|
align = MAX(align, memory_region_get_alignment(mr));
|
||||||
addr = mdc->get_addr(md);
|
addr = mdc->get_addr(md);
|
||||||
addr = memory_device_get_free_addr(ms, !addr ? NULL : &addr, align,
|
addr = memory_device_get_free_addr(ms, !addr ? NULL : &addr, align,
|
||||||
memory_region_size(mr), &local_err);
|
memory_region_size(mr), &local_err);
|
||||||
|
|
|
@ -69,7 +69,7 @@ void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp)
|
||||||
&error_abort);
|
&error_abort);
|
||||||
trace_mhp_pc_dimm_assigned_slot(slot);
|
trace_mhp_pc_dimm_assigned_slot(slot);
|
||||||
|
|
||||||
memory_device_pre_plug(MEMORY_DEVICE(dimm), machine, NULL, errp);
|
memory_device_pre_plug(MEMORY_DEVICE(dimm), machine, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine)
|
void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine)
|
||||||
|
|
|
@ -37,7 +37,7 @@ void virtio_md_pci_pre_plug(VirtIOMDPCI *vmd, MachineState *ms, Error **errp)
|
||||||
* First, see if we can plug this memory device at all. If that
|
* First, see if we can plug this memory device at all. If that
|
||||||
* succeeds, branch of to the actual hotplug handler.
|
* succeeds, branch of to the actual hotplug handler.
|
||||||
*/
|
*/
|
||||||
memory_device_pre_plug(md, ms, NULL, &local_err);
|
memory_device_pre_plug(md, ms, &local_err);
|
||||||
if (!local_err && bus_handler) {
|
if (!local_err && bus_handler) {
|
||||||
hotplug_handler_pre_plug(bus_handler, dev, &local_err);
|
hotplug_handler_pre_plug(bus_handler, dev, &local_err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ uint64_t get_plugged_memory_size(void);
|
||||||
unsigned int memory_devices_get_reserved_memslots(void);
|
unsigned int memory_devices_get_reserved_memslots(void);
|
||||||
bool memory_devices_memslot_auto_decision_active(void);
|
bool memory_devices_memslot_auto_decision_active(void);
|
||||||
void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
|
void memory_device_pre_plug(MemoryDeviceState *md, MachineState *ms,
|
||||||
const uint64_t *legacy_align, Error **errp);
|
Error **errp);
|
||||||
void memory_device_plug(MemoryDeviceState *md, MachineState *ms);
|
void memory_device_plug(MemoryDeviceState *md, MachineState *ms);
|
||||||
void memory_device_unplug(MemoryDeviceState *md, MachineState *ms);
|
void memory_device_unplug(MemoryDeviceState *md, MachineState *ms);
|
||||||
uint64_t memory_device_get_region_size(const MemoryDeviceState *md,
|
uint64_t memory_device_get_region_size(const MemoryDeviceState *md,
|
||||||
|
|
Loading…
Reference in New Issue