Miscellaneous patches and fixes for QEMU