Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu int…
…o staging

trivial patches for 2023-12-25

# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCAAtFiEEe3O61ovnosKJMUsicBtPaxppPlkFAmWJOBUPHG1qdEB0bHMu
# bXNrLnJ1AAoJEHAbT2saaT5ZigcIAL21an9qATltedufz/QH5gf21g54LBtiBfny
# LN6yyMYj0j+Kydwr1FErub4b2Ek7xIT69ywpXhW7bI3ultCsVf5wVG8Gaa8iVq8L
# j6wV7PHn4+BErv4ZZmHhS0Pb8zeNJ8sDX0pBAZnATzXsaRYXN726a0D70kRZCZi9
# MGPjzUeuS9VoBzYr3kiBILDw3NBArIJusdcFVs4cmoxCDRcAVtwLwQqcvS6XXyr8
# /IfN8NCm54qnwa+mlHWrY9MFM0t7htDL2HLPjiRevLbMMBiJ9bKzVoMCsSK7gn4U
# OFZX49vjtuR0KPflRmmkHGbadU1/QyG+Rj5Un9M+wHhsMEZjoRY=
# =G1GO
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 25 Dec 2023 03:06:45 EST
# gpg:                using RSA key 7B73BAD68BE7A2C289314B22701B4F6B1A693E59
# gpg:                issuer "mjt@tls.msk.ru"
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" [full]
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>" [full]
# gpg:                 aka "Michael Tokarev <mjt@debian.org>" [full]
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931  4B22 701B 4F6B 1A69 3E59

* tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu:
  virtio-blk: Fix potential nullpointer read access in virtio_blk_data_plane_destroy
  include/ui/rect.h: fix qemu_rect_init() mis-assignment
  accel/kvm: Turn DPRINTF macro use into tracepoints
  docs/tools/qemu-img.rst: fix typo (sumarizes)
  qemu-options: Tell more for -display cocoa
  qemu-options: Unify the help entries for cocoa
  target/riscv/kvm: do not use non-portable strerrorname_np()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
Stefan Hajnoczi committed Dec 26, 2023
2 parents 400819c + d819fc9 commit 0d138a9
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 39 deletions.
28 changes: 6 additions & 22 deletions accel/kvm/kvm-all.c
Expand Up @@ -69,16 +69,6 @@
#define KVM_GUESTDBG_BLOCKIRQ 0
#endif

//#define DEBUG_KVM

#ifdef DEBUG_KVM
#define DPRINTF(fmt, ...) \
do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, ...) \
do { } while (0)
#endif

struct KVMParkedVcpu {
unsigned long vcpu_id;
int kvm_fd;
Expand Down Expand Up @@ -331,7 +321,7 @@ static int do_kvm_destroy_vcpu(CPUState *cpu)
struct KVMParkedVcpu *vcpu = NULL;
int ret = 0;

DPRINTF("kvm_destroy_vcpu\n");
trace_kvm_destroy_vcpu();

ret = kvm_arch_destroy_vcpu(cpu);
if (ret < 0) {
Expand All @@ -341,7 +331,7 @@ static int do_kvm_destroy_vcpu(CPUState *cpu)
mmap_size = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0);
if (mmap_size < 0) {
ret = mmap_size;
DPRINTF("KVM_GET_VCPU_MMAP_SIZE failed\n");
trace_kvm_failed_get_vcpu_mmap_size();
goto err;
}

Expand Down Expand Up @@ -443,7 +433,6 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp)
PAGE_SIZE * KVM_DIRTY_LOG_PAGE_OFFSET);
if (cpu->kvm_dirty_gfns == MAP_FAILED) {
ret = -errno;
DPRINTF("mmap'ing vcpu dirty gfns failed: %d\n", ret);
goto err;
}
}
Expand Down Expand Up @@ -2821,7 +2810,7 @@ int kvm_cpu_exec(CPUState *cpu)
struct kvm_run *run = cpu->kvm_run;
int ret, run_ret;

DPRINTF("kvm_cpu_exec()\n");
trace_kvm_cpu_exec();

