qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	yan.y.zhao@intel.com, qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com, Xin Zeng <xin.zeng@intel.com>
Subject: Re: [PATCH] hw/vfio: let readonly flag take effect for mmaped regions
Date: Fri, 27 Mar 2020 17:17:21 +0100	[thread overview]
Message-ID: <c4eb2313-96b3-7e76-f48c-0059a40eabf7@redhat.com> (raw)
In-Reply-To: <11c90e84-6c0c-9411-0d6c-7955136413c6@redhat.com>

On 27/03/20 11:51, Philippe Mathieu-Daudé wrote:
>>  diff --git a/memory.c b/memory.c
>> index 601b749906..4b1071dc74 100644
>> --- a/memory.c
>> +++ b/memory.c
>> @@ -1313,6 +1313,9 @@ static void memory_region_ram_device_write(void
>> *opaque, hwaddr addr,
>>       MemoryRegion *mr = opaque;
>>         trace_memory_region_ram_device_write(get_cpu_index(), mr,
>> addr, data, size);
>> +    if (mr->readonly) {
>> +        return;
>> +    }
> 
> Shouldn't this be in memory_region_dispatch_write()?

No, in general you want memory regions to get writes, so that they
become for example a machine-check exception of some sorts.  However,
memory_region_ram_device_write should probably be changed to a
.write_with_attrs operation, so that it can return MEMTX_ERROR.

> Please split this patch in 2, this (generic) hunk as first patch, then
> the VFIO more specific change.
> 
>>         switch (size) {
>>       case 1:
>>
> 

No need, I can just add my Acked-by for Alex to pick up the patch.

Paolo



  reply	other threads:[~2020-03-27 16:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 11:19 [PATCH] hw/vfio: let readonly flag take effect for mmaped regions yan.y.zhao
2020-03-27 10:51 ` Philippe Mathieu-Daudé
2020-03-27 16:17   ` Paolo Bonzini [this message]
2020-03-31  7:59     ` Philippe Mathieu-Daudé
2020-04-01  6:47       ` Yan Zhao
2020-03-27 17:25 ` Alex Williamson
2020-03-30  1:35   ` Yan Zhao
2020-03-30  6:34     ` Yan Zhao
2020-03-30 14:59       ` Alex Williamson
2020-03-31  1:59         ` Yan Zhao
2020-03-31 19:28           ` Alex Williamson
2020-04-01  6:45             ` Yan Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4eb2313-96b3-7e76-f48c-0059a40eabf7@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xin.zeng@intel.com \
    --cc=yan.y.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).