qemu: add recommended patches

This commit is contained in:
Leonid Pliushch 2018-10-28 14:04:25 +02:00 committed by Yaksh Bariya
parent 79ae4f43eb
commit 15c161c2e6
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
2 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,25 @@
commit cb61bc8a42da1a971079767e63df4503b6ab2efb
Author: Anatol Pomozov <anatol.pomozov@gmail.com>
Date: Mon Jan 29 10:08:53 2018 -0800
multiboot: Make elf64 loading functionality compatible with GRUB
GRUB is a reference multiboot implementation and supports loading elf64
binaries. Make QEMU to work similar was as GRUB.
diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 5bc0a2cddb..0907e42a39 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -193,11 +193,6 @@ int load_multiboot(FWCfgState *fw_cfg,
int kernel_size;
fclose(f);
- if (((struct elf64_hdr*)header)->e_machine == EM_X86_64) {
- error_report("Cannot load x86-64 image, give a 32bit one.");
- exit(1);
- }
-
kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
&elf_low, &elf_high, 0, I386_ELF_MACHINE,
0, 0);

View File

@ -0,0 +1,55 @@
From db812c4073c77c8a64db8d6663b3416a587c7b4a Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Thu, 23 Aug 2018 14:21:23 +0200
Subject: [PATCH] virtio: update MemoryRegionCaches when guest negotiates
features
Because the cache is sized to include the rings and the event indices,
negotiating the VIRTIO_RING_F_EVENT_IDX feature will result in the size
of the cache changing. And because MemoryRegionCache accesses are
range-checked, if we skip this we end up with an assertion failure.
This happens with OpenBSD 6.3.
Reported-by: Fam Zheng <famz@redhat.com>
Fixes: 97cd965c070152bc626c7507df9fb356bbe1cd81
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index d4e4d98b595..f6a588ab57e 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2006,14 +2006,25 @@ static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
int virtio_set_features(VirtIODevice *vdev, uint64_t val)
{
- /*
+ int ret;
+ /*
* The driver must not attempt to set features after feature negotiation
* has finished.
*/
if (vdev->status & VIRTIO_CONFIG_S_FEATURES_OK) {
return -EINVAL;
}
- return virtio_set_features_nocheck(vdev, val);
+ ret = virtio_set_features_nocheck(vdev, val);
+ if (!ret && virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
+ /* VIRTIO_RING_F_EVENT_IDX changes the size of the caches. */
+ int i;
+ for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
+ if (vdev->vq[i].vring.num != 0) {
+ virtio_init_region_cache(vdev, i);
+ }
+ }
+ }
+ return ret;
}
int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)