Compare commits

...

6 Commits

Author SHA1 Message Date
Gerd Hoffmann
bdcc3a28b7 input: add sanity check
Check we've actually found a input handler before trying to call it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-01 10:17:45 +02:00
Hani Benhabiles
0419f78fae input: mouse_set should check input device type.
Otherwise, the index of an input device like a usb-kbd is silently accepted.

(qemu) info mice
  Mouse #2: QEMU PS/2 Mouse
* Mouse #3: QEMU HID Mouse
(qemu) mouse_set 1
(qemu) info mice
  Mouse #2: QEMU PS/2 Mouse
* Mouse #3: QEMU HID Mouse

Also replace monitor_printf() call in do_mouse_set() with error_report() and
adjust error message.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-01 10:17:45 +02:00
Gerd Hoffmann
e82597f6f8 input: fix input_event_key_number trace event
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-04-01 10:17:45 +02:00
Steven Noonan
63678e17cf configure: add option to disable -fstack-protector flags
The -fstack-protector flag family is useful for ensuring safety and for
debugging, but has a performance impact. Here are some boot time comparisons of
the various versions of -fstack-protector using qemu-system-arm on an x86_64
host:

    # -fstack-protector-all
    Startup finished in 1.810s (kernel) + 12.331s (initrd) + 49.016s (userspace) = 1min 3.159s
    Startup finished in 1.801s (kernel) + 12.287s (initrd) + 47.925s (userspace) = 1min 2.013s
    Startup finished in 1.812s (kernel) + 12.302s (initrd) + 47.995s (userspace) = 1min 2.111s

    # -fstack-protector-strong
    Startup finished in 1.744s (kernel) + 11.223s (initrd) + 44.688s (userspace) = 57.657s
    Startup finished in 1.721s (kernel) + 11.222s (initrd) + 44.194s (userspace) = 57.138s
    Startup finished in 1.693s (kernel) + 11.250s (initrd) + 44.426s (userspace) = 57.370s

    # -fstack-protector
    Startup finished in 1.705s (kernel) + 11.409s (initrd) + 43.563s (userspace) = 56.677s
    Startup finished in 1.877s (kernel) + 11.137s (initrd) + 43.719s (userspace) = 56.734s
    Startup finished in 1.708s (kernel) + 11.141s (initrd) + 43.628s (userspace) = 56.478s

    # no stack protector
    Startup finished in 1.743s (kernel) + 11.190s (initrd) + 43.709s (userspace) = 56.643s
    Startup finished in 1.763s (kernel) + 11.216s (initrd) + 43.767s (userspace) = 56.747s
    Startup finished in 1.711s (kernel) + 11.283s (initrd) + 43.878s (userspace) = 56.873s

This patch introduces a configure option to disable the stack protector
entirely, and conditional stack protector flag selection (in order,
based on availability): -fstack-protector-strong, -fstack-protector-all,
no stack protector.

