qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 01/16] memory: Add FlatView foreach function


From: Paolo Bonzini
Subject: Re: [PATCH v3 01/16] memory: Add FlatView foreach function
Date: Thu, 8 Oct 2020 08:57:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 21/09/20 04:24, Alexander Bulekov wrote:
> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> ---
>  include/exec/memory.h | 5 +++++
>  softmmu/memory.c      | 9 +++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index f1bb2a7df5..975a90c871 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -688,6 +688,11 @@ static inline FlatView 
> *address_space_to_flatview(AddressSpace *as)
>      return atomic_rcu_read(&as->current_map);
>  }
>  
> +typedef int (*flatview_cb)(ram_addr_t start,
> +                           ram_addr_t len,
> +                           const MemoryRegion*, void*);
> +
> +void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque);
>  
>  /**
>   * MemoryRegionSection: describes a fragment of a #MemoryRegion
> diff --git a/softmmu/memory.c b/softmmu/memory.c
> index d030eb6f7c..9db5fbe43a 100644
> --- a/softmmu/memory.c
> +++ b/softmmu/memory.c
> @@ -655,6 +655,15 @@ static void render_memory_region(FlatView *view,
>      }
>  }
>  
> +void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque)
> +{
> +    FlatRange *fr;
> +    FOR_EACH_FLAT_RANGE(fr, fv) {
> +        if (cb(fr->addr.start, fr->addr.size, fr->mr, opaque))
> +            break;
> +    }
> +}

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

>  static MemoryRegion *memory_region_get_flatview_root(MemoryRegion *mr)
>  {
>      while (mr->enabled) {
> 




reply via email to

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