From 3a0614c6c782cb760ec925f1662037c1c6038f0c Mon Sep 17 00:00:00 2001 From: Zhu Guihua Date: Mon, 3 Nov 2014 13:51:34 +0800 Subject: [PATCH 01/11] icc_bus: fix typo ICC_BRIGDE -> ICC_BRIDGE Rename ICC_BRIGDE for better readability. Signed-off-by: Zhu Guihua Reviewed-by: Markus Armbruster Signed-off-by: Michael Tokarev --- hw/cpu/icc_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/cpu/icc_bus.c b/hw/cpu/icc_bus.c index 9575fd6a42..6646ea2b34 100644 --- a/hw/cpu/icc_bus.c +++ b/hw/cpu/icc_bus.c @@ -73,11 +73,11 @@ typedef struct ICCBridgeState { MemoryRegion apic_container; } ICCBridgeState; -#define ICC_BRIGDE(obj) OBJECT_CHECK(ICCBridgeState, (obj), TYPE_ICC_BRIDGE) +#define ICC_BRIDGE(obj) OBJECT_CHECK(ICCBridgeState, (obj), TYPE_ICC_BRIDGE) static void icc_bridge_init(Object *obj) { - ICCBridgeState *s = ICC_BRIGDE(obj); + ICCBridgeState *s = ICC_BRIDGE(obj); SysBusDevice *sb = SYS_BUS_DEVICE(obj); qbus_create_inplace(&s->icc_bus, sizeof(s->icc_bus), TYPE_ICC_BUS, From 63c693f8d0182fddc411572916e460144ac71689 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Mon, 3 Nov 2014 20:48:30 +0800 Subject: [PATCH 02/11] qemu-doc.texi: fix typos in x509 examples Signed-off-by: Gonglei Signed-off-by: Michael Tokarev --- qemu-doc.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 9973090c6c..ad418f851d 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -1631,7 +1631,7 @@ EOF # certtool --generate-certificate \ --load-ca-certificate ca-cert.pem \ --load-ca-privkey ca-key.pem \ - --load-privkey server server-key.pem \ + --load-privkey server-key.pem \ --template server.info \ --outfile server-cert.pem @end example @@ -1654,7 +1654,7 @@ the secure CA private key: country = GB state = London locality = London -organiazation = Name of your organization +organization = Name of your organization cn = client.foo.example.com tls_www_client encryption_key From 7912d04be6322b16cfece6b698361ae6ed036ba9 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 3 Nov 2014 11:52:10 +0100 Subject: [PATCH 03/11] slirp/smbd: modify/set several parameters in generated smbd.conf The file sharing module should not handle printers, so disable it. The options 'load printers' and 'printing' have been available since the beginning (May 1996, commit 0e8fd3398771da2f016d72830179507f3edda51b). Option 'disable spoolss' is available since Samba 2.0.4, commit de5f42c9d9172592779fa2504d44544e3b6b1c0d). Next, "socket address" was reported as deprecated, use a combination of "interfaces" and "bind interfaces only" instead (available since October 1997, commit 79f4fb52c1ed56fd843f81b4eb0cdd2991d4d0f4). Override cache directory to avoid writing to a global directory. Option available since Samba 3.4.0, Jan 2009, commit 19a05bf2f485023b11b41dfae3f6459847d55ef7. Set "usershare max shared=0" to prevent a global directory from being used. Option available since Samba 3.0.23, February 2006, commit 5831715049f2d460ce42299963a5defdc160891b. The last option was introduced with Samba 3.4.0, but previously "state directory" was already added which exists in Samba 3.4.0. As unknown parameters are ignored (while printing a warning), it should be safe to add another option. Signed-off-by: Peter Wu Cc: Jan Kiszka Signed-off-by: Michael Tokarev --- net/slirp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/slirp.c b/net/slirp.c index 920af30bda..dc89e6b086 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -523,15 +523,21 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, fprintf(f, "[global]\n" "private dir=%s\n" - "socket address=127.0.0.1\n" + "interfaces=127.0.0.1\n" + "bind interfaces only=yes\n" "pid directory=%s\n" "lock directory=%s\n" "state directory=%s\n" + "cache directory=%s\n" "ncalrpc dir=%s/ncalrpc\n" "log file=%s/log.smbd\n" "smb passwd file=%s/smbpasswd\n" "security = user\n" "map to guest = Bad User\n" + "load printers = no\n" + "printing = bsd\n" + "disable spoolss = yes\n" + "usershare max shares = 0\n" "[qemu]\n" "path=%s\n" "read only=no\n" @@ -544,6 +550,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 ); From 5b009e400809523e71f1b72bdaa2b681e2a5b1c7 Mon Sep 17 00:00:00 2001 From: zhanghailiang Date: Tue, 4 Nov 2014 19:49:30 +0800 Subject: [PATCH 04/11] numa: make 'info numa' take into account hotplugged memory When do memory hotplug, if there is numa node, we should add the memory size to the corresponding node memory size. It affects the result of hmp command "info numa". Reviewed-by: Igor Mammedov Signed-off-by: zhanghailiang Signed-off-by: Michael Tokarev --- include/sysemu/sysemu.h | 1 + monitor.c | 6 +++++- numa.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 0037a695c1..50de1d36b1 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -161,6 +161,7 @@ typedef struct node_info { extern NodeInfo numa_info[MAX_NODES]; void set_numa_nodes(void); void set_numa_modes(void); +void query_numa_node_mem(uint64_t node_mem[]); extern QemuOptsList qemu_numa_opts; int numa_init_func(QemuOpts *opts, void *opaque); diff --git a/monitor.c b/monitor.c index 1fc201ae82..32db7ee257 100644 --- a/monitor.c +++ b/monitor.c @@ -1948,7 +1948,10 @@ static void do_info_numa(Monitor *mon, const QDict *qdict) { int i; CPUState *cpu; + uint64_t *node_mem; + node_mem = g_new0(uint64_t, nb_numa_nodes); + query_numa_node_mem(node_mem); monitor_printf(mon, "%d nodes\n", nb_numa_nodes); for (i = 0; i < nb_numa_nodes; i++) { monitor_printf(mon, "node %d cpus:", i); @@ -1959,8 +1962,9 @@ static void do_info_numa(Monitor *mon, const QDict *qdict) } monitor_printf(mon, "\n"); monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i, - numa_info[i].node_mem >> 20); + node_mem[i] >> 20); } + g_free(node_mem); } #ifdef CONFIG_PROFILER diff --git a/numa.c b/numa.c index 3b981359d1..afd28666b3 100644 --- a/numa.c +++ b/numa.c @@ -35,6 +35,7 @@ #include "hw/boards.h" #include "sysemu/hostmem.h" #include "qmp-commands.h" +#include "hw/mem/pc-dimm.h" QemuOptsList qemu_numa_opts = { .name = "numa", @@ -315,6 +316,43 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, } } +static void numa_stat_memory_devices(uint64_t node_mem[]) +{ + MemoryDeviceInfoList *info_list = NULL; + MemoryDeviceInfoList **prev = &info_list; + MemoryDeviceInfoList *info; + + qmp_pc_dimm_device_list(qdev_get_machine(), &prev); + for (info = info_list; info; info = info->next) { + MemoryDeviceInfo *value = info->value; + + if (value) { + switch (value->kind) { + case MEMORY_DEVICE_INFO_KIND_DIMM: + node_mem[value->dimm->node] += value->dimm->size; + break; + default: + break; + } + } + } + qapi_free_MemoryDeviceInfoList(info_list); +} + +void query_numa_node_mem(uint64_t node_mem[]) +{ + int i; + + if (nb_numa_nodes <= 0) { + return; + } + + numa_stat_memory_devices(node_mem); + for (i = 0; i < nb_numa_nodes; i++) { + node_mem[i] += numa_info[i].node_mem; + } +} + static int query_memdev(Object *obj, void *opaque) { MemdevList **list = opaque; From f17b06901049e54dbfa8b01c278cdc2e3ae5d62d Mon Sep 17 00:00:00 2001 From: Martin Simmons Date: Wed, 5 Nov 2014 14:47:39 +0000 Subject: [PATCH 05/11] gdbstub: Add a missing case of signal number translation in gdbstub While using qemu with gdb "target remote" to debug an application that uses fork and exec, the qemu process receives SIGSTOP every time the forked process terminates (sending SIGCHLD). This is caused by a missing call to gdb_signal_to_target in gdbstub.c, which is fixed by this patch: Signed-off-by: Martin Simmons Reviewed-by: Peter Maydell Signed-off-by: Michael Tokarev --- gdbstub.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdbstub.c b/gdbstub.c index d1b5afd8fe..0faca568d9 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -823,7 +823,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) action = *p++; signal = 0; if (action == 'C' || action == 'S') { - signal = strtoul(p, (char **)&p, 16); + signal = gdb_signal_to_target(strtoul(p, (char **)&p, 16)); + if (signal == -1) { + signal = 0; + } } else if (action != 'c' && action != 's') { res = 0; break; From c21fd2c79e1fcaf45582f2dd4deb491c257aa9f2 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Mon, 3 Nov 2014 17:26:30 +0800 Subject: [PATCH 06/11] pc-bios: petalogix-s3adsp1800.dtb: Use 'xlnx, xps-ethernetlite-2.00.a' instead of 'xlnx, xps-ethernetlite-2.00.b' For Linux upstream kernel (e.g. 3.17-rc7), the related compatible string 'xlnx,xps-ethernetlite-2.00.a' is supported, but 'b' is not supported, so change qemu dtb file to match kernel driver. The related operation for qemu (after this patch): yum install libvirt yum install tunctl tunctl -b ip link set tap0 up brctl addif virbr0 tap0 ./configure make ./microblaze-softmmu/qemu-system-microblaze -M petalogix-s3adsp1800 \ -kernel ../linux-stable.microblaze/arch/microblaze/boot/linux.bin \ -no-reboot -append "console=ttyUL0,115200 doreboot" -nographic \ -net nic,vlan=0,model=xlnx.xps-ethernetlite,macaddr=00:16:35:AF:94:00 \ -net tap,vlan=0,ifname=tap0,script=no,downscript=no in microblaze qemu bash (guest machine): ifconfig eth0 add 192.168.122.2 netmask 255.255.255.0 ifconfig eth0 up Then can telnet 192.168.122.2 directly without password from the host machine. The related operation for generating new dtb: building Linux kernel firstly, then get dts tool "./scripts/dts/dts". "./scripts/dtc/dtc -I dtb -O dts -o ../work.dts ../qemu/petalogix-s3adsp1800.dtb" edit work.dts (replace 'xlnx,xps-ethernetlite-2.00.b') "./scripts/dtc/dtc -I dts -O dtb -o ..qemu/petalogix-s3adsp1800.dtb ../work.dts" (Since I am not quite sure whether can read this patch or not, I put the related dtb file in attachment, please check, thanks). Signed-off-by: Chen Gang Signed-off-by: Michael Tokarev --- pc-bios/petalogix-s3adsp1800.dtb | Bin 8259 -> 8259 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/pc-bios/petalogix-s3adsp1800.dtb b/pc-bios/petalogix-s3adsp1800.dtb index 93c5973fd81244268aace6e5e6006ad6fb4d6199..8ac80f2f2d191a8491b71182be50b3df2989551d 100644 GIT binary patch delta 14 VcmX@?aM)pkI6GtFW(js}NdPEw1Wf<{ delta 14 VcmX@?aM)pkI6Gs~W(js}NdPE$1Wo_| From 7f151e6f718f2edaf8661c4dedf6fcdb30b10e1b Mon Sep 17 00:00:00 2001 From: Willem Pinckaers Date: Fri, 7 Nov 2014 19:51:59 -0800 Subject: [PATCH 07/11] coroutine-sigaltstack: Change jmp_buf to sigjmp_buf This is a simple patch to change the type of old_env from jmp_buf to sigjmp_buf. old_env is used by sigsetjmp and as such should be a sigjmp_buf. This fixes a stack_chk fail in a OSX 32bit build. Since at least on OSX sigjmp_buf is four bytes larger then a jmpbuf, resulting in an overflow in sigsetjmp. Due to variable reordering this overwrites the stack cookie. Signed-off-by: Willem Pinckaers Reviewed-by: Peter Maydell Peter: I think I must have missed this one when I converted all the jmp_buf to sigjmp_buf in commit 6ab7e546. Signed-off-by: Michael Tokarev --- coroutine-sigaltstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coroutine-sigaltstack.c b/coroutine-sigaltstack.c index 3de0bb33bd..63519fffc7 100644 --- a/coroutine-sigaltstack.c +++ b/coroutine-sigaltstack.c @@ -155,7 +155,7 @@ Coroutine *qemu_coroutine_new(void) stack_t oss; sigset_t sigs; sigset_t osigs; - jmp_buf old_env; + sigjmp_buf old_env; /* The way to manipulate stack is with the sigaltstack function. We * prepare a stack, with it delivering a signal to ourselves and then From d208a85f1568ab8aec238cb91367581c61350008 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Tue, 11 Nov 2014 17:23:40 +0800 Subject: [PATCH 08/11] xen-hvm: Remove redundant variable 'xstate' In xen_hvm_change_state_handler(), we can pass 'opaque' with type cast to xen_main_loop_prepare() directly, there's no need to use additional variable for it. Signed-off-by: Chen Gang Acked-by: Stefano Stabellini Signed-off-by: Michael Tokarev --- xen-hvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen-hvm.c b/xen-hvm.c index 21f1cbb01b..754879481e 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -993,9 +993,8 @@ static void xen_main_loop_prepare(XenIOState *state) static void xen_hvm_change_state_handler(void *opaque, int running, RunState rstate) { - XenIOState *xstate = opaque; if (running) { - xen_main_loop_prepare(xstate); + xen_main_loop_prepare((XenIOState *)opaque); } } From 8f9d989cac7bd92fb976d65d0aada2d4c6d8ecf9 Mon Sep 17 00:00:00 2001 From: Chen Fan Date: Wed, 5 Nov 2014 16:40:33 +0800 Subject: [PATCH 09/11] target-i386: cpu: keeping function parameters alignment on new line Signed-off-by: Chen Fan Signed-off-by: Michael Tokarev --- target-i386/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index e4ccee133a..236bbeeeee 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -533,8 +533,8 @@ void host_cpuid(uint32_t function, uint32_t count, * otherwise the string is assumed to sized by a terminating nul. * Return lexical ordering of *s1:*s2. */ -static int sstrcmp(const char *s1, const char *e1, const char *s2, - const char *e2) +static int sstrcmp(const char *s1, const char *e1, + const char *s2, const char *e2) { for (;;) { if (!*s1 || !*s2 || *s1 != *s2) @@ -1845,7 +1845,7 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features, * if flags, suppress names undefined in featureset. */ static void listflags(char *buf, int bufsize, uint32_t fbits, - const char **featureset, uint32_t flags) + const char **featureset, uint32_t flags) { const char **p = &featureset[31]; char *q, *b, bit; From 00c2275c95edb3c355fce7e1128bdef845b9fe34 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Tue, 11 Nov 2014 17:37:59 +0800 Subject: [PATCH 10/11] sysbus: Correct SYSTEM_BUS(obj) defines Signed-off-by: Gonglei Reviewed-by: Markus Armbruster Signed-off-by: Michael Tokarev --- include/hw/sysbus.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 9fb1782d7b..9bddfdec42 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -10,7 +10,7 @@ #define QDEV_MAX_PIO 32 #define TYPE_SYSTEM_BUS "System" -#define SYSTEM_BUS(obj) OBJECT_CHECK(IDEBus, (obj), TYPE_IDE_BUS) +#define SYSTEM_BUS(obj) OBJECT_CHECK(BusState, (obj), TYPE_SYSTEM_BUS) typedef struct SysBusDevice SysBusDevice; From 705be728c0b5546da10d8ef4239a112d1616bb97 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 10 Nov 2014 17:10:38 +0800 Subject: [PATCH 11/11] block: Fix comment for bdrv_co_get_block_status It returns more information than binary, fix the comment. Signed-off-by: Fam Zheng Reviewed-by: Max Reitz Reviewed-by: Markus Armbruster Signed-off-by: Michael Tokarev --- block.c | 6 +++--- include/block/block.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 88f6d9b236..5f5b244a98 100644 --- a/block.c +++ b/block.c @@ -3877,9 +3877,9 @@ typedef struct BdrvCoGetBlockStatusData { } BdrvCoGetBlockStatusData; /* - * Returns true iff the specified sector is present in the disk image. Drivers - * not implementing the functionality are assumed to not support backing files, - * hence all their sectors are reported as allocated. + * Returns the allocation status of the specified sectors. + * Drivers not implementing the functionality are assumed to not support + * backing files, hence all their sectors are reported as allocated. * * If 'sector_num' is beyond the end of the disk image the return value is 0 * and 'pnum' is set to 0. diff --git a/include/block/block.h b/include/block/block.h index 341054dcf7..603d4b4392 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -83,7 +83,9 @@ typedef enum { #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) #define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1) -/* BDRV_BLOCK_DATA: data is read from bs->file or another file +/* + * Allocation status flags + * BDRV_BLOCK_DATA: data is read from bs->file or another file * BDRV_BLOCK_ZERO: sectors read as zero * BDRV_BLOCK_OFFSET_VALID: sector stored in bs->file as raw data * BDRV_BLOCK_ALLOCATED: the content of the block is determined by this