[Top][All Lists]

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

Re: Any reason we need memoryregionsection

From: Peter Xu
Subject: Re: Any reason we need memoryregionsection
Date: Mon, 22 Feb 2021 12:11:02 -0500

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.

Feel free to have a look at commit 2177955a89 ("memory: introduce
memory_region_find()", 2011-12-20) too - that should be the place where
MemoryRegionSection is firstly introduced.


Peter Xu

reply via email to

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