qemu-devel
[Top][All Lists]
Advanced

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

Re: Any reason we need memoryregionsection


From: Peter Maydell
Subject: Re: Any reason we need memoryregionsection
Date: Mon, 22 Feb 2021 17:22:03 +0000

On Mon, 22 Feb 2021 at 17:19, Peter Xu <peterx@redhat.com> wrote:
>
> On Mon, Feb 22, 2021 at 10:55:15PM +0800, 沈梦姣 wrote:
> > Usually when we add memory region in the platform init process, the 
> > corresponding address range in address space will not overlap with others, 
> > I’m not sure in which case we should use MemoryRegionSection? Thanks
> >
>
> Memory regions can overlap, see memory_region_add_subregion_overlap() and the
> comment above its definition.  memory_region_add_subregion() is actually
> similar to that, but just set the MR priority to zero as default.
>
> IMHO MemoryRegion is the major abstraction layer of the address range in QEMU
> along with the bigger AddressSpace idea, while MemoryRegionSection is mostly
> used as a temporarly variable to describe part of a MemoryRegion in many
> contexts, so that this partial range information can be further consumed by
> callers of a lot of memory APIs.

Yes. You only really need to care about MemoryRegionSections if you're
using an API that deals with them (notably if you're working with a
MemoryListener, or if you're using memory_region_find()). Most code,
and in particular almost all device and board code, works with
MemoryRegions.

-- PMM



reply via email to

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