if (kvm_arch_process_async_events(cpu)) {
qatomic_set(&cpu->exit_request, 0);
Expand All @@ -2848,7 +2837,7 @@ int kvm_cpu_exec(CPUState *cpu)

kvm_arch_pre_run(cpu, run);
if (qatomic_read(&cpu->exit_request)) {
DPRINTF("interrupt exit requested\n");
trace_kvm_interrupt_exit_request();
/*
* KVM requires us to reenter the kernel after IO exits to complete
* instruction emulation. This self-signal will ensure that we
Expand Down Expand Up @@ -2878,7 +2867,7 @@ int kvm_cpu_exec(CPUState *cpu)

if (run_ret < 0) {
if (run_ret == -EINTR || run_ret == -EAGAIN) {
DPRINTF("io window exit\n");
trace_kvm_io_window_exit();
kvm_eat_signals(cpu);
ret = EXCP_INTERRUPT;
break;
Expand All @@ -2900,7 +2889,6 @@ int kvm_cpu_exec(CPUState *cpu)
trace_kvm_run_exit(cpu->cpu_index, run->exit_reason);
switch (run->exit_reason) {
case KVM_EXIT_IO:
DPRINTF("handle_io\n");
/* Called outside BQL */
kvm_handle_io(run->io.port, attrs,
(uint8_t *)run + run->io.data_offset,
Expand All @@ -2910,7 +2898,6 @@ int kvm_cpu_exec(CPUState *cpu)
ret = 0;
break;
case KVM_EXIT_MMIO:
DPRINTF("handle_mmio\n");
/* Called outside BQL */
address_space_rw(&address_space_memory,
run->mmio.phys_addr, attrs,
Expand All @@ -2920,11 +2907,9 @@ int kvm_cpu_exec(CPUState *cpu)
ret = 0;
break;
case KVM_EXIT_IRQ_WINDOW_OPEN:
DPRINTF("irq_window_open\n");
ret = EXCP_INTERRUPT;
break;
case KVM_EXIT_SHUTDOWN:
DPRINTF("shutdown\n");
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
ret = EXCP_INTERRUPT;
break;
Expand Down Expand Up @@ -2959,6 +2944,7 @@ int kvm_cpu_exec(CPUState *cpu)
ret = 0;
break;
case KVM_EXIT_SYSTEM_EVENT:
trace_kvm_run_exit_system_event(cpu->cpu_index, run->system_event.type);
switch (run->system_event.type) {
case KVM_SYSTEM_EVENT_SHUTDOWN:
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
Expand All @@ -2976,13 +2962,11 @@ int kvm_cpu_exec(CPUState *cpu)
ret = 0;
break;
default:
DPRINTF("kvm_arch_handle_exit\n");
ret = kvm_arch_handle_exit(cpu, run);
break;
}
break;
default:
DPRINTF("kvm_arch_handle_exit\n");
ret = kvm_arch_handle_exit(cpu, run);
break;
}
Expand Down
7 changes: 6 additions & 1 deletion accel/kvm/trace-events
Expand Up @@ -25,4 +25,9 @@ kvm_dirty_ring_reaper(const char *s) "%s"
kvm_dirty_ring_reap(uint64_t count, int64_t t) "reaped %"PRIu64" pages (took %"PRIi64" us)"
kvm_dirty_ring_reaper_kick(const char *reason) "%s"
kvm_dirty_ring_flush(int finished) "%d"

kvm_destroy_vcpu(void) ""
kvm_failed_get_vcpu_mmap_size(void) ""
kvm_cpu_exec(void) ""
kvm_interrupt_exit_request(void) ""
kvm_io_window_exit(void) ""
kvm_run_exit_system_event(int cpu_index, uint32_t event_type) "cpu_index %d, system_even_type %"PRIu32
2 changes: 1 addition & 1 deletion docs/tools/qemu-img.rst
Expand Up @@ -406,7 +406,7 @@ Command description:
Compare exits with ``0`` in case the images are equal and with ``1``
in case the images differ. Other exit codes mean an error occurred during
execution and standard error output should contain an error message.
The following table sumarizes all exit codes of the compare subcommand:
The following table summarizes all exit codes of the compare subcommand:
0
Images are identical (or requested help was printed)
Expand Down
3 changes: 2 additions & 1 deletion hw/block/dataplane/virtio-blk.c
Expand Up @@ -152,14 +152,15 @@ bool virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)
{
VirtIOBlock *vblk;
VirtIOBlkConf *conf = s->conf;
VirtIOBlkConf *conf;

if (!s) {
return;
}

vblk = VIRTIO_BLK(s->vdev);
assert(!vblk->dataplane_started);
conf = s->conf;

if (conf->iothread_vq_mapping_list) {
IOThreadVirtQueueMappingList *node;
Expand Down
2 changes: 1 addition & 1 deletion include/ui/rect.h
Expand Up @@ -19,7 +19,7 @@ static inline void qemu_rect_init(QemuRect *rect,
uint16_t width, uint16_t height)
{
rect->x = x;
rect->y = x;
rect->y = y;
rect->width = width;
rect->height = height;
}
Expand Down
21 changes: 18 additions & 3 deletions qemu-options.hx
Expand Up @@ -2087,16 +2087,15 @@ DEF("display", HAS_ARG, QEMU_OPTION_display,
#endif
#if defined(CONFIG_COCOA)
"-display cocoa[,full-grab=on|off][,swap-opt-cmd=on|off]\n"
" [,show-cursor=on|off][,left-command-key=on|off]\n"
" [,full-screen=on|off][,zoom-to-fit=on|off]\n"
#endif
#if defined(CONFIG_OPENGL)
"-display egl-headless[,rendernode=<file>]\n"
#endif
#if defined(CONFIG_DBUS_DISPLAY)
"-display dbus[,addr=<dbusaddr>]\n"
" [,gl=on|core|es|off][,rendernode=<file>]\n"
#endif
#if defined(CONFIG_COCOA)
"-display cocoa[,show-cursor=on|off][,left-command-key=on|off]\n"
#endif
"-display none\n"
" select display backend type\n"
Expand Down Expand Up @@ -2191,10 +2190,26 @@ SRST
provides drop-down menus and other UI elements to configure and
control the VM during runtime. Valid parameters are:

``full-grab=on|off`` : Capture all key presses, including system combos.
This requires accessibility permissions, since it
performs a global grab on key events.
(default: off) See
https://support.apple.com/en-in/guide/mac-help/mh32356/mac

``swap-opt-cmd=on|off`` : Swap the Option and Command keys so that their
key codes match their position on non-Mac
keyboards and you can use Meta/Super and Alt
where you expect them. (default: off)

``show-cursor=on|off`` : Force showing the mouse cursor

``left-command-key=on|off`` : Disable forwarding left command key to host

``full-screen=on|off`` : Start in fullscreen mode

``zoom-to-fit=on|off`` : Expand video output to the window size,
defaults to "off"

``egl-headless[,rendernode=<file>]``
Offload all OpenGL operations to a local DRI device. For any
graphical display, this display needs to be paired with either
Expand Down
18 changes: 8 additions & 10 deletions target/riscv/kvm/kvm-cpu.c
Expand Up @@ -832,9 +832,8 @@ static void kvm_riscv_read_multiext_legacy(RISCVCPU *cpu,
multi_ext_cfg->supported = false;
val = false;
} else {
error_report("Unable to read ISA_EXT KVM register %s, "
"error code: %s", multi_ext_cfg->name,
strerrorname_np(errno));
error_report("Unable to read ISA_EXT KVM register %s: %s",
multi_ext_cfg->name, strerror(errno));
exit(EXIT_FAILURE);
}
} else {
Expand Down Expand Up @@ -895,8 +894,8 @@ static void kvm_riscv_init_multiext_cfg(RISCVCPU *cpu, KVMScratchCPU *kvmcpu)
*
* Error out if we get any other errno.
*/
error_report("Error when accessing get-reg-list, code: %s",
strerrorname_np(errno));
error_report("Error when accessing get-reg-list: %s",
strerror(errno));
exit(EXIT_FAILURE);
}

Expand All @@ -905,8 +904,8 @@ static void kvm_riscv_init_multiext_cfg(RISCVCPU *cpu, KVMScratchCPU *kvmcpu)
reglist->n = rl_struct.n;
ret = ioctl(kvmcpu->cpufd, KVM_GET_REG_LIST, reglist);
if (ret) {
error_report("Error when reading KVM_GET_REG_LIST, code %s ",
strerrorname_np(errno));
error_report("Error when reading KVM_GET_REG_LIST: %s",
strerror(errno));
exit(EXIT_FAILURE);
}

Expand All @@ -927,9 +926,8 @@ static void kvm_riscv_init_multiext_cfg(RISCVCPU *cpu, KVMScratchCPU *kvmcpu)
reg.addr = (uint64_t)&val;
ret = ioctl(kvmcpu->cpufd, KVM_GET_ONE_REG, &reg);
if (ret != 0) {
error_report("Unable to read ISA_EXT KVM register %s, "
"error code: %s", multi_ext_cfg->name,
strerrorname_np(errno));
error_report("Unable to read ISA_EXT KVM register %s: %s",
multi_ext_cfg->name, strerror(errno));
exit(EXIT_FAILURE);
}

Expand Down

0 comments on commit 0d138a9

Please sign in to comment.