* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "qemu-version.h"
#include "qemu/cutils.h"
#include "qemu/help_option.h"
#include "qemu/uuid.h"
#ifdef CONFIG_SECCOMP
+#include <sys/prctl.h>
#include "sysemu/seccomp.h"
-#include "sys/prctl.h"
#endif
#ifdef CONFIG_SDL
#include "sysemu/hax.h"
#include "qapi/qobject-input-visitor.h"
#include "qapi-visit.h"
-#include "qapi/qmp/qjson.h"
#include "qemu/option.h"
#include "qemu/config-file.h"
#include "qemu-options.h"
QEMUClockType rtc_clock;
int vga_interface_type = VGA_NONE;
static int full_screen = 0;
-static int no_frame = 0;
+int no_frame;
int no_quit = 0;
static bool grab_on_hover;
Chardev *serial_hds[MAX_SERIAL_PORTS];
static int usb_device_add(const char *devname)
{
USBDevice *dev = NULL;
-#ifndef CONFIG_LINUX
- const char *p;
-#endif
if (!machine_usb(current_machine)) {
return -1;
}
- /* drivers with .usbdevice_name entry in USBDeviceInfo */
dev = usbdevice_create(devname);
- if (dev)
- goto done;
-
- /* the other ones */
-#ifndef CONFIG_LINUX
- /* only the linux version is qdev-ified, usb-bsd still needs this */
- if (strstart(devname, "host:", &p)) {
- dev = usb_host_device_open(usb_bus_find(-1), p);
- }
-#endif
if (!dev)
return -1;
-done:
return 0;
}
display_opengl = 1;
display = DT_EGL;
#else
- fprintf(stderr, "egl support is disabled\n");
+ error_report("egl support is disabled");
exit(1);
#endif
} else if (strstart(p, "curses", &opts)) {
curses_display_init(ds, full_screen);
break;
case DT_SDL:
- sdl_display_init(ds, full_screen, no_frame);
+ sdl_display_init(ds, full_screen);
break;
case DT_COCOA:
cocoa_display_init(ds, full_screen);
main_loop();
replay_disable_events();
- iothread_stop_all();
+ /* The ordering of the following is delicate. Stop vcpus to prevent new
+ * I/O requests being queued by the guest. Then stop IOThreads (this
+ * includes a drain operation and completes all request processing). At
+ * this point emulated devices are still associated with their IOThreads
+ * (if any) but no longer have any work to do. Only then can we close
+ * block devices safely because we know there is no more I/O coming.
+ */
pause_all_vcpus();
+ iothread_stop_all();
bdrv_close_all();
+
res_free();
/* vhost-user must be cleaned up before chardevs. */