From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYeuN-0004Sr-Dx for qemu-devel@nongnu.org; Tue, 31 Jan 2017 15:20:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYeuI-0004Sc-EW for qemu-devel@nongnu.org; Tue, 31 Jan 2017 15:20:07 -0500 Received: from mail.kernel.org ([198.145.29.136]:52858) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cYeuI-0004SP-9F for qemu-devel@nongnu.org; Tue, 31 Jan 2017 15:20:02 -0500 Date: Tue, 31 Jan 2017 22:19:58 +0200 From: "Michael S. Tsirkin" Message-ID: <1485893872-26524-19-git-send-email-mst@redhat.com> References: <1485893872-26524-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1485893872-26524-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL v5 18/22] vhost: skip ROM sections List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Laurent Vivier 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 --- 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 b124d97..febe519 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -612,7 +612,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) -- MST