From patchwork Tue Jan 24 17:11:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 719264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v7FCj6GNJz9sCg for ; Wed, 25 Jan 2017 04:14:25 +1100 (AEDT) Received: from localhost ([::1]:52216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW4fn-0004wb-Ad for incoming@patchwork.ozlabs.org; Tue, 24 Jan 2017 12:14:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW4co-0002Td-Cf for qemu-devel@nongnu.org; Tue, 24 Jan 2017 12:11:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cW4cl-0004uh-8M for qemu-devel@nongnu.org; Tue, 24 Jan 2017 12:11:18 -0500 Received: from mail.kernel.org ([198.145.29.136]:39286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cW4cl-0004u1-1g for qemu-devel@nongnu.org; Tue, 24 Jan 2017 12:11:15 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 415F820434; Tue, 24 Jan 2017 17:11:12 +0000 (UTC) Received: from redhat.com (unknown [66.187.232.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E83A720429; Tue, 24 Jan 2017 17:11:10 +0000 (UTC) Date: Tue, 24 Jan 2017 19:11:09 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1485277734-16871-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email 2.8.0.287.g0deeb61 X-Mutt-Fcc: =sent X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 198.145.29.136 Subject: [Qemu-devel] [PATCH] vhost: skip ROM sections X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. With phys address in the 32T range we would need 1Gbyte sized log - scanning it would take ages, and allocating such huge amount of log memory was also reported to fail on powerpc. 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 9cacf55..94b8c4a 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)