diff --git a/CODING_STYLE.rst b/CODING_STYLE.rst index 8b13ef0669..7bf4e39d48 100644 --- a/CODING_STYLE.rst +++ b/CODING_STYLE.rst @@ -85,8 +85,13 @@ Line width Lines should be 80 characters; try not to make them longer. Sometimes it is hard to do, especially when dealing with QEMU subsystems -that use long function or symbol names. Even in that case, do not make -lines much longer than 80 characters. +that use long function or symbol names. If wrapping the line at 80 columns +is obviously less readable and more awkward, prefer not to wrap it; better +to have an 85 character line than one which is awkwardly wrapped. + +Even in that case, try not to make lines much longer than 80 characters. +(The checkpatch script will warn at 100 characters, but this is intended +as a guard against obviously-overlength lines, not a target.) Rationale: diff --git a/MAINTAINERS b/MAINTAINERS index 3a9dcae315..062074e47c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2442,7 +2442,7 @@ F: scripts/simplebench/ QAPI M: Markus Armbruster -M: Michael Roth +M: Michael Roth S: Supported F: qapi/ X: qapi/*.json @@ -2486,7 +2486,7 @@ F: tests/data/qobject/qdict.txt T: git https://repo.or.cz/qemu/armbru.git qapi-next QEMU Guest Agent -M: Michael Roth +M: Michael Roth S: Maintained F: qga/ F: docs/interop/qemu-ga.rst diff --git a/block/file-posix.c b/block/file-posix.c index 83e2cc5530..9804681d5c 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2111,7 +2111,7 @@ static void raw_aio_attach_aio_context(BlockDriverState *bs, #endif #ifdef CONFIG_LINUX_IO_URING if (s->use_linux_io_uring) { - Error *local_err; + Error *local_err = NULL; if (!aio_setup_linux_io_uring(new_context, &local_err)) { error_reportf_err(local_err, "Unable to use linux io_uring, " "falling back to thread pool: "); diff --git a/blockdev.c b/blockdev.c index 412354b4b6..2431448c5d 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1827,6 +1827,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) if (set_backing_hd) { bdrv_set_backing_hd(target_bs, source, &local_err); if (local_err) { + error_propagate(errp, local_err); goto unref; } } diff --git a/configure b/configure index 3f823ed163..cb21108d34 100755 --- a/configure +++ b/configure @@ -1875,6 +1875,10 @@ if test -z "$python" then error_exit "Python not found. Use --python=/path/to/python" fi +if ! has "$make" +then + error_exit "GNU make ($make) not found" +fi # Note that if the Python conditional here evaluates True we will exit # with status 1 which is a shell 'false' value. @@ -2328,12 +2332,6 @@ else l2tpv3=no fi -if check_include "pty.h" ; then - pty_h=yes -else - pty_h=no -fi - cat > $TMPC < int main(int argc, char *argv[]) { @@ -3103,28 +3101,6 @@ EOF fi fi -########################################## -# getifaddrs (for tests/test-io-channel-socket ) - -have_ifaddrs_h=yes -if ! check_include "ifaddrs.h" ; then - have_ifaddrs_h=no -fi - -######################################### -# libdrm check -have_drm_h=no -if check_include "libdrm/drm.h" ; then - have_drm_h=yes -fi - -######################################### -# sys/signal.h check -have_sys_signal_h=no -if check_include "sys/signal.h" ; then - have_sys_signal_h=yes -fi - ########################################## # VTE probe @@ -4426,18 +4402,6 @@ if compile_prog "" "" ; then syncfs=yes fi -# check for kcov support (kernel must be 4.4+, compiled with certain options) -kcov=no -if check_include sys/kcov.h ; then - kcov=yes -fi - -# check for btrfs filesystem support (kernel must be 3.9+) -btrfs=no -if check_include linux/btrfs.h ; then - btrfs=yes -fi - # Search for bswap_32 function byteswap_h=no cat > $TMPC << EOF @@ -6136,12 +6100,6 @@ fi if test "$syncfs" = "yes" ; then echo "CONFIG_SYNCFS=y" >> $config_host_mak fi -if test "$kcov" = "yes" ; then - echo "CONFIG_KCOV=y" >> $config_host_mak -fi -if test "$btrfs" = "yes" ; then - echo "CONFIG_BTRFS=y" >> $config_host_mak -fi if test "$inotify" = "yes" ; then echo "CONFIG_INOTIFY=y" >> $config_host_mak fi @@ -6215,21 +6173,12 @@ fi if test "$auth_pam" = "yes" ; then echo "CONFIG_AUTH_PAM=y" >> $config_host_mak fi -if test "$have_ifaddrs_h" = "yes" ; then - echo "HAVE_IFADDRS_H=y" >> $config_host_mak -fi -if test "$have_drm_h" = "yes" ; then - echo "HAVE_DRM_H=y" >> $config_host_mak -fi if test "$have_broken_size_max" = "yes" ; then echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak fi if test "$have_openpty" = "yes" ; then echo "HAVE_OPENPTY=y" >> $config_host_mak fi -if test "$have_sys_signal_h" = "yes" ; then - echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak -fi # Work around a system header bug with some kernel/XFS header # versions where they both try to define 'struct fsxattr': @@ -6694,9 +6643,6 @@ if test "$sheepdog" = "yes" ; then add_to deprecated_features "sheepdog" echo "CONFIG_SHEEPDOG=y" >> $config_host_mak fi -if test "$pty_h" = "yes" ; then - echo "HAVE_PTY_H=y" >> $config_host_mak -fi if test "$have_mlockall" = "yes" ; then echo "HAVE_MLOCKALL=y" >> $config_host_mak fi diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index a5bd40c99d..b3a6547068 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp/pdb.c @@ -285,6 +285,7 @@ int pdb_init_from_file(const char *name, struct pdb_reader *reader) reader->gmf = g_mapped_file_new(name, TRUE, &gerr); if (gerr) { eprintf("Failed to map PDB file \'%s\'\n", name); + g_error_free(gerr); return 1; } diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index 0db7816586..b601b6d7ba 100644 --- a/contrib/elf2dmp/qemu_elf.c +++ b/contrib/elf2dmp/qemu_elf.c @@ -126,6 +126,7 @@ int QEMU_Elf_init(QEMU_Elf *qe, const char *filename) qe->gmf = g_mapped_file_new(filename, TRUE, &gerr); if (gerr) { eprintf("Failed to map ELF dump file \'%s\'\n", filename); + g_error_free(gerr); return 1; } diff --git a/fsdev/9p-marshal.h b/fsdev/9p-marshal.h index 8f3babb60a..ceaf2f521e 100644 --- a/fsdev/9p-marshal.h +++ b/fsdev/9p-marshal.h @@ -1,21 +1,18 @@ #ifndef QEMU_9P_MARSHAL_H #define QEMU_9P_MARSHAL_H -typedef struct V9fsString -{ +typedef struct V9fsString { uint16_t size; char *data; } V9fsString; -typedef struct V9fsQID -{ +typedef struct V9fsQID { uint8_t type; uint32_t version; uint64_t path; } V9fsQID; -typedef struct V9fsStat -{ +typedef struct V9fsStat { int16_t size; int16_t type; int32_t dev; @@ -35,8 +32,7 @@ typedef struct V9fsStat int32_t n_muid; } V9fsStat; -typedef struct V9fsIattr -{ +typedef struct V9fsIattr { int32_t valid; int32_t mode; int32_t uid; diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index d51cec2f3b..42f677cf38 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -110,8 +110,7 @@ typedef union V9fsFidOpenState V9fsFidOpenState; void cred_init(FsCred *); -struct FileOperations -{ +struct FileOperations { int (*parse_opts)(QemuOpts *, FsDriverEntry *, Error **errp); int (*init)(FsContext *, Error **errp); void (*cleanup)(FsContext *); diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index eb8a8844cf..0a242e4c5d 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -156,7 +156,7 @@ config TOSA config SPITZ bool - select ADS7846 # display + select ADS7846 # touch-screen controller select MAX111X # A/D converter select WM8750 # audio codec select MAX7310 # GPIO expander diff --git a/hw/display/Kconfig b/hw/display/Kconfig index 15d59e10dc..ca46b5830e 100644 --- a/hw/display/Kconfig +++ b/hw/display/Kconfig @@ -9,9 +9,6 @@ config EDID config FW_CFG_DMA bool -config ADS7846 - bool - config VGA_CIRRUS bool default y if PCI_DEVICES diff --git a/hw/display/meson.build b/hw/display/meson.build index dad3bd2b41..9d79e3951d 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -6,7 +6,6 @@ softmmu_ss.add(when: 'CONFIG_EDID', if_true: files('edid-generate.c', 'edid-regi softmmu_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb.c')) softmmu_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('ramfb-standalone.c')) -softmmu_ss.add(when: 'CONFIG_ADS7846', if_true: files('ads7846.c')) softmmu_ss.add(when: 'CONFIG_VGA_CIRRUS', if_true: files('cirrus_vga.c')) softmmu_ss.add(when: ['CONFIG_VGA_CIRRUS', 'CONFIG_VGA_ISA'], if_true: files('cirrus_vga_isa.c')) softmmu_ss.add(when: 'CONFIG_G364FB', if_true: files('g364fb.c')) diff --git a/hw/input/Kconfig b/hw/input/Kconfig index 64f14daabf..55865bb386 100644 --- a/hw/input/Kconfig +++ b/hw/input/Kconfig @@ -1,6 +1,9 @@ config ADB bool +config ADS7846 + bool + config LM832X bool depends on I2C diff --git a/hw/display/ads7846.c b/hw/input/ads7846.c similarity index 100% rename from hw/display/ads7846.c rename to hw/input/ads7846.c diff --git a/hw/input/meson.build b/hw/input/meson.build index e7285b15ae..0042c3f0dc 100644 --- a/hw/input/meson.build +++ b/hw/input/meson.build @@ -1,5 +1,6 @@ softmmu_ss.add(files('hid.c')) softmmu_ss.add(when: 'CONFIG_ADB', if_true: files('adb.c', 'adb-mouse.c', 'adb-kbd.c')) +softmmu_ss.add(when: 'CONFIG_ADS7846', if_true: files('ads7846.c')) softmmu_ss.add(when: 'CONFIG_LM832X', if_true: files('lm832x.c')) softmmu_ss.add(when: 'CONFIG_PCKBD', if_true: files('pckbd.c')) softmmu_ss.add(when: 'CONFIG_PL050', if_true: files('pl050.c')) diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index a496205783..454dd120db 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -62,7 +62,7 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory, void pam_update(PAMMemoryRegion *pam, int idx, uint8_t val) { - assert(0 <= idx && idx <= 12); + assert(0 <= idx && idx < PAM_REGIONS_COUNT); memory_region_set_enabled(&pam->alias[pam->current], false); pam->current = (val >> ((!(idx & 1)) * 4)) & PAM_ATTR_MASK; diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index b67cb9c29f..2eb729dff5 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -641,7 +641,7 @@ static void mch_realize(PCIDevice *d, Error **errp) init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space, &mch->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE); - for (i = 0; i < 12; ++i) { + for (i = 0; i < ARRAY_SIZE(mch->pam_regions) - 1; ++i) { init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space, &mch->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 6d359ee486..a5f3dd590c 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -489,7 +489,7 @@ static int xen_pt_register_regions(XenPCIPassthroughState *s, uint16_t *cmd) pci_register_bar(&s->dev, i, type, &s->bar[i]); XEN_PT_LOG(&s->dev, "IO region %i registered (size=0x%08"PRIx64 - " base_addr=0x%08"PRIx64" type: %#x)\n", + " base_addr=0x%08"PRIx64" type: 0x%x)\n", i, r->size, r->base_addr, type); } @@ -578,7 +578,7 @@ static void xen_pt_check_bar_overlap(PCIBus *bus, PCIDevice *d, void *opaque) if (ranges_overlap(arg->addr, arg->size, r->addr, r->size)) { XEN_PT_WARN(&s->dev, "Overlapped to device [%02x:%02x.%d] Region: %i" - " (addr: %#"FMT_PCIBUS", len: %#"FMT_PCIBUS")\n", + " (addr: 0x%"FMT_PCIBUS", len: 0x%"FMT_PCIBUS")\n", pci_bus_num(bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), i, r->addr, r->size); arg->rc = true; @@ -618,8 +618,8 @@ static void xen_pt_region_update(XenPCIPassthroughState *s, pci_for_each_device(pci_get_bus(d), pci_dev_bus_num(d), xen_pt_check_bar_overlap, &args); if (args.rc) { - XEN_PT_WARN(d, "Region: %d (addr: %#"FMT_PCIBUS - ", len: %#"FMT_PCIBUS") is overlapped.\n", + XEN_PT_WARN(d, "Region: %d (addr: 0x%"FMT_PCIBUS + ", len: 0x%"FMT_PCIBUS") is overlapped.\n", bar, sec->offset_within_address_space, int128_get64(sec->size)); } @@ -786,7 +786,7 @@ static void xen_pt_realize(PCIDevice *d, Error **errp) /* register real device */ XEN_PT_LOG(d, "Assigning real physical device %02x:%02x.%d" - " to devfn %#x\n", + " to devfn 0x%x\n", s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function, s->dev.devfn); diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index c8724cc7c8..c5c4e943a8 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -1622,7 +1622,7 @@ static int xen_pt_pcie_size_init(XenPCIPassthroughState *s, case PCI_EXP_TYPE_PCIE_BRIDGE: case PCI_EXP_TYPE_RC_EC: default: - XEN_PT_ERR(d, "Unsupported device/port type %#x.\n", type); + XEN_PT_ERR(d, "Unsupported device/port type 0x%x.\n", type); return -1; } } @@ -1645,11 +1645,11 @@ static int xen_pt_pcie_size_init(XenPCIPassthroughState *s, case PCI_EXP_TYPE_PCIE_BRIDGE: case PCI_EXP_TYPE_RC_EC: default: - XEN_PT_ERR(d, "Unsupported device/port type %#x.\n", type); + XEN_PT_ERR(d, "Unsupported device/port type 0x%x.\n", type); return -1; } } else { - XEN_PT_ERR(d, "Unsupported capability version %#x.\n", version); + XEN_PT_ERR(d, "Unsupported capability version 0x%x.\n", version); return -1; } diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c index fb4b887b92..b71563f98a 100644 --- a/hw/xen/xen_pt_msi.c +++ b/hw/xen/xen_pt_msi.c @@ -123,7 +123,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s, *ppirq = XEN_PT_UNASSIGNED_PIRQ; } else { XEN_PT_LOG(&s->dev, "requested pirq %d for MSI%s" - " (vec: %#x, entry: %#x)\n", + " (vec: 0x%x, entry: 0x%x)\n", *ppirq, is_msix ? "-X" : "", gvec, msix_entry); } } @@ -142,7 +142,7 @@ static int msi_msix_setup(XenPCIPassthroughState *s, msix_entry, table_base); if (rc) { XEN_PT_ERR(&s->dev, - "Mapping of MSI%s (err: %i, vec: %#x, entry %#x)\n", + "Mapping of MSI%s (err: %i, vec: 0x%x, entry 0x%x)\n", is_msix ? "-X" : "", errno, gvec, msix_entry); return rc; } @@ -165,8 +165,8 @@ static int msi_msix_update(XenPCIPassthroughState *s, int rc = 0; uint64_t table_addr = 0; - XEN_PT_LOG(d, "Updating MSI%s with pirq %d gvec %#x gflags %#x" - " (entry: %#x)\n", + XEN_PT_LOG(d, "Updating MSI%s with pirq %d gvec 0x%x gflags 0x%x" + " (entry: 0x%x)\n", is_msix ? "-X" : "", pirq, gvec, gflags, msix_entry); if (is_msix) { @@ -208,11 +208,11 @@ static int msi_msix_disable(XenPCIPassthroughState *s, } if (is_binded) { - XEN_PT_LOG(d, "Unbind MSI%s with pirq %d, gvec %#x\n", + XEN_PT_LOG(d, "Unbind MSI%s with pirq %d, gvec 0x%x\n", is_msix ? "-X" : "", pirq, gvec); rc = xc_domain_unbind_msi_irq(xen_xc, xen_domid, gvec, pirq, gflags); if (rc) { - XEN_PT_ERR(d, "Unbinding of MSI%s failed. (err: %d, pirq: %d, gvec: %#x)\n", + XEN_PT_ERR(d, "Unbinding of MSI%s failed. (err: %d, pirq: %d, gvec: 0x%x)\n", is_msix ? "-X" : "", errno, pirq, gvec); return rc; } @@ -539,7 +539,7 @@ int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base) } if (id != PCI_CAP_ID_MSIX) { - XEN_PT_ERR(d, "Invalid id %#x base %#x\n", id, base); + XEN_PT_ERR(d, "Invalid id 0x%x base 0x%x\n", id, base); return -1; } @@ -582,7 +582,7 @@ int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base) XEN_PT_ERR(d, "Can't open /dev/mem: %s\n", strerror(errno)); goto error_out; } - XEN_PT_LOG(d, "table_off = %#x, total_entries = %d\n", + XEN_PT_LOG(d, "table_off = 0x%x, total_entries = %d\n", table_off, total_entries); msix->table_offset_adjust = table_off & 0x0fff; msix->phys_iomem_base = diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index 6c16eaf876..24fd53942c 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -29,7 +29,7 @@ struct PCII440FXState { MemoryRegion *system_memory; MemoryRegion *pci_address_space; MemoryRegion *ram_memory; - PAMMemoryRegion pam_regions[13]; + PAMMemoryRegion pam_regions[PAM_REGIONS_COUNT]; MemoryRegion smram_region; MemoryRegion smram, low_smram; }; diff --git a/include/hw/pci-host/pam.h b/include/hw/pci-host/pam.h index fec5cd35d6..c1fd06ba2a 100644 --- a/include/hw/pci-host/pam.h +++ b/include/hw/pci-host/pam.h @@ -80,6 +80,8 @@ #define SMRAM_C_BASE_SEG_MASK ((uint8_t)0x7) #define SMRAM_C_BASE_SEG ((uint8_t)0x2) /* hardwired to b010 */ +#define PAM_REGIONS_COUNT 13 + typedef struct PAMMemoryRegion { MemoryRegion alias[4]; /* index = PAM value */ unsigned current; diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index bbb9581765..ab989698ef 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -44,7 +44,7 @@ struct MCHPCIState { MemoryRegion *pci_address_space; MemoryRegion *system_memory; MemoryRegion *address_space_io; - PAMMemoryRegion pam_regions[13]; + PAMMemoryRegion pam_regions[PAM_REGIONS_COUNT]; MemoryRegion smram_region, open_high_smram; MemoryRegion smram, low_smram, high_smram; MemoryRegion tseg_blackhole, tseg_window; diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index 585874f090..8efb4d38c0 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -715,7 +715,7 @@ IOCTL_IGNORE(TIOCSTOP) #endif -#ifdef CONFIG_KCOV +#ifdef HAVE_SYS_KCOV_H IOCTL(KCOV_ENABLE, 0, TYPE_NULL) IOCTL(KCOV_DISABLE, 0, TYPE_NULL) IOCTL(KCOV_INIT_TRACE, IOC_R, TYPE_ULONG) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 27adee908e..7bf99beb18 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -73,7 +73,7 @@ #ifdef CONFIG_SENDFILE #include #endif -#ifdef CONFIG_KCOV +#ifdef HAVE_SYS_KCOV_H #include #endif @@ -112,7 +112,7 @@ #include #include #include -#ifdef CONFIG_BTRFS +#ifdef HAVE_BTRFS_H #include #endif #ifdef HAVE_DRM_H diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index cabbfb762d..b934d0b606 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1006,7 +1006,7 @@ struct target_rtc_pll_info { #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) /* btrfs ioctls */ -#ifdef CONFIG_BTRFS +#ifdef HAVE_BTRFS_H #define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1) #define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4) #define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5) diff --git a/meson.build b/meson.build index f344b25955..fba6413056 100644 --- a/meson.build +++ b/meson.build @@ -836,7 +836,12 @@ config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0] config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]) config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2]) +config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h')) +config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) +config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h')) +config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h')) +config_host_data.set('HAVE_SYS_SIGNAL_H', cc.has_header('sys/signal.h')) ignored = ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] diff --git a/qemu-options.hx b/qemu-options.hx index e60ad42976..ae8872d1d6 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3958,30 +3958,34 @@ SRST ERST DEF("icount", HAS_ARG, QEMU_OPTION_icount, \ - "-icount [shift=N|auto][,align=on|off][,sleep=on|off,rr=record|replay,rrfile=,rrsnapshot=]\n" \ + "-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=[,rrsnapshot=]]\n" \ " enable virtual instruction counter with 2^N clock ticks per\n" \ " instruction, enable aligning the host and virtual clocks\n" \ - " or disable real time cpu sleeping\n", QEMU_ARCH_ALL) + " or disable real time cpu sleeping, and optionally enable\n" \ + " record-and-replay mode\n", QEMU_ARCH_ALL) SRST -``-icount [shift=N|auto][,rr=record|replay,rrfile=filename,rrsnapshot=snapshot]`` +``-icount [shift=N|auto][,align=on|off][,sleep=on|off][,rr=record|replay,rrfile=filename[,rrsnapshot=snapshot]]`` Enable virtual instruction counter. The virtual cpu will execute one instruction every 2^N ns of virtual time. If ``auto`` is specified then the virtual cpu speed will be automatically adjusted to keep virtual time within a few seconds of real time. - When the virtual cpu is sleeping, the virtual time will advance at - default speed unless ``sleep=on|off`` is specified. With - ``sleep=on|off``, the virtual time will jump to the next timer - deadline instantly whenever the virtual cpu goes to sleep mode and - will not advance if no timer is enabled. This behavior give - deterministic execution times from the guest point of view. - Note that while this option can give deterministic behavior, it does not provide cycle accurate emulation. Modern CPUs contain superscalar out of order cores with complex cache hierarchies. The number of instructions executed often has little or no correlation with actual performance. + When the virtual cpu is sleeping, the virtual time will advance at + default speed unless ``sleep=on`` is specified. With + ``sleep=on``, the virtual time will jump to the next timer + deadline instantly whenever the virtual cpu goes to sleep mode and + will not advance if no timer is enabled. This behavior gives + deterministic execution times from the guest point of view. + The default if icount is enabled is ``sleep=off``. + ``sleep=on`` cannot be used together with either ``shift=auto`` + or ``align=on``. + ``align=on`` will activate the delay algorithm which will try to synchronise the host clock and the virtual clock. The goal is to have a guest running at the real frequency imposed by the shift @@ -3991,15 +3995,17 @@ SRST ``shift`` is ``auto``. Note: The sync algorithm will work for those shift values for which the guest clock runs ahead of the host clock. Typically this happens when the shift value is high (how high - depends on the host machine). + depends on the host machine). The default if icount is enabled + is ``align=off``. - When ``rr`` option is specified deterministic record/replay is - enabled. Replay log is written into filename file in record mode and - read from this file in replay mode. - - Option rrsnapshot is used to create new vm snapshot named snapshot - at the start of execution recording. In replay mode this option is - used to load the initial VM state. + When the ``rr`` option is specified deterministic record/replay is + enabled. The ``rrfile=`` option must also be provided to + specify the path to the replay log. In record mode data is written + to this file, and in replay mode it is read back. + If the ``rrsnapshot`` option is given then it specifies a VM snapshot + name. In record mode, a new VM snapshot with the given name is created + at the start of execution recording. In replay mode this option + specifies the snapshot name used to load the initial VM state. ERST DEF("watchdog", HAS_ARG, QEMU_OPTION_watchdog, \ diff --git a/target/i386/trace-events b/target/i386/trace-events index 9f299e94a2..246158ae1f 100644 --- a/target/i386/trace-events +++ b/target/i386/trace-events @@ -8,11 +8,11 @@ kvm_x86_update_msi_routes(int num) "Updated %d MSI routes" # sev.c kvm_sev_init(void) "" -kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%zu" -kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%zu" +kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%zx" +kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%zx" kvm_sev_change_state(const char *old, const char *new) "%s -> %s" kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p" -kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIu64 +kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIx64 kvm_sev_launch_measurement(const char *value) "data %s" kvm_sev_launch_finish(void) "" kvm_sev_launch_secret(uint64_t hpa, uint64_t hva, uint64_t secret, int len) "hpa 0x%" PRIx64 " hva 0x%" PRIx64 " data 0x%" PRIx64 " len %d"