[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] vhost: skip ROM sections
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [PATCH] vhost: skip ROM sections |
Date: |
Tue, 24 Jan 2017 18:16:46 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
On 24/01/2017 18:11, Michael S. Tsirkin wrote:
> 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 <address@hidden>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Tested-by: Laurent Vivier <address@hidden>
> ---
> 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)
>