From 2bed4683942626b8e3bcf2721710d6f26322a470 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 2 Feb 2017 18:19:32 +0100 Subject: [PATCH 3/9] vhost: skip ROM sections RH-Author: Laurent Vivier Message-id: <20170202181932.551-4-lvivier@redhat.com> Patchwork-id: 73520 O-Subject: [RHEV-7.3.z qemu-kvm-rhev PATCH 3/3] vhost: skip ROM sections Bugzilla: 1420456 RH-Acked-by: David Gibson RH-Acked-by: Michael S. Tsirkin RH-Acked-by: Thomas Huth From: "Michael S. Tsirkin" vhost does not support RO protections on memory at the moment - adding ROMs would mean that e.g. a buggy guest might change them in-memory - a condition from which guest reset does not recover. Not nice. We also definitely don't want to try logging writes into ROMs - in particular guests set very high addresses for ROM BARs so logging these writes would waste a lot of memory. Maybe ROMs could be supported with the iotlb variant - not sure, but there seems to be no good reason for virtio to try to do DMA from ROM. So let's just skip ROM memory. Suggested-by: Laurent Vivier Signed-off-by: Michael S. Tsirkin Reviewed-by: Laurent Vivier Tested-by: Laurent Vivier (cherry picked from commit d56ec1e98c0005933fe677d633484297f422691a) Signed-off-by: Laurent Vivier BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1404673 Signed-off-by: Miroslav Rezanina --- hw/virtio/vhost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 3b4db14..b8f1d3f 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -542,7 +542,8 @@ static void vhost_set_memory(MemoryListener *listener, static bool vhost_section(MemoryRegionSection *section) { - return memory_region_is_ram(section->mr); + return memory_region_is_ram(section->mr) && + !memory_region_is_rom(section->mr); } static void vhost_begin(MemoryListener *listener) -- 1.8.3.1