qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] memory: Do not allow subregion out of the parent region rang


From: Paolo Bonzini
Subject: Re: [PATCH] memory: Do not allow subregion out of the parent region range
Date: Tue, 17 Dec 2019 11:51:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

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 via email to

[Prev in Thread] Current Thread [Next in Thread]