Signed-off-by: Steven Noonan <snoonan@amazon.com>
Cc: Anthony Liguori <aliguori@amazon.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
[Prefer -fstack-protector-all to -fstack-protector, suggested by
 Laurent Desnogues. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-31 20:16:02 +01:00
Cole Robinson
58b590148c pci: Fix clearing IRQs on reset
irq_state is cleared before calling pci_device_deassert_intx, but the
latter misbehaves if the former isn't accurate. In this case, any raised
IRQs are not cleared, which hits an assertion in pcibus_reset:

qemu-system-x86_64: hw/pci/pci.c:250: pcibus_reset: Assertion
`bus->irq_count[i] == 0' failed.

pci_device_deassert_intx should clear irq_state anyways, so add
an assert.

This fixes migration with usb2 + usb-tablet.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 7da1ad94ce027183b4049c2de370cb191b0073c1.1396290569.git.crobinso@redhat.com
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-31 19:53:34 +01:00
Peter Maydell
7d4d7975e5 Merge remote-tracking branch 'remotes/afaerber/tags/qom-cpu-for-2.0' into staging
QOM CPUState refactorings / X86CPU

* X86CPU IA32e 1GB paging support
* Performance quickfix for CPU() cast macro

# gpg: Signature made Mon 31 Mar 2014 18:33:27 BST using RSA key ID 3E7E013F
# gpg: Good signature from "Andreas Färber <afaerber@suse.de>"
# gpg:                 aka "Andreas Färber <afaerber@suse.com>"

* remotes/afaerber/tags/qom-cpu-for-2.0:
  cpu: Avoid QOM casts for CPU()
  target-i386: x86_cpu_get_phys_page_debug(): support 1GB page translation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-03-31 18:47:14 +01:00
4 changed files with 32 additions and 11 deletions

18
configure vendored
View File

@@ -198,6 +198,7 @@ audio_win_int=""
cc_i386=i386-pc-linux-gnu-gcc cc_i386=i386-pc-linux-gnu-gcc
libs_qga="" libs_qga=""
debug_info="yes" debug_info="yes"
stack_protector=""
# Don't accept a target_list environment variable. # Don't accept a target_list environment variable.
unset target_list unset target_list
@@ -950,6 +951,10 @@ for opt do
;; ;;
--disable-werror) werror="no" --disable-werror) werror="no"
;; ;;
--enable-stack-protector) stack_protector="yes"
;;
--disable-stack-protector) stack_protector="no"
;;
--disable-curses) curses="no" --disable-curses) curses="no"
;; ;;
--enable-curses) curses="yes" --enable-curses) curses="yes"
@@ -1219,6 +1224,7 @@ Advanced options (experts only):
--disable-sparse disable sparse checker (default) --disable-sparse disable sparse checker (default)
--disable-strip disable stripping binaries --disable-strip disable stripping binaries
--disable-werror disable compilation abort on warning --disable-werror disable compilation abort on warning
--disable-stack-protector disable compiler-provided stack protection
--disable-sdl disable SDL --disable-sdl disable SDL
--enable-sdl enable SDL --enable-sdl enable SDL
--with-sdlabi select preferred SDL ABI 1.2 or 2.0 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
@@ -1439,9 +1445,15 @@ for flag in $gcc_flags; do
fi fi
done done
if compile_prog "-Werror -fstack-protector-all" "" ; then if test "$stack_protector" != "no" ; then
QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all" gcc_flags="-fstack-protector-strong -fstack-protector-all"
LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all" for flag in $gcc_flags; do
if compile_prog "-Werror $flag" "" ; then
QEMU_CFLAGS="$QEMU_CFLAGS $flag"
LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag"
break
fi
done
fi fi
# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and

View File

@@ -189,9 +189,9 @@ static void pci_do_device_reset(PCIDevice *dev)
{ {
int r; int r;
dev->irq_state = 0;
pci_update_irq_status(dev);
pci_device_deassert_intx(dev); pci_device_deassert_intx(dev);
assert(dev->irq_state == 0);
/* Clear all writable bits */ /* Clear all writable bits */
pci_word_test_and_clear_mask(dev->config + PCI_COMMAND, pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
pci_get_word(dev->wmask + PCI_COMMAND) | pci_get_word(dev->wmask + PCI_COMMAND) |

View File

@@ -1022,7 +1022,7 @@ gd_update(int x, int y, int w, int h) "x=%d, y=%d, w=%d, h=%d"
gd_key_event(int gdk_keycode, int qemu_keycode, const char *action) "translated GDK keycode %d to QEMU keycode %d (%s)" gd_key_event(int gdk_keycode, int qemu_keycode, const char *action) "translated GDK keycode %d to QEMU keycode %d (%s)"
# ui/input.c # ui/input.c
input_event_key_number(int conidx, int number, bool down) "con %d, key number 0x%d, down %d" input_event_key_number(int conidx, int number, bool down) "con %d, key number 0x%x, down %d"
input_event_key_qcode(int conidx, const char *qcode, bool down) "con %d, key qcode %s, down %d" input_event_key_qcode(int conidx, const char *qcode, bool down) "con %d, key qcode %s, down %d"
input_event_btn(int conidx, const char *btn, bool down) "con %d, button %s, down %d" input_event_btn(int conidx, const char *btn, bool down) "con %d, button %s, down %d"
input_event_rel(int conidx, const char *axis, int value) "con %d, axis %s, value %d" input_event_rel(int conidx, const char *axis, int value) "con %d, axis %s, value %d"

View File

@@ -143,6 +143,9 @@ void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
/* send event */ /* send event */
s = qemu_input_find_handler(1 << evt->kind); s = qemu_input_find_handler(1 << evt->kind);
if (!s) {
return;
}
s->handler->event(s->dev, src, evt); s->handler->event(s->dev, src, evt);
s->events++; s->events++;
} }
@@ -342,15 +345,21 @@ void do_mouse_set(Monitor *mon, const QDict *qdict)
int found = 0; int found = 0;
QTAILQ_FOREACH(s, &handlers, node) { QTAILQ_FOREACH(s, &handlers, node) {
if (s->id == index) { if (s->id != index) {
found = 1; continue;
qemu_input_handler_activate(s);
break;
} }
if (!(s->handler->mask & (INPUT_EVENT_MASK_REL |
INPUT_EVENT_MASK_ABS))) {
error_report("Input device '%s' is not a mouse", s->handler->name);
return;
}
found = 1;
qemu_input_handler_activate(s);
break;
} }
if (!found) { if (!found) {
monitor_printf(mon, "Mouse at given index not found\n"); error_report("Mouse at index '%d' not found", index);
} }
qemu_input_check_mode_change(); qemu_input_check_mode_change();