qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Alexey Kardashevskiy" <aik@ozlabs.ru>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Alex Williamson" <alex.williamson@redhat.com>
Subject: Re: [PATCH] memory: Do not allow subregion out of the parent region range
Date: Tue, 17 Dec 2019 11:51:39 +0100	[thread overview]
Message-ID: <4a07cc6f-8762-145e-2b54-c61b0e287f19@redhat.com> (raw)
In-Reply-To: <92bb8e12-3ece-9811-438b-8fa64d2bde66@redhat.com>

On 16/12/19 18:46, Philippe Mathieu-Daudé wrote:
>>>
>>
>> I think in some cases this could be intentional, for example if you have
>> different models with different BAR sizes and you organize this with the
>> same tree of MemoryRegion and different sizes for the parent.
> 
> But if a child is outside of the parent range, it can't be reached,
> right? I'm confused, maybe AddressSpace can do that, but MemoryRegion
> shouldn't?

Yes, the idea is that you could have for one version of the device

   parent 0x000-0x7ff
     stuff 0x000-0x3ff
     morestuff 0x400-0x7ff

and for another

   parent 0x000-0x3ff
     stuff 0x000-0x3ff
     morestuff 0x400-0x7ff

where parent is the BAR, and you can share the code to generate the tree
underneath parent.

> In the PCI case, you will simply alias a subregion with
> memory_region_init_alias(..., size), and size has to be <= parent size.
> But you won't add the PCI region, you'll add the alias, so the assert
> won't fire.

Yes, this is a workaround though.  You shouldn't need the alias.

I can see a case for your patch but I can also see one for the current
behavior...

Paolo



  reply	other threads:[~2019-12-17 10:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-14 16:02 [PATCH] memory: Do not allow subregion out of the parent region range Philippe Mathieu-Daudé
2019-12-16 13:08 ` Paolo Bonzini
2019-12-16 17:46   ` Philippe Mathieu-Daudé
2019-12-17 10:51     ` Paolo Bonzini [this message]
2019-12-17 11:58       ` Christophe de Dinechin
2019-12-17 16:57         ` Richard Henderson
2019-12-17 18:17           ` Peter Maydell
2019-12-17 18:31             ` Paolo Bonzini
2019-12-17 18:52               ` Alex Williamson
2019-12-17 19:17                 ` Philippe Mathieu-Daudé

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=4a07cc6f-8762-145e-2b54-c61b0e287f19@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).