From eb6282f230b75eca057dd3b3027f1bfa100bef9c Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 7 Apr 2014 20:28:23 +0200 Subject: [PATCH 01/18] misc: Use cpu_physical_memory_read and cpu_physical_memory_write These functions don't need type casts (as does cpu_physical_memory_rw) and also make the code better readable. Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- cpus.c | 2 +- hw/i386/kvmvapic.c | 31 ++++++++++++++----------------- hw/intc/apic.c | 4 ++-- target-s390x/misc_helper.c | 12 ++++++------ 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/cpus.c b/cpus.c index 1104d6175c..7bbe15348c 100644 --- a/cpus.c +++ b/cpus.c @@ -1454,7 +1454,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename, l = sizeof(buf); if (l > size) l = size; - cpu_physical_memory_rw(addr, buf, l, 0); + cpu_physical_memory_read(addr, buf, l); if (fwrite(buf, 1, l, f) != l) { error_set(errp, QERR_IO_ERROR); goto exit; diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index a1c3d1cb85..a967b48965 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -124,14 +124,14 @@ static const TPRInstruction tpr_instr[] = { static void read_guest_rom_state(VAPICROMState *s) { - cpu_physical_memory_rw(s->rom_state_paddr, (void *)&s->rom_state, - sizeof(GuestROMState), 0); + cpu_physical_memory_read(s->rom_state_paddr, &s->rom_state, + sizeof(GuestROMState)); } static void write_guest_rom_state(VAPICROMState *s) { - cpu_physical_memory_rw(s->rom_state_paddr, (void *)&s->rom_state, - sizeof(GuestROMState), 1); + cpu_physical_memory_write(s->rom_state_paddr, &s->rom_state, + sizeof(GuestROMState)); } static void update_guest_rom_state(VAPICROMState *s) @@ -311,16 +311,14 @@ static int update_rom_mapping(VAPICROMState *s, CPUX86State *env, target_ulong i for (pos = le32_to_cpu(s->rom_state.fixup_start); pos < le32_to_cpu(s->rom_state.fixup_end); pos += 4) { - cpu_physical_memory_rw(paddr + pos - s->rom_state.vaddr, - (void *)&offset, sizeof(offset), 0); + cpu_physical_memory_read(paddr + pos - s->rom_state.vaddr, + &offset, sizeof(offset)); offset = le32_to_cpu(offset); - cpu_physical_memory_rw(paddr + offset, (void *)&patch, - sizeof(patch), 0); + cpu_physical_memory_read(paddr + offset, &patch, sizeof(patch)); patch = le32_to_cpu(patch); patch += rom_state_vaddr - le32_to_cpu(s->rom_state.vaddr); patch = cpu_to_le32(patch); - cpu_physical_memory_rw(paddr + offset, (void *)&patch, - sizeof(patch), 1); + cpu_physical_memory_write(paddr + offset, &patch, sizeof(patch)); } read_guest_rom_state(s); s->vapic_paddr = paddr + le32_to_cpu(s->rom_state.vapic_vaddr) - @@ -364,8 +362,8 @@ static int vapic_enable(VAPICROMState *s, X86CPU *cpu) } vapic_paddr = s->vapic_paddr + (((hwaddr)cpu_number) << VAPIC_CPU_SHIFT); - cpu_physical_memory_rw(vapic_paddr + offsetof(VAPICState, enabled), - (void *)&enabled, sizeof(enabled), 1); + cpu_physical_memory_write(vapic_paddr + offsetof(VAPICState, enabled), + &enabled, sizeof(enabled)); apic_enable_vapic(cpu->apic_state, vapic_paddr); s->state = VAPIC_ACTIVE; @@ -535,7 +533,7 @@ static int patch_hypercalls(VAPICROMState *s) uint8_t *rom; rom = g_malloc(s->rom_size); - cpu_physical_memory_rw(rom_paddr, rom, s->rom_size, 0); + cpu_physical_memory_read(rom_paddr, rom, s->rom_size); for (pos = 0; pos < s->rom_size - sizeof(vmcall_pattern); pos++) { if (kvm_irqchip_in_kernel()) { @@ -551,8 +549,7 @@ static int patch_hypercalls(VAPICROMState *s) } if (memcmp(rom + pos, pattern, 7) == 0 && (rom[pos + 7] == alternates[0] || rom[pos + 7] == alternates[1])) { - cpu_physical_memory_rw(rom_paddr + pos + 5, (uint8_t *)patch, - 3, 1); + cpu_physical_memory_write(rom_paddr + pos + 5, patch, 3); /* * Don't flush the tb here. Under ordinary conditions, the patched * calls are miles away from the current IP. Under malicious @@ -760,8 +757,8 @@ static int vapic_post_load(void *opaque, int version_id) run_on_cpu(first_cpu, do_vapic_enable, s); } else { zero = g_malloc0(s->rom_state.vapic_size); - cpu_physical_memory_rw(s->vapic_paddr, zero, - s->rom_state.vapic_size, 1); + cpu_physical_memory_write(s->vapic_paddr, zero, + s->rom_state.vapic_size); g_free(zero); } } diff --git a/hw/intc/apic.c b/hw/intc/apic.c index b8c061bdaa..2f40cbad2d 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -98,8 +98,8 @@ static void apic_sync_vapic(APICCommonState *s, int sync_type) return; } if (sync_type & SYNC_FROM_VAPIC) { - cpu_physical_memory_rw(s->vapic_paddr, (void *)&vapic_state, - sizeof(vapic_state), 0); + cpu_physical_memory_read(s->vapic_paddr, &vapic_state, + sizeof(vapic_state)); s->tpr = vapic_state.tpr; } if (sync_type & (SYNC_TO_VAPIC | SYNC_ISR_IRR_TO_VAPIC)) { diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c index 294b3ed4fb..cdbbb79314 100644 --- a/target-s390x/misc_helper.c +++ b/target-s390x/misc_helper.c @@ -336,7 +336,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, ebcdic_put(sysib.model, "QEMU ", 16); ebcdic_put(sysib.sequence, "QEMU ", 16); ebcdic_put(sysib.plant, "QEMU", 4); - cpu_physical_memory_rw(a0, (uint8_t *)&sysib, sizeof(sysib), 1); + cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 == 2) && (sel2 == 1)) { /* Basic Machine CPU */ struct sysib_121 sysib; @@ -346,7 +346,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, ebcdic_put(sysib.sequence, "QEMUQEMUQEMUQEMU", 16); ebcdic_put(sysib.plant, "QEMU", 4); stw_p(&sysib.cpu_addr, env->cpu_num); - cpu_physical_memory_rw(a0, (uint8_t *)&sysib, sizeof(sysib), 1); + cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 == 2) && (sel2 == 2)) { /* Basic Machine CPUs */ struct sysib_122 sysib; @@ -358,7 +358,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, stw_p(&sysib.active_cpus, 1); stw_p(&sysib.standby_cpus, 0); stw_p(&sysib.reserved_cpus, 0); - cpu_physical_memory_rw(a0, (uint8_t *)&sysib, sizeof(sysib), 1); + cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else { cc = 3; } @@ -375,7 +375,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, ebcdic_put(sysib.plant, "QEMU", 4); stw_p(&sysib.cpu_addr, env->cpu_num); stw_p(&sysib.cpu_id, 0); - cpu_physical_memory_rw(a0, (uint8_t *)&sysib, sizeof(sysib), 1); + cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 == 2) && (sel2 == 2)) { /* LPAR CPUs */ struct sysib_222 sysib; @@ -392,7 +392,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, stl_p(&sysib.caf, 1000); stw_p(&sysib.dedicated_cpus, 0); stw_p(&sysib.shared_cpus, 0); - cpu_physical_memory_rw(a0, (uint8_t *)&sysib, sizeof(sysib), 1); + cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else { cc = 3; } @@ -414,7 +414,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, ebcdic_put(sysib.vm[0].name, "KVMguest", 8); stl_p(&sysib.vm[0].caf, 1000); ebcdic_put(sysib.vm[0].cpi, "KVM/Linux ", 16); - cpu_physical_memory_rw(a0, (uint8_t *)&sysib, sizeof(sysib), 1); + cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else { cc = 3; } From e96e5ae880f0e5d4d372264e2a5cb91cba40f771 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 6 Mar 2014 10:39:24 +0100 Subject: [PATCH 02/18] qemu-option: introduce qemu_find_opts_singleton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Laszlo Ersek Reviewed-by: Andreas Färber Signed-off-by: Paolo Bonzini Signed-off-by: Igor Mammedov Signed-off-by: Michael Tokarev --- include/qemu/config-file.h | 2 ++ util/qemu-config.c | 14 ++++++++++++++ vl.c | 11 +---------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index dbd97c4bdb..d4ba20e049 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -8,6 +8,8 @@ QemuOptsList *qemu_find_opts(const char *group); QemuOptsList *qemu_find_opts_err(const char *group, Error **errp); +QemuOpts *qemu_find_opts_singleton(const char *group); + void qemu_add_opts(QemuOptsList *list); void qemu_add_drive_opts(QemuOptsList *list); int qemu_set_option(const char *str); diff --git a/util/qemu-config.c b/util/qemu-config.c index f6101012c0..60051dfed4 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -39,6 +39,20 @@ QemuOptsList *qemu_find_opts(const char *group) return ret; } +QemuOpts *qemu_find_opts_singleton(const char *group) +{ + QemuOptsList *list; + QemuOpts *opts; + + list = qemu_find_opts(group); + assert(list); + opts = qemu_opts_find(list, NULL); + if (!opts) { + opts = qemu_opts_create(list, NULL, 0, &error_abort); + } + return opts; +} + static CommandLineParameterInfoList *query_option_descs(const QemuOptDesc *desc) { CommandLineParameterInfoList *param_list = NULL, *entry; diff --git a/vl.c b/vl.c index db9ea90a1d..5aad3bcca4 100644 --- a/vl.c +++ b/vl.c @@ -517,16 +517,7 @@ static QemuOptsList qemu_name_opts = { */ QemuOpts *qemu_get_machine_opts(void) { - QemuOptsList *list; - QemuOpts *opts; - - list = qemu_find_opts("machine"); - assert(list); - opts = qemu_opts_find(list, NULL); - if (!opts) { - opts = qemu_opts_create(list, NULL, 0, &error_abort); - } - return opts; + return qemu_find_opts_singleton("machine"); } const char *qemu_get_vm_name(void) From 6e1d3c1c855818a6d1399698572afae0d11b872b Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 27 Nov 2013 01:27:35 +0100 Subject: [PATCH 03/18] vl: convert -m to QemuOpts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds option to -m "size" - startup memory amount For compatibility with legacy CLI if suffix-less number is passed, it assumes amount in Mb. Otherwise user is free to use suffixed number using suffixes b,k/K,M,G Signed-off-by: Igor Mammedov Signed-off-by: Paolo Bonzini Reviewed-by: Eric Blake Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- qemu-options.hx | 9 ++++--- vl.c | 71 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 63 insertions(+), 17 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 6457034b8c..926349b997 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -210,10 +210,13 @@ use is discouraged as it may be removed from future versions. ETEXI DEF("m", HAS_ARG, QEMU_OPTION_m, - "-m megs set virtual RAM size to megs MB [default=" - stringify(DEFAULT_RAM_SIZE) "]\n", QEMU_ARCH_ALL) + "-m [size=]megs\n" + " configure guest RAM\n" + " size: initial amount of guest memory (default: " + stringify(DEFAULT_RAM_SIZE) "MiB)\n", + QEMU_ARCH_ALL) STEXI -@item -m @var{megs} +@item -m [size=]@var{megs} @findex -m Set virtual RAM size to @var{megs} megabytes. Default is 128 MiB. Optionally, a suffix of ``M'' or ``G'' can be used to signify a value in megabytes or diff --git a/vl.c b/vl.c index 5aad3bcca4..d6c5df192a 100644 --- a/vl.c +++ b/vl.c @@ -510,6 +510,20 @@ static QemuOptsList qemu_name_opts = { }, }; +static QemuOptsList qemu_mem_opts = { + .name = "memory", + .implied_opt_name = "size", + .head = QTAILQ_HEAD_INITIALIZER(qemu_mem_opts.head), + .merge_lists = true, + .desc = { + { + .name = "size", + .type = QEMU_OPT_SIZE, + }, + { /* end of list */ } + }, +}; + /** * Get machine options * @@ -2955,6 +2969,8 @@ int main(int argc, char **argv, char **envp) }; const char *trace_events = NULL; const char *trace_file = NULL; + const ram_addr_t default_ram_size = (ram_addr_t)DEFAULT_RAM_SIZE * + 1024 * 1024; atexit(qemu_run_exit_notifiers); error_set_progname(argv[0]); @@ -2978,6 +2994,7 @@ int main(int argc, char **argv, char **envp) qemu_add_opts(&qemu_trace_opts); qemu_add_opts(&qemu_option_rom_opts); qemu_add_opts(&qemu_machine_opts); + qemu_add_opts(&qemu_mem_opts); qemu_add_opts(&qemu_smp_opts); qemu_add_opts(&qemu_boot_opts); qemu_add_opts(&qemu_sandbox_opts); @@ -3002,7 +3019,7 @@ int main(int argc, char **argv, char **envp) module_call_init(MODULE_INIT_MACHINE); machine_class = find_default_machine(); cpu_model = NULL; - ram_size = 0; + ram_size = default_ram_size; snapshot = 0; cyls = heads = secs = 0; translation = BIOS_ATA_TRANSLATION_AUTO; @@ -3289,20 +3306,48 @@ int main(int argc, char **argv, char **envp) exit(0); break; case QEMU_OPTION_m: { - int64_t value; uint64_t sz; - char *end; + const char *mem_str; - value = strtosz(optarg, &end); - if (value < 0 || *end) { - fprintf(stderr, "qemu: invalid ram size: %s\n", optarg); - exit(1); + opts = qemu_opts_parse(qemu_find_opts("memory"), + optarg, 1); + if (!opts) { + exit(EXIT_FAILURE); } - sz = QEMU_ALIGN_UP((uint64_t)value, 8192); + + mem_str = qemu_opt_get(opts, "size"); + if (!mem_str) { + error_report("invalid -m option, missing 'size' option"); + exit(EXIT_FAILURE); + } + if (!*mem_str) { + error_report("missing 'size' option value"); + exit(EXIT_FAILURE); + } + + sz = qemu_opt_get_size(opts, "size", ram_size); + + /* Fix up legacy suffix-less format */ + if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) { + uint64_t overflow_check = sz; + + sz <<= 20; + if ((sz >> 20) != overflow_check) { + error_report("too large 'size' option value"); + exit(EXIT_FAILURE); + } + } + + /* backward compatibility behaviour for case "-m 0" */ + if (sz == 0) { + sz = default_ram_size; + } + + sz = QEMU_ALIGN_UP(sz, 8192); ram_size = sz; if (ram_size != sz) { - fprintf(stderr, "qemu: ram size too large\n"); - exit(1); + error_report("ram size too large"); + exit(EXIT_FAILURE); } break; } @@ -4145,10 +4190,8 @@ int main(int argc, char **argv, char **envp) exit(1); } - /* init the memory */ - if (ram_size == 0) { - ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; - } + /* store value for the future use */ + qemu_opt_set_number(qemu_find_opts_singleton("memory"), "size", ram_size); if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0) != 0) { From 2d2ad6d0902bb6338f7fc64e52c202439b90f7ce Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 18 Apr 2014 14:55:36 +0800 Subject: [PATCH 04/18] configure: Improve help behavior Old: There are two paths to show help and exit 1, one is with "-h" or "--help", one is with invalid options. New: Show help and exit 0 for --help. On invalid option, don't show the long help and bury the early "ERROR:" line, just give a message pointing to --help. Signed-off-by: Fam Zheng Signed-off-by: Michael Tokarev --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index b08afc3fb8..2fbec59e96 100755 --- a/configure +++ b/configure @@ -1087,7 +1087,10 @@ for opt do ;; --enable-quorum) quorum="yes" ;; - *) echo "ERROR: unknown option $opt"; show_help="yes" + *) + echo "ERROR: unknown option $opt" + echo "Try '$0 --help' for more information" + exit 1 ;; esac done @@ -1353,7 +1356,7 @@ Advanced options (experts only): NOTE: The object files are built at the place where configure is launched EOF -exit 1 +exit 0 fi # Now we have handled --enable-tcg-interpreter and know we're not just From 296b14491aaaeb7082f8447f6650bfb22c58965b Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 11 Apr 2014 18:23:01 -0400 Subject: [PATCH 05/18] move test-* from .gitignore to tests/.gitignore Also sort the test-* entries in the latter. Signed-off-by: Laszlo Ersek Signed-off-by: Michael Tokarev --- .gitignore | 9 --------- tests/.gitignore | 11 +++++++++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index de90463d8a..2748526e25 100644 --- a/.gitignore +++ b/.gitignore @@ -49,15 +49,6 @@ libuser /qemu-monitor.texi /qmp-commands.txt /vscclient -/test-bitops -/test-coroutine -/test-int128 -/test-opts-visitor -/test-qmp-input-visitor -/test-qmp-output-visitor -/test-string-input-visitor -/test-string-output-visitor -/test-visitor-serialization /fsdev/virtfs-proxy-helper /fsdev/virtfs-proxy-helper.1 /fsdev/virtfs-proxy-helper.pod diff --git a/tests/.gitignore b/tests/.gitignore index 9ba9d96b6b..3aa1e95618 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -7,20 +7,27 @@ check-qstring check-qom-interface test-aio test-bitops -test-throttle +test-coroutine test-cutils test-hbitmap test-int128 test-iov test-mul64 +test-opts-visitor test-qapi-types.[ch] test-qapi-visit.[ch] test-qdev-global-props -test-qmp-commands.h test-qmp-commands +test-qmp-commands.h test-qmp-input-strict +test-qmp-input-visitor test-qmp-marshal.c +test-qmp-output-visitor +test-string-input-visitor +test-string-output-visitor test-thread-pool +test-throttle +test-visitor-serialization test-vmstate test-x86-cpuid test-xbzrle From a27b04577e6db52158d0e1d4483dfbaa037bff5d Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Fri, 11 Apr 2014 18:23:02 -0400 Subject: [PATCH 06/18] tests/.gitignore: Ignore test-rfifolock Signed-off-by: Cole Robinson Signed-off-by: Michael Tokarev --- tests/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/.gitignore b/tests/.gitignore index 3aa1e95618..c71c11020e 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -23,6 +23,7 @@ test-qmp-input-strict test-qmp-input-visitor test-qmp-marshal.c test-qmp-output-visitor +test-rfifolock test-string-input-visitor test-string-output-visitor test-thread-pool From 5d77c8f9b61fbcbf26bb9647935df57a1eed6c05 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Sun, 27 Apr 2014 15:02:26 +0400 Subject: [PATCH 07/18] gitignore: cleanups #2 A few more cleanups for .gitignore file. The final goal is to have only files in there which are generated during build. Things like .orig or .gdbinit are definitely not generated during build. Also, anchor a few more build-time directories. Signed-off-by: Michael Tokarev --- .gitignore | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 2748526e25..8a5270973e 100644 --- a/.gitignore +++ b/.gitignore @@ -18,8 +18,8 @@ /*-darwin-user /*-linux-user /*-bsd-user -libdis* -libuser +/libdis* +/libuser /linux-headers/asm /qga/qapi-generated /qapi-generated @@ -52,7 +52,6 @@ libuser /fsdev/virtfs-proxy-helper /fsdev/virtfs-proxy-helper.1 /fsdev/virtfs-proxy-helper.pod -/.gdbinit *.a *.aux *.cp @@ -81,12 +80,8 @@ libuser *.pc .libs .sdk -*.swp -*.orig -.pc *.gcda *.gcno -patches /pc-bios/bios-pq/status /pc-bios/vgabios-pq/status /pc-bios/optionrom/linuxboot.asm From a629f2fdba18c8860e0995a846f7cb14b03cde24 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Wed, 16 Apr 2014 07:56:20 +0800 Subject: [PATCH 08/18] vl: Remove useless 'continue' "This if else has no code between it and the end of the enclosing while loop. This makes this continue redundant." Signed-off-by: Chen Gang Reviewed-by: Markus Armbruster Signed-off-by: Michael Tokarev --- vl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/vl.c b/vl.c index d6c5df192a..0b08a029c6 100644 --- a/vl.c +++ b/vl.c @@ -3042,7 +3042,6 @@ int main(int argc, char **argv, char **envp) if (argv[optind][0] != '-') { /* disk image */ optind++; - continue; } else { const QEMUOption *popt; From 6924bc1eef86170b7d5bee6c4aae8bb4a78350dd Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Wed, 16 Apr 2014 07:57:41 +0800 Subject: [PATCH 09/18] vl: Eliminate a superfluous local variable CODING_STYLE frowns upon mixing declarations and statements. main() has such a declaration. Clean up by eliminating the variable. Signed-off-by: Chen Gang Reviewed-by: Markus Armbruster Signed-off-by: Michael Tokarev --- vl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vl.c b/vl.c index 0b08a029c6..773649f023 100644 --- a/vl.c +++ b/vl.c @@ -4404,15 +4404,15 @@ int main(int argc, char **argv, char **envp) qdev_machine_init(); - QEMUMachineInitArgs args = { .machine = machine, - .ram_size = ram_size, - .boot_order = boot_order, - .kernel_filename = kernel_filename, - .kernel_cmdline = kernel_cmdline, - .initrd_filename = initrd_filename, - .cpu_model = cpu_model }; + current_machine->init_args = (QEMUMachineInitArgs) { + .machine = machine, + .ram_size = ram_size, + .boot_order = boot_order, + .kernel_filename = kernel_filename, + .kernel_cmdline = kernel_cmdline, + .initrd_filename = initrd_filename, + .cpu_model = cpu_model }; - current_machine->init_args = args; machine->init(¤t_machine->init_args); audio_init(); From 24c12b79235ca8187f6652900c1d25a10cbdac71 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 17 Apr 2014 19:32:42 +0200 Subject: [PATCH 10/18] xilinx: Fix typo in comment (Marvel -> Marvell) Signed-off-by: Stefan Weil Reviewed-by: Peter Crosthwaite Signed-off-by: Michael Tokarev --- hw/net/xilinx_axienet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 839d97ca86..6dc665fa47 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -98,7 +98,7 @@ static unsigned int tdk_read(struct PHY *phy, unsigned int req) r |= 1; break; case 17: - /* Marvel PHY on many xilinx boards. */ + /* Marvell PHY on many xilinx boards. */ r = 0x8000; /* 1000Mb */ break; case 18: From 7fb8b5d9c4ef6a49457155e1b7a002c227cd8bbd Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Tue, 22 Apr 2014 09:12:34 +0800 Subject: [PATCH 11/18] vl: avoid closing stdout with 'writeconfig' 'writeconfig' supports output to stdout (with '-'); when that happens, we must not close stdout, or further command line options that also use stdout will be impacted. (Although 'writeconfig' was copied from 'readconfig', the latter does not have the problem because it does not support reading from '-') Signed-off-by: Chen Gang Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev --- vl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 773649f023..236f95efd7 100644 --- a/vl.c +++ b/vl.c @@ -3890,7 +3890,9 @@ int main(int argc, char **argv, char **envp) } } qemu_config_write(fp); - fclose(fp); + if (fp != stdout) { + fclose(fp); + } break; } case QEMU_OPTION_qtest: From d461863d3c43422ad6b9bb56b5d3d85f18c26cf9 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 17 Apr 2014 22:31:13 +0200 Subject: [PATCH 12/18] Add QEMU logo (SVG file) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Q" of the logo is already included in pc-bios/qemu_logo_no_text.svg. This file now adds the complete logo as it was designed by Benoît Canet. Benoît licensed it under CC-BY 3.0, see http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg02865.html. Unneeded borders from Benoît's original logo were removed, and metadata (license, author, date) was added in this version. Cc: Benoît Canet Signed-off-by: Stefan Weil Reviewed-by: Stefan Hajnoczi Signed-off-by: Michael Tokarev --- pc-bios/qemu_logo.svg | 1010 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1010 insertions(+) create mode 100644 pc-bios/qemu_logo.svg diff --git a/pc-bios/qemu_logo.svg b/pc-bios/qemu_logo.svg new file mode 100644 index 0000000000..07b5b516ec --- /dev/null +++ b/pc-bios/qemu_logo.svg @@ -0,0 +1,1010 @@ + + + + + Kew the Angry Emu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Kew the Angry Emu + + + Benoît Canet + + + + + CC BY 3.0 + + + + + QEMU Community + + + 2012-02-15 + + + + QEMU logo + QEMU mascot + + + http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg01961.html + + + + + + + + + + + + + + + + + + EMU + + From 9057698d93cd4678788d1e8e0eaa5adb4fcbd82c Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Wed, 16 Apr 2014 17:43:07 +0400 Subject: [PATCH 13/18] net/net.c: remove unnecessary semicolon Signed-off-by: Igor Ryzhov Reviewed-by: Stefan Weil Signed-off-by: Michael Tokarev --- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/net.c b/net/net.c index a4aadffc11..bc9ed6def0 100644 --- a/net/net.c +++ b/net/net.c @@ -473,7 +473,7 @@ ssize_t qemu_deliver_packet(NetClientState *sender, if (ret == 0) { nc->receive_disabled = 1; - }; + } return ret; } From b0f9300ca389952aeaa4b96aa58bf3661e227420 Mon Sep 17 00:00:00 2001 From: Tim Comer Date: Sat, 19 Apr 2014 13:39:57 -0400 Subject: [PATCH 14/18] virtfs-proxy-helper: fix call to accept The current code calls accept() without initializing the size parameter which means the accept call might write too much to the stack. URL: https://bugs.gentoo.org/486714 Signed-off-by: Tim Comer Signed-off-by: Mike Frysinger Reviewed-by: Paolo Bonzini Signed-off-by: Michael Tokarev --- fsdev/virtfs-proxy-helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index bfecb8706c..cd291d32f2 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -760,6 +760,7 @@ static int proxy_socket(const char *path, uid_t uid, gid_t gid) return -1; } + size = sizeof(qemu); client = accept(sock, (struct sockaddr *)&qemu, &size); if (client < 0) { do_perror("accept"); From 00a9cacaea9afa4cb72871d1067bb21f75dcc3bd Mon Sep 17 00:00:00 2001 From: Kirill Batuzov Date: Thu, 10 Apr 2014 18:07:57 +0400 Subject: [PATCH 15/18] init_paths: fix minor memory leak Fields "name" (created with strdup in new_entry) and "pathname" (created with g_strdup_printf in new_entry) of pathelem struct should be freed before the whole struct is. Signed-off-by: Kirill Batuzov Signed-off-by: Michael Tokarev --- util/path.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/path.c b/util/path.c index 623219e4c5..5c59d9f1d3 100644 --- a/util/path.c +++ b/util/path.c @@ -160,7 +160,9 @@ void init_paths(const char *prefix) base = new_entry("", NULL, pref_buf); base = add_dir_maybe(base); if (base->num_entries == 0) { - free (base); + g_free(base->pathname); + free(base->name); + free(base); base = NULL; } else { set_parents(base, base); From b920cad6693d6f2baa0217543c9f9cca5ebaf6ce Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Sun, 27 Apr 2014 13:32:07 +0400 Subject: [PATCH 16/18] po/Makefile: fix $SRC_PATH reference The rule for messages.po appears to be slightly wrong. Move the `cd' command within parens. Signed-off-by: Michael Tokarev Tested-by: Stefan Weil --- po/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/Makefile b/po/Makefile index 705166e2d3..669f8654a6 100644 --- a/po/Makefile +++ b/po/Makefile @@ -37,8 +37,8 @@ install: $(OBJS) $(call quiet-command, msgfmt -o $@ $<, " GEN $@") $(PO_PATH)/messages.po: $(SRC_PATH)/ui/gtk.c - $(call quiet-command, cd $(SRC_PATH) && \ - (xgettext -o - --from-code=UTF-8 --foreign-user \ + $(call quiet-command, ( cd $(SRC_PATH) && \ + xgettext -o - --from-code=UTF-8 --foreign-user \ --package-name=QEMU --package-version=$(VERSION) \ --msgid-bugs-address=qemu-devel@nongnu.org -k_ -C ui/gtk.c | \ sed -e s/CHARSET/UTF-8/) >$@, " GEN $@") From 7a30842186274a139c2dd8de5c0a43a8d638c8a6 Mon Sep 17 00:00:00 2001 From: Michael Tokarev Date: Sun, 27 Apr 2014 14:49:14 +0400 Subject: [PATCH 17/18] po: add proper Language: tags to .po files Signed-off-by: Michael Tokarev --- po/de_DE.po | 2 +- po/fr_FR.po | 2 +- po/hu.po | 2 +- po/it.po | 2 +- po/tr.po | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/po/de_DE.po b/po/de_DE.po index fcbde954c2..dec68c9ee8 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -10,7 +10,7 @@ msgstr "" "PO-Revision-Date: 2012-02-28 16:00+0100\n" "Last-Translator: Kevin Wolf \n" "Language-Team: Deutsch \n" -"Language: \n" +"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/po/fr_FR.po b/po/fr_FR.po index 45b2c0153d..ec54eb95a8 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -10,7 +10,7 @@ msgstr "" "PO-Revision-Date: 2013-03-31 19:39+0200\n" "Last-Translator: Aurelien Jarno \n" "Language-Team: French \n" -"Language: \n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/po/hu.po b/po/hu.po index 0a44c664df..401ed211ad 100644 --- a/po/hu.po +++ b/po/hu.po @@ -10,7 +10,7 @@ msgstr "" "PO-Revision-Date: 2013-05-06 20:42+0200\n" "Last-Translator: Ákos Kovács \n" "Language-Team: Hungarian \n" -"Language: \n" +"Language: hu\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/po/it.po b/po/it.po index 592d3d85f9..a62665cb22 100644 --- a/po/it.po +++ b/po/it.po @@ -10,7 +10,7 @@ msgstr "" "PO-Revision-Date: 2012-02-27 08:23+0100\n" "Last-Translator: Paolo Bonzini \n" "Language-Team: Italian \n" -"Language: \n" +"Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/po/tr.po b/po/tr.po index d57995a60b..d712ced9cc 100644 --- a/po/tr.po +++ b/po/tr.po @@ -10,7 +10,7 @@ msgstr "" "PO-Revision-Date: 2013-04-22 18:35+0300\n" "Last-Translator: Ozan Çağlayan \n" "Language-Team: Türkçe <>\n" -"Language: \n" +"Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" From b87b8a8b32518df9e5285f9b3d4f9d9a0c426a06 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Sun, 27 Apr 2014 14:54:12 +0400 Subject: [PATCH 18/18] slirp/smb: Move ncalrpc directory to tmp The smbd forked by qemu still uses the default ncalrpc directory in /var/run/samba. This may lead to problems, if /var/run/samba does not exist (for example if /var/run is a tmpfs and the host smbd was not started). This leads to the following error message from samba and an unworkable smbd: Failed to create pipe directory /var/run/samba/ncalrpc - No such file or directory Fix this by pointing smbd to /tmp/qemu-smb.%d.%d/ncalrpc as ncalrpc directory. Smbd will create the actual ncalrpc subdirectory on its own. Signed-off-by: Michael Buesch Cc: Jan Kiszka Signed-off-by: Michael Tokarev (Applying this to -trivial because it _is_ rather trivial and because Jan does not reply for months) --- net/slirp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/slirp.c b/net/slirp.c index cce026bf12..8fddc03841 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -527,6 +527,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, "pid directory=%s\n" "lock directory=%s\n" "state directory=%s\n" + "ncalrpc dir=%s/ncalrpc\n" "log file=%s/log.smbd\n" "smb passwd file=%s/smbpasswd\n" "security = user\n" @@ -542,6 +543,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, s->smb_dir, s->smb_dir, s->smb_dir, + s->smb_dir, exported_dir, passwd->pw_name );