On Fri, Aug 19, 2022 at 1:34 PM Richard Henderson
<richard.hender...@linaro.org> wrote:
>
> The base qemu_ram_addr_from_host function is already in
> softmmu/physmem.c; move the nofail version to be adjacent.
>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>

Reviewed-by: Alistair Francis <alistair.fran...@wdc.com>

Alistair

> ---
>  include/exec/cpu-common.h |  1 +
>  accel/tcg/cputlb.c        | 12 ------------
>  softmmu/physmem.c         | 12 ++++++++++++
>  3 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index 2281be4e10..d909429427 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -72,6 +72,7 @@ typedef uintptr_t ram_addr_t;
>  void qemu_ram_remap(ram_addr_t addr, ram_addr_t length);
>  /* This should not be used by devices.  */
>  ram_addr_t qemu_ram_addr_from_host(void *ptr);
> +ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr);
>  RAMBlock *qemu_ram_block_by_name(const char *name);
>  RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
>                                     ram_addr_t *offset);
> diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> index 43bd65c973..80a3eb4f1c 100644
> --- a/accel/tcg/cputlb.c
> +++ b/accel/tcg/cputlb.c
> @@ -1283,18 +1283,6 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr,
>                              prot, mmu_idx, size);
>  }
>
> -static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr)
> -{
> -    ram_addr_t ram_addr;
> -
> -    ram_addr = qemu_ram_addr_from_host(ptr);
> -    if (ram_addr == RAM_ADDR_INVALID) {
> -        error_report("Bad ram pointer %p", ptr);
> -        abort();
> -    }
> -    return ram_addr;
> -}
> -
>  /*
>   * Note: tlb_fill() can trigger a resize of the TLB. This means that all of 
> the
>   * caller's prior references to the TLB table (e.g. CPUTLBEntry pointers) 
> must
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index dc3c3e5f2e..d4c30e99ea 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -2460,6 +2460,18 @@ ram_addr_t qemu_ram_addr_from_host(void *ptr)
>      return block->offset + offset;
>  }
>
> +ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr)
> +{
> +    ram_addr_t ram_addr;
> +
> +    ram_addr = qemu_ram_addr_from_host(ptr);
> +    if (ram_addr == RAM_ADDR_INVALID) {
> +        error_report("Bad ram pointer %p", ptr);
> +        abort();
> +    }
> +    return ram_addr;
> +}
> +
>  static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
>                                   MemTxAttrs attrs, void *buf, hwaddr len);
>  static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs 
> attrs,
> --
> 2.34.1
>
>

Reply via email to