qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qdev: hotplug: drop HotplugHandler.post_plug callback

as nvdimm acpi is okay to build fit when the nvdimm device
has not been 'realized'

Suggested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

authored by

Xiao Guangrong and committed by
Michael S. Tsirkin
c7f8d0f3 0d34fbab

+9 -62
+1 -5
hw/acpi/nvdimm.c
··· 38 38 GSList **list = opaque; 39 39 40 40 if (object_dynamic_cast(obj, TYPE_NVDIMM)) { 41 - DeviceState *dev = DEVICE(obj); 42 - 43 - if (dev->realized) { /* only realized NVDIMMs matter */ 44 - *list = g_slist_append(*list, DEVICE(obj)); 45 - } 41 + *list = g_slist_append(*list, DEVICE(obj)); 46 42 } 47 43 48 44 object_child_foreach(obj, nvdimm_plugged_device_list, opaque);
-11
hw/core/hotplug.c
··· 35 35 } 36 36 } 37 37 38 - void hotplug_handler_post_plug(HotplugHandler *plug_handler, 39 - DeviceState *plugged_dev, 40 - Error **errp) 41 - { 42 - HotplugHandlerClass *hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler); 43 - 44 - if (hdc->post_plug) { 45 - hdc->post_plug(plug_handler, plugged_dev, errp); 46 - } 47 - } 48 - 49 38 void hotplug_handler_unplug_request(HotplugHandler *plug_handler, 50 39 DeviceState *plugged_dev, 51 40 Error **errp)
+4 -16
hw/core/qdev.c
··· 945 945 goto child_realize_fail; 946 946 } 947 947 } 948 - 949 948 if (dev->hotplugged) { 950 949 device_reset(dev); 951 950 } 952 951 dev->pending_deleted_event = false; 953 - dev->realized = value; 954 - 955 - if (hotplug_ctrl) { 956 - hotplug_handler_post_plug(hotplug_ctrl, dev, &local_err); 957 - } 958 - 959 - if (local_err != NULL) { 960 - dev->realized = value; 961 - goto post_realize_fail; 962 - } 963 952 } else if (!value && dev->realized) { 964 953 Error **local_errp = NULL; 965 954 QLIST_FOREACH(bus, &dev->child_bus, sibling) { ··· 976 965 } 977 966 dev->pending_deleted_event = true; 978 967 DEVICE_LISTENER_CALL(unrealize, Reverse, dev); 968 + } 979 969 980 - if (local_err != NULL) { 981 - goto fail; 982 - } 983 - 984 - dev->realized = value; 970 + if (local_err != NULL) { 971 + goto fail; 985 972 } 986 973 974 + dev->realized = value; 987 975 return; 988 976 989 977 child_realize_fail:
+4 -19
hw/i386/pc.c
··· 1715 1715 goto out; 1716 1716 } 1717 1717 1718 + if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { 1719 + nvdimm_acpi_hotplug(&pcms->acpi_nvdimm_state); 1720 + } 1721 + 1718 1722 hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); 1719 1723 hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort); 1720 1724 out: 1721 1725 error_propagate(errp, local_err); 1722 - } 1723 - 1724 - static void pc_dimm_post_plug(HotplugHandler *hotplug_dev, 1725 - DeviceState *dev, Error **errp) 1726 - { 1727 - PCMachineState *pcms = PC_MACHINE(hotplug_dev); 1728 - 1729 - if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { 1730 - nvdimm_acpi_hotplug(&pcms->acpi_nvdimm_state); 1731 - } 1732 1726 } 1733 1727 1734 1728 static void pc_dimm_unplug_request(HotplugHandler *hotplug_dev, ··· 2005 1999 pc_dimm_plug(hotplug_dev, dev, errp); 2006 2000 } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { 2007 2001 pc_cpu_plug(hotplug_dev, dev, errp); 2008 - } 2009 - } 2010 - 2011 - static void pc_machine_device_post_plug_cb(HotplugHandler *hotplug_dev, 2012 - DeviceState *dev, Error **errp) 2013 - { 2014 - if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) { 2015 - pc_dimm_post_plug(hotplug_dev, dev, errp); 2016 2002 } 2017 2003 } 2018 2004 ··· 2322 2308 mc->reset = pc_machine_reset; 2323 2309 hc->pre_plug = pc_machine_device_pre_plug_cb; 2324 2310 hc->plug = pc_machine_device_plug_cb; 2325 - hc->post_plug = pc_machine_device_post_plug_cb; 2326 2311 hc->unplug_request = pc_machine_device_unplug_request_cb; 2327 2312 hc->unplug = pc_machine_device_unplug_cb; 2328 2313 nc->nmi_monitor_handler = x86_nmi;
-11
include/hw/hotplug.h
··· 47 47 * @parent: Opaque parent interface. 48 48 * @pre_plug: pre plug callback called at start of device.realize(true) 49 49 * @plug: plug callback called at end of device.realize(true). 50 - * @post_pug: post plug callback called after device is successfully plugged. 51 50 * @unplug_request: unplug request callback. 52 51 * Used as a means to initiate device unplug for devices that 53 52 * require asynchronous unplug handling. ··· 62 61 /* <public> */ 63 62 hotplug_fn pre_plug; 64 63 hotplug_fn plug; 65 - hotplug_fn post_plug; 66 64 hotplug_fn unplug_request; 67 65 hotplug_fn unplug; 68 66 } HotplugHandlerClass; ··· 84 82 void hotplug_handler_pre_plug(HotplugHandler *plug_handler, 85 83 DeviceState *plugged_dev, 86 84 Error **errp); 87 - 88 - /** 89 - * hotplug_handler_post_plug: 90 - * 91 - * Call #HotplugHandlerClass.post_plug callback of @plug_handler. 92 - */ 93 - void hotplug_handler_post_plug(HotplugHandler *plug_handler, 94 - DeviceState *plugged_dev, 95 - Error **errp); 96 85 97 86 /** 98 87 * hotplug_handler_unplug_request: