diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/block/nbd.h | 3 | ||||
-rw-r--r-- | include/crypto/block.h | 6 | ||||
-rw-r--r-- | include/crypto/random.h | 9 | ||||
-rw-r--r-- | include/exec/ram_addr.h | 13 | ||||
-rw-r--r-- | include/hw/acpi/acpi-defs.h | 77 | ||||
-rw-r--r-- | include/hw/i386/pc.h | 6 | ||||
-rw-r--r-- | include/hw/pci/pcie_aer.h | 4 | ||||
-rw-r--r-- | include/hw/s390x/3270-ccw.h | 53 | ||||
-rw-r--r-- | include/hw/s390x/css.h | 2 | ||||
-rw-r--r-- | include/hw/s390x/s390-virtio-ccw.h | 1 | ||||
-rw-r--r-- | include/hw/virtio/vhost-scsi-common.h | 48 | ||||
-rw-r--r-- | include/hw/virtio/vhost-scsi.h | 11 | ||||
-rw-r--r-- | include/hw/virtio/virtio-scsi.h | 2 | ||||
-rw-r--r-- | include/io/channel-socket.h | 4 | ||||
-rw-r--r-- | include/migration/cpu.h | 7 | ||||
-rw-r--r-- | include/migration/migration.h | 3 | ||||
-rw-r--r-- | include/migration/postcopy-ram.h | 94 | ||||
-rw-r--r-- | include/migration/vmstate.h | 18 | ||||
-rw-r--r-- | include/qapi/clone-visitor.h | 14 | ||||
-rw-r--r-- | include/qapi/qmp/qdict.h | 8 | ||||
-rw-r--r-- | include/qapi/qmp/qlist.h | 8 | ||||
-rw-r--r-- | include/qapi/visitor.h | 6 | ||||
-rw-r--r-- | include/qemu/sockets.h | 16 | ||||
-rw-r--r-- | include/sysemu/char.h | 20 | ||||
-rw-r--r-- | include/sysemu/dump.h | 1 | ||||
-rw-r--r-- | include/sysemu/sysemu.h | 5 |
26 files changed, 257 insertions, 182 deletions
diff --git a/include/block/nbd.h b/include/block/nbd.h index 3e373f0498..0ed077502e 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -164,4 +164,7 @@ void nbd_client_new(NBDExport *exp, void nbd_client_get(NBDClient *client); void nbd_client_put(NBDClient *client); +void nbd_server_start(SocketAddress *addr, const char *tls_creds, + Error **errp); + #endif diff --git a/include/crypto/block.h b/include/crypto/block.h index 4a053a3ffa..013a435f1b 100644 --- a/include/crypto/block.h +++ b/include/crypto/block.h @@ -30,22 +30,22 @@ typedef struct QCryptoBlock QCryptoBlock; * and QCryptoBlockOpenOptions in qapi/crypto.json */ typedef ssize_t (*QCryptoBlockReadFunc)(QCryptoBlock *block, - void *opaque, size_t offset, uint8_t *buf, size_t buflen, + void *opaque, Error **errp); typedef ssize_t (*QCryptoBlockInitFunc)(QCryptoBlock *block, - void *opaque, size_t headerlen, + void *opaque, Error **errp); typedef ssize_t (*QCryptoBlockWriteFunc)(QCryptoBlock *block, - void *opaque, size_t offset, const uint8_t *buf, size_t buflen, + void *opaque, Error **errp); /** diff --git a/include/crypto/random.h b/include/crypto/random.h index a101353202..a07229ce96 100644 --- a/include/crypto/random.h +++ b/include/crypto/random.h @@ -40,5 +40,14 @@ int qcrypto_random_bytes(uint8_t *buf, size_t buflen, Error **errp); +/** + * qcrypto_random_init: + * @errp: pointer to a NULL-initialized error object + * + * Initializes the handles used by qcrypto_random_bytes + * + * Returns 0 on success, -1 on error + */ +int qcrypto_random_init(Error **errp); #endif /* QCRYPTO_RANDOM_H */ diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index dbe2f08d47..140efa840c 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -39,6 +39,14 @@ struct RAMBlock { QLIST_HEAD(, RAMBlockNotifier) ramblock_notifiers; int fd; size_t page_size; + /* dirty bitmap used during migration */ + unsigned long *bmap; + /* bitmap of pages that haven't been sent even once + * only maintained and used in postcopy at the moment + * where it's used to send the dirtymap at the start + * of the postcopy phase + */ + unsigned long *unsentmap; }; static inline bool offset_in_ramblock(RAMBlock *b, ram_addr_t offset) @@ -360,16 +368,15 @@ static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, static inline -uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned long *dest, - RAMBlock *rb, +uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb, ram_addr_t start, ram_addr_t length, uint64_t *real_dirty_pages) { ram_addr_t addr; - start = rb->offset + start; unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS); uint64_t num_dirty = 0; + unsigned long *dest = rb->bmap; /* start address is aligned at the start of a word? */ if (((page * BITS_PER_LONG) << TARGET_PAGE_BITS) == start) { diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index 4cc3630e61..293ee4524b 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -131,17 +131,37 @@ typedef struct AcpiTableHeader AcpiTableHeader; uint8_t duty_width; /* Bit width of duty cycle field in p_cnt reg */ \ uint8_t day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ uint8_t mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ - uint8_t century; /* Index to century in RTC CMOS RAM */ - -struct AcpiFadtDescriptorRev1 -{ - ACPI_FADT_COMMON_DEF - uint8_t reserved4; /* Reserved */ - uint8_t reserved4a; /* Reserved */ - uint8_t reserved4b; /* Reserved */ - uint32_t flags; -} QEMU_PACKED; -typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1; + uint8_t century; /* Index to century in RTC CMOS RAM */ \ + /* IA-PC Boot Architecture Flags (see below for individual flags) */ \ + uint16_t boot_flags; \ + uint8_t reserved; /* Reserved, must be zero */ \ + /* Miscellaneous flag bits (see below for individual flags) */ \ + uint32_t flags; \ + /* 64-bit address of the Reset register */ \ + struct AcpiGenericAddress reset_register; \ + /* Value to write to the reset_register port to reset the system */ \ + uint8_t reset_value; \ + /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ \ + uint16_t arm_boot_flags; \ + uint8_t minor_revision; /* FADT Minor Revision (ACPI 5.1) */ \ + uint64_t Xfacs; /* 64-bit physical address of FACS */ \ + uint64_t Xdsdt; /* 64-bit physical address of DSDT */ \ + /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ \ + struct AcpiGenericAddress xpm1a_event_block; \ + /* 64-bit Extended Power Mgt 1b Event Reg Blk address */ \ + struct AcpiGenericAddress xpm1b_event_block; \ + /* 64-bit Extended Power Mgt 1a Control Reg Blk address */ \ + struct AcpiGenericAddress xpm1a_control_block; \ + /* 64-bit Extended Power Mgt 1b Control Reg Blk address */ \ + struct AcpiGenericAddress xpm1b_control_block; \ + /* 64-bit Extended Power Mgt 2 Control Reg Blk address */ \ + struct AcpiGenericAddress xpm2_control_block; \ + /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ \ + struct AcpiGenericAddress xpm_timer_block; \ + /* 64-bit Extended General Purpose Event 0 Reg Blk address */ \ + struct AcpiGenericAddress xgpe0_block; \ + /* 64-bit Extended General Purpose Event 1 Reg Blk address */ \ + struct AcpiGenericAddress xgpe1_block; \ struct AcpiGenericAddress { uint8_t space_id; /* Address space where struct or register exists */ @@ -151,38 +171,13 @@ struct AcpiGenericAddress { uint64_t address; /* 64-bit address of struct or register */ } QEMU_PACKED; +struct AcpiFadtDescriptorRev3 { + ACPI_FADT_COMMON_DEF +} QEMU_PACKED; +typedef struct AcpiFadtDescriptorRev3 AcpiFadtDescriptorRev3; + struct AcpiFadtDescriptorRev5_1 { ACPI_FADT_COMMON_DEF - /* IA-PC Boot Architecture Flags (see below for individual flags) */ - uint16_t boot_flags; - uint8_t reserved; /* Reserved, must be zero */ - /* Miscellaneous flag bits (see below for individual flags) */ - uint32_t flags; - /* 64-bit address of the Reset register */ - struct AcpiGenericAddress reset_register; - /* Value to write to the reset_register port to reset the system */ - uint8_t reset_value; - /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ - uint16_t arm_boot_flags; - uint8_t minor_revision; /* FADT Minor Revision (ACPI 5.1) */ - uint64_t Xfacs; /* 64-bit physical address of FACS */ - uint64_t Xdsdt; /* 64-bit physical address of DSDT */ - /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ - struct AcpiGenericAddress xpm1a_event_block; - /* 64-bit Extended Power Mgt 1b Event Reg Blk address */ - struct AcpiGenericAddress xpm1b_event_block; - /* 64-bit Extended Power Mgt 1a Control Reg Blk address */ - struct AcpiGenericAddress xpm1a_control_block; - /* 64-bit Extended Power Mgt 1b Control Reg Blk address */ - struct AcpiGenericAddress xpm1b_control_block; - /* 64-bit Extended Power Mgt 2 Control Reg Blk address */ - struct AcpiGenericAddress xpm2_control_block; - /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ - struct AcpiGenericAddress xpm_timer_block; - /* 64-bit Extended General Purpose Event 0 Reg Blk address */ - struct AcpiGenericAddress xgpe0_block; - /* 64-bit Extended General Purpose Event 1 Reg Blk address */ - struct AcpiGenericAddress xgpe1_block; /* 64-bit Sleep Control register (ACPI 5.0) */ struct AcpiGenericAddress sleep_control; /* 64-bit Sleep Status register (ACPI 5.0) */ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index f278b3ae89..416aaa56ea 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -303,6 +303,12 @@ typedef struct PCII440FXState PCII440FXState; #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" +/* + * Reset Control Register: PCI-accessible ISA-Compatible Register at address + * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). + */ +#define RCR_IOPORT 0xcf9 + PCIBus *i440fx_init(const char *host_type, const char *pci_type, PCII440FXState **pi440fx_state, int *piix_devfn, ISABus **isa_bus, qemu_irq *pic, diff --git a/include/hw/pci/pcie_aer.h b/include/hw/pci/pcie_aer.h index 526802bd31..729a9439c8 100644 --- a/include/hw/pci/pcie_aer.h +++ b/include/hw/pci/pcie_aer.h @@ -100,8 +100,4 @@ void pcie_aer_root_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len, uint32_t root_cmd_prev); -/* error injection */ -int pcie_aer_inject_error(PCIDevice *dev, const PCIEAERErr *err); -void pcie_aer_msg(PCIDevice *dev, const PCIEAERMsg *msg); - #endif /* QEMU_PCIE_AER_H */ diff --git a/include/hw/s390x/3270-ccw.h b/include/hw/s390x/3270-ccw.h new file mode 100644 index 0000000000..46bee2533c --- /dev/null +++ b/include/hw/s390x/3270-ccw.h @@ -0,0 +1,53 @@ +/* + * Emulated ccw-attached 3270 definitions + * + * Copyright 2017 IBM Corp. + * Author(s): Yang Chen <bjcyang@linux.vnet.ibm.com> + * Jing Liu <liujbjl@linux.vnet.ibm.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level + * directory. + */ + +#ifndef HW_S390X_3270_CCW_H +#define HW_S390X_3270_CCW_H + +#include "hw/sysbus.h" +#include "hw/s390x/css.h" +#include "hw/s390x/ccw-device.h" + +#define EMULATED_CCW_3270_CU_TYPE 0x3270 +#define EMULATED_CCW_3270_CHPID_TYPE 0x1a + +#define TYPE_EMULATED_CCW_3270 "emulated-ccw-3270" + +/* Local Channel Commands */ +#define TC_WRITE 0x01 /* Write */ +#define TC_RDBUF 0x02 /* Read buffer */ +#define TC_EWRITE 0x05 /* Erase write */ +#define TC_READMOD 0x06 /* Read modified */ +#define TC_EWRITEA 0x0d /* Erase write alternate */ +#define TC_WRITESF 0x11 /* Write structured field */ + +#define EMULATED_CCW_3270(obj) \ + OBJECT_CHECK(EmulatedCcw3270Device, (obj), TYPE_EMULATED_CCW_3270) +#define EMULATED_CCW_3270_CLASS(klass) \ + OBJECT_CLASS_CHECK(EmulatedCcw3270Class, (klass), TYPE_EMULATED_CCW_3270) +#define EMULATED_CCW_3270_GET_CLASS(obj) \ + OBJECT_GET_CLASS(EmulatedCcw3270Class, (obj), TYPE_EMULATED_CCW_3270) + +typedef struct EmulatedCcw3270Device { + CcwDevice parent_obj; +} EmulatedCcw3270Device; + +typedef struct EmulatedCcw3270Class { + CCWDeviceClass parent_class; + + void (*init)(EmulatedCcw3270Device *, Error **); + int (*read_payload_3270)(EmulatedCcw3270Device *, uint32_t, uint16_t); + int (*write_payload_3270)(EmulatedCcw3270Device *, uint8_t, uint32_t, + uint16_t); +} EmulatedCcw3270Class; + +#endif diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index f1f0d7f07a..e61fa74d9b 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -28,6 +28,7 @@ #define MAX_CIWS 62 #define VIRTUAL_CSSID 0xfe +#define VIRTIO_CCW_CHPID 0 /* used by convention */ typedef struct CIW { uint8_t type; @@ -115,6 +116,7 @@ bool css_devno_used(uint8_t cssid, uint8_t ssid, uint16_t devno); void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid, uint16_t devno, SubchDev *sch); void css_sch_build_virtual_schib(SubchDev *sch, uint8_t chpid, uint8_t type); +unsigned int css_find_free_chpid(uint8_t cssid); uint16_t css_build_subchannel_id(SubchDev *sch); void css_reset(void); void css_reset_sch(SubchDev *sch); diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h index 6ecae00386..7b8a3e4d74 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -28,6 +28,7 @@ typedef struct S390CcwMachineState { /*< public >*/ bool aes_key_wrap; bool dea_key_wrap; + uint8_t loadparm[8]; } S390CcwMachineState; typedef struct S390CcwMachineClass { diff --git a/include/hw/virtio/vhost-scsi-common.h b/include/hw/virtio/vhost-scsi-common.h new file mode 100644 index 0000000000..4553be4bc3 --- /dev/null +++ b/include/hw/virtio/vhost-scsi-common.h @@ -0,0 +1,48 @@ +/* + * vhost_scsi host device + * + * Copyright (c) 2016 Nutanix Inc. All rights reserved. + * + * Author: + * Felipe Franciosi <felipe@nutanix.com> + * + * This work is licensed under the terms of the GNU LGPL, version 2 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef VHOST_SCSI_COMMON_H +#define VHOST_SCSI_COMMON_H + +#include "qemu-common.h" +#include "hw/qdev.h" +#include "hw/virtio/virtio-scsi.h" +#include "hw/virtio/vhost.h" +#include "hw/fw-path-provider.h" + +#define TYPE_VHOST_SCSI_COMMON "vhost-scsi-common" +#define VHOST_SCSI_COMMON(obj) \ + OBJECT_CHECK(VHostSCSICommon, (obj), TYPE_VHOST_SCSI_COMMON) + +typedef struct VHostSCSICommon { + VirtIOSCSICommon parent_obj; + + Error *migration_blocker; + + struct vhost_dev dev; + const int *feature_bits; + int32_t bootindex; + int channel; + int target; + int lun; +} VHostSCSICommon; + +int vhost_scsi_common_start(VHostSCSICommon *vsc); +void vhost_scsi_common_stop(VHostSCSICommon *vsc); +char *vhost_scsi_common_get_fw_dev_path(FWPathProvider *p, BusState *bus, + DeviceState *dev); +void vhost_scsi_common_set_config(VirtIODevice *vdev, const uint8_t *config); +uint64_t vhost_scsi_common_get_features(VirtIODevice *vdev, uint64_t features, + Error **errp); + +#endif /* VHOST_SCSI_COMMON_H */ diff --git a/include/hw/virtio/vhost-scsi.h b/include/hw/virtio/vhost-scsi.h index 9fd63df12e..04658d14f5 100644 --- a/include/hw/virtio/vhost-scsi.h +++ b/include/hw/virtio/vhost-scsi.h @@ -18,6 +18,7 @@ #include "hw/qdev.h" #include "hw/virtio/virtio-scsi.h" #include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-scsi-common.h" enum vhost_scsi_vq_list { VHOST_SCSI_VQ_CONTROL = 0, @@ -30,15 +31,7 @@ enum vhost_scsi_vq_list { OBJECT_CHECK(VHostSCSI, (obj), TYPE_VHOST_SCSI) typedef struct VHostSCSI { - VirtIOSCSICommon parent_obj; - - Error *migration_blocker; - - struct vhost_dev dev; - int32_t bootindex; - int channel; - int target; - int lun; + VHostSCSICommon parent_obj; } VHostSCSI; #endif diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h index 8c8453cf19..eac2013ddd 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -49,8 +49,10 @@ struct VirtIOSCSIConf { uint32_t num_queues; uint32_t max_sectors; uint32_t cmd_per_lun; +#ifdef CONFIG_VHOST_SCSI char *vhostfd; char *wwpn; +#endif uint32_t boot_tpgt; IOThread *iothread; }; diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h index 711f8bf7ce..53801f6042 100644 --- a/include/io/channel-socket.h +++ b/include/io/channel-socket.h @@ -205,7 +205,7 @@ void qio_channel_socket_dgram_async(QIOChannelSocket *ioc, * Get the string representation of the local socket * address. A pointer to the allocated address information * struct will be returned, which the caller is required to - * release with a call qapi_free_SocketAddress when no + * release with a call qapi_free_SocketAddress() when no * longer required. * * Returns: 0 on success, -1 on error @@ -222,7 +222,7 @@ qio_channel_socket_get_local_address(QIOChannelSocket *ioc, * Get the string representation of the local socket * address. A pointer to the allocated address information * struct will be returned, which the caller is required to - * release with a call qapi_free_SocketAddress when no + * release with a call qapi_free_SocketAddress() when no * longer required. * * Returns: the socket address struct, or NULL on error diff --git a/include/migration/cpu.h b/include/migration/cpu.h index f3d5dfcf61..a40bd3549f 100644 --- a/include/migration/cpu.h +++ b/include/migration/cpu.h @@ -18,6 +18,8 @@ VMSTATE_UINT64_EQUAL_V(_f, _s, _v) #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) +#define VMSTATE_UINTTL_2DARRAY_V(_f, _s, _n1, _n2, _v) \ + VMSTATE_UINT64_2DARRAY_V(_f, _s, _n1, _n2, _v) #define VMSTATE_UINTTL_TEST(_f, _s, _t) \ VMSTATE_UINT64_TEST(_f, _s, _t) #define vmstate_info_uinttl vmstate_info_uint64 @@ -37,6 +39,8 @@ VMSTATE_UINT32_EQUAL_V(_f, _s, _v) #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) +#define VMSTATE_UINTTL_2DARRAY_V(_f, _s, _n1, _n2, _v) \ + VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, _v) #define VMSTATE_UINTTL_TEST(_f, _s, _t) \ VMSTATE_UINT32_TEST(_f, _s, _t) #define vmstate_info_uinttl vmstate_info_uint32 @@ -48,5 +52,8 @@ VMSTATE_UINTTL_EQUAL_V(_f, _s, 0) #define VMSTATE_UINTTL_ARRAY(_f, _s, _n) \ VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, 0) +#define VMSTATE_UINTTL_2DARRAY(_f, _s, _n1, _n2) \ + VMSTATE_UINTTL_2DARRAY_V(_f, _s, _n1, _n2, 0) + #endif diff --git a/include/migration/migration.h b/include/migration/migration.h index ba1a16cbc1..e29cb0144b 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -266,7 +266,8 @@ uint64_t xbzrle_mig_pages_cache_miss(void); double xbzrle_mig_cache_miss_rate(void); void ram_handle_compressed(void *host, uint8_t ch, uint64_t size); -void ram_debug_dump_bitmap(unsigned long *todump, bool expected); +void ram_debug_dump_bitmap(unsigned long *todump, bool expected, + unsigned long pages); /* For outgoing discard bitmap */ int ram_postcopy_send_discard_bitmap(MigrationState *ms); /* For incoming postcopy discard */ diff --git a/include/migration/postcopy-ram.h b/include/migration/postcopy-ram.h deleted file mode 100644 index 8e036b95a2..0000000000 --- a/include/migration/postcopy-ram.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Postcopy migration for RAM - * - * Copyright 2013 Red Hat, Inc. and/or its affiliates - * - * Authors: - * Dave Gilbert <dgilbert@redhat.com> - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ -#ifndef QEMU_POSTCOPY_RAM_H -#define QEMU_POSTCOPY_RAM_H - -/* Return true if the host supports everything we need to do postcopy-ram */ -bool postcopy_ram_supported_by_host(void); - -/* - * Make all of RAM sensitive to accesses to areas that haven't yet been written - * and wire up anything necessary to deal with it. - */ -int postcopy_ram_enable_notify(MigrationIncomingState *mis); - -/* - * Initialise postcopy-ram, setting the RAM to a state where we can go into - * postcopy later; must be called prior to any precopy. - * called from ram.c's similarly named ram_postcopy_incoming_init - */ -int postcopy_ram_incoming_init(MigrationIncomingState *mis, size_t ram_pages); - -/* - * At the end of a migration where postcopy_ram_incoming_init was called. - */ -int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis); - -/* - * Userfault requires us to mark RAM as NOHUGEPAGE prior to discard - * however leaving it until after precopy means that most of the precopy - * data is still THPd - */ -int postcopy_ram_prepare_discard(MigrationIncomingState *mis); - -/* - * Called at the start of each RAMBlock by the bitmap code. - * 'offset' is the bitmap offset of the named RAMBlock in the migration - * bitmap. - * Returns a new PDS - */ -PostcopyDiscardState *postcopy_discard_send_init(MigrationState *ms, - unsigned long offset, - const char *name); - -/* - * Called by the bitmap code for each chunk to discard. - * May send a discard message, may just leave it queued to - * be sent later. - * @start,@length: a range of pages in the migration bitmap in the - * RAM block passed to postcopy_discard_send_init() (length=1 is one page) - */ -void postcopy_discard_send_range(MigrationState *ms, PostcopyDiscardState *pds, - unsigned long start, unsigned long length); - -/* - * Called at the end of each RAMBlock by the bitmap code. - * Sends any outstanding discard messages, frees the PDS. - */ -void postcopy_discard_send_finish(MigrationState *ms, - PostcopyDiscardState *pds); - -/* - * Place a page (from) at (host) efficiently - * There are restrictions on how 'from' must be mapped, in general best - * to use other postcopy_ routines to allocate. - * returns 0 on success - */ -int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from, - size_t pagesize); - -/* - * Place a zero page at (host) atomically - * returns 0 on success - */ -int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, - size_t pagesize); - -/* - * Allocate a page of memory that can be mapped at a later point in time - * using postcopy_place_page - * Returns: Pointer to allocated page - */ -void *postcopy_get_tmp_page(MigrationIncomingState *mis); - -#endif diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index dad3984c07..f4bf3f1b4e 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -500,6 +500,19 @@ extern const VMStateInfo vmstate_info_qtailq; .offset = vmstate_offset_array(_state, _field, _type, _num),\ } +#define VMSTATE_STRUCT_2DARRAY_TEST(_field, _state, _n1, _n2, _test, \ + _version, _vmsd, _type) { \ + .name = (stringify(_field)), \ + .num = (_n1) * (_n2), \ + .field_exists = (_test), \ + .version_id = (_version), \ + .vmsd = &(_vmsd), \ + .size = sizeof(_type), \ + .flags = VMS_STRUCT | VMS_ARRAY, \ + .offset = vmstate_offset_2darray(_state, _field, _type, \ + _n1, _n2), \ +} + #define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \ .name = (stringify(_field)), \ .num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \ @@ -747,6 +760,11 @@ extern const VMStateInfo vmstate_info_qtailq; VMSTATE_STRUCT_ARRAY_TEST(_field, _state, _num, NULL, _version, \ _vmsd, _type) +#define VMSTATE_STRUCT_2DARRAY(_field, _state, _n1, _n2, _version, \ + _vmsd, _type) \ + VMSTATE_STRUCT_2DARRAY_TEST(_field, _state, _n1, _n2, NULL, \ + _version, _vmsd, _type) + #define VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, _info, _size) \ VMSTATE_BUFFER_UNSAFE_INFO_TEST(_field, _state, NULL, _version, _info, \ _size) diff --git a/include/qapi/clone-visitor.h b/include/qapi/clone-visitor.h index b16177e1ee..a4915c7d57 100644 --- a/include/qapi/clone-visitor.h +++ b/include/qapi/clone-visitor.h @@ -24,6 +24,9 @@ typedef struct QapiCloneVisitor QapiCloneVisitor; void *qapi_clone(const void *src, void (*visit_type)(Visitor *, const char *, void **, Error **)); +void qapi_clone_members(void *dst, const void *src, size_t sz, + void (*visit_type_members)(Visitor *, void *, + Error **)); /* * Deep-clone QAPI object @src of the given @type, and return the result. @@ -36,4 +39,15 @@ void *qapi_clone(const void *src, void (*visit_type)(Visitor *, const char *, (void (*)(Visitor *, const char *, void**, \ Error **))visit_type_ ## type)) +/* + * Copy deep clones of @type members from @src to @dst. + * + * Not usable on QAPI scalars (integers, strings, enums), nor on a + * QAPI object that references the 'any' type. + */ +#define QAPI_CLONE_MEMBERS(type, dst, src) \ + qapi_clone_members(dst, src, sizeof(type), \ + (void (*)(Visitor *, void *, \ + Error **))visit_type_ ## type ## _members) + #endif diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h index fe9a4c5c60..188440a6a8 100644 --- a/include/qapi/qmp/qdict.h +++ b/include/qapi/qmp/qdict.h @@ -52,6 +52,14 @@ void qdict_destroy_obj(QObject *obj); #define qdict_put(qdict, key, obj) \ qdict_put_obj(qdict, key, QOBJECT(obj)) +/* Helpers for int, bool, and string */ +#define qdict_put_int(qdict, key, value) \ + qdict_put(qdict, key, qint_from_int(value)) +#define qdict_put_bool(qdict, key, value) \ + qdict_put(qdict, key, qbool_from_bool(value)) +#define qdict_put_str(qdict, key, value) \ + qdict_put(qdict, key, qstring_from_str(value)) + /* High level helpers */ double qdict_get_double(const QDict *qdict, const char *key); int64_t qdict_get_int(const QDict *qdict, const char *key); diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h index a84117ecb1..5dc4ed9616 100644 --- a/include/qapi/qmp/qlist.h +++ b/include/qapi/qmp/qlist.h @@ -29,6 +29,14 @@ typedef struct QList { #define qlist_append(qlist, obj) \ qlist_append_obj(qlist, QOBJECT(obj)) +/* Helpers for int, bool, and string */ +#define qlist_append_int(qlist, value) \ + qlist_append(qlist, qint_from_int(value)) +#define qlist_append_bool(qlist, value) \ + qlist_append(qlist, qbool_from_bool(value)) +#define qlist_append_str(qlist, value) \ + qlist_append(qlist, qstring_from_str(value)) + #define QLIST_FOREACH_ENTRY(qlist, var) \ for ((var) = ((qlist)->head.tqh_first); \ (var); \ diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index 1a1b62012b..b0e233df76 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -63,8 +63,10 @@ * The @name parameter of visit_type_FOO() describes the relation * between this QAPI value and its parent container. When visiting * the root of a tree, @name is ignored; when visiting a member of an - * object, @name is the key associated with the value; and when - * visiting a member of a list, @name is NULL. + * object, @name is the key associated with the value; when visiting a + * member of a list, @name is NULL; and when visiting the member of an + * alternate, @name should equal the name used for visiting the + * alternate. * * The visit_type_FOO() functions expect a non-null @obj argument; * they allocate *@obj during input visits, leave it unchanged on diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index af285321b8..5c326db232 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -34,7 +34,7 @@ typedef void NonBlockingConnectHandler(int fd, Error *err, void *opaque); int inet_ai_family_from_address(InetSocketAddress *addr, Error **errp); -InetSocketAddress *inet_parse(const char *str, Error **errp); +int inet_parse(InetSocketAddress *addr, const char *str, Error **errp); int inet_connect(const char *str, Error **errp); int inet_connect_saddr(InetSocketAddress *saddr, NonBlockingConnectHandler *callback, void *opaque, @@ -65,7 +65,7 @@ int socket_init(void); * Get the string representation of the socket * address. A pointer to the allocated address information * struct will be returned, which the caller is required to - * release with a call qapi_free_SocketAddress when no + * release with a call qapi_free_SocketAddress() when no * longer required. * * Returns: the socket address struct, or NULL on error @@ -83,7 +83,7 @@ socket_sockaddr_to_address(struct sockaddr_storage *sa, * Get the string representation of the local socket * address. A pointer to the allocated address information * struct will be returned, which the caller is required to - * release with a call qapi_free_SocketAddress when no + * release with a call qapi_free_SocketAddress() when no * longer required. * * Returns: the socket address struct, or NULL on error @@ -98,7 +98,7 @@ SocketAddress *socket_local_address(int fd, Error **errp); * Get the string representation of the remote socket * address. A pointer to the allocated address information * struct will be returned, which the caller is required to - * release with a call qapi_free_SocketAddress when no + * release with a call qapi_free_SocketAddress() when no * longer required. * * Returns: the socket address struct, or NULL on error @@ -121,14 +121,14 @@ SocketAddress *socket_remote_address(int fd, Error **errp); char *socket_address_to_string(struct SocketAddress *addr, Error **errp); /** - * socket_address_crumple: - * @addr_flat: the socket address to crumple + * socket_address_flatten: + * @addr: the socket address to flatten * - * Convert SocketAddressFlat to SocketAddress. Caller is responsible + * Convert SocketAddressLegacy to SocketAddress. Caller is responsible * for freeing with qapi_free_SocketAddress(). * * Returns: the argument converted to SocketAddress. */ -SocketAddress *socket_address_crumple(SocketAddressFlat *addr_flat); +SocketAddress *socket_address_flatten(SocketAddressLegacy *addr); #endif /* QEMU_SOCKETS_H */ diff --git a/include/sysemu/char.h b/include/sysemu/char.h index 450881d42c..fffc0f40d4 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -7,6 +7,14 @@ #include "qemu/bitmap.h" #include "qom/object.h" +#define IAC_EOR 239 +#define IAC_SE 240 +#define IAC_NOP 241 +#define IAC_BREAK 243 +#define IAC_IP 244 +#define IAC_SB 250 +#define IAC 255 + /* character device */ typedef enum { @@ -93,9 +101,8 @@ struct Chardev { char *filename; int logfd; int be_open; - guint fd_in_tag; + GSource *gsource; DECLARE_BITMAP(features, QEMU_CHAR_FEATURE_LAST); - QTAILQ_ENTRY(Chardev) next; }; /** @@ -171,14 +178,6 @@ int qemu_chr_fe_wait_connected(CharBackend *be, Error **errp); Chardev *qemu_chr_new_noreplay(const char *label, const char *filename); /** - * @qemu_chr_delete: - * - * Destroy a character backend and remove it from the list of - * identified character backends. - */ -void qemu_chr_delete(Chardev *chr); - -/** * @qemu_chr_fe_set_echo: * * Ask the backend to override its normal echo setting. This only really @@ -427,7 +426,6 @@ void qemu_chr_fe_set_handlers(CharBackend *b, */ void qemu_chr_fe_take_focus(CharBackend *b); -void qemu_chr_be_generic_open(Chardev *s); void qemu_chr_fe_accept_input(CharBackend *be); int qemu_chr_add_client(Chardev *s, int fd); Chardev *qemu_chr_find(const char *name); diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h index ef931be469..2672a15f8b 100644 --- a/include/sysemu/dump.h +++ b/include/sysemu/dump.h @@ -157,6 +157,7 @@ typedef struct DumpState { uint32_t sh_info; bool have_section; bool resume; + bool detached; ssize_t note_size; hwaddr memory_offset; int fd; diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 16175f7295..15656b7c36 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -75,11 +75,8 @@ void qemu_remove_exit_notifier(Notifier *notify); void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); -void hmp_savevm(Monitor *mon, const QDict *qdict); -int save_vmstate(Monitor *mon, const char *name); +int save_vmstate(const char *name); int load_vmstate(const char *name); -void hmp_delvm(Monitor *mon, const QDict *qdict); -void hmp_info_snapshots(Monitor *mon, const QDict *qdict); void qemu_announce_self(void); |