All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 15/17] hw/core: Implement cpu_get_phys_addr_attrs_debug() with cpu_translate_for_debug()
Date: Thu, 23 Apr 2026 13:08:54 +1000	[thread overview]
Message-ID: <fdbef0ff-453f-4e3b-b7bd-a164cc38b341@linaro.org> (raw)
In-Reply-To: <20260417173105.1648172-16-peter.maydell@linaro.org>

On 4/18/26 03:31, Peter Maydell wrote:
> Implement cpu_get_phys_addr_attrs_debug() with
> cpu_translate_for_debug(), so that CPUs can implement only the
> translate_for_debug method and have all of the wrapper functions
> cpu_translate_for_debug(), cpu_get_phys_addr_attrs_debug() and
> cpu_get_phys_addr_debug() work.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/core/cpu-system.c | 17 ++++++-----------
>   1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
> index cab65d549a..be5cb48126 100644
> --- a/hw/core/cpu-system.c
> +++ b/hw/core/cpu-system.c
> @@ -90,19 +90,14 @@ bool cpu_translate_for_debug(CPUState *cpu, vaddr addr,
>   hwaddr cpu_get_phys_addr_attrs_debug(CPUState *cpu, vaddr addr,
>                                        MemTxAttrs *attrs)
>   {
> -    hwaddr paddr;
> +    TranslateForDebugResult result;
>   
> -    if (cpu->cc->sysemu_ops->get_phys_addr_attrs_debug) {
> -        paddr = cpu->cc->sysemu_ops->get_phys_addr_attrs_debug(cpu, addr,
> -                                                               attrs);
> -    } else {
> -        /* Fallback for CPUs which don't implement the _attrs_ hook */
> -        *attrs = MEMTXATTRS_UNSPECIFIED;
> -        paddr = cpu->cc->sysemu_ops->get_phys_addr_debug(cpu, addr);
> +    if (!cpu_translate_for_debug(cpu, addr, &result)) {
> +        return -1;
>       }
> -    /* Indicate that this is a debug access. */
> -    attrs->debug = 1;
> -    return paddr;
> +
> +    *attrs = result.attrs;
> +    return result.physaddr;
>   }
>   
>   hwaddr cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr)

As far as it goes,

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

But I'll note there's exactly one user in system/physmem.c, so it'd be better to drop this 
function entirely.


r~


  reply	other threads:[~2026-04-23  3:09 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 17:30 [PATCH 00/17] Handle sub-page granularity in cpu_memory_rw_debug() Peter Maydell
2026-04-17 17:30 ` [PATCH 01/17] target/riscv: Make get_phys_page_debug handle non-page-aligned addrs Peter Maydell
2026-04-18  3:43   ` Chao Liu
2026-04-18 22:18   ` Philippe Mathieu-Daudé
2026-04-23  2:13   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 02/17] target/alpha: " Peter Maydell
2026-04-23  2:14   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 03/17] target/microblaze: Make get_phys_page_attrs_debug " Peter Maydell
2026-04-18 22:18   ` Philippe Mathieu-Daudé
2026-04-23  2:24   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 04/17] target/sparc: Make get_phys_page_debug " Peter Maydell
2026-04-23  2:26   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 05/17] target/x86: Make get_phys_page_attrs_debug " Peter Maydell
2026-04-23  2:27   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 06/17] target/s390x: Make get_phys_page_debug " Peter Maydell
2026-04-21 11:04   ` Ilya Leoshkevich
2026-04-23  2:29   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 07/17] target/ppc: " Peter Maydell
2026-04-23  2:30   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 08/17] target: Rename get_phys_page_debug to get_phys_addr_debug Peter Maydell
2026-04-18 22:14   ` Philippe Mathieu-Daudé
2026-04-23  2:32   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 09/17] target: Rename cpu_get_phys_page_{,attrs_}debug Peter Maydell
2026-04-18 22:15   ` Philippe Mathieu-Daudé
2026-04-23  2:34   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 10/17] hw/core: Update docs for get_phys_addr_{attrs_,}debug Peter Maydell
2026-04-18 22:16   ` Philippe Mathieu-Daudé
2026-04-23  2:42   ` Richard Henderson
2026-04-17 17:30 ` [PATCH 11/17] target/arm: Rename arm_cpu_get_phys_page() Peter Maydell
2026-04-18 22:16   ` Philippe Mathieu-Daudé
2026-04-17 17:31 ` [PATCH 12/17] monitor: hmp_gva2gpa: Don't page-align cpu_get_phys_addr_debug() arg and return Peter Maydell
2026-04-17 17:46   ` Dr. David Alan Gilbert
2026-04-18 22:16   ` Philippe Mathieu-Daudé
2026-04-17 17:31 ` [PATCH 13/17] plugins/api.c: Trust cpu_get_phys_addr_debug() return address Peter Maydell
2026-04-23  2:44   ` Richard Henderson
2026-04-17 17:31 ` [PATCH 14/17] hw/core: Implement new cpu_translate_for_debug() Peter Maydell
2026-04-18 22:25   ` Philippe Mathieu-Daudé
2026-04-23  3:05   ` Richard Henderson
2026-04-28 10:42     ` Peter Maydell
2026-04-17 17:31 ` [PATCH 15/17] hw/core: Implement cpu_get_phys_addr_attrs_debug() with cpu_translate_for_debug() Peter Maydell
2026-04-23  3:08   ` Richard Henderson [this message]
2026-04-28 10:43     ` Peter Maydell
2026-04-17 17:31 ` [PATCH 16/17] target/arm: Implement translate_for_debug Peter Maydell
2026-04-18 22:29   ` Philippe Mathieu-Daudé
2026-04-23  3:12   ` Richard Henderson
2026-04-28 10:26     ` Peter Maydell
2026-04-17 17:31 ` [PATCH 17/17] system/physmem: Use translate_for_debug() in cpu_memory_rw_debug() Peter Maydell
2026-04-18 22:33   ` Philippe Mathieu-Daudé
2026-04-23  3:17   ` Richard Henderson
2026-04-28 10:32     ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fdbef0ff-453f-4e3b-b7bd-a164cc38b341@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.