trivial patches 2023-06-10
Hi here!
This is my first pullreq in quite some years.
It looks like there has been quite some trivial patches which were forgotten, so I thought I'd give it a shot at least.
And since I haven't done a PR in a while, I basically forgot how to do it properly :)
Please note: there are 2 patches in there which are *not* reviewed. Being a trivial-patch collection, they're "obviously correct", - namely these are spelling fixes ("information") and adding comments in linux-user/syscall.c. If that's not okay, let's remove these 2 changes and apply the rest.
Thanks,
/mjt
The following changes since commit 5f9dd6a8ce3961db4ce47411ed2097ad88bdf5fc:
Merge tag 'pull-9p-20230608' of https://github.com/cschoenebeck/qemu into staging (2023-06-08 08:47:35 -0700)
are available in the Git repository at:
https://gitlab.com/mjt0k/qemu.git tags/trivial-patches-20230610
for you to fetch changes up to e928907105cfeb48b68cedce232bbd4784536707:
linux-user: elfload: Specify -R is an option for qemu-user binaries (2023-06-10 09:40:46 +0300)
----------------------------------------------------------------
trivial-patches-20230610
----------------------------------------------------------------
Anastasia Belova (1):
vnc: move assert in vnc_worker_thread_loop
Andrew Jeffery (2):
linux-user: elfload: s/min_mmap_addr/mmap_min_addr/
linux-user: elfload: Specify -R is an option for qemu-user binaries
Carlos Santos (1):
meson: install keyboard maps only if necessary
Mattias Nissler (1):
hw/remote: Fix vfu_cfg trace offset format
Michael Tokarev (4):
hw/virtio/virtio-qmp.c: spelling: suppoted
spelling: information
block.c: add newline for "Detected format" warning
linux-user: add comments for TARGET_NR_[gs]etgroups{,32}
Milan Zamazal (1):
docs: Fix trivial typos in vhost-user.rst
Peter Maydell (1):
linux-user: Return EINVAL for getgroups() with negative gidsetsize
Philippe Mathieu-Daudé (5):
target/m68k/fpu_helper: Use FloatRelation enum to hold comparison result hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro hw/i386/microvm: Simplify using object_dynamic_cast() hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro
block.c | 2 +- docs/system/devices/vhost-user.rst | 4 ++-- hw/core/cpu-common.c | 3 +-- hw/i386/microvm.c | 3 +-- hw/pci/pci.c | 4 +--- hw/remote/trace-events | 4 ++-- hw/usb/hcd-ehci-pci.c | 2 +- hw/virtio/virtio-qmp.c | 2 +- include/ui/clipboard.h | 2 +- linux-user/elfload.c | 5 +++-- linux-user/syscall.c | 12 ++++++------ pc-bios/keymaps/meson.build | 6 ++++-- qapi/cryptodev.json | 2 +- qga/qapi-schema.json | 2 +- target/m68k/fpu_helper.c | 4 ++-- ui/vnc-jobs.c | 3 ++- 16 files changed, 30 insertions(+), 30 deletions(-)
[PULL 01/16] docs: Fix trivial typos in vhost-user.rst
From: Milan Zamazal <[email protected]>
--- docs/system/devices/vhost-user.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
docs/system/devices/vhost-user.rst +2 -2
@@ -38,13 +38,13 @@ system memory as defined by the ``-m`` argument. Example ======= -First start you daemon. +First start your daemon. .. parsed-literal:: $ virtio-foo --socket-path=/var/run/foo.sock $OTHER_ARGS -The you start your QEMU instance specifying the device, chardev and +Then you start your QEMU instance specifying the device, chardev and memory objects. .. parsed-literal::
Signature · 1 line
2.39.2
[PULL 03/16] spelling: information
In reply to Michael Tokarev3 trivial fixes: 2 .json comments which goes to
executables, and 1 .h file comment.
--- include/ui/clipboard.h | 2 +- qapi/cryptodev.json | 2 +- qga/qapi-schema.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
include/ui/clipboard.h +1 -1
@@ -170,7 +170,7 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer,* * @selection: clipboard selection. * -* Return the current clipboard data & owner informations. +* Return the current clipboard data & owner information. */ QemuClipboardInfo *qemu_clipboard_info (QemuClipboardSelection selection);
qapi/cryptodev.json +1 -1
@@ -75,7 +75,7 @@ # # @service: supported service types of a crypto device # -# @client: the additional infomation of the crypto device +# @client: the additional information of the crypto device # # Since: 8.0 ##
qga/qapi-schema.json +1 -1
@@ -931,7 +931,7 @@ ## # @GuestNVMeSmart: # -# NVMe smart informations, based on NVMe specification, section +# NVMe smart information, based on NVMe specification, section # <SMART / Health Information (Log Identifier 02h)> # # Since: 7.1
Signature · 1 line
2.39.2
[PULL 02/16] hw/virtio/virtio-qmp.c: spelling: suppoted
In reply to Michael Tokarev--- hw/virtio/virtio-qmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-qmp.c +1 -1
@@ -331,7 +331,7 @@ static const qmp_virtio_feature_map_t virtio_net_feature_map[] = {static const qmp_virtio_feature_map_t virtio_scsi_feature_map[] = {FEATURE_ENTRY (VIRTIO_SCSI_F_INOUT , \"VIRTIO_SCSI_F_INOUT: Requests including read and writable data " -"buffers suppoted" ), +"buffers supported" ),FEATURE_ENTRY (VIRTIO_SCSI_F_HOTPLUG , \"VIRTIO_SCSI_F_HOTPLUG: Reporting and handling hot-plug events " "supported" ),
Signature · 1 line
2.39.2
[PULL 04/16] hw/remote: Fix vfu_cfg trace offset format
In reply to Michael TokarevFrom: Mattias Nissler <[email protected]>
The printed offset value is prefixed with 0x, but was actually printed in decimal. To spare others the confusion, adjust the format specifier to hexadecimal.
--- hw/remote/trace-events | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/remote/trace-events +2 -2
@@ -5,8 +5,8 @@ mpqemu_recv_io_error(int cmd, int size, int nfds) "failed to receive %d size %d, # vfio-user-obj.c vfu_prop(const char *prop, const char *val) "vfu: setting %s as %s" -vfu_cfg_read(uint32_t offset, uint32_t val) "vfu: cfg: 0x%u -> 0x%x" -vfu_cfg_write(uint32_t offset, uint32_t val) "vfu: cfg: 0x%u <- 0x%x" +vfu_cfg_read(uint32_t offset, uint32_t val) "vfu: cfg: 0x%x -> 0x%x" +vfu_cfg_write(uint32_t offset, uint32_t val) "vfu: cfg: 0x%x <- 0x%x" vfu_dma_register(uint64_t gpa, size_t len) "vfu: registering GPA 0x%"PRIx64", %zu bytes" vfu_dma_unregister(uint64_t gpa) "vfu: unregistering GPA 0x%"PRIx64"" vfu_bar_register(int i, uint64_t addr, uint64_t size) "vfu: BAR %d: addr 0x%"PRIx64" size 0x%"PRIx64""
Signature · 1 line
2.39.2
[PULL 05/16] block.c: add newline for "Detected format" warning
In reply to Michael TokarevAdd the forgotten trailing newline.
--- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
@@ -7158,7 +7158,7 @@ void bdrv_img_create(const char *filename, const char *fmt,if (!backing_fmt) {error_setg (&local_err,"Backing file specified without backing format" ); -error_append_hint (&local_err,"Detected format of %s." , +error_append_hint (&local_err,"Detected format of %s.\n" , bs->drv->format_name); goto out; }
Signature · 1 line
2.39.2
[PULL 06/16] meson: install keyboard maps only if necessary
In reply to Michael TokarevFrom: Carlos Santos <[email protected]>
They are required only for system emulation (i.e. have_system is true).
--- pc-bios/keymaps/meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
pc-bios/keymaps/meson.build +4 -2
@@ -47,7 +47,7 @@ if native_qemu_keymap.found() build_by_default: true, output: km, command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()], - install: true, + install: have_system, install_dir: qemu_datadir / 'keymaps') endforeach
@@ -56,4 +56,6 @@ else install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps') endif -install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps') +if have_system + install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps') +endif
Signature · 1 line
2.39.2
[PULL 07/16] target/m68k/fpu_helper: Use FloatRelation enum to hold comparison result
In reply to Michael TokarevFrom: Philippe Mathieu-Daudé <[email protected]>
Use the FloatRelation enum to hold the comparison result (missed in commit 71bfd65c5f "softfloat: Name compare relation enum").
--- target/m68k/fpu_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/m68k/fpu_helper.c +2 -2
@@ -349,7 +349,7 @@ void HELPER(fsgldiv)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)PREC_END (); } -static int float_comp_to_cc (int float_compare) +static int float_comp_to_cc (FloatRelation float_compare) {switch (float_compare) {case float_relation_equal:
@@ -367,7 +367,7 @@ static int float_comp_to_cc(int float_compare)void HELPER (fcmp )(CPUM68KState *env,FPReg *val0,FPReg *val1) { -int float_compare; +FloatRelation float_compare; float_compare =floatx80_compare (val1->d, val0->d, &env->fp_status); env->fpsr = (env->fpsr & ~FPSR_CC_MASK ) |float_comp_to_cc (float_compare);
Signature · 1 line
2.39.2
[PULL 09/16] hw/i386/microvm: Simplify using object_dynamic_cast()
In reply to Michael TokarevFrom: Philippe Mathieu-Daudé <[email protected]>
Use object_dynamic_cast() to determine if 'dev' is a TYPE_VIRTIO_MMIO.
--- hw/i386/microvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
hw/i386/microvm.c +1 -2
@@ -389,9 +389,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine) bus =sysbus_get_default (); QTAILQ_FOREACH(kid, &bus->children, sibling) {DeviceState *dev = kid->child; -ObjectClass *class =object_get_class (OBJECT (dev)); -if (class ==object_class_by_name (TYPE_VIRTIO_MMIO )) { +if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MMIO )) {VirtIOMMIOProxy *mmio =VIRTIO_MMIO (OBJECT (dev));VirtioBusState *mmio_virtio_bus = &mmio->bus;BusState *mmio_bus = &mmio_virtio_bus->parent_obj;
Signature · 1 line
2.39.2
[PULL 08/16] hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro
In reply to Michael TokarevFrom: Philippe Mathieu-Daudé <[email protected]>
--- hw/core/cpu-common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
hw/core/cpu-common.c +1 -2
@@ -196,8 +196,7 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)* no need to check the ignore_memory_transaction_failures board flag. */ if (object_dynamic_cast (machine,TYPE_MACHINE )) { -ObjectClass *oc =object_get_class (machine); -MachineClass *mc =MACHINE_CLASS (oc); +MachineClass *mc =MACHINE_GET_CLASS (machine);if (mc) { cpu->ignore_memory_transaction_failures =
Signature · 1 line
2.39.2
[PULL 11/16] hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro
In reply to Michael TokarevFrom: Philippe Mathieu-Daudé <[email protected]>
--- hw/usb/hcd-ehci-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/hcd-ehci-pci.c +1 -1
@@ -74,7 +74,7 @@ static void usb_ehci_pci_realize(PCIDevice *dev, Error **errp)static void usb_ehci_pci_init (Object *obj) { -DeviceClass *dc =OBJECT_GET_CLASS (DeviceClass, obj,TYPE_DEVICE ); +DeviceClass *dc =DEVICE_GET_CLASS (obj);EHCIPCIState *i =PCI_EHCI (obj);EHCIState *s = &i->ehci;
Signature · 1 line
2.39.2
[PULL 12/16] linux-user: add comments for TARGET_NR_[gs]etgroups{, 32}
In reply to Michael TokarevThere are 2 pairs of identical code (with different types) for TARGET_NR_setgroups & TARGET_NR_setgroups32, and for TARGET_NR_getgroups & TARGET_NR_getgroups32. Add comments stating this fact, so that further modifications are done in two places.
--- linux-user/syscall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
linux-user/syscall.c +4 -4
@@ -11670,7 +11670,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,case TARGET_NR_setregid:return get_errno (setregid (low2highgid (arg1),low2highgid (arg2)));case TARGET_NR_getgroups: - { + {/* the same code as for TARGET_NR_getgroups32 */ int gidsetsize = arg1;target_id *target_grouplist; g_autofree gid_t *grouplist = NULL;
@@ -11701,7 +11701,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,return ret; }case TARGET_NR_setgroups: - { + {/* the same code as for TARGET_NR_setgroups32 */ int gidsetsize = arg1;target_id *target_grouplist; g_autofree gid_t *grouplist = NULL;
@@ -12006,7 +12006,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,#endif #ifdef TARGET_NR_getgroups32case TARGET_NR_getgroups32: - { + {/* the same code as for TARGET_NR_getgroups */ int gidsetsize = arg1;uint32_t *target_grouplist; g_autofree gid_t *grouplist = NULL;
@@ -12038,7 +12038,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,#endif #ifdef TARGET_NR_setgroups32case TARGET_NR_setgroups32: - { + {/* the same code as for TARGET_NR_setgroups */ int gidsetsize = arg1;uint32_t *target_grouplist; g_autofree gid_t *grouplist = NULL;
Signature · 1 line
2.39.2
[PULL 10/16] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro
In reply to Michael TokarevFrom: Philippe Mathieu-Daudé <[email protected]>
Remove unnecessary intermediate variables.
--- hw/pci/pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/pci/pci.c +1 -3
@@ -1446,9 +1446,7 @@ pcibus_t pci_bar_address(PCIDevice *d, {pcibus_t new_addr, last_addr;uint16_t cmd =pci_get_word (d->config +PCI_COMMAND ); -Object *machine =qdev_get_machine (); -ObjectClass *oc =object_get_class (machine); -MachineClass *mc =MACHINE_CLASS (oc); +MachineClass *mc =MACHINE_GET_CLASS (qdev_get_machine ());bool allow_0_address = mc->pci_allow_0_address;if (type &PCI_BASE_ADDRESS_SPACE_IO ) {
Signature · 1 line
2.39.2
[PULL 13/16] linux-user: Return EINVAL for getgroups() with negative gidsetsize
In reply to Michael TokarevFrom: Peter Maydell <[email protected]>
Coverity doesn't like the way we might end up calling getgroups() with a NULL grouplist pointer. This is fine for the special case of gidsetsize == 0, but we will also do it if the guest passes us a negative gidsetsize. (CID 1512465)
Explicitly fail the negative gidsetsize with EINVAL, as the kernel does. This means we definitely only call the libc getgroups() with valid parameters. It also brings the getgroups() code in to line with the setgroups() code.
Possibly Coverity may still complain about getgroups(0, NULL), but that would be a false positive.
--- linux-user/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/syscall.c +2 -2
@@ -11676,7 +11676,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, g_autofree gid_t *grouplist = NULL;int i; -if (gidsetsize >NGROUPS_MAX ) { +if (gidsetsize >NGROUPS_MAX || gidsetsize <0 ) {return -TARGET_EINVAL ; }if (gidsetsize >0 ) {
@@ -12012,7 +12012,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, g_autofree gid_t *grouplist = NULL;int i; -if (gidsetsize >NGROUPS_MAX ) { +if (gidsetsize >NGROUPS_MAX || gidsetsize <0 ) {return -TARGET_EINVAL ; }if (gidsetsize >0 ) {
Signature · 1 line
2.39.2
[PULL 15/16] linux-user: elfload: s/min_mmap_addr/mmap_min_addr/
In reply to Michael TokarevFrom: Andrew Jeffery <[email protected]>
As-is the error message can cause some confusion as the mentioned sysctl attribute name is wrong:
https://www.kernel.org/doc/html/latest/admin-guide/sysctl/vm.html#mmap-min-addr
--- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/elfload.c +1 -1
@@ -2798,7 +2798,7 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,if (addr ==MAP_FAILED || addr != test) {error_report ("Unable to reserve 0x%lx bytes of virtual address " "space at %p (%s) for use as guest address space (check your " -"virtual memory ulimit setting, min_mmap_addr or reserve less " +"virtual memory ulimit setting, mmap_min_addr or reserve less " "using -R option)" , reserved_va +1 , test,strerror (errno));exit (EXIT_FAILURE ); }
Signature · 1 line
2.39.2
[PULL 14/16] vnc: move assert in vnc_worker_thread_loop
In reply to Michael TokarevFrom: Anastasia Belova <[email protected]>
job may be NULL if queue->exit is true. Check it before dereference job.
--- ui/vnc-jobs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ui/vnc-jobs.c +2 -1
@@ -250,12 +250,13 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)/* Here job can only be NULL if queue->exit is true */ job =QTAILQ_FIRST (&queue->jobs);vnc_unlock_queue (queue); -assert (job->vs->magic ==VNC_MAGIC );if (queue->exit) {return -1 ; } +assert (job->vs->magic ==VNC_MAGIC ); +vnc_lock_output (job->vs);if (job->vs->ioc ==NULL || job->vs->abort == true) {vnc_unlock_output (job->vs);
Signature · 1 line
2.39.2
[PULL 16/16] linux-user: elfload: Specify -R is an option for qemu-user binaries
In reply to Michael TokarevFrom: Andrew Jeffery <[email protected]>
Given several different concepts are suggested for investigation, let's not confuse e.g. ulimit's -R with what was actually intended.
--- linux-user/elfload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
linux-user/elfload.c +2 -1
@@ -2799,7 +2799,8 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,error_report ("Unable to reserve 0x%lx bytes of virtual address " "space at %p (%s) for use as guest address space (check your " "virtual memory ulimit setting, mmap_min_addr or reserve less " -"using -R option)" , reserved_va +1 , test,strerror (errno)); +"using qemu-user's -R option)" , + reserved_va +1 , test,strerror (errno));exit (EXIT_FAILURE ); }
Signature · 1 line
2.39.2
Richard Henderson
AppliedQuoted 25 lines · Michael Tokarev
Hi here!
This is my first pullreq in quite some years.
It looks like there has been quite some trivial patches which were forgotten, so I thought I'd give it a shot at least.
And since I haven't done a PR in a while, I basically forgot how to do it properly :)
Please note: there are 2 patches in there which are*not* reviewed. Being a trivial-patch collection, they're "obviously correct", - namely these are spelling fixes ("information") and adding comments in
linux-user/syscall.c. If that's not okay, let's remove these 2 changes and apply the rest.Thanks,
/mjt
The following changes since commit
5f9dd6a8ce3961db4ce47411ed2097ad88bdf5fc:Merge tag 'pull-9p-20230608' ofhttps://github.com/cschoenebeck/qemu into staging (2023-06-08 08:47:35 -0700)are available in the Git repository at:
Quoted 8 lines
https://gitlab.com/mjt0k/qemu.git tags/trivial-patches-20230610for you to fetch changes up to
e928907105cfeb48b68cedce232bbd4784536707:linux-user: elfload: Specify -R is an option for qemu-user binaries (2023-06-10 09:40:46 +0300)----------------------------------------------------------------
trivial-patches-20230610
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/8.1 as appropriate.
